Skip to content

Reject list_label perPage values outside 1..100 - #3649

Open
vshalpnjabi wants to merge 1 commit into
github:mainfrom
vshalpnjabi:fix-list-label-perpage-zero
Open

vshalpnjabi wants to merge 1 commit into
github:mainfrom
vshalpnjabi:fix-list-label-perpage-zero

Conversation

@vshalpnjabi

Copy link
Copy Markdown

Summary

list_label now rejects perPage values outside 1..100 instead of passing 0 through.

Why

The advertised schema says minimum: 1, but the runtime input schema doesn't enforce it, so perPage: 0 reached the handler and was silently replaced with the default page size.
Fixes #3647

What changed

  • listLabelsLegacy reads perPage only when it's present and returns perPage must be between 1 and 100, got N when it's out of range. The default still applies when it's omitted.
  • Added a table case for perPage: 0 and updated the >100 case to the new message.
  • Added TestListLabelPerPageZeroThroughToolCall, which calls the registered tool through an MCP session and asserts the error and that no GraphQL request is made. It fails on main.

MCP impact

  • Tool schema or behavior changed
    list_label returns a tool error for perPage 0 or below, matching the schema it already advertises. The schema is unchanged.

Prompts tested (tool changes only)

  • Not tested with a live client. Covered by the tool-call test above.

Security / limits

  • No security or limits impact

Tool renaming

  • I am not renaming tools as part of this PR

Lint & tests

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

Also ran go test -v ./..., UPDATE_TOOLSNAPS=true go test ./... (no snapshot changes) and script/generate-docs (no diff).

Docs

  • Not needed

@vshalpnjabi
vshalpnjabi requested a review from a team as a code owner November 1, 2026 16:39
@cursor
cursor Bot force-pushed the fix-list-label-perpage-zero branch from 6f56a99 to c11d716 Compare November 2, 2026 22:37
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_label silently turns perPage=0 into 100 although the schema advertises minimum: 1

1 participant