Skip to content

Commit e5522fc

Browse files
authored
Consolidate pull request review tools (github#1192)
* Consolidate pull request review tools * Prompt tweaks + deleting snap * Server instructions change * Add enums * Remove excessive mentions of event parameter * Doc update
1 parent bcc5275 commit e5522fc

11 files changed

+361
-599
lines changed

README.md

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -822,20 +822,6 @@ The following sets of tools are available (all are on by default):
822822
- `startSide`: For multi-line comments, the starting side of the diff that the comment applies to. LEFT indicates the previous state, RIGHT indicates the new state (string, optional)
823823
- `subjectType`: The level at which the comment is targeted (string, required)
824824

825-
- **create_and_submit_pull_request_review** - Create and submit a pull request review without comments
826-
- `body`: Review comment text (string, required)
827-
- `commitID`: SHA of commit to review (string, optional)
828-
- `event`: Review action to perform (string, required)
829-
- `owner`: Repository owner (string, required)
830-
- `pullNumber`: Pull request number (number, required)
831-
- `repo`: Repository name (string, required)
832-
833-
- **create_pending_pull_request_review** - Create pending pull request review
834-
- `commitID`: SHA of commit to review (string, optional)
835-
- `owner`: Repository owner (string, required)
836-
- `pullNumber`: Pull request number (number, required)
837-
- `repo`: Repository name (string, required)
838-
839825
- **create_pull_request** - Open new pull request
840826
- `base`: Branch to merge into (string, required)
841827
- `body`: PR description (string, optional)
@@ -846,11 +832,6 @@ The following sets of tools are available (all are on by default):
846832
- `repo`: Repository name (string, required)
847833
- `title`: PR title (string, required)
848834

849-
- **delete_pending_pull_request_review** - Delete the requester's latest pending pull request review
850-
- `owner`: Repository owner (string, required)
851-
- `pullNumber`: Pull request number (number, required)
852-
- `repo`: Repository name (string, required)
853-
854835
- **list_pull_requests** - List pull requests
855836
- `base`: Filter by base branch (string, optional)
856837
- `direction`: Sort direction (string, optional)
@@ -886,6 +867,15 @@ Possible options:
886867
- `pullNumber`: Pull request number (number, required)
887868
- `repo`: Repository name (string, required)
888869

870+
- **pull_request_review_write** - Write operations (create, submit, delete) on pull request reviews.
871+
- `body`: Review comment text (string, optional)
872+
- `commitID`: SHA of commit to review (string, optional)
873+
- `event`: Review action to perform. (string, optional)
874+
- `method`: The write operation to perform on pull request review. (string, required)
875+
- `owner`: Repository owner (string, required)
876+
- `pullNumber`: Pull request number (number, required)
877+
- `repo`: Repository name (string, required)
878+
889879
- **request_copilot_review** - Request Copilot review
890880
- `owner`: Repository owner (string, required)
891881
- `pullNumber`: Pull request number (number, required)
@@ -900,13 +890,6 @@ Possible options:
900890
- `repo`: Optional repository name. If provided with owner, only pull requests for this repository are listed. (string, optional)
901891
- `sort`: Sort field by number of matches of categories, defaults to best match (string, optional)
902892

903-
- **submit_pending_pull_request_review** - Submit the requester's latest pending pull request review
904-
- `body`: The text of the review comment (string, optional)
905-
- `event`: The event to perform (string, required)
906-
- `owner`: Repository owner (string, required)
907-
- `pullNumber`: Pull request number (number, required)
908-
- `repo`: Repository name (string, required)
909-
910893
- **update_pull_request** - Edit pull request
911894
- `base`: New base branch name (string, optional)
912895
- `body`: New description (string, optional)

pkg/github/__toolsnaps__/create_and_submit_pull_request_review.snap

Lines changed: 0 additions & 49 deletions
This file was deleted.

pkg/github/__toolsnaps__/create_pending_pull_request_review.snap

Lines changed: 0 additions & 34 deletions
This file was deleted.

pkg/github/__toolsnaps__/delete_pending_pull_request_review.snap

Lines changed: 0 additions & 30 deletions
This file was deleted.

pkg/github/__toolsnaps__/pull_request_read.snap

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88
"properties": {
99
"method": {
1010
"description": "Action to specify what pull request data needs to be retrieved from GitHub. \nPossible options: \n 1. get - Get details of a specific pull request.\n 2. get_diff - Get the diff of a pull request.\n 3. get_status - Get status of a head commit in a pull request. This reflects status of builds and checks.\n 4. get_files - Get the list of files changed in a pull request. Use with pagination parameters to control the number of results returned.\n 5. get_review_comments - Get the review comments on a pull request. Use with pagination parameters to control the number of results returned.\n 6. get_reviews - Get the reviews on a pull request. When asked for review comments, use get_review_comments method.\n",
11+
"enum": [
12+
"get",
13+
"get_diff",
14+
"get_status",
15+
"get_files",
16+
"get_review_comments",
17+
"get_reviews"
18+
],
1119
"type": "string"
1220
},
1321
"owner": {
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"annotations": {
3+
"title": "Write operations (create, submit, delete) on pull request reviews.",
4+
"readOnlyHint": false
5+
},
6+
"description": "Create and/or submit, delete review of a pull request.\n\nAvailable methods:\n- create: Create a new review of a pull request. If \"event\" parameter is provided, the review is submitted. If \"event\" is omitted, a pending review is created.\n- submit_pending: Submit an existing pending review of a pull request. This requires that a pending review exists for the current user on the specified pull request. The \"body\" and \"event\" parameters are used when submitting the review.\n- delete_pending: Delete an existing pending review of a pull request. This requires that a pending review exists for the current user on the specified pull request.\n",
7+
"inputSchema": {
8+
"properties": {
9+
"body": {
10+
"description": "Review comment text",
11+
"type": "string"
12+
},
13+
"commitID": {
14+
"description": "SHA of commit to review",
15+
"type": "string"
16+
},
17+
"event": {
18+
"description": "Review action to perform.",
19+
"enum": [
20+
"APPROVE",
21+
"REQUEST_CHANGES",
22+
"COMMENT"
23+
],
24+
"type": "string"
25+
},
26+
"method": {
27+
"description": "The write operation to perform on pull request review.",
28+
"enum": [
29+
"create",
30+
"submit_pending",
31+
"delete_pending"
32+
],
33+
"type": "string"
34+
},
35+
"owner": {
36+
"description": "Repository owner",
37+
"type": "string"
38+
},
39+
"pullNumber": {
40+
"description": "Pull request number",
41+
"type": "number"
42+
},
43+
"repo": {
44+
"description": "Repository name",
45+
"type": "string"
46+
}
47+
},
48+
"required": [
49+
"method",
50+
"owner",
51+
"repo",
52+
"pullNumber"
53+
],
54+
"type": "object"
55+
},
56+
"name": "pull_request_review_write"
57+
}

pkg/github/__toolsnaps__/submit_pending_pull_request_review.snap

Lines changed: 0 additions & 44 deletions
This file was deleted.

pkg/github/instructions.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,17 @@ Tool usage guidance:
5151
func getToolsetInstructions(toolset string) string {
5252
switch toolset {
5353
case "pull_requests":
54-
return "## Pull Requests\n\nPR review workflow: Always use 'create_pending_pull_request_review' → 'add_comment_to_pending_review' → 'submit_pending_pull_request_review' for complex reviews with line-specific comments."
54+
return `## Pull Requests
55+
56+
PR review workflow: Always use 'pull_request_review_write' with method 'create' to create a pending review, then 'add_comment_to_pending_review' to add comments, and finally 'pull_request_review_write' with method 'submit_pending' to submit the review for complex reviews with line-specific comments.`
5557
case "issues":
56-
return "## Issues\n\nCheck 'list_issue_types' first for organizations to use proper issue types. Use 'search_issues' before creating new issues to avoid duplicates. Always set 'state_reason' when closing issues."
58+
return `## Issues
59+
60+
Check 'list_issue_types' first for organizations to use proper issue types. Use 'search_issues' before creating new issues to avoid duplicates. Always set 'state_reason' when closing issues.`
5761
case "discussions":
58-
return "## Discussions\n\nUse 'list_discussion_categories' to understand available categories before creating discussions. Filter by category for better organization."
62+
return `## Discussions
63+
64+
Use 'list_discussion_categories' to understand available categories before creating discussions. Filter by category for better organization.`
5965
default:
6066
return ""
6167
}

0 commit comments

Comments
 (0)