feat: add batch pull request review threads tool#2688
Open
rodboev wants to merge 1 commit into
Open
Conversation
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
get_pull_request_review_threads_batch, a read-only MCP tool for fetching review threads for an explicit list of pull requests in one batch contract. This replaces the current N-call workflow where callers must invokepull_request_readwithget_review_commentsonce per PR and manage per-PR errors and cursors themselves.Why
The current review-thread read path exists only inside
pull_request_read, wheremethod=get_review_commentshydrates one PR at a time through GraphQL. That single-PR implementation already returns the right structured thread payload, but there is no batch contract for explicit PR lists and no higher-level way to carry per-PR cursors across multiple reads.Fixes #2301
What changed
pkg/github/pullrequests_batch_review_threads.go: adds the new batch review-thread tool, per-PR cursor handling throughafterByPullNumber, duplicate-input deduplication, and partial-success response handling for per-PR GitHub/GraphQL failures.pkg/github/tools.go: registers the new batch review-thread tool.pkg/github/pullrequests_batch_review_threads_test.go: covers schema, multi-PR success, cursor forwarding, partial GraphQL failures, duplicate-input deduplication, and cap validation.pkg/github/__toolsnaps__/get_pull_request_review_threads_batch.snap: added for the new tool schema.README.md: regenerated tool documentation.MCP impact
Adds a new read-only batch tool; the existing single-PR review-thread method remains unchanged.
Prompts tested (tool changes only)
Security / limits
The tool stays repo-scoped and read-only; the input cap and shared per-page limit bound GraphQL fan-out and payload size.
Tool renaming
Lint & tests
Linted locally with
./script/lintDirect lint command passed locally:
golangci-lint runreported0 issues.Tested locally with
./script/test./script/testwas not run locally. Focused package and generation checks passed locally:go test ./pkg/github -run Test_GetPullRequestReviewThreadsBatch- passed. Covers schema/toolsnap, multi-PR success, per-PR cursor forwarding, partial GraphQL failures, duplicate-input deduplication, and validation errors.$env:UPDATE_TOOLSNAPS='true'; go test ./pkg/github; Remove-Item env:UPDATE_TOOLSNAPS- passed. Regenerated the new tool snapshot and re-ran thepkg/githubpackage tests.bash script/generate-docs- passed. Regenerated tool docs; the final diff only updatesREADME.md.Docs
Regenerated via
script/generate-docs; toolsnaps were updated in the same implementation run.