| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
This PR adds three new MCP write tools that let clients create emoji reactions on GitHub issues, issue comments, and pull request review comments, extending the server’s “write” surface area to cover a core GitHub interaction.
Changes:
| File | Description |
|---|---|
| README.md | Documents the three new tools and their parameters in the generated tool listing. |
| pkg/github/tools.go | Registers the three new tools in AllTools so they’re available to clients. |
| pkg/github/issues_granular.go | Implements add_issue_reaction and add_issue_comment_reaction tool schemas and handlers. |
| pkg/github/pullrequests_granular.go | Implements add_pull_request_review_comment_reaction tool schema and handler. |
| pkg/github/helper_test.go | Adds mocked endpoint patterns for the reactions REST endpoints. |
| pkg/github/granular_tools_test.go | Adds toolsnap coverage and handler tests for the new reaction tools. |
| pkg/github/toolsnaps/add_issue_reaction.snap | New snapshot for add_issue_reaction tool schema. |
| pkg/github/toolsnaps/add_issue_comment_reaction.snap | New snapshot for add_issue_comment_reaction tool schema. |
| pkg/github/toolsnaps/add_pull_request_review_comment_reaction.snap | New snapshot for add_pull_request_review_comment_reaction tool schema. |
Sorry, something went wrong.
Implement three granular-only tools for adding emoji reactions: - add_issue_reaction: Add reaction to an issue - add_issue_comment_reaction: Add reaction to an issue comment - add_pull_request_review_comment_reaction: Add reaction to a PR review comment All tools are feature-flagged with FeatureFlagEnable set to enable them only when clients request granular toolsets. Tools use go-github's Reactions service and return minimal ID response on success (HTTP 201). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove feature flag gates from reaction tools so they're available to all clients regardless of granular toolset preference. Reaction tools are naturally atomic operations and work equally well in both modes. Updates test expectations to exclude reaction tools from granular-only test assertions, since they're now always available. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Looks good to me 🚀
Sorry, something went wrong.
|
Tested manually locally and this is all working. We could consider adding tools to remove reactions, but I think this is a good incremental step and we can choose to add more later. |
Sorry, something went wrong.
Return reaction URLs in minimal responses and clarify issue tools apply to pull requests where applicable. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
internal/ghmcp/server_test.go.github/actions/build-ui/action.ymlREADME.mdhttps://github.com/modelcontextprotocol/modelcontextprotocol/issues/1489
Sorry, something went wrong.
Keep the standalone reaction tools behind granular feature flags to avoid expanding the default tool count. Add optional reaction support to the existing issue comment and pull request comment reply tools, requiring at least one of body or reaction. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Document that PR review comment reaction inputs require the numeric review comment ID, not the GraphQL review thread node ID returned by review thread APIs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add optional comment_id support so the default add_issue_comment tool can react to a specific issue or pull request comment without exposing a separate default reaction tool. Keep body creation tied to issue_number and require reaction targets to provide either issue_number or comment_id. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
| expectError: false, | ||
| expectedErrMsg: "missing required parameter: body", | ||
| expectedErrMsg: "failed to create comment", | ||
| }, |
| createdComment, resp, err := client.Issues.CreateComment(ctx, owner, repo, issueNumber, comment) | ||
| if err != nil { | ||
| return utils.NewToolResultErrorFromErr("failed to read response body", err), nil, nil | ||
| return utils.NewToolResultErrorFromErr("failed to create comment", err), nil, nil | ||
| } |
| if hasReaction && !hasIssueNumber && !hasCommentID { | ||
| return utils.NewToolResultError("issue_number or comment_id is required when reaction is provided"), nil, nil | ||
| } |
| ListIssueFields(t), | ||
| IssueWrite(t), | ||
| AddIssueComment(t), | ||
| AddIssueReaction(t), | ||
| AddIssueCommentReaction(t), |
Apply reactions before creating comments or replies so retrying a failed combined call cannot duplicate the non-idempotent comment operation. Also reject issue comment IDs without a reaction target to avoid silently ignoring the field. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
| if hasBody && !hasIssueNumber { | ||
| return utils.NewToolResultError("issue_number is required when body is provided"), nil, nil | ||
| } | ||
| if hasReaction && !hasIssueNumber && !hasCommentID { | ||
| return utils.NewToolResultError("issue_number or comment_id is required when reaction is provided"), nil, nil | ||
| } | ||
| if hasCommentID && !hasReaction { | ||
| return utils.NewToolResultError("comment_id can only be provided when reaction is provided"), nil, nil | ||
| } |
| // AddIssueReaction adds a reaction to an issue or pull request. | ||
| func AddIssueReaction(t translations.TranslationHelperFunc) inventory.ServerTool { | ||
| st := NewTool( |
| // AddPullRequestReviewCommentReaction adds a reaction to a pull request review comment. | ||
| func AddPullRequestReviewCommentReaction(t translations.TranslationHelperFunc) inventory.ServerTool { | ||
| st := NewTool( |
There was a problem hiding this comment.
pkg/github/issues_test.go:631
expectedErrMsg: "failed to create comment",
},
}
for _, tc := range tests {
Sorry, something went wrong.
Make issue_number required on the consolidated add_issue_comment tool even when reacting to a specific issue comment, keeping the default tool input shape explicit. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
| @@ -618,10 +621,10 @@ func Test_AddIssueComment(t *testing.T) { | |||
| "owner": "owner", | |||
| "repo": "repo", | |||
| "issue_number": float64(42), | |||
| "body": "", | |||
| "body": "This is a test comment", | |||
| }, | |||
| expectError: false, | |||
| expectedErrMsg: "missing required parameter: body", | |||
| expectedErrMsg: "failed to create comment", | |||
| }, | |||
Return structured GitHub API errors for issue comment creation failures and assert MCP error results in tests. Also reject comment_id with body on the consolidated comment tool to avoid ambiguous comment-plus-comment-reaction requests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use the required issue_number to verify issue comment reaction targets before creating the reaction, and remove overlapping add_issue_comment test coverage. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
| commentID, err := RequiredBigInt(args, "commentId") | ||
| if err != nil { | ||
| return utils.NewToolResultError(err.Error()), nil, nil | ||
| } |
| commentID, err = RequiredBigInt(args, "comment_id") | ||
| if err != nil { | ||
| return utils.NewToolResultError(err.Error()), nil, nil | ||
| } | ||
| hasCommentID = true |
Reject non-positive issue and pull request comment IDs in handlers and add the missing schema minimum for pull request review comment IDs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
|
||
| reactionResponse = &MinimalResponse{ | ||
| ID: fmt.Sprintf("%d", reaction.GetID()), | ||
| URL: fmt.Sprintf("%srepos/%s/%s/pulls/comments/%d/reactions/%d", client.BaseURL(), owner, repo, commentID, reaction.GetID()), | ||
| } |
| r, err := json.Marshal(MinimalResponse{ | ||
| ID: fmt.Sprintf("%d", reaction.GetID()), | ||
| URL: fmt.Sprintf("%srepos/%s/%s/pulls/comments/%d/reactions/%d", client.BaseURL(), owner, repo, commentID, reaction.GetID()), | ||
| }) |
| reactionResponse = &MinimalResponse{ | ||
| ID: fmt.Sprintf("%d", reaction.GetID()), | ||
| URL: fmt.Sprintf("%srepos/%s/%s/issues/comments/%d/reactions/%d", client.BaseURL(), owner, repo, commentID, reaction.GetID()), | ||
| } |
| reactionResponse = &MinimalResponse{ | ||
| ID: fmt.Sprintf("%d", reaction.GetID()), | ||
| URL: fmt.Sprintf("%srepos/%s/%s/issues/%d/reactions/%d", client.BaseURL(), owner, repo, issueNumber, reaction.GetID()), | ||
| } |
| r, err := json.Marshal(MinimalResponse{ | ||
| ID: fmt.Sprintf("%d", reaction.GetID()), | ||
| URL: fmt.Sprintf("%srepos/%s/%s/issues/%d/reactions/%d", client.BaseURL(), owner, repo, issueNumber, reaction.GetID()), | ||
| }) |
| r, err := json.Marshal(MinimalResponse{ | ||
| ID: fmt.Sprintf("%d", reaction.GetID()), | ||
| URL: fmt.Sprintf("%srepos/%s/%s/issues/comments/%d/reactions/%d", client.BaseURL(), owner, repo, commentID, reaction.GetID()), | ||
| }) |
…nning-reaction-tools # Conflicts: # pkg/github/helper_test.go
| Back | FazBrowse Home | New Git URL |
Summary
Add reaction support for issues, issue comments, and pull request review comments while keeping standalone reaction tools behind the granular tool feature flags.
Default users can add reactions through existing comment tools to avoid adding more default tools:
Granular users also get standalone tools:
Why
Reactions are a fundamental part of GitHub's interaction model. Clients should be able to add reactions programmatically just as they can create issues, comments, and reviews, without increasing the default tool surface more than necessary.
What changed
MCP impact
Prompts tested (tool changes only)
Security / limits
Tool renaming
Lint & tests
Docs
Closes #2757