diff --git a/README.md b/README.md index d1ce061da..46eef3b4b 100644 --- a/README.md +++ b/README.md @@ -701,11 +701,6 @@ The following sets of tools are available (all are on by default): - `pullNumber`: Pull request number (number, required) - `repo`: Repository name (string, required) -- **get_pull_request_comments** - Get pull request comments - - `owner`: Repository owner (string, required) - - `pullNumber`: Pull request number (number, required) - - `repo`: Repository name (string, required) - - **get_pull_request_diff** - Get pull request diff - `owner`: Repository owner (string, required) - `pullNumber`: Pull request number (number, required) @@ -718,6 +713,11 @@ The following sets of tools are available (all are on by default): - `pullNumber`: Pull request number (number, required) - `repo`: Repository name (string, required) +- **get_pull_request_review_comments** - Get pull request review comments + - `owner`: Repository owner (string, required) + - `pullNumber`: Pull request number (number, required) + - `repo`: Repository name (string, required) + - **get_pull_request_reviews** - Get pull request reviews - `owner`: Repository owner (string, required) - `pullNumber`: Pull request number (number, required) diff --git a/pkg/github/__toolsnaps__/get_pull_request_comments.snap b/pkg/github/__toolsnaps__/get_pull_request_review_comments.snap similarity index 60% rename from pkg/github/__toolsnaps__/get_pull_request_comments.snap rename to pkg/github/__toolsnaps__/get_pull_request_review_comments.snap index 6699f6d97..92996fec2 100644 --- a/pkg/github/__toolsnaps__/get_pull_request_comments.snap +++ b/pkg/github/__toolsnaps__/get_pull_request_review_comments.snap @@ -1,9 +1,9 @@ { "annotations": { - "title": "Get pull request comments", + "title": "Get pull request review comments", "readOnlyHint": true }, - "description": "Get comments for a specific pull request.", + "description": "Get pull request review comments. They are comments made on a portion of the unified diff during a pull request review. These are different from commit comments and issue comments in a pull request.", "inputSchema": { "properties": { "owner": { @@ -26,5 +26,5 @@ ], "type": "object" }, - "name": "get_pull_request_comments" + "name": "get_pull_request_review_comments" } \ No newline at end of file diff --git a/pkg/github/pullrequests.go b/pkg/github/pullrequests.go index d7547519d..b2e4e9290 100644 --- a/pkg/github/pullrequests.go +++ b/pkg/github/pullrequests.go @@ -975,12 +975,12 @@ func UpdatePullRequestBranch(getClient GetClientFn, t translations.TranslationHe } } -// GetPullRequestComments creates a tool to get the review comments on a pull request. -func GetPullRequestComments(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.Tool, server.ToolHandlerFunc) { - return mcp.NewTool("get_pull_request_comments", - mcp.WithDescription(t("TOOL_GET_PULL_REQUEST_COMMENTS_DESCRIPTION", "Get comments for a specific pull request.")), +// GetPullRequestReviewComments creates a tool to get the review comments on a pull request. +func GetPullRequestReviewComments(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.Tool, server.ToolHandlerFunc) { + return mcp.NewTool("get_pull_request_review_comments", + mcp.WithDescription(t("TOOL_GET_PULL_REQUEST_REVIEW_COMMENTS_DESCRIPTION", "Get pull request review comments. They are comments made on a portion of the unified diff during a pull request review. These are different from commit comments and issue comments in a pull request.")), mcp.WithToolAnnotation(mcp.ToolAnnotation{ - Title: t("TOOL_GET_PULL_REQUEST_COMMENTS_USER_TITLE", "Get pull request comments"), + Title: t("TOOL_GET_PULL_REQUEST_REVIEW_COMMENTS_USER_TITLE", "Get pull request review comments"), ReadOnlyHint: ToBoolPtr(true), }), mcp.WithString("owner", @@ -1023,7 +1023,7 @@ func GetPullRequestComments(getClient GetClientFn, t translations.TranslationHel comments, resp, err := client.PullRequests.ListComments(ctx, owner, repo, pullNumber, opts) if err != nil { return ghErrors.NewGitHubAPIErrorResponse(ctx, - "failed to get pull request comments", + "failed to get pull request review comments", resp, err, ), nil @@ -1035,7 +1035,7 @@ func GetPullRequestComments(getClient GetClientFn, t translations.TranslationHel if err != nil { return nil, fmt.Errorf("failed to read response body: %w", err) } - return mcp.NewToolResultError(fmt.Sprintf("failed to get pull request comments: %s", string(body))), nil + return mcp.NewToolResultError(fmt.Sprintf("failed to get pull request review comments: %s", string(body))), nil } r, err := json.Marshal(comments) diff --git a/pkg/github/pullrequests_test.go b/pkg/github/pullrequests_test.go index ea2df97f4..18fc8d87d 100644 --- a/pkg/github/pullrequests_test.go +++ b/pkg/github/pullrequests_test.go @@ -1555,10 +1555,10 @@ func Test_UpdatePullRequestBranch(t *testing.T) { func Test_GetPullRequestComments(t *testing.T) { // Verify tool definition once mockClient := github.NewClient(nil) - tool, _ := GetPullRequestComments(stubGetClientFn(mockClient), translations.NullTranslationHelper) + tool, _ := GetPullRequestReviewComments(stubGetClientFn(mockClient), translations.NullTranslationHelper) require.NoError(t, toolsnaps.Test(tool.Name, tool)) - assert.Equal(t, "get_pull_request_comments", tool.Name) + assert.Equal(t, "get_pull_request_review_comments", tool.Name) assert.NotEmpty(t, tool.Description) assert.Contains(t, tool.InputSchema.Properties, "owner") assert.Contains(t, tool.InputSchema.Properties, "repo") @@ -1636,7 +1636,7 @@ func Test_GetPullRequestComments(t *testing.T) { "pullNumber": float64(999), }, expectError: true, - expectedErrMsg: "failed to get pull request comments", + expectedErrMsg: "failed to get pull request review comments", }, } @@ -1644,7 +1644,7 @@ func Test_GetPullRequestComments(t *testing.T) { t.Run(tc.name, func(t *testing.T) { // Setup client with mock client := github.NewClient(tc.mockedClient) - _, handler := GetPullRequestComments(stubGetClientFn(client), translations.NullTranslationHelper) + _, handler := GetPullRequestReviewComments(stubGetClientFn(client), translations.NullTranslationHelper) // Create call request request := createMCPRequest(tc.requestArgs) diff --git a/pkg/github/tools.go b/pkg/github/tools.go index 728d78097..10a3f3eca 100644 --- a/pkg/github/tools.go +++ b/pkg/github/tools.go @@ -86,7 +86,7 @@ func DefaultToolsetGroup(readOnly bool, getClient GetClientFn, getGQLClient GetG toolsets.NewServerTool(GetPullRequestFiles(getClient, t)), toolsets.NewServerTool(SearchPullRequests(getClient, t)), toolsets.NewServerTool(GetPullRequestStatus(getClient, t)), - toolsets.NewServerTool(GetPullRequestComments(getClient, t)), + toolsets.NewServerTool(GetPullRequestReviewComments(getClient, t)), toolsets.NewServerTool(GetPullRequestReviews(getClient, t)), toolsets.NewServerTool(GetPullRequestDiff(getClient, t)), ).