Conversation
Add two tools behind the issues_granular feature flag that hide (minimize) and unhide (unminimize) comments via the GraphQL minimizeComment/unminimizeComment mutations. They support issue and pull request conversation comments, pull request review comments, and pull request review bodies. Callers pass the numeric REST ID plus a comment_type; the tool resolves the GraphQL node ID via the matching REST endpoint before mutating. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
issues_granular toolset
Use `pull_request_review` and `pull_request_review_comment` instead of `review` and `review_comment` so the comment_type values are explicit about which object they refer to. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Runtime validation is missing for classifier values and positive comment IDs.
Review effort: Balanced
Findings: 2
Open (2)
What changed in this PR
Adds feature-flagged tools for minimizing and restoring issue and pull-request comments through GitHub’s GraphQL API.
Changes:
- Adds
hide_commentandunhide_comment. - Resolves REST IDs to GraphQL node IDs.
- Adds schemas, tests, snapshots, and generated documentation.
| File | Description |
|---|---|
pkg/github/tools.go |
Registers both tools. |
pkg/github/issues_granular.go |
Defines tool schemas and handlers. |
pkg/github/comment_minimize.go |
Implements ID resolution and mutations. |
pkg/github/comment_minimize_test.go |
Tests supported targets and failures. |
pkg/github/granular_tools_test.go |
Verifies registration and snapshots. |
pkg/github/__toolsnaps__/hide_comment.snap |
Captures the hide tool schema. |
pkg/github/__toolsnaps__/unhide_comment.snap |
Captures the unhide tool schema. |
docs/feature-flags.md |
Documents both tools. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+80
to
+83
| commentID, err := RequiredBigInt(args, "comment_id") | ||
| if err != nil { | ||
| return utils.NewToolResultError(err.Error()) | ||
| } |
Comment on lines
+1933
to
+1937
| classifier, err := RequiredParam[string](args, "classifier") | ||
| if err != nil { | ||
| return utils.NewToolResultError(err.Error()), nil, nil | ||
| } | ||
| return setCommentVisibility(ctx, deps, args, true, classifier), nil, nil |
timrogers
commented
Sep 30, 2026
GitHub returns minimizedReason in lowercase, hyphenated form (e.g. "off-topic") rather than echoing the classifier enum, as confirmed by an end-to-end run against the live API. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Adds
hide_commentandunhide_commenttools, behind theissues_granularfeature flag. They hide (minimize) and unhide comments on issues and pull requests using the GraphQLminimizeComment/unminimizeCommentmutations.Why
The server has no way to hide spam, off-topic, outdated or resolved comments. Hiding is only available through GraphQL; REST has no equivalent. Related: #3321 / #3329, which surface
minimized_reasonwhen reading comments.What changed
hide_commenttool: takesowner,repo,comment_type,comment_id,classifier(all required) and an optionalpull_number.unhide_commenttool: same inputs, withoutclassifier.comment_typeis one ofissue_comment(issue or PR conversation comment),pull_request_review_comment(inline PR diff comment) orpull_request_review(PR review body, needspull_number).resolveCommentNodeIDfetches the matching REST resource to get its GraphQLnode_id, then runs the mutation. Each numeric ID type has its own ID space, socomment_typeis required rather than guessed.pkg/github/comment_minimize.go. The tool constructors live inissues_granular.goalongside the other granular issue tools.docs/feature-flags.mdupdated.MCP impact
Two new write tools, visible only when
issues_granularis enabled.Prompts tested (tool changes only)
End-to-end test against the live API: I built the server, ran it over stdio with
--toolsets issues --features issues_granular, and drove it with a small MCP client. It created real content on #3351 (a temporary test issue) and on this PR. For each object, it calledhide_commentand thenunhide_comment, and checkedisMinimized/minimizedReasonwith an independent GraphQL query after each call:comment_typeissue_commentSPAMissue_commentOFF_TOPICpull_request_review_commentOUTDATEDpull_request_reviewRESOLVEDError cases also behaved correctly against the live API:
pull_request_review_commentreturnsfailed to get comment … 404.pull_request_reviewwithoutpull_numberis rejected before any API call.The test comments have been deleted and #3351 is closed. The test review stays on this PR with its body edited, because GitHub doesn't allow deleting submitted reviews.
Security / limits
Requires the
reposcope, like the other granular issue write tools. GitHub itself enforces that the caller has triage/write access or authored the comment; permission errors from the mutation are returned as tool errors.Tool renaming
deprecated_tool_aliases.goLint & tests
./script/lint./script/testLint was run with Go 1.25 and golangci-lint v2.9.0 to match CI. The new tests cover all three comment types for hide and unhide, GraphQL mutation failures, comment-not-found, missing node ID, and missing or invalid arguments.
Docs
docs/feature-flags.mdregenerated withscript/generate-docs. README is unchanged because flag-gated tools aren't listed there.