Repository navigation
fix: discover all pages of MCP tool resource and prompt catalogs - #302
Conversation
Eigenwise
left a comment
There was a problem hiding this comment.
Source review of 6e52126a1bfdbd350a59312ed66f8109e1696500: the pagination fix is useful, but mcp_definition_service.py:267-272 applies the unsupported-template fallback to every page. If the first call returns a template and nextCursor, then the continuation raises METHOD_NOT_FOUND, the error is swallowed and the collected templates are discarded. Keep the fallback for the initial request and propagate continuation errors. Please add that later-page regression alongside the existing first-call fallback test.
The new _fetch_all_pages helper also introduces Callable[..., Awaitable[Any]] and List[Any]. Preserve the known SDK response and item types with a concrete or constrained generic boundary.
These are source findings. I haven't run this head's tests or measured its per-function coverage.
Eigenwise
left a comment
There was a problem hiding this comment.
Checked 99969e2c279be706e3f6d57c7fa783a22833856a. The unsupported-template fallback is limited to the initial request, and continuation errors propagate unchanged. Both new error-identity cases and the six pagination cases passed in normal CI. The helper now preserves the SDK response/item types, ordering and session ownership. Full CI: 408 passed, 3 MiniMax integration skips, with formatting and lint passing. Both earlier findings are resolved.
MCP discovery currently reads only the first page of tools, resources, resource templates and prompts. A paginated server therefore exposes an incomplete catalog to generated agents.
Follow each opaque
nextCursor, keeping the first request free of cursor arguments and preserving discovery order and definition conversion. Unsupported resource-template fallback applies only to the initial request: once a server has returned a page, continuation failures propagate instead of discarding the partial catalog.The pagination helper uses constrained MCP SDK response and item types plus typed item accessors. Its return and callback boundaries retain the concrete SDK types.
Validation on Windows / Python 3.13:
METHOD_NOT_FOUNDregression fails on the previous PR head; the accompanying internal-error case verifies propagation by error identity.99969e2.