From 37f74d2703dfea5a423dfdc09ea19d36aadce369 Mon Sep 17 00:00:00 2001 From: tonytrg Date: Mon, 8 Sep 2025 18:16:49 +0200 Subject: [PATCH 1/3] update get_pull_request_comments to get_pull_request_review_comments to signify difference --- README.md | 10 +++---- .../get_pull_request_review_comments.snap | 30 +++++++++++++++++++ pkg/github/pullrequests.go | 10 +++---- pkg/github/pullrequests_test.go | 6 ++-- pkg/github/tools.go | 2 +- 5 files changed, 44 insertions(+), 14 deletions(-) create mode 100644 pkg/github/__toolsnaps__/get_pull_request_review_comments.snap diff --git a/README.md b/README.md index d1ce061da..36b6ce08c 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 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_review_comments.snap b/pkg/github/__toolsnaps__/get_pull_request_review_comments.snap new file mode 100644 index 000000000..89ccd9559 --- /dev/null +++ b/pkg/github/__toolsnaps__/get_pull_request_review_comments.snap @@ -0,0 +1,30 @@ +{ + "annotations": { + "title": "Get pull request comments", + "readOnlyHint": true + }, + "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": { + "description": "Repository owner", + "type": "string" + }, + "pullNumber": { + "description": "Pull request number", + "type": "number" + }, + "repo": { + "description": "Repository name", + "type": "string" + } + }, + "required": [ + "owner", + "repo", + "pullNumber" + ], + "type": "object" + }, + "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..379cb6d01 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 comments"), ReadOnlyHint: ToBoolPtr(true), }), mcp.WithString("owner", diff --git a/pkg/github/pullrequests_test.go b/pkg/github/pullrequests_test.go index ea2df97f4..f69e4f83d 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") @@ -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)), ). From 4305e07cef824bda9fea51eb52ae361c0e9d2772 Mon Sep 17 00:00:00 2001 From: tonytrg Date: Mon, 8 Sep 2025 18:25:36 +0200 Subject: [PATCH 2/3] fix remaining old references --- README.md | 2 +- .../__toolsnaps__/get_pull_request_review_comments.snap | 2 +- pkg/github/pullrequests.go | 6 +++--- pkg/github/pullrequests_test.go | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 36b6ce08c..46eef3b4b 100644 --- a/README.md +++ b/README.md @@ -713,7 +713,7 @@ 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 comments +- **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) diff --git a/pkg/github/__toolsnaps__/get_pull_request_review_comments.snap b/pkg/github/__toolsnaps__/get_pull_request_review_comments.snap index 89ccd9559..92996fec2 100644 --- a/pkg/github/__toolsnaps__/get_pull_request_review_comments.snap +++ b/pkg/github/__toolsnaps__/get_pull_request_review_comments.snap @@ -1,6 +1,6 @@ { "annotations": { - "title": "Get pull request comments", + "title": "Get pull request review comments", "readOnlyHint": true }, "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.", diff --git a/pkg/github/pullrequests.go b/pkg/github/pullrequests.go index 379cb6d01..b2e4e9290 100644 --- a/pkg/github/pullrequests.go +++ b/pkg/github/pullrequests.go @@ -980,7 +980,7 @@ func GetPullRequestReviewComments(getClient GetClientFn, t translations.Translat 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_REVIEW_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 GetPullRequestReviewComments(getClient GetClientFn, t translations.Translat 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 GetPullRequestReviewComments(getClient GetClientFn, t translations.Translat 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 f69e4f83d..18fc8d87d 100644 --- a/pkg/github/pullrequests_test.go +++ b/pkg/github/pullrequests_test.go @@ -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", }, } From 9953e7acc5410ced6fccdd6f25bb0f17da91afa9 Mon Sep 17 00:00:00 2001 From: tonytrg Date: Mon, 8 Sep 2025 18:27:20 +0200 Subject: [PATCH 3/3] cleanup dangling tool snap --- .../get_pull_request_comments.snap | 30 ------------------- 1 file changed, 30 deletions(-) delete mode 100644 pkg/github/__toolsnaps__/get_pull_request_comments.snap diff --git a/pkg/github/__toolsnaps__/get_pull_request_comments.snap b/pkg/github/__toolsnaps__/get_pull_request_comments.snap deleted file mode 100644 index 6699f6d97..000000000 --- a/pkg/github/__toolsnaps__/get_pull_request_comments.snap +++ /dev/null @@ -1,30 +0,0 @@ -{ - "annotations": { - "title": "Get pull request comments", - "readOnlyHint": true - }, - "description": "Get comments for a specific pull request.", - "inputSchema": { - "properties": { - "owner": { - "description": "Repository owner", - "type": "string" - }, - "pullNumber": { - "description": "Pull request number", - "type": "number" - }, - "repo": { - "description": "Repository name", - "type": "string" - } - }, - "required": [ - "owner", - "repo", - "pullNumber" - ], - "type": "object" - }, - "name": "get_pull_request_comments" -} \ No newline at end of file