From 42d7449e9d58949e7048f603f9f5b4ee959c37fd Mon Sep 17 00:00:00 2001 From: LuluBeatson Date: Fri, 18 Jul 2025 09:13:43 +0100 Subject: [PATCH 1/3] shorten tool name --- README.md | 2 +- e2e/e2e_test.go | 12 ++++++------ ...eview.snap => add_comment_to_pending_review.snap} | 4 ++-- pkg/github/pullrequests.go | 6 +++--- pkg/github/pullrequests_test.go | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) rename pkg/github/__toolsnaps__/{add_pull_request_review_comment_to_pending_review.snap => add_comment_to_pending_review.snap} (89%) diff --git a/README.md b/README.md index c5274ff83..bc05282f2 100644 --- a/README.md +++ b/README.md @@ -722,7 +722,7 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description Pull Requests -- **add_pull_request_review_comment_to_pending_review** - Add comment to the requester's latest pending pull request review +- **add_comment_to_pending_review** - Add comment to the requester's latest pending pull request review - `body`: The text of the review comment (string, required) - `line`: The line of the blob in the pull request diff that the comment applies to. For multi-line comments, the last line of the range (number, optional) - `owner`: Repository owner (string, required) diff --git a/e2e/e2e_test.go b/e2e/e2e_test.go index d46e8de8b..64c5729ba 100644 --- a/e2e/e2e_test.go +++ b/e2e/e2e_test.go @@ -1338,7 +1338,7 @@ func TestPullRequestReviewCommentSubmit(t *testing.T) { // Add a file review comment addFileReviewCommentRequest := mcp.CallToolRequest{} - addFileReviewCommentRequest.Params.Name = "add_pull_request_review_comment_to_pending_review" + addFileReviewCommentRequest.Params.Name = "add_comment_to_pending_review" addFileReviewCommentRequest.Params.Arguments = map[string]any{ "owner": currentOwner, "repo": repoName, @@ -1350,12 +1350,12 @@ func TestPullRequestReviewCommentSubmit(t *testing.T) { t.Logf("Adding file review comment to pull request in %s/%s...", currentOwner, repoName) resp, err = mcpClient.CallTool(ctx, addFileReviewCommentRequest) - require.NoError(t, err, "expected to call 'add_pull_request_review_comment_to_pending_review' tool successfully") + require.NoError(t, err, "expected to call 'add_comment_to_pending_review' tool successfully") require.False(t, resp.IsError, fmt.Sprintf("expected result not to be an error: %+v", resp)) // Add a single line review comment addSingleLineReviewCommentRequest := mcp.CallToolRequest{} - addSingleLineReviewCommentRequest.Params.Name = "add_pull_request_review_comment_to_pending_review" + addSingleLineReviewCommentRequest.Params.Name = "add_comment_to_pending_review" addSingleLineReviewCommentRequest.Params.Arguments = map[string]any{ "owner": currentOwner, "repo": repoName, @@ -1370,12 +1370,12 @@ func TestPullRequestReviewCommentSubmit(t *testing.T) { t.Logf("Adding single line review comment to pull request in %s/%s...", currentOwner, repoName) resp, err = mcpClient.CallTool(ctx, addSingleLineReviewCommentRequest) - require.NoError(t, err, "expected to call 'add_pull_request_review_comment_to_pending_review' tool successfully") + require.NoError(t, err, "expected to call 'add_comment_to_pending_review' tool successfully") require.False(t, resp.IsError, fmt.Sprintf("expected result not to be an error: %+v", resp)) // Add a multiline review comment addMultilineReviewCommentRequest := mcp.CallToolRequest{} - addMultilineReviewCommentRequest.Params.Name = "add_pull_request_review_comment_to_pending_review" + addMultilineReviewCommentRequest.Params.Name = "add_comment_to_pending_review" addMultilineReviewCommentRequest.Params.Arguments = map[string]any{ "owner": currentOwner, "repo": repoName, @@ -1392,7 +1392,7 @@ func TestPullRequestReviewCommentSubmit(t *testing.T) { t.Logf("Adding multi line review comment to pull request in %s/%s...", currentOwner, repoName) resp, err = mcpClient.CallTool(ctx, addMultilineReviewCommentRequest) - require.NoError(t, err, "expected to call 'add_pull_request_review_comment_to_pending_review' tool successfully") + require.NoError(t, err, "expected to call 'add_comment_to_pending_review' tool successfully") require.False(t, resp.IsError, fmt.Sprintf("expected result not to be an error: %+v", resp)) // Submit the review diff --git a/pkg/github/__toolsnaps__/add_pull_request_review_comment_to_pending_review.snap b/pkg/github/__toolsnaps__/add_comment_to_pending_review.snap similarity index 89% rename from pkg/github/__toolsnaps__/add_pull_request_review_comment_to_pending_review.snap rename to pkg/github/__toolsnaps__/add_comment_to_pending_review.snap index 454b9d0ba..9907816b8 100644 --- a/pkg/github/__toolsnaps__/add_pull_request_review_comment_to_pending_review.snap +++ b/pkg/github/__toolsnaps__/add_comment_to_pending_review.snap @@ -3,7 +3,7 @@ "title": "Add comment to the requester's latest pending pull request review", "readOnlyHint": false }, - "description": "Add a comment to the requester's latest pending pull request review, a pending review needs to already exist to call this (check with the user if not sure).", + "description": "Add a review comment to the requester's latest pending pull request review, a pending review needs to already exist to call this (check with the user if not sure).", "inputSchema": { "properties": { "body": { @@ -69,5 +69,5 @@ ], "type": "object" }, - "name": "add_pull_request_review_comment_to_pending_review" + "name": "add_comment_to_pending_review" } \ No newline at end of file diff --git a/pkg/github/pullrequests.go b/pkg/github/pullrequests.go index aeca650fa..3147c8fb7 100644 --- a/pkg/github/pullrequests.go +++ b/pkg/github/pullrequests.go @@ -1153,10 +1153,10 @@ func CreatePendingPullRequestReview(getGQLClient GetGQLClientFn, t translations. // AddPullRequestReviewCommentToPendingReview creates a tool to add a comment to a pull request review. func AddPullRequestReviewCommentToPendingReview(getGQLClient GetGQLClientFn, t translations.TranslationHelperFunc) (mcp.Tool, server.ToolHandlerFunc) { - return mcp.NewTool("add_pull_request_review_comment_to_pending_review", - mcp.WithDescription(t("TOOL_ADD_PULL_REQUEST_REVIEW_COMMENT_TO_PENDING_REVIEW_DESCRIPTION", "Add a comment to the requester's latest pending pull request review, a pending review needs to already exist to call this (check with the user if not sure).")), + return mcp.NewTool("add_comment_to_pending_review", + mcp.WithDescription(t("TOOL_ADD_COMMENT_TO_PENDING_REVIEW_DESCRIPTION", "Add a review comment to the requester's latest pending pull request review, a pending review needs to already exist to call this (check with the user if not sure).")), mcp.WithToolAnnotation(mcp.ToolAnnotation{ - Title: t("TOOL_ADD_PULL_REQUEST_REVIEW_COMMENT_TO_PENDING_REVIEW_USER_TITLE", "Add comment to the requester's latest pending pull request review"), + Title: t("TOOL_ADD_COMMENT_TO_PENDING_REVIEW_USER_TITLE", "Add comment to the requester's latest pending pull request review"), ReadOnlyHint: ToBoolPtr(false), }), // Ideally, for performance sake this would just accept the pullRequestReviewID. However, we would need to diff --git a/pkg/github/pullrequests_test.go b/pkg/github/pullrequests_test.go index e39315232..d77e95e57 100644 --- a/pkg/github/pullrequests_test.go +++ b/pkg/github/pullrequests_test.go @@ -2140,7 +2140,7 @@ func TestAddPullRequestReviewCommentToPendingReview(t *testing.T) { tool, _ := AddPullRequestReviewCommentToPendingReview(stubGetGQLClientFn(mockClient), translations.NullTranslationHelper) require.NoError(t, toolsnaps.Test(tool.Name, tool)) - assert.Equal(t, "add_pull_request_review_comment_to_pending_review", tool.Name) + assert.Equal(t, "add_comment_to_pending_review", tool.Name) assert.NotEmpty(t, tool.Description) assert.Contains(t, tool.InputSchema.Properties, "owner") assert.Contains(t, tool.InputSchema.Properties, "repo") From 4bdb40af9c839055e05e73199ea9e7b9a7b6bc33 Mon Sep 17 00:00:00 2001 From: LuluBeatson Date: Fri, 18 Jul 2025 09:17:56 +0100 Subject: [PATCH 2/3] update function name to match tool name --- pkg/github/pullrequests.go | 4 ++-- pkg/github/pullrequests_test.go | 4 ++-- pkg/github/tools.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/github/pullrequests.go b/pkg/github/pullrequests.go index 3147c8fb7..4f68c7006 100644 --- a/pkg/github/pullrequests.go +++ b/pkg/github/pullrequests.go @@ -1151,8 +1151,8 @@ func CreatePendingPullRequestReview(getGQLClient GetGQLClientFn, t translations. } } -// AddPullRequestReviewCommentToPendingReview creates a tool to add a comment to a pull request review. -func AddPullRequestReviewCommentToPendingReview(getGQLClient GetGQLClientFn, t translations.TranslationHelperFunc) (mcp.Tool, server.ToolHandlerFunc) { +// AddCommentToPendingReview creates a tool to add a comment to a pull request review. +func AddCommentToPendingReview(getGQLClient GetGQLClientFn, t translations.TranslationHelperFunc) (mcp.Tool, server.ToolHandlerFunc) { return mcp.NewTool("add_comment_to_pending_review", mcp.WithDescription(t("TOOL_ADD_COMMENT_TO_PENDING_REVIEW_DESCRIPTION", "Add a review comment to the requester's latest pending pull request review, a pending review needs to already exist to call this (check with the user if not sure).")), mcp.WithToolAnnotation(mcp.ToolAnnotation{ diff --git a/pkg/github/pullrequests_test.go b/pkg/github/pullrequests_test.go index d77e95e57..42fd5bf03 100644 --- a/pkg/github/pullrequests_test.go +++ b/pkg/github/pullrequests_test.go @@ -2137,7 +2137,7 @@ func TestAddPullRequestReviewCommentToPendingReview(t *testing.T) { // Verify tool definition once mockClient := githubv4.NewClient(nil) - tool, _ := AddPullRequestReviewCommentToPendingReview(stubGetGQLClientFn(mockClient), translations.NullTranslationHelper) + tool, _ := AddCommentToPendingReview(stubGetGQLClientFn(mockClient), translations.NullTranslationHelper) require.NoError(t, toolsnaps.Test(tool.Name, tool)) assert.Equal(t, "add_comment_to_pending_review", tool.Name) @@ -2222,7 +2222,7 @@ func TestAddPullRequestReviewCommentToPendingReview(t *testing.T) { // Setup client with mock client := githubv4.NewClient(tc.mockedClient) - _, handler := AddPullRequestReviewCommentToPendingReview(stubGetGQLClientFn(client), translations.NullTranslationHelper) + _, handler := AddCommentToPendingReview(stubGetGQLClientFn(client), translations.NullTranslationHelper) // Create call request request := createMCPRequest(tc.requestArgs) diff --git a/pkg/github/tools.go b/pkg/github/tools.go index 77a1ccd3b..bd349171d 100644 --- a/pkg/github/tools.go +++ b/pkg/github/tools.go @@ -89,7 +89,7 @@ func DefaultToolsetGroup(readOnly bool, getClient GetClientFn, getGQLClient GetG // Reviews toolsets.NewServerTool(CreateAndSubmitPullRequestReview(getGQLClient, t)), toolsets.NewServerTool(CreatePendingPullRequestReview(getGQLClient, t)), - toolsets.NewServerTool(AddPullRequestReviewCommentToPendingReview(getGQLClient, t)), + toolsets.NewServerTool(AddCommentToPendingReview(getGQLClient, t)), toolsets.NewServerTool(SubmitPendingPullRequestReview(getGQLClient, t)), toolsets.NewServerTool(DeletePendingPullRequestReview(getGQLClient, t)), ) From 83308df976bc64f5d62f5af0f15d7f2559618284 Mon Sep 17 00:00:00 2001 From: LuluBeatson Date: Fri, 18 Jul 2025 10:18:51 +0100 Subject: [PATCH 3/3] adjust wording of descriptions --- README.md | 2 +- pkg/github/__toolsnaps__/add_comment_to_pending_review.snap | 4 ++-- pkg/github/pullrequests.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3b04f0966..e0ebe0f72 100644 --- a/README.md +++ b/README.md @@ -589,7 +589,7 @@ The following sets of tools are available (all are on by default): Pull Requests -- **add_comment_to_pending_review** - Add comment to the requester's latest pending pull request review +- **add_comment_to_pending_review** - Add review comment to the requester's latest pending pull request review - `body`: The text of the review comment (string, required) - `line`: The line of the blob in the pull request diff that the comment applies to. For multi-line comments, the last line of the range (number, optional) - `owner`: Repository owner (string, required) diff --git a/pkg/github/__toolsnaps__/add_comment_to_pending_review.snap b/pkg/github/__toolsnaps__/add_comment_to_pending_review.snap index 9907816b8..08fa42df5 100644 --- a/pkg/github/__toolsnaps__/add_comment_to_pending_review.snap +++ b/pkg/github/__toolsnaps__/add_comment_to_pending_review.snap @@ -1,9 +1,9 @@ { "annotations": { - "title": "Add comment to the requester's latest pending pull request review", + "title": "Add review comment to the requester's latest pending pull request review", "readOnlyHint": false }, - "description": "Add a review comment to the requester's latest pending pull request review, a pending review needs to already exist to call this (check with the user if not sure).", + "description": "Add review comment to the requester's latest pending pull request review. A pending review needs to already exist to call this (check with the user if not sure).", "inputSchema": { "properties": { "body": { diff --git a/pkg/github/pullrequests.go b/pkg/github/pullrequests.go index 4f68c7006..d98dc334d 100644 --- a/pkg/github/pullrequests.go +++ b/pkg/github/pullrequests.go @@ -1154,9 +1154,9 @@ func CreatePendingPullRequestReview(getGQLClient GetGQLClientFn, t translations. // AddCommentToPendingReview creates a tool to add a comment to a pull request review. func AddCommentToPendingReview(getGQLClient GetGQLClientFn, t translations.TranslationHelperFunc) (mcp.Tool, server.ToolHandlerFunc) { return mcp.NewTool("add_comment_to_pending_review", - mcp.WithDescription(t("TOOL_ADD_COMMENT_TO_PENDING_REVIEW_DESCRIPTION", "Add a review comment to the requester's latest pending pull request review, a pending review needs to already exist to call this (check with the user if not sure).")), + mcp.WithDescription(t("TOOL_ADD_COMMENT_TO_PENDING_REVIEW_DESCRIPTION", "Add review comment to the requester's latest pending pull request review. A pending review needs to already exist to call this (check with the user if not sure).")), mcp.WithToolAnnotation(mcp.ToolAnnotation{ - Title: t("TOOL_ADD_COMMENT_TO_PENDING_REVIEW_USER_TITLE", "Add comment to the requester's latest pending pull request review"), + Title: t("TOOL_ADD_COMMENT_TO_PENDING_REVIEW_USER_TITLE", "Add review comment to the requester's latest pending pull request review"), ReadOnlyHint: ToBoolPtr(false), }), // Ideally, for performance sake this would just accept the pullRequestReviewID. However, we would need to