Skip to content

Commit 85b0399

Browse files
timrogersCopilot
andauthored
Add granular tools to hide and unhide issue comments, PR review comments and PR reviews (#3350)
* Add hide_comment and unhide_comment granular issue tools 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> * Rename comment_type enum values to pull_request_review(_comment) 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> * Use realistic minimizedReason values in hide_comment test mocks 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> * Split hide/unhide comment tools per object type Replace hide_comment/unhide_comment, which took a comment_type argument, with a granular pair per object type: - hide_issue_comment / unhide_issue_comment (issues_granular): issue comments and pull request conversation comments - hide_pull_request_review_comment / unhide_pull_request_review_comment (pull_requests_granular): inline pull request review comments - hide_pull_request_review / unhide_pull_request_review (pull_requests_granular): pull request review bodies Every argument is now unconditionally required, so the schemas no longer need prose explaining which arguments apply to which type. The six tools are built from one shared helper, parameterised by a commentVisibilityTarget that describes each object type and how to resolve its GraphQL node ID. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Validate classifier and IDs before calling the GitHub API JSON schema constraints (enum, minimum) aren't enforced when tool arguments are unmarshalled, so an invalid classifier or a negative ID previously reached GitHub and surfaced as a confusing 404 or GraphQL error. Reject them up front with a clear argument error instead. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent a1f6500 commit 85b0399

13 files changed

Lines changed: 1053 additions & 0 deletions

‎docs/feature-flags.md‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,13 @@ as output formatting) won't appear here.
120120
- `repo`: Repository name (string, required)
121121
- `title`: Issue title (string, required)
122122

123+
- **hide_issue_comment** - Hide Issue Comment
124+
- **OAuth Challenge Scopes**: `repo`
125+
- `classifier`: The reason for hiding the comment (string, required)
126+
- `comment_id`: The numeric ID of the issue or pull request conversation comment (number, required)
127+
- `owner`: Repository owner (username or organization) (string, required)
128+
- `repo`: Repository name (string, required)
129+
123130
- **remove_issue_comment_reaction** - Remove Reaction from Issue or Pull Request Comment
124131
- **OAuth Challenge Scopes**: `repo`
125132
- `comment_id`: The issue or pull request comment ID (number, required)
@@ -157,6 +164,12 @@ as output formatting) won't appear here.
157164
- `owner`: Repository owner (username or organization) (string, required)
158165
- `repo`: Repository name (string, required)
159166

167+
- **unhide_issue_comment** - Unhide Issue Comment
168+
- **OAuth Challenge Scopes**: `repo`
169+
- `comment_id`: The numeric ID of the issue or pull request conversation comment (number, required)
170+
- `owner`: Repository owner (username or organization) (string, required)
171+
- `repo`: Repository name (string, required)
172+
160173
- **update_issue_assignees** - Update Issue Assignees
161174
- **OAuth Challenge Scopes**: `repo`
162175
- `assignees`: GitHub usernames to assign to this issue. ([], required)
@@ -251,6 +264,21 @@ as output formatting) won't appear here.
251264
- `pullNumber`: The pull request number (number, required)
252265
- `repo`: Repository name (string, required)
253266

267+
- **hide_pull_request_review** - Hide Pull Request Review
268+
- **OAuth Challenge Scopes**: `repo`
269+
- `classifier`: The reason for hiding the comment (string, required)
270+
- `owner`: Repository owner (username or organization) (string, required)
271+
- `pullNumber`: The pull request number (number, required)
272+
- `repo`: Repository name (string, required)
273+
- `review_id`: The numeric ID of the pull request review (number, required)
274+
275+
- **hide_pull_request_review_comment** - Hide Pull Request Review Comment
276+
- **OAuth Challenge Scopes**: `repo`
277+
- `classifier`: The reason for hiding the comment (string, required)
278+
- `comment_id`: The numeric pull request review comment ID. Use the number from a #discussion_r... anchor, not the GraphQL thread node ID (PRRT_...). (number, required)
279+
- `owner`: Repository owner (username or organization) (string, required)
280+
- `repo`: Repository name (string, required)
281+
254282
- **remove_pull_request_review_comment_reaction** - Remove Pull Request Review Comment Reaction
255283
- **OAuth Challenge Scopes**: `repo`
256284
- `comment_id`: The numeric pull request review comment ID. Use the number from a #discussion_r... anchor, not the GraphQL thread node ID (PRRT_...). (number, required)
@@ -277,6 +305,19 @@ as output formatting) won't appear here.
277305
- `pullNumber`: The pull request number (number, required)
278306
- `repo`: Repository name (string, required)
279307

308+
- **unhide_pull_request_review** - Unhide Pull Request Review
309+
- **OAuth Challenge Scopes**: `repo`
310+
- `owner`: Repository owner (username or organization) (string, required)
311+
- `pullNumber`: The pull request number (number, required)
312+
- `repo`: Repository name (string, required)
313+
- `review_id`: The numeric ID of the pull request review (number, required)
314+
315+
- **unhide_pull_request_review_comment** - Unhide Pull Request Review Comment
316+
- **OAuth Challenge Scopes**: `repo`
317+
- `comment_id`: The numeric pull request review comment ID. Use the number from a #discussion_r... anchor, not the GraphQL thread node ID (PRRT_...). (number, required)
318+
- `owner`: Repository owner (username or organization) (string, required)
319+
- `repo`: Repository name (string, required)
320+
280321
- **unresolve_review_thread** - Unresolve Review Thread
281322
- **OAuth Challenge Scopes**: `repo`
282323
- `threadID`: The node ID of the review thread to unresolve (e.g., PRRT_kwDOxxx) (string, required)
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"annotations": {
3+
"destructiveHint": false,
4+
"idempotentHint": false,
5+
"openWorldHint": true,
6+
"readOnlyHint": false,
7+
"title": "Hide Issue Comment"
8+
},
9+
"description": "Hide (minimize) a comment on an issue, or a conversation comment on a pull request. Requires triage or write access to the repository, or being its author.",
10+
"inputSchema": {
11+
"properties": {
12+
"classifier": {
13+
"description": "The reason for hiding the comment",
14+
"enum": [
15+
"SPAM",
16+
"ABUSE",
17+
"OFF_TOPIC",
18+
"OUTDATED",
19+
"DUPLICATE",
20+
"RESOLVED",
21+
"LOW_QUALITY"
22+
],
23+
"type": "string"
24+
},
25+
"comment_id": {
26+
"description": "The numeric ID of the issue or pull request conversation comment",
27+
"minimum": 1,
28+
"type": "number"
29+
},
30+
"owner": {
31+
"description": "Repository owner (username or organization)",
32+
"type": "string"
33+
},
34+
"repo": {
35+
"description": "Repository name",
36+
"type": "string"
37+
}
38+
},
39+
"required": [
40+
"owner",
41+
"repo",
42+
"comment_id",
43+
"classifier"
44+
],
45+
"type": "object"
46+
},
47+
"name": "hide_issue_comment"
48+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"annotations": {
3+
"destructiveHint": false,
4+
"idempotentHint": false,
5+
"openWorldHint": true,
6+
"readOnlyHint": false,
7+
"title": "Hide Pull Request Review"
8+
},
9+
"description": "Hide (minimize) the body of a submitted pull request review. Requires triage or write access to the repository, or being its author.",
10+
"inputSchema": {
11+
"properties": {
12+
"classifier": {
13+
"description": "The reason for hiding the comment",
14+
"enum": [
15+
"SPAM",
16+
"ABUSE",
17+
"OFF_TOPIC",
18+
"OUTDATED",
19+
"DUPLICATE",
20+
"RESOLVED",
21+
"LOW_QUALITY"
22+
],
23+
"type": "string"
24+
},
25+
"owner": {
26+
"description": "Repository owner (username or organization)",
27+
"type": "string"
28+
},
29+
"pullNumber": {
30+
"description": "The pull request number",
31+
"minimum": 1,
32+
"type": "number"
33+
},
34+
"repo": {
35+
"description": "Repository name",
36+
"type": "string"
37+
},
38+
"review_id": {
39+
"description": "The numeric ID of the pull request review",
40+
"minimum": 1,
41+
"type": "number"
42+
}
43+
},
44+
"required": [
45+
"owner",
46+
"repo",
47+
"pullNumber",
48+
"review_id",
49+
"classifier"
50+
],
51+
"type": "object"
52+
},
53+
"name": "hide_pull_request_review"
54+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"annotations": {
3+
"destructiveHint": false,
4+
"idempotentHint": false,
5+
"openWorldHint": true,
6+
"readOnlyHint": false,
7+
"title": "Hide Pull Request Review Comment"
8+
},
9+
"description": "Hide (minimize) an inline review comment on a pull request diff. Requires triage or write access to the repository, or being its author.",
10+
"inputSchema": {
11+
"properties": {
12+
"classifier": {
13+
"description": "The reason for hiding the comment",
14+
"enum": [
15+
"SPAM",
16+
"ABUSE",
17+
"OFF_TOPIC",
18+
"OUTDATED",
19+
"DUPLICATE",
20+
"RESOLVED",
21+
"LOW_QUALITY"
22+
],
23+
"type": "string"
24+
},
25+
"comment_id": {
26+
"description": "The numeric pull request review comment ID. Use the number from a #discussion_r... anchor, not the GraphQL thread node ID (PRRT_...).",
27+
"minimum": 1,
28+
"type": "number"
29+
},
30+
"owner": {
31+
"description": "Repository owner (username or organization)",
32+
"type": "string"
33+
},
34+
"repo": {
35+
"description": "Repository name",
36+
"type": "string"
37+
}
38+
},
39+
"required": [
40+
"owner",
41+
"repo",
42+
"comment_id",
43+
"classifier"
44+
],
45+
"type": "object"
46+
},
47+
"name": "hide_pull_request_review_comment"
48+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"annotations": {
3+
"destructiveHint": false,
4+
"idempotentHint": false,
5+
"openWorldHint": true,
6+
"readOnlyHint": false,
7+
"title": "Unhide Issue Comment"
8+
},
9+
"description": "Unhide (unminimize) a previously hidden comment on an issue, or conversation comment on a pull request. Requires triage or write access to the repository, or being its author.",
10+
"inputSchema": {
11+
"properties": {
12+
"comment_id": {
13+
"description": "The numeric ID of the issue or pull request conversation comment",
14+
"minimum": 1,
15+
"type": "number"
16+
},
17+
"owner": {
18+
"description": "Repository owner (username or organization)",
19+
"type": "string"
20+
},
21+
"repo": {
22+
"description": "Repository name",
23+
"type": "string"
24+
}
25+
},
26+
"required": [
27+
"owner",
28+
"repo",
29+
"comment_id"
30+
],
31+
"type": "object"
32+
},
33+
"name": "unhide_issue_comment"
34+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"annotations": {
3+
"destructiveHint": false,
4+
"idempotentHint": false,
5+
"openWorldHint": true,
6+
"readOnlyHint": false,
7+
"title": "Unhide Pull Request Review"
8+
},
9+
"description": "Unhide (unminimize) the previously hidden body of a submitted pull request review. Requires triage or write access to the repository, or being its author.",
10+
"inputSchema": {
11+
"properties": {
12+
"owner": {
13+
"description": "Repository owner (username or organization)",
14+
"type": "string"
15+
},
16+
"pullNumber": {
17+
"description": "The pull request number",
18+
"minimum": 1,
19+
"type": "number"
20+
},
21+
"repo": {
22+
"description": "Repository name",
23+
"type": "string"
24+
},
25+
"review_id": {
26+
"description": "The numeric ID of the pull request review",
27+
"minimum": 1,
28+
"type": "number"
29+
}
30+
},
31+
"required": [
32+
"owner",
33+
"repo",
34+
"pullNumber",
35+
"review_id"
36+
],
37+
"type": "object"
38+
},
39+
"name": "unhide_pull_request_review"
40+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"annotations": {
3+
"destructiveHint": false,
4+
"idempotentHint": false,
5+
"openWorldHint": true,
6+
"readOnlyHint": false,
7+
"title": "Unhide Pull Request Review Comment"
8+
},
9+
"description": "Unhide (unminimize) a previously hidden inline review comment on a pull request diff. Requires triage or write access to the repository, or being its author.",
10+
"inputSchema": {
11+
"properties": {
12+
"comment_id": {
13+
"description": "The numeric pull request review comment ID. Use the number from a #discussion_r... anchor, not the GraphQL thread node ID (PRRT_...).",
14+
"minimum": 1,
15+
"type": "number"
16+
},
17+
"owner": {
18+
"description": "Repository owner (username or organization)",
19+
"type": "string"
20+
},
21+
"repo": {
22+
"description": "Repository name",
23+
"type": "string"
24+
}
25+
},
26+
"required": [
27+
"owner",
28+
"repo",
29+
"comment_id"
30+
],
31+
"type": "object"
32+
},
33+
"name": "unhide_pull_request_review_comment"
34+
}

0 commit comments

Comments
 (0)