Skip to content

fix: add missing pagination on get_reviews#2367

Open
RossTarrant wants to merge 3 commits intomainfrom
rosstarrant/add-pagination-to-pr-reviews-tool
Open

fix: add missing pagination on get_reviews#2367
RossTarrant wants to merge 3 commits intomainfrom
rosstarrant/add-pagination-to-pr-reviews-tool

Conversation

@RossTarrant
Copy link
Copy Markdown
Contributor

Summary

Add pagination support to get_reviews method in pull_request_read tool, bringing it in line with other paginated methods like get_files, get_comments, and get_check_runs.

Why

Fixes #2347 - GetPullRequestReviews passed nil options to ListReviews, silently truncating results to the first page (~30 items) with no pagination support.

What changed

  • Added PaginationParams to GetPullRequestReviews function signature
  • Forward Page/PerPage to ListReviews API call
  • Updated tool description to document pagination support
  • Added pagination test case and updated failure test to verify default query params

MCP impact

  • No tool or API changes
  • Tool schema or behavior changed
  • New tool added

Prompts tested (tool changes only)

  • get_reviews with page and perPage parameters on a PR with 37 reviews - confirmed pagination params are forwarded correctly
  • get_reviews without pagination params - confirmed defaults (page=1, per_page=30) are sent

Example Prompts:

Basic fetch (default pagination): List the reviews on PR ID: 1 in rosstarrant/octopus-mcp
Explicit pagination - first page: Get the first 10 reviews on rosstarrant/octopus-mcp PR ID: 1
Explicit pagination - second page: Get page 2 of reviews on rosstarrant/octopus-mcp PR ID: 1, with 10 per page
Edge case - page beyond results: Get page 100 of reviews on rosstarrant/octopus-mcp PR ID: 1

Security / limits

  • No security or limits impact
  • Auth / permissions considered
  • Data exposure, filtering, or token/size limits considered

Tool renaming

  • I am renaming tools as part of this PR (e.g. a part of a consolidation effort)
  • I have added the new tool aliases in deprecated_tool_aliases.go
  • I am not renaming tools as part of this PR

Note: if you're renaming tools, you must add the tool aliases. For more information on how to do so, please refer to the official docs.

Lint & tests

  • Linted locally with ./script/lint
  • Tested locally with ./script/test

Docs

  • Not needed
  • Updated (README / docs / examples)

@RossTarrant RossTarrant changed the title Rosstarrant/add pagination to pr reviews tool fix: add missing pagination on get_reviews Apr 22, 2026
@RossTarrant RossTarrant marked this pull request as ready for review April 22, 2026 14:39
@RossTarrant RossTarrant requested a review from a team as a code owner April 22, 2026 14:39
Copilot AI review requested due to automatic review settings April 22, 2026 14:39
Copy link
Copy Markdown
Contributor

Copilot AI 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

Adds REST pagination support to the get_reviews method of the pull_request_read MCP tool so callers can fetch review pages beyond GitHub’s default first page.

Changes:

  • Extend GetPullRequestReviews to accept PaginationParams and pass Page/PerPage into PullRequests.ListReviews.
  • Add/adjust unit tests to assert pagination query params are forwarded (including default page=1&per_page=30).
  • Update tool/docs text (toolsnap + README) to document pagination support for get_reviews.
Show a summary per file
File Description
pkg/github/pullrequests.go Wires PaginationParams into ListReviews and updates tool method description text.
pkg/github/pullrequests_test.go Adds a paginated success case and asserts default pagination query params on failure path.
pkg/github/toolsnaps/pull_request_read.snap Updates the tool schema snapshot description to mention pagination for get_reviews.
README.md Mirrors the updated get_reviews pagination note in generated docs.

Copilot's findings

  • Files reviewed: 4/4 changed files
  • Comments generated: 2

Comment thread pkg/github/pullrequests.go
Comment thread pkg/github/pullrequests_test.go Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

list_pull_request_reviews silently truncates results to first page (~30 items) with no pagination support

2 participants