Skip to content

feat: add batch pull request metadata read tool#2687

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

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

Conversation

@rodboev

@rodboev rodboev commented Jun 15, 2026

Copy link
Copy Markdown

Summary

Adds get_pull_request_metadata_batch, a read-only MCP tool for hydrating explicit pull request number lists in one call. This fixes the current N-call release-note workflow where callers already know the PR numbers they want but must fetch each PR one at a time.

Why

The current pull-request surface only supports single-PR hydration through pull_request_read and discovery through list_pull_requests / search_pull_requests. GetPullRequest() already returns the metadata this workflow needs, but there is no batch entry point for explicit PR number lists, so release-note and changelog generation must issue one REST read per PR and stitch the results client-side.

Fixes #2302

What changed

  • pkg/github/pullrequests_batch_metadata.go: adds the new get_pull_request_metadata_batch tool, bounded explicit-PR-number validation, deduplicated input handling, partial-success response handling, and repo-visibility IFC labeling.
  • pkg/github/pullrequests.go: extracts the shared single-PR hydration path so the new batch tool and the existing pull_request_read path reuse the same GitHub fetch, sanitization, and lockdown behavior.
  • pkg/github/tools.go: registers the new batch metadata tool in the pull-request toolset.
  • pkg/github/pullrequests_batch_metadata_test.go: covers schema, success ordering, partial failures, duplicate-input deduplication, lockdown allow/deny behavior, and cap validation.
  • pkg/github/__toolsnaps__/get_pull_request_metadata_batch.snap: added for the new tool schema.
  • README.md: regenerated tool documentation.

MCP impact

  • New tool added
    Adds a new read-only tool for batch PR metadata hydration; existing tool schemas and behavior are unchanged.

Prompts tested (tool changes only)

  • "Fetch merged metadata for PRs 12, 18, and 25 so I can draft release notes."
  • "Hydrate this explicit PR list with titles, authors, labels, and merge SHAs."

Security / limits

  • Data exposure, filtering, or token/size limits considered
    The tool is still repo-scoped and read-only; the input cap bounds payload size and REST fan-out.

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_GetPullRequestMetadataBatch - passed. Covers schema/toolsnap, success ordering, partial failure reporting, duplicate input deduplication, and lockdown allow/deny behavior.

  • $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:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants