Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Split PR review creation, commenting, submission and deletion#410

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

williammartin
Copy link
Collaborator

@williammartinwilliammartin commentedMay 19, 2025
edited
Loading

Description

Fixes#343

This is a very large PR as a result of needing to:

  • Split an existing tool into multiple finer grained tools
  • Introducing GraphQL support

Previously, PR review submission and commenting was provided by:

  • add_pull_request_review_comment
  • create_pull_request_review

However, Gemini experienced issues with the schema for comments oncreate_pull_request_review. The original desire was to remove comments from that schema and require users to useadd_pull_request_review_comment but as it turns out, this tool isn't that useful because it was backed by the REST API which only allows the addition of a single comment and then submits the review.

As a result, this PR has introduced a number of new tools backed by the GraphQL API:

  • create_pending_pull_request_review
  • add_pull_request_review_comment_to_pending_review
  • submit_pending_pull_request_review

A tool was added to create and submit a review without comments:

  • create_and_submit_pull_request_review

A tool was added to clean up pending reviews which were previously not a valid state:

  • delete_pending_pull_request_review

Finally, in order to help the LLM determine line numbers for pull requests we added:

  • get_pull_request_diff

It's important to note that these tools are focused on working with a review that the caller owns. It does not allow adding arbitrary comments to review threads.

Example:

image

Created:https://github.com/github/github-mcp-server/pull/410/files#r2095483869

This worked with both GPT-4.1 and Gemini.

E2E Tests

github.com

➜  github-mcp-server git:(343-remove-comments-from-create_pull_request_review) ✗ GOMAXPROCS=1 GITHUB_MCP_SERVER_E2E_HOST=https://github.com GITHUB_MCP_SERVER_E2E_TOKEN=$(gh auth token --hostname github.com) go test -v -count=1 --tags e2e ./e2e=== RUN   TestGetMe=== PAUSE TestGetMe=== RUN   TestToolsets=== PAUSE TestToolsets=== RUN   TestTags=== PAUSE TestTags=== RUN   TestFileDeletion=== PAUSE TestFileDeletion=== RUN   TestDirectoryDeletion=== PAUSE TestDirectoryDeletion=== RUN   TestRequestCopilotReview=== PAUSE TestRequestCopilotReview=== RUN   TestPullRequestAtomicCreateAndSubmit=== PAUSE TestPullRequestAtomicCreateAndSubmit=== RUN   TestPullRequestReviewCommentSubmit=== PAUSE TestPullRequestReviewCommentSubmit=== RUN   TestPullRequestReviewDeletion=== PAUSE TestPullRequestReviewDeletion=== CONT  TestGetMe    e2e_test.go:76: Building Docker image for e2e tests...    e2e_test.go:159: Starting Stdio MCP client...--- PASS: TestGetMe (2.44s)=== CONT  TestPullRequestReviewDeletion    e2e_test.go:159: Starting Stdio MCP client...    e2e_test.go:1360: Getting current user...    e2e_test.go:1389: Creating repository williammartin/github-mcp-server-e2e-TestPullRequestReviewDeletion-1747652889839...    e2e_test.go:1413: Creating branch in williammartin/github-mcp-server-e2e-TestPullRequestReviewDeletion-1747652889839...    e2e_test.go:1430: Creating commit with new file in williammartin/github-mcp-server-e2e-TestPullRequestReviewDeletion-1747652889839...    e2e_test.go:1447: Creating pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewDeletion-1747652889839...    e2e_test.go:1462: Creating pending review for pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewDeletion-1747652889839...    e2e_test.go:1480: Getting reviews for pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewDeletion-1747652889839...    e2e_test.go:1507: Deleting review for pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewDeletion-1747652889839...    e2e_test.go:1513: Getting reviews for pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewDeletion-1747652889839...    e2e_test.go:1398: Deleting repository williammartin/github-mcp-server-e2e-TestPullRequestReviewDeletion-1747652889839...--- PASS: TestPullRequestReviewDeletion (6.96s)=== CONT  TestPullRequestReviewCommentSubmit    e2e_test.go:159: Starting Stdio MCP client...    e2e_test.go:1115: Getting current user...    e2e_test.go:1144: Creating repository williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652896783...    e2e_test.go:1168: Creating branch in williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652896783...    e2e_test.go:1185: Creating commit with new file in williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652896783...    e2e_test.go:1214: Creating pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652896783...    e2e_test.go:1229: Creating pending review for pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652896783...    e2e_test.go:1250: Adding file review comment to pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652896783...    e2e_test.go:1270: Adding single line review comment to pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652896783...    e2e_test.go:1292: Adding multi line review comment to pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652896783...    e2e_test.go:1308: Submitting review for pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652896783...    e2e_test.go:1322: Getting reviews for pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652896783...    e2e_test.go:1153: Deleting repository williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652896783...--- PASS: TestPullRequestReviewCommentSubmit (11.26s)=== CONT  TestPullRequestAtomicCreateAndSubmit    e2e_test.go:159: Starting Stdio MCP client...    e2e_test.go:955: Getting current user...    e2e_test.go:984: Creating repository williammartin/github-mcp-server-e2e-TestPullRequestAtomicCreateAndSubmit-1747652908027...    e2e_test.go:1008: Creating branch in williammartin/github-mcp-server-e2e-TestPullRequestAtomicCreateAndSubmit-1747652908027...    e2e_test.go:1025: Creating commit with new file in williammartin/github-mcp-server-e2e-TestPullRequestAtomicCreateAndSubmit-1747652908027...    e2e_test.go:1054: Creating pull request in williammartin/github-mcp-server-e2e-TestPullRequestAtomicCreateAndSubmit-1747652908027...    e2e_test.go:1071: Creating and submitting review for pull request in williammartin/github-mcp-server-e2e-TestPullRequestAtomicCreateAndSubmit-1747652908027...    e2e_test.go:1085: Getting reviews for pull request in williammartin/github-mcp-server-e2e-TestPullRequestAtomicCreateAndSubmit-1747652908027...    e2e_test.go:993: Deleting repository williammartin/github-mcp-server-e2e-TestPullRequestAtomicCreateAndSubmit-1747652908027...--- PASS: TestPullRequestAtomicCreateAndSubmit (5.49s)=== CONT  TestRequestCopilotReview    e2e_test.go:159: Starting Stdio MCP client...    e2e_test.go:810: Getting current user...    e2e_test.go:839: Creating repository williammartin/github-mcp-server-e2e-TestRequestCopilotReview-1747652913523...    e2e_test.go:863: Creating branch in williammartin/github-mcp-server-e2e-TestRequestCopilotReview-1747652913523...    e2e_test.go:880: Creating commit with new file in williammartin/github-mcp-server-e2e-TestRequestCopilotReview-1747652913523...    e2e_test.go:908: Creating pull request in williammartin/github-mcp-server-e2e-TestRequestCopilotReview-1747652913523...    e2e_test.go:922: Requesting Copilot review for pull request in williammartin/github-mcp-server-e2e-TestRequestCopilotReview-1747652913523...    e2e_test.go:934: Getting reviews for pull request in williammartin/github-mcp-server-e2e-TestRequestCopilotReview-1747652913523...    e2e_test.go:848: Deleting repository williammartin/github-mcp-server-e2e-TestRequestCopilotReview-1747652913523...--- PASS: TestRequestCopilotReview (4.53s)=== CONT  TestDirectoryDeletion    e2e_test.go:159: Starting Stdio MCP client...    e2e_test.go:611: Getting current user...    e2e_test.go:639: Creating repository williammartin/github-mcp-server-e2e-TestDirectoryDeletion-1747652918067...    e2e_test.go:663: Creating branch in williammartin/github-mcp-server-e2e-TestDirectoryDeletion-1747652918067...    e2e_test.go:680: Creating commit with new file in williammartin/github-mcp-server-e2e-TestDirectoryDeletion-1747652918067...    e2e_test.go:698: Getting file contents in williammartin/github-mcp-server-e2e-TestDirectoryDeletion-1747652918067...    e2e_test.go:726: Deleting directory in williammartin/github-mcp-server-e2e-TestDirectoryDeletion-1747652918067...    e2e_test.go:740: Listing commits in williammartin/github-mcp-server-e2e-TestDirectoryDeletion-1747652918067...    e2e_test.go:774: Getting commit williammartin/github-mcp-server-e2e-TestDirectoryDeletion-1747652918067:19469e4668a4c95924f09208dcd5dcd2531cbff1...    e2e_test.go:648: Deleting repository williammartin/github-mcp-server-e2e-TestDirectoryDeletion-1747652918067...--- PASS: TestDirectoryDeletion (5.28s)=== CONT  TestFileDeletion    e2e_test.go:159: Starting Stdio MCP client...    e2e_test.go:419: Getting current user...    e2e_test.go:447: Creating repository williammartin/github-mcp-server-e2e-TestFileDeletion-1747652923359...    e2e_test.go:471: Creating branch in williammartin/github-mcp-server-e2e-TestFileDeletion-1747652923359...    e2e_test.go:488: Creating commit with new file in williammartin/github-mcp-server-e2e-TestFileDeletion-1747652923359...    e2e_test.go:503: Getting file contents in williammartin/github-mcp-server-e2e-TestFileDeletion-1747652923359...    e2e_test.go:531: Deleting file in williammartin/github-mcp-server-e2e-TestFileDeletion-1747652923359...    e2e_test.go:545: Listing commits in williammartin/github-mcp-server-e2e-TestFileDeletion-1747652923359...    e2e_test.go:579: Getting commit williammartin/github-mcp-server-e2e-TestFileDeletion-1747652923359:c19b22660f4bd4206bc295b772b113df8f353df6...    e2e_test.go:456: Deleting repository williammartin/github-mcp-server-e2e-TestFileDeletion-1747652923359...--- PASS: TestFileDeletion (5.22s)=== CONT  TestTags    e2e_test.go:159: Starting Stdio MCP client...    e2e_test.go:281: Getting current user...    e2e_test.go:310: Creating repository williammartin/github-mcp-server-e2e-TestTags-1747652928525...    e2e_test.go:327: Creating tag williammartin/github-mcp-server-e2e-TestTags-1747652928525:v0.0.1...    e2e_test.go:357: Listing tags for williammartin/github-mcp-server-e2e-TestTags-1747652928525...    e2e_test.go:390: Getting tag williammartin/github-mcp-server-e2e-TestTags-1747652928525:v0.0.1...    e2e_test.go:319: Deleting repository williammartin/github-mcp-server-e2e-TestTags-1747652928525...--- PASS: TestTags (4.03s)=== CONT  TestToolsets    e2e_test.go:159: Starting Stdio MCP client...--- PASS: TestToolsets (0.18s)PASSok      github.com/github/github-mcp-server/e2e 45.657s

GHES

➜  github-mcp-server git:(343-remove-comments-from-create_pull_request_review) GOMAXPROCS=1 GITHUB_MCP_SERVER_E2E_HOST=https://ghe.io GITHUB_MCP_SERVER_E2E_TOKEN=$(gh auth token --hostname ghe.io) go test -v -count=1 --tags e2e ./e2e=== RUN   TestGetMe=== PAUSE TestGetMe=== RUN   TestToolsets=== PAUSE TestToolsets=== RUN   TestTags=== PAUSE TestTags=== RUN   TestFileDeletion=== PAUSE TestFileDeletion=== RUN   TestDirectoryDeletion=== PAUSE TestDirectoryDeletion=== RUN   TestRequestCopilotReview    e2e_test.go:797: Skipping test because the host does not support copilot reviews--- SKIP: TestRequestCopilotReview (0.00s)=== RUN   TestPullRequestAtomicCreateAndSubmit=== PAUSE TestPullRequestAtomicCreateAndSubmit=== RUN   TestPullRequestReviewCommentSubmit=== PAUSE TestPullRequestReviewCommentSubmit=== RUN   TestPullRequestReviewDeletion=== PAUSE TestPullRequestReviewDeletion=== CONT  TestGetMe    e2e_test.go:76: Building Docker image for e2e tests...    e2e_test.go:159: Starting Stdio MCP client...--- PASS: TestGetMe (1.43s)=== CONT  TestPullRequestReviewDeletion    e2e_test.go:159: Starting Stdio MCP client...    e2e_test.go:1360: Getting current user...    e2e_test.go:1389: Creating repository williammartin/github-mcp-server-e2e-TestPullRequestReviewDeletion-1747652364427...    e2e_test.go:1413: Creating branch in williammartin/github-mcp-server-e2e-TestPullRequestReviewDeletion-1747652364427...    e2e_test.go:1430: Creating commit with new file in williammartin/github-mcp-server-e2e-TestPullRequestReviewDeletion-1747652364427...    e2e_test.go:1447: Creating pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewDeletion-1747652364427...    e2e_test.go:1462: Creating pending review for pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewDeletion-1747652364427...    e2e_test.go:1480: Getting reviews for pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewDeletion-1747652364427...    e2e_test.go:1507: Deleting review for pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewDeletion-1747652364427...    e2e_test.go:1513: Getting reviews for pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewDeletion-1747652364427...    e2e_test.go:1398: Deleting repository williammartin/github-mcp-server-e2e-TestPullRequestReviewDeletion-1747652364427...--- PASS: TestPullRequestReviewDeletion (15.82s)=== CONT  TestPullRequestReviewCommentSubmit    e2e_test.go:159: Starting Stdio MCP client...    e2e_test.go:1115: Getting current user...    e2e_test.go:1144: Creating repository williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652380360...    e2e_test.go:1168: Creating branch in williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652380360...    e2e_test.go:1185: Creating commit with new file in williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652380360...    e2e_test.go:1214: Creating pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652380360...    e2e_test.go:1229: Creating pending review for pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652380360...    e2e_test.go:1250: Adding file review comment to pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652380360...    e2e_test.go:1270: Adding single line review comment to pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652380360...    e2e_test.go:1292: Adding multi line review comment to pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652380360...    e2e_test.go:1308: Submitting review for pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652380360...    e2e_test.go:1322: Getting reviews for pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652380360...    e2e_test.go:1153: Deleting repository williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652380360...--- PASS: TestPullRequestReviewCommentSubmit (20.76s)=== CONT  TestPullRequestAtomicCreateAndSubmit    e2e_test.go:159: Starting Stdio MCP client...    e2e_test.go:955: Getting current user...    e2e_test.go:984: Creating repository williammartin/github-mcp-server-e2e-TestPullRequestAtomicCreateAndSubmit-1747652401180...    e2e_test.go:1008: Creating branch in williammartin/github-mcp-server-e2e-TestPullRequestAtomicCreateAndSubmit-1747652401180...    e2e_test.go:1025: Creating commit with new file in williammartin/github-mcp-server-e2e-TestPullRequestAtomicCreateAndSubmit-1747652401180...    e2e_test.go:1054: Creating pull request in williammartin/github-mcp-server-e2e-TestPullRequestAtomicCreateAndSubmit-1747652401180...    e2e_test.go:1071: Creating and submitting review for pull request in williammartin/github-mcp-server-e2e-TestPullRequestAtomicCreateAndSubmit-1747652401180...    e2e_test.go:1085: Getting reviews for pull request in williammartin/github-mcp-server-e2e-TestPullRequestAtomicCreateAndSubmit-1747652401180...    e2e_test.go:993: Deleting repository williammartin/github-mcp-server-e2e-TestPullRequestAtomicCreateAndSubmit-1747652401180...--- PASS: TestPullRequestAtomicCreateAndSubmit (15.77s)=== CONT  TestDirectoryDeletion    e2e_test.go:159: Starting Stdio MCP client...    e2e_test.go:611: Getting current user...    e2e_test.go:639: Creating repository williammartin/github-mcp-server-e2e-TestDirectoryDeletion-1747652416798...    e2e_test.go:663: Creating branch in williammartin/github-mcp-server-e2e-TestDirectoryDeletion-1747652416798...    e2e_test.go:680: Creating commit with new file in williammartin/github-mcp-server-e2e-TestDirectoryDeletion-1747652416798...    e2e_test.go:698: Getting file contents in williammartin/github-mcp-server-e2e-TestDirectoryDeletion-1747652416798...    e2e_test.go:726: Deleting directory in williammartin/github-mcp-server-e2e-TestDirectoryDeletion-1747652416798...    e2e_test.go:740: Listing commits in williammartin/github-mcp-server-e2e-TestDirectoryDeletion-1747652416798...    e2e_test.go:774: Getting commit williammartin/github-mcp-server-e2e-TestDirectoryDeletion-1747652416798:acc838ff4168023b112c524208c18b025e4d5bf6...    e2e_test.go:648: Deleting repository williammartin/github-mcp-server-e2e-TestDirectoryDeletion-1747652416798...--- PASS: TestDirectoryDeletion (16.60s)=== CONT  TestFileDeletion    e2e_test.go:159: Starting Stdio MCP client...    e2e_test.go:419: Getting current user...    e2e_test.go:447: Creating repository williammartin/github-mcp-server-e2e-TestFileDeletion-1747652433355...    e2e_test.go:471: Creating branch in williammartin/github-mcp-server-e2e-TestFileDeletion-1747652433355...    e2e_test.go:488: Creating commit with new file in williammartin/github-mcp-server-e2e-TestFileDeletion-1747652433355...    e2e_test.go:503: Getting file contents in williammartin/github-mcp-server-e2e-TestFileDeletion-1747652433355...    e2e_test.go:531: Deleting file in williammartin/github-mcp-server-e2e-TestFileDeletion-1747652433355...    e2e_test.go:545: Listing commits in williammartin/github-mcp-server-e2e-TestFileDeletion-1747652433355...    e2e_test.go:579: Getting commit williammartin/github-mcp-server-e2e-TestFileDeletion-1747652433355:0f170b760e7e4e73de707f300cd68f6e260af44b...    e2e_test.go:456: Deleting repository williammartin/github-mcp-server-e2e-TestFileDeletion-1747652433355...--- PASS: TestFileDeletion (17.15s)=== CONT  TestTags    e2e_test.go:159: Starting Stdio MCP client...    e2e_test.go:281: Getting current user...    e2e_test.go:310: Creating repository williammartin/github-mcp-server-e2e-TestTags-1747652450592...    e2e_test.go:327: Creating tag williammartin/github-mcp-server-e2e-TestTags-1747652450592:v0.0.1...    e2e_test.go:357: Listing tags for williammartin/github-mcp-server-e2e-TestTags-1747652450592...    e2e_test.go:390: Getting tag williammartin/github-mcp-server-e2e-TestTags-1747652450592:v0.0.1...    e2e_test.go:319: Deleting repository williammartin/github-mcp-server-e2e-TestTags-1747652450592...--- PASS: TestTags (10.59s)=== CONT  TestToolsets    e2e_test.go:159: Starting Stdio MCP client...--- PASS: TestToolsets (0.18s)PASSok      github.com/github/github-mcp-server/e2e 98.542s

GHEC

➜  github-mcp-server git:(343-remove-comments-from-create_pull_request_review) GOMAXPROCS=1 GITHUB_MCP_SERVER_E2E_HOST=https://staffship-01.ghe.com GITHUB_MCP_SERVER_E2E_TOKEN=$(gh auth token --hostname staffship-01.ghe.com) go test -v -count=1 --tags e2e ./e2e=== RUN   TestGetMe=== PAUSE TestGetMe=== RUN   TestToolsets=== PAUSE TestToolsets=== RUN   TestTags=== PAUSE TestTags=== RUN   TestFileDeletion=== PAUSE TestFileDeletion=== RUN   TestDirectoryDeletion=== PAUSE TestDirectoryDeletion=== RUN   TestRequestCopilotReview    e2e_test.go:797: Skipping test because the host does not support copilot reviews--- SKIP: TestRequestCopilotReview (0.00s)=== RUN   TestPullRequestAtomicCreateAndSubmit=== PAUSE TestPullRequestAtomicCreateAndSubmit=== RUN   TestPullRequestReviewCommentSubmit=== PAUSE TestPullRequestReviewCommentSubmit=== RUN   TestPullRequestReviewDeletion=== PAUSE TestPullRequestReviewDeletion=== CONT  TestGetMe    e2e_test.go:76: Building Docker image for e2e tests...    e2e_test.go:159: Starting Stdio MCP client...--- PASS: TestGetMe (3.66s)=== CONT  TestPullRequestReviewDeletion    e2e_test.go:159: Starting Stdio MCP client...    e2e_test.go:1360: Getting current user...    e2e_test.go:1389: Creating repository williammartin/github-mcp-server-e2e-TestPullRequestReviewDeletion-1747652508440...    e2e_test.go:1413: Creating branch in williammartin/github-mcp-server-e2e-TestPullRequestReviewDeletion-1747652508440...    e2e_test.go:1430: Creating commit with new file in williammartin/github-mcp-server-e2e-TestPullRequestReviewDeletion-1747652508440...    e2e_test.go:1447: Creating pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewDeletion-1747652508440...    e2e_test.go:1462: Creating pending review for pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewDeletion-1747652508440...    e2e_test.go:1480: Getting reviews for pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewDeletion-1747652508440...    e2e_test.go:1507: Deleting review for pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewDeletion-1747652508440...    e2e_test.go:1513: Getting reviews for pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewDeletion-1747652508440...    e2e_test.go:1398: Deleting repository williammartin/github-mcp-server-e2e-TestPullRequestReviewDeletion-1747652508440...--- PASS: TestPullRequestReviewDeletion (10.60s)=== CONT  TestPullRequestReviewCommentSubmit    e2e_test.go:159: Starting Stdio MCP client...    e2e_test.go:1115: Getting current user...    e2e_test.go:1144: Creating repository williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652519303...    e2e_test.go:1168: Creating branch in williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652519303...    e2e_test.go:1185: Creating commit with new file in williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652519303...    e2e_test.go:1214: Creating pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652519303...    e2e_test.go:1229: Creating pending review for pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652519303...    e2e_test.go:1250: Adding file review comment to pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652519303...    e2e_test.go:1270: Adding single line review comment to pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652519303...    e2e_test.go:1292: Adding multi line review comment to pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652519303...    e2e_test.go:1308: Submitting review for pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652519303...    e2e_test.go:1322: Getting reviews for pull request in williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652519303...    e2e_test.go:1153: Deleting repository williammartin/github-mcp-server-e2e-TestPullRequestReviewCommentSubmit-1747652519303...--- PASS: TestPullRequestReviewCommentSubmit (18.60s)=== CONT  TestPullRequestAtomicCreateAndSubmit    e2e_test.go:159: Starting Stdio MCP client...    e2e_test.go:955: Getting current user...    e2e_test.go:984: Creating repository williammartin/github-mcp-server-e2e-TestPullRequestAtomicCreateAndSubmit-1747652537651...    e2e_test.go:1008: Creating branch in williammartin/github-mcp-server-e2e-TestPullRequestAtomicCreateAndSubmit-1747652537651...    e2e_test.go:1025: Creating commit with new file in williammartin/github-mcp-server-e2e-TestPullRequestAtomicCreateAndSubmit-1747652537651...    e2e_test.go:1054: Creating pull request in williammartin/github-mcp-server-e2e-TestPullRequestAtomicCreateAndSubmit-1747652537651...    e2e_test.go:1071: Creating and submitting review for pull request in williammartin/github-mcp-server-e2e-TestPullRequestAtomicCreateAndSubmit-1747652537651...    e2e_test.go:1085: Getting reviews for pull request in williammartin/github-mcp-server-e2e-TestPullRequestAtomicCreateAndSubmit-1747652537651...    e2e_test.go:993: Deleting repository williammartin/github-mcp-server-e2e-TestPullRequestAtomicCreateAndSubmit-1747652537651...--- PASS: TestPullRequestAtomicCreateAndSubmit (9.81s)=== CONT  TestDirectoryDeletion    e2e_test.go:159: Starting Stdio MCP client...    e2e_test.go:611: Getting current user...    e2e_test.go:639: Creating repository williammartin/github-mcp-server-e2e-TestDirectoryDeletion-1747652547435...    e2e_test.go:663: Creating branch in williammartin/github-mcp-server-e2e-TestDirectoryDeletion-1747652547435...    e2e_test.go:680: Creating commit with new file in williammartin/github-mcp-server-e2e-TestDirectoryDeletion-1747652547435...    e2e_test.go:698: Getting file contents in williammartin/github-mcp-server-e2e-TestDirectoryDeletion-1747652547435...    e2e_test.go:726: Deleting directory in williammartin/github-mcp-server-e2e-TestDirectoryDeletion-1747652547435...    e2e_test.go:740: Listing commits in williammartin/github-mcp-server-e2e-TestDirectoryDeletion-1747652547435...    e2e_test.go:774: Getting commit williammartin/github-mcp-server-e2e-TestDirectoryDeletion-1747652547435:2e082560a63f76f6604af4ccbd413e665b33fff7...    e2e_test.go:648: Deleting repository williammartin/github-mcp-server-e2e-TestDirectoryDeletion-1747652547435...--- PASS: TestDirectoryDeletion (8.51s)=== CONT  TestFileDeletion    e2e_test.go:159: Starting Stdio MCP client...    e2e_test.go:419: Getting current user...    e2e_test.go:447: Creating repository williammartin/github-mcp-server-e2e-TestFileDeletion-1747652555997...    e2e_test.go:471: Creating branch in williammartin/github-mcp-server-e2e-TestFileDeletion-1747652555997...    e2e_test.go:488: Creating commit with new file in williammartin/github-mcp-server-e2e-TestFileDeletion-1747652555997...    e2e_test.go:503: Getting file contents in williammartin/github-mcp-server-e2e-TestFileDeletion-1747652555997...    e2e_test.go:531: Deleting file in williammartin/github-mcp-server-e2e-TestFileDeletion-1747652555997...    e2e_test.go:545: Listing commits in williammartin/github-mcp-server-e2e-TestFileDeletion-1747652555997...    e2e_test.go:579: Getting commit williammartin/github-mcp-server-e2e-TestFileDeletion-1747652555997:8ce03e432fcd67b4ead2d763199365becf0c33d6...    e2e_test.go:456: Deleting repository williammartin/github-mcp-server-e2e-TestFileDeletion-1747652555997...--- PASS: TestFileDeletion (8.05s)=== CONT  TestTags    e2e_test.go:159: Starting Stdio MCP client...    e2e_test.go:281: Getting current user...    e2e_test.go:310: Creating repository williammartin/github-mcp-server-e2e-TestTags-1747652563993...    e2e_test.go:327: Creating tag williammartin/github-mcp-server-e2e-TestTags-1747652563993:v0.0.1...    e2e_test.go:357: Listing tags for williammartin/github-mcp-server-e2e-TestTags-1747652563993...    e2e_test.go:390: Getting tag williammartin/github-mcp-server-e2e-TestTags-1747652563993:v0.0.1...    e2e_test.go:319: Deleting repository williammartin/github-mcp-server-e2e-TestTags-1747652563993...--- PASS: TestTags (6.14s)=== CONT  TestToolsets    e2e_test.go:159: Starting Stdio MCP client...--- PASS: TestToolsets (0.20s)PASSok      github.com/github/github-mcp-server/e2e 65.794s

@williammartinwilliammartinforce-pushed the343-remove-comments-from-create_pull_request_review branch fromf15b891 to3d58333CompareMay 19, 2025 10:38
@@ -0,0 +1,235 @@
// githubv4mock package provides a mock GraphQL server used for testing queries produced via
Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This whole package should have its own tests but I want to get feedback on it before the extra effort.

w.Header().Set("Content-Type", "application/json")
_, _ = w.Write([]byte(`{"message": "Validation Failed"}`))
}),
name: "failure to get pull request",
Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I didn't do these GQL error cases in all the other tests intentionally yet, I just wanted to get a feel for whether it made sense. Every handler follows the same pattern onif err := ... ; err != nil

@@ -157,7 +164,7 @@ func Test_OptionalStringParam(t *testing.T) {
}
}

funcTest_RequiredNumberParam(t *testing.T) {
funcTest_RequiredInt(t *testing.T) {
Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

These names just didn't match the actual functions.

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'm starting to feel the tension in the repetition in this file now, which is a good thing because it means we probably have sufficient examples to start teasing out shared abstractions, asserting the MCP result isn't an error and has text content etc etc.

Would prefer not to address in this PR since it's about behaviour rather than maintenance.

SamMorrowDrums reacted with heart emoji
// Construct our REST client
restClient := gogithub.NewClient(nil).WithAuthToken(cfg.Token)
restClient.UserAgent = fmt.Sprintf("github-mcp-server/%s", cfg.Version)
restClient.BaseURL = apiHost.baseRESTURL
Copy link
CollaboratorAuthor

@williammartinwilliammartinMay 19, 2025
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I chose to go away fromWithEnterpriseURLS because there are hosts that are not enterprise but require different URLs e.g. review labs or development environments.

Sadly,githubv4 doesn't offer quite the same options, so I commented below why that is. It also doesn't export the internalgraphql.Client so we can't just set it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

That's a shame! Might need to propose exporting it.

return apiHost{}, fmt.Errorf("could not parse host as URL: %s", s)
}

if url.Scheme == "" {
Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'd be happy to loosen this later, but it is currently the expectation of the REST client.

@williammartinwilliammartinforce-pushed the343-remove-comments-from-create_pull_request_review branch from3d58333 to249064bCompareMay 19, 2025 10:53
@williammartinwilliammartinforce-pushed the343-remove-comments-from-create_pull_request_review branch from249064b to1c1082eCompareMay 19, 2025 11:09
@@ -75,8 +77,123 @@ func GetPullRequest(getClient GetClientFn, t translations.TranslationHelperFunc)
}
}

// CreatePullRequest creates a tool to create a new pull request.
func CreatePullRequest(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.Tool, server.ToolHandlerFunc) {
Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This was just moved to a more natural place in the file.

@williammartinwilliammartinforce-pushed the343-remove-comments-from-create_pull_request_review branch from1c1082e to6273564CompareMay 19, 2025 11:15
Comment on lines +1140 to +1151
var getLatestReviewForViewerQuery struct {
Repository struct {
PullRequest struct {
Reviews struct {
Nodes []struct {
ID githubv4.ID
State githubv4.PullRequestReviewState
URL githubv4.URI
}
} `graphql:"reviews(first: 1, author: $author)"`
} `graphql:"pullRequest(number: $prNum)"`
} `graphql:"repository(owner: $owner, name: $name)"`
Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Could we DRY this out?

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

We could because a number of tools share it, but I'm keen to let it sit and soak in for a bit before choosing the wrong abstraction.

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Author note: this came from GPT-4.1

@williammartinwilliammartin marked this pull request as ready for reviewMay 19, 2025 11:22
@williammartinwilliammartin requested a review froma team as acode ownerMay 19, 2025 11:22
Comment on lines +1140 to +1151
var getLatestReviewForViewerQuery struct {
Repository struct {
PullRequest struct {
Reviews struct {
Nodes []struct {
ID githubv4.ID
State githubv4.PullRequestReviewState
URL githubv4.URI
}
} `graphql:"reviews(first: 1, author: $author)"`
} `graphql:"pullRequest(number: $prNum)"`
} `graphql:"repository(owner: $owner, name: $name)"`
Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Could we DRY this out?

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Author note: this came from Gemini 2.5

Copy link
Contributor

@CopilotCopilotAI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Pull Request Overview

This PR refactors the PR review workflow by splitting existing REST-based review/comment tools into finer-grained GraphQL-backed operations, adds diff retrieval support, and introduces host-specific URL parsing for GitHub API endpoints.

  • Extracts separate GraphQL tools: create pending reviews, add comments to pending reviews, submit/delete pending reviews, and atomic create-and-submit.
  • Addsget_pull_request_diff and end-to-end mocks, including a local GraphQL mock server for testing.
  • IntroducesparseAPIHost and custom transports to support dotcom, GHEC, and GHES URL patterns.

Reviewed Changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
third-party/github.com/shurcooL/graphql/LICENSEAdded MIT license file for the shurcooL/graphql dependency
third-party/github.com/shurcooL/githubv4/LICENSEAdded MIT license file for the shurcooL/githubv4 dependency
third-party-licenses.*.mdRegistered new GraphQL libraries in platform-specific license docs
pkg/github/tools.goUpdatedInitToolsets signature to accept a GraphQL client and registered new review tools
pkg/github/server_test.goAddedstubGetGQLClientFn; renamed tests for integer params
pkg/github/helper_test.goEnhancedmockResponse to handle raw string bodies
internal/githubv4mock/*Introduced a local GraphQL mock server, query builder, and equality checks for tests
internal/ghmcp/server.goAddedparseAPIHost, custom HTTP transports, and GraphQL client setup
go.modBumped and addedgithubv4,graphql, andoauth2 dependencies
Comments suppressed due to low confidence (5)

pkg/github/server_test.go:167

  • [nitpick] The test nameTest_RequiredInt is inconsistent withTest_OptionalIntParam. Consider renaming toTest_RequiredIntParam to match the naming convention.
func Test_RequiredInt(t *testing.T) {

internal/githubv4mock/query.go:1

  • Typo in comment:Ths should beThe.
// Ths contents of this file are taken from https://github.com/shurcooL/graphql/blob/ed46e5a4646634fc16cb07c3b8db389542cc8847/query.go

internal/ghmcp/server.go:335

  • There are no tests coveringparseAPIHost. Adding unit tests for dotcom, GHEC, and GHES cases would help ensure correctness.
func parseAPIHost(s string) (apiHost, error) {

third-party-licenses.windows.md:20

  • The indentation of this new list item does not align with existing entries (two spaces before the dash). Please adjust to match the surrounding style.
- [github.com/shurcooL/githubv4](https://pkg.go.dev/github.com/shurcooL/githubv4) ([MIT](https://github.com/shurcooL/githubv4/blob/48295856cce7/LICENSE))

third-party-licenses.linux.md:20

  • This list item’s indentation differs from the rest of the file; align the dash under the others (two spaces) for consistency.
- [github.com/shurcooL/graphql](https://pkg.go.dev/github.com/shurcooL/graphql) ([MIT](https://github.com/shurcooL/graphql/blob/ed46e5a46466/LICENSE))

@williammartinwilliammartinforce-pushed the343-remove-comments-from-create_pull_request_review branch from6273564 to1089f84CompareMay 19, 2025 11:30
Copy link
Collaborator

@SamMorrowDrumsSamMorrowDrums left a comment
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Amazing work, I think without the graphql parts it's not too big, and those parts are going to be shared by other APIs, so I say shipit!

I submitted this using it.

Comment on lines +1 to +3
// Ths contents of this file are taken from https://github.com/shurcooL/graphql/blob/ed46e5a4646634fc16cb07c3b8db389542cc8847/query.go
// because they are not exported by the module, and we would like to use them in building the githubv4mock test utility.
//
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I feel like eventually we might want a mock library to exist in standalone form, so we could pull this out, but it's OK to coexist here for now

Comment on lines +82 to +117
return mcp.NewTool("create_pull_request",
mcp.WithDescription(t("TOOL_CREATE_PULL_REQUEST_DESCRIPTION", "Create a new pull request in a GitHub repository.")),
mcp.WithToolAnnotation(mcp.ToolAnnotation{
Title: t("TOOL_CREATE_PULL_REQUEST_USER_TITLE", "Open new pull request"),
ReadOnlyHint: toBoolPtr(false),
}),
mcp.WithString("owner",
mcp.Required(),
mcp.Description("Repository owner"),
),
mcp.WithString("repo",
mcp.Required(),
mcp.Description("Repository name"),
),
mcp.WithString("title",
mcp.Required(),
mcp.Description("PR title"),
),
mcp.WithString("body",
mcp.Description("PR description"),
),
mcp.WithString("head",
mcp.Required(),
mcp.Description("Branch containing changes"),
),
mcp.WithString("base",
mcp.Required(),
mcp.Description("Branch to merge into"),
),
mcp.WithBoolean("draft",
mcp.Description("Create as draft PR"),
),
mcp.WithBoolean("maintainer_can_modify",
mcp.Description("Allow maintainer edits"),
),
),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I hope the GO SDK makes these definitions and parsing much closer to standard JSON parsing into structs as discussed!

@SamMorrowDrumsSamMorrowDrumsforce-pushed the343-remove-comments-from-create_pull_request_review branch from1089f84 to1de146bCompareMay 19, 2025 15:37
@SamMorrowDrumsSamMorrowDrums merged commiteca853b intomainMay 19, 2025
16 checks passed
@SamMorrowDrumsSamMorrowDrums deleted the 343-remove-comments-from-create_pull_request_review branchMay 19, 2025 15:50
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

Copilot code reviewCopilotCopilot left review comments

@SamMorrowDrumsSamMorrowDrumsSamMorrowDrums approved these changes

@tobytobyAwaiting requested review from toby

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Remove comments fromcreate_pull_request_review
2 participants
@williammartin@SamMorrowDrums

[8]ページ先頭

©2009-2025 Movatter.jp