Skip to content

fix: shorten long tool name for adding pr review comments #697

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ The following sets of tools are available (all are on by default):

<summary>Pull Requests</summary>

- **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 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)
Expand Down
12 changes: 6 additions & 6 deletions e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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 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": {
Expand Down Expand Up @@ -69,5 +69,5 @@
],
"type": "object"
},
"name": "add_pull_request_review_comment_to_pending_review"
"name": "add_comment_to_pending_review"
}
10 changes: 5 additions & 5 deletions pkg/github/pullrequests.go
Original file line number Diff line number Diff line change
Expand Up @@ -1151,12 +1151,12 @@ 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).")),
// 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 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 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
Expand Down
6 changes: 3 additions & 3 deletions pkg/github/pullrequests_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2137,10 +2137,10 @@ 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_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")
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pkg/github/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
)
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy