Skip to content

fix(mcp): follow tools/list pagination cursors - #311

Merged
franciscojavierarceo merged 2 commits into
vllm-project:mainfrom
Zheng-Lu:fix/mcp-tools-pagination
Sep 17, 2026
Merged

franciscojavierarceo merged 2 commits into
vllm-project:mainfrom
Zheng-Lu:fix/mcp-tools-pagination

Conversation

@Zheng-Lu

@Zheng-Lu Zheng-Lu commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow MCP tools/list pagination so discovery includes tools beyond the first page.

  • Preserve list_tools(None) for the first request and pass each subsequent cursor through unchanged, including empty strings: cursors are opaque tokens.
  • Finish only when nextCursor is absent. Return typed PaginationLoop for a repeated cursor and PaginationExceeded after 32 pages instead of returning a partial list.
  • Apply the existing 60-second timeout to the complete traversal; propagate failures from any page.

The explicit loop preserves first-page wire compatibility and adds termination guards missing from rmcp 1.8.0's list_all_tools().

Test Plan

  • Deterministic Python stdio MCP server exercises multi-page discovery, exact empty-cursor forwarding, repeated-cursor errors, and runaway pagination.
  • The empty-cursor and repeated-cursor regressions failed before the review fix and pass afterward.
  • All 9 MCP client tests passed after the final patch; core library: 688 passed, 3 PostgreSQL-gated tests ignored.
  • cargo clippy -p agentic-server-core --all-targets -- -D warnings passed.
  • pre-commit run --all-files passed.

Signed-off-by: Zheng Lu <Lz429671594@gmail.com>
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>

@franciscojavierarceo franciscojavierarceo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

patched empty-cursor forwarding and repeated-cursor errors, with regressions verified before and after the fix. all 688 core tests, Clippy, and pre-commit checks pass locally.

@franciscojavierarceo
franciscojavierarceo merged commit 53c33ab into vllm-project:main Sep 17, 2026
19 checks passed
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.

2 participants