Reject unsupported pagination params in pull_request_read - #3336
Open
muhammadumer-waheed wants to merge 1 commit into
Open
muhammadumer-waheed wants to merge 1 commit into
muhammadumer-waheed wants to merge 1 commit into
Conversation
The pull_request_read tool exposes two pagination mechanisms: page/perPage for the REST-backed methods and the after cursor for get_review_comments. Passing a parameter the selected method does not use was silently dropped, so callers (especially LLM agents) would receive the first page again with no signal that anything was ignored. Validate the pagination parameters against the selected method before dispatch and return a tool error naming the method and the parameter: - after is rejected for all methods except get_review_comments - page is rejected for get_review_comments - perPage remains accepted for every method Fixes github#3316
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
pull_request_readnow returns a validation error when a pagination parameter is passed that the selected method does not use, instead of silently dropping it.Why
A pagination parameter that the selected method cannot honour was silently dropped: an agent following the schema and passing
afterto e.g.get_fileswould get the first page back again with no signal that anything was ignored. Silent parameter drops are worst-case for agentic callers, since the tool reports success with a plausible payload and the model has no reason to retry.Fixes #3316
What changed
validatePaginationParamsForMethodinpkg/github/pullrequests.go, called before the tool dispatches onmethod:afteris rejected for all methods exceptget_review_comments(with a hint to useget_review_commentsfor cursor-based pagination)pageis rejected forget_review_comments, which uses cursor-based paginationperPageremains accepted for every methodpage/perPagestill work forget_filesandperPage/afterstill work forget_review_comments.MCP impact
The
pull_request_readinput schema is unchanged; behavior only: passing a pagination parameter the selected method does not honour now returns an error naming the method and the parameter, instead of silently returning the first page.Prompts tested (tool changes only)
get_fileswithpage/perPage: accepted (covered by unit test)cursor-page-2" →get_review_commentswithafter: accepted (covered by unit test)cursor-page-2" →get_fileswithafter: now errors withmethod "get_files" uses page/perPage pagination; "after" is not supported(covered by unit test)Security / limits
Tool renaming
deprecated_tool_aliases.goLint & tests
./script/lint./script/testDocs