Skip to content

feat: add batch pull request review threads tool#2688

Open
rodboev wants to merge 1 commit into
github:mainfrom
rodboev:pr/batch-pr-review-threads-read
Open

feat: add batch pull request review threads tool#2688
rodboev wants to merge 1 commit into
github:mainfrom
rodboev:pr/batch-pr-review-threads-read

Conversation

@rodboev

@rodboev rodboev commented Jun 15, 2026

Copy link
Copy Markdown

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 invoke pull_request_read with get_review_comments once per PR and manage per-PR errors and cursors themselves.

Why

The current review-thread read path exists only inside pull_request_read, where method=get_review_comments hydrates 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 through afterByPullNumber, 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

  • New tool added
    Adds a new read-only batch tool; the existing single-PR review-thread method remains unchanged.

Prompts tested (tool changes only)

  • "Fetch review threads for PRs 12, 18, and 25 so I can summarize recurring review feedback."
  • "Read review comments for this explicit PR list and keep each PR's thread metadata separate."

Security / limits

  • Data exposure, filtering, or token/size limits considered
    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

  • I am not renaming tools as part of this PR

Lint & tests

  • Linted locally with ./script/lint
    Direct lint command passed locally: golangci-lint run reported 0 issues.

  • Tested locally with ./script/test
    ./script/test was 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 the pkg/github package tests.

  • bash script/generate-docs - passed. Regenerated tool docs; the final diff only updates README.md.

Docs

  • Updated (README / docs / examples)
    Regenerated via script/generate-docs; toolsnaps were updated in the same implementation run.
@rodboev rodboev requested a review from a team as a code owner June 15, 2026 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants