Skip to content

Commit b5e3348

Browse files
authored
fix: shorten long tool name for adding pr review comments (#697)
* shorten tool name * update function name to match tool name * adjust wording of descriptions
1 parent 1a74e6d commit b5e3348

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ The following sets of tools are available (all are on by default):
589589

590590
<summary>Pull Requests</summary>
591591

592-
- **add_pull_request_review_comment_to_pending_review** - Add comment to the requester's latest pending pull request review
592+
- **add_comment_to_pending_review** - Add review comment to the requester's latest pending pull request review
593593
- `body`: The text of the review comment (string, required)
594594
- `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)
595595
- `owner`: Repository owner (string, required)

e2e/e2e_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,7 @@ func TestPullRequestReviewCommentSubmit(t *testing.T) {
13381338

13391339
// Add a file review comment
13401340
addFileReviewCommentRequest := mcp.CallToolRequest{}
1341-
addFileReviewCommentRequest.Params.Name = "add_pull_request_review_comment_to_pending_review"
1341+
addFileReviewCommentRequest.Params.Name = "add_comment_to_pending_review"
13421342
addFileReviewCommentRequest.Params.Arguments = map[string]any{
13431343
"owner": currentOwner,
13441344
"repo": repoName,
@@ -1350,12 +1350,12 @@ func TestPullRequestReviewCommentSubmit(t *testing.T) {
13501350

13511351
t.Logf("Adding file review comment to pull request in %s/%s...", currentOwner, repoName)
13521352
resp, err = mcpClient.CallTool(ctx, addFileReviewCommentRequest)
1353-
require.NoError(t, err, "expected to call 'add_pull_request_review_comment_to_pending_review' tool successfully")
1353+
require.NoError(t, err, "expected to call 'add_comment_to_pending_review' tool successfully")
13541354
require.False(t, resp.IsError, fmt.Sprintf("expected result not to be an error: %+v", resp))
13551355

13561356
// Add a single line review comment
13571357
addSingleLineReviewCommentRequest := mcp.CallToolRequest{}
1358-
addSingleLineReviewCommentRequest.Params.Name = "add_pull_request_review_comment_to_pending_review"
1358+
addSingleLineReviewCommentRequest.Params.Name = "add_comment_to_pending_review"
13591359
addSingleLineReviewCommentRequest.Params.Arguments = map[string]any{
13601360
"owner": currentOwner,
13611361
"repo": repoName,
@@ -1370,12 +1370,12 @@ func TestPullRequestReviewCommentSubmit(t *testing.T) {
13701370

13711371
t.Logf("Adding single line review comment to pull request in %s/%s...", currentOwner, repoName)
13721372
resp, err = mcpClient.CallTool(ctx, addSingleLineReviewCommentRequest)
1373-
require.NoError(t, err, "expected to call 'add_pull_request_review_comment_to_pending_review' tool successfully")
1373+
require.NoError(t, err, "expected to call 'add_comment_to_pending_review' tool successfully")
13741374
require.False(t, resp.IsError, fmt.Sprintf("expected result not to be an error: %+v", resp))
13751375

13761376
// Add a multiline review comment
13771377
addMultilineReviewCommentRequest := mcp.CallToolRequest{}
1378-
addMultilineReviewCommentRequest.Params.Name = "add_pull_request_review_comment_to_pending_review"
1378+
addMultilineReviewCommentRequest.Params.Name = "add_comment_to_pending_review"
13791379
addMultilineReviewCommentRequest.Params.Arguments = map[string]any{
13801380
"owner": currentOwner,
13811381
"repo": repoName,
@@ -1392,7 +1392,7 @@ func TestPullRequestReviewCommentSubmit(t *testing.T) {
13921392

13931393
t.Logf("Adding multi line review comment to pull request in %s/%s...", currentOwner, repoName)
13941394
resp, err = mcpClient.CallTool(ctx, addMultilineReviewCommentRequest)
1395-
require.NoError(t, err, "expected to call 'add_pull_request_review_comment_to_pending_review' tool successfully")
1395+
require.NoError(t, err, "expected to call 'add_comment_to_pending_review' tool successfully")
13961396
require.False(t, resp.IsError, fmt.Sprintf("expected result not to be an error: %+v", resp))
13971397

13981398
// Submit the review

pkg/github/__toolsnaps__/add_pull_request_review_comment_to_pending_review.snap renamed to pkg/github/__toolsnaps__/add_comment_to_pending_review.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"annotations": {
3-
"title": "Add comment to the requester's latest pending pull request review",
3+
"title": "Add review comment to the requester's latest pending pull request review",
44
"readOnlyHint": false
55
},
6-
"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).",
6+
"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).",
77
"inputSchema": {
88
"properties": {
99
"body": {
@@ -69,5 +69,5 @@
6969
],
7070
"type": "object"
7171
},
72-
"name": "add_pull_request_review_comment_to_pending_review"
72+
"name": "add_comment_to_pending_review"
7373
}

pkg/github/pullrequests.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,12 +1151,12 @@ func CreatePendingPullRequestReview(getGQLClient GetGQLClientFn, t translations.
11511151
}
11521152
}
11531153

1154-
// AddPullRequestReviewCommentToPendingReview creates a tool to add a comment to a pull request review.
1155-
func AddPullRequestReviewCommentToPendingReview(getGQLClient GetGQLClientFn, t translations.TranslationHelperFunc) (mcp.Tool, server.ToolHandlerFunc) {
1156-
return mcp.NewTool("add_pull_request_review_comment_to_pending_review",
1157-
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).")),
1154+
// AddCommentToPendingReview creates a tool to add a comment to a pull request review.
1155+
func AddCommentToPendingReview(getGQLClient GetGQLClientFn, t translations.TranslationHelperFunc) (mcp.Tool, server.ToolHandlerFunc) {
1156+
return mcp.NewTool("add_comment_to_pending_review",
1157+
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).")),
11581158
mcp.WithToolAnnotation(mcp.ToolAnnotation{
1159-
Title: t("TOOL_ADD_PULL_REQUEST_REVIEW_COMMENT_TO_PENDING_REVIEW_USER_TITLE", "Add comment to the requester's latest pending pull request review"),
1159+
Title: t("TOOL_ADD_COMMENT_TO_PENDING_REVIEW_USER_TITLE", "Add review comment to the requester's latest pending pull request review"),
11601160
ReadOnlyHint: ToBoolPtr(false),
11611161
}),
11621162
// Ideally, for performance sake this would just accept the pullRequestReviewID. However, we would need to

pkg/github/pullrequests_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2137,10 +2137,10 @@ func TestAddPullRequestReviewCommentToPendingReview(t *testing.T) {
21372137

21382138
// Verify tool definition once
21392139
mockClient := githubv4.NewClient(nil)
2140-
tool, _ := AddPullRequestReviewCommentToPendingReview(stubGetGQLClientFn(mockClient), translations.NullTranslationHelper)
2140+
tool, _ := AddCommentToPendingReview(stubGetGQLClientFn(mockClient), translations.NullTranslationHelper)
21412141
require.NoError(t, toolsnaps.Test(tool.Name, tool))
21422142

2143-
assert.Equal(t, "add_pull_request_review_comment_to_pending_review", tool.Name)
2143+
assert.Equal(t, "add_comment_to_pending_review", tool.Name)
21442144
assert.NotEmpty(t, tool.Description)
21452145
assert.Contains(t, tool.InputSchema.Properties, "owner")
21462146
assert.Contains(t, tool.InputSchema.Properties, "repo")
@@ -2222,7 +2222,7 @@ func TestAddPullRequestReviewCommentToPendingReview(t *testing.T) {
22222222

22232223
// Setup client with mock
22242224
client := githubv4.NewClient(tc.mockedClient)
2225-
_, handler := AddPullRequestReviewCommentToPendingReview(stubGetGQLClientFn(client), translations.NullTranslationHelper)
2225+
_, handler := AddCommentToPendingReview(stubGetGQLClientFn(client), translations.NullTranslationHelper)
22262226

22272227
// Create call request
22282228
request := createMCPRequest(tc.requestArgs)

pkg/github/tools.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func DefaultToolsetGroup(readOnly bool, getClient GetClientFn, getGQLClient GetG
8989
// Reviews
9090
toolsets.NewServerTool(CreateAndSubmitPullRequestReview(getGQLClient, t)),
9191
toolsets.NewServerTool(CreatePendingPullRequestReview(getGQLClient, t)),
92-
toolsets.NewServerTool(AddPullRequestReviewCommentToPendingReview(getGQLClient, t)),
92+
toolsets.NewServerTool(AddCommentToPendingReview(getGQLClient, t)),
9393
toolsets.NewServerTool(SubmitPendingPullRequestReview(getGQLClient, t)),
9494
toolsets.NewServerTool(DeletePendingPullRequestReview(getGQLClient, t)),
9595
)

0 commit comments

Comments
 (0)