Skip to content

Commit 9db2e17

Browse files
authored
Updating tool get_pull_request_comments -> get_pull_request_review_comments (#1062)
* update get_pull_request_comments to get_pull_request_review_comments to signify difference * fix remaining old references * cleanup dangling tool snap
1 parent bbb411f commit 9db2e17

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -701,11 +701,6 @@ The following sets of tools are available (all are on by default):
701701
- `pullNumber`: Pull request number (number, required)
702702
- `repo`: Repository name (string, required)
703703

704-
- **get_pull_request_comments** - Get pull request comments
705-
- `owner`: Repository owner (string, required)
706-
- `pullNumber`: Pull request number (number, required)
707-
- `repo`: Repository name (string, required)
708-
709704
- **get_pull_request_diff** - Get pull request diff
710705
- `owner`: Repository owner (string, required)
711706
- `pullNumber`: Pull request number (number, required)
@@ -718,6 +713,11 @@ The following sets of tools are available (all are on by default):
718713
- `pullNumber`: Pull request number (number, required)
719714
- `repo`: Repository name (string, required)
720715

716+
- **get_pull_request_review_comments** - Get pull request review comments
717+
- `owner`: Repository owner (string, required)
718+
- `pullNumber`: Pull request number (number, required)
719+
- `repo`: Repository name (string, required)
720+
721721
- **get_pull_request_reviews** - Get pull request reviews
722722
- `owner`: Repository owner (string, required)
723723
- `pullNumber`: Pull request number (number, required)

pkg/github/__toolsnaps__/get_pull_request_comments.snap renamed to pkg/github/__toolsnaps__/get_pull_request_review_comments.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"annotations": {
3-
"title": "Get pull request comments",
3+
"title": "Get pull request review comments",
44
"readOnlyHint": true
55
},
6-
"description": "Get comments for a specific pull request.",
6+
"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.",
77
"inputSchema": {
88
"properties": {
99
"owner": {
@@ -26,5 +26,5 @@
2626
],
2727
"type": "object"
2828
},
29-
"name": "get_pull_request_comments"
29+
"name": "get_pull_request_review_comments"
3030
}

pkg/github/pullrequests.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -975,12 +975,12 @@ func UpdatePullRequestBranch(getClient GetClientFn, t translations.TranslationHe
975975
}
976976
}
977977

978-
// GetPullRequestComments creates a tool to get the review comments on a pull request.
979-
func GetPullRequestComments(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.Tool, server.ToolHandlerFunc) {
980-
return mcp.NewTool("get_pull_request_comments",
981-
mcp.WithDescription(t("TOOL_GET_PULL_REQUEST_COMMENTS_DESCRIPTION", "Get comments for a specific pull request.")),
978+
// GetPullRequestReviewComments creates a tool to get the review comments on a pull request.
979+
func GetPullRequestReviewComments(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.Tool, server.ToolHandlerFunc) {
980+
return mcp.NewTool("get_pull_request_review_comments",
981+
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.")),
982982
mcp.WithToolAnnotation(mcp.ToolAnnotation{
983-
Title: t("TOOL_GET_PULL_REQUEST_COMMENTS_USER_TITLE", "Get pull request comments"),
983+
Title: t("TOOL_GET_PULL_REQUEST_REVIEW_COMMENTS_USER_TITLE", "Get pull request review comments"),
984984
ReadOnlyHint: ToBoolPtr(true),
985985
}),
986986
mcp.WithString("owner",
@@ -1023,7 +1023,7 @@ func GetPullRequestComments(getClient GetClientFn, t translations.TranslationHel
10231023
comments, resp, err := client.PullRequests.ListComments(ctx, owner, repo, pullNumber, opts)
10241024
if err != nil {
10251025
return ghErrors.NewGitHubAPIErrorResponse(ctx,
1026-
"failed to get pull request comments",
1026+
"failed to get pull request review comments",
10271027
resp,
10281028
err,
10291029
), nil
@@ -1035,7 +1035,7 @@ func GetPullRequestComments(getClient GetClientFn, t translations.TranslationHel
10351035
if err != nil {
10361036
return nil, fmt.Errorf("failed to read response body: %w", err)
10371037
}
1038-
return mcp.NewToolResultError(fmt.Sprintf("failed to get pull request comments: %s", string(body))), nil
1038+
return mcp.NewToolResultError(fmt.Sprintf("failed to get pull request review comments: %s", string(body))), nil
10391039
}
10401040

10411041
r, err := json.Marshal(comments)

pkg/github/pullrequests_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,10 +1555,10 @@ func Test_UpdatePullRequestBranch(t *testing.T) {
15551555
func Test_GetPullRequestComments(t *testing.T) {
15561556
// Verify tool definition once
15571557
mockClient := github.NewClient(nil)
1558-
tool, _ := GetPullRequestComments(stubGetClientFn(mockClient), translations.NullTranslationHelper)
1558+
tool, _ := GetPullRequestReviewComments(stubGetClientFn(mockClient), translations.NullTranslationHelper)
15591559
require.NoError(t, toolsnaps.Test(tool.Name, tool))
15601560

1561-
assert.Equal(t, "get_pull_request_comments", tool.Name)
1561+
assert.Equal(t, "get_pull_request_review_comments", tool.Name)
15621562
assert.NotEmpty(t, tool.Description)
15631563
assert.Contains(t, tool.InputSchema.Properties, "owner")
15641564
assert.Contains(t, tool.InputSchema.Properties, "repo")
@@ -1636,15 +1636,15 @@ func Test_GetPullRequestComments(t *testing.T) {
16361636
"pullNumber": float64(999),
16371637
},
16381638
expectError: true,
1639-
expectedErrMsg: "failed to get pull request comments",
1639+
expectedErrMsg: "failed to get pull request review comments",
16401640
},
16411641
}
16421642

16431643
for _, tc := range tests {
16441644
t.Run(tc.name, func(t *testing.T) {
16451645
// Setup client with mock
16461646
client := github.NewClient(tc.mockedClient)
1647-
_, handler := GetPullRequestComments(stubGetClientFn(client), translations.NullTranslationHelper)
1647+
_, handler := GetPullRequestReviewComments(stubGetClientFn(client), translations.NullTranslationHelper)
16481648

16491649
// Create call request
16501650
request := createMCPRequest(tc.requestArgs)

pkg/github/tools.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func DefaultToolsetGroup(readOnly bool, getClient GetClientFn, getGQLClient GetG
8686
toolsets.NewServerTool(GetPullRequestFiles(getClient, t)),
8787
toolsets.NewServerTool(SearchPullRequests(getClient, t)),
8888
toolsets.NewServerTool(GetPullRequestStatus(getClient, t)),
89-
toolsets.NewServerTool(GetPullRequestComments(getClient, t)),
89+
toolsets.NewServerTool(GetPullRequestReviewComments(getClient, t)),
9090
toolsets.NewServerTool(GetPullRequestReviews(getClient, t)),
9191
toolsets.NewServerTool(GetPullRequestDiff(getClient, t)),
9292
).

0 commit comments

Comments
 (0)