fix(client): support prompt pagination and implement listAllPrompts - #2461
fix(client): support prompt pagination and implement listAllPrompts#2461rohith500 wants to merge 4 commits into
Conversation
- Extend BaseConnector.listPrompts and MCPSession.listPrompts to accept cursor and request options - Implement listAllPrompts on BaseConnector and MCPSession with auto-pagination and cycle detection - Update useMcp and useMcpOperations to fetch complete prompt inventories via listAllPrompts - Update packages/agent and packages/server mcp-proxy to introspect complete paginated prompt lists - Add unit tests for listPrompts, listAllPrompts, MCPSession delegation, and useMcp inventory loading
@mcp-use/agent
@mcp-use/cli
@mcp-use/client
create-mcp-use-app
@mcp-use/inspector
mcp-use
@mcp-use/tunnel
commit: |
TypeScript Conformance (current head)Runner: Score: 2006/2012 passed (6 expected failures, 0 unexpected failures, 4 expected warnings, 0 unexpected warnings)
|
There was a problem hiding this comment.
All reported issues were addressed across 8 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
1 issue found across 1 file (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="libraries/typescript/packages/server/src/mcp-proxy.ts">
<violation number="1">
P1: When an upstream has paginated prompts, proxy introspection calls only `listPrompts()` and permanently omits every page after the first. Detect and call the concrete connection’s `listAllPrompts()` before falling back to `listPrompts()`, while keeping the public interface unchanged if required.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 5 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
|
All review items from Cubic have been addressed:
All 34 CI checks and the Cubic AI review have passed with 0 issues. |
Fixes #2460
Summary of Changes
BaseConnector(packages/client/src/transport/base.ts):listPrompts(cursor?: string, options?: RequestOptions)to accept pagination cursors and request options (mirroringlistResources).listAllPrompts(options?: RequestOptions)with auto-pagination overnextCursor, transport disconnect protection across page iterations, and defensive repeated-cursor cycle detection.MCPSession(packages/client/src/core/session.ts):listPrompts(cursor?: string, options?: RequestOptions)to forward pagination parameters to the connector.listAllPrompts(options?: RequestOptions)delegating tothis.connector.listAllPrompts(options).useMcp.ts&useMcp-operations.ts):listAllPrompts, ensuring servers with multiple prompt pages have their entire catalog loaded rather than silently truncating prompts on page 2+.@mcp-use/agentloadPromptsForConnectorto uselistAllPromptswhen available, matching resource loading.@mcp-use/servermcp-proxyupstream prompt introspection to checkconnection.listAllPromptswhen available.packages/client/tests/unit/client/list-all-prompts.test.ts(11 new unit tests) covering cursor forwarding, options forwarding, multi-page auto-pagination, cycle detection, disconnect handling, andMCPSessiondelegation.useMcp-connection-metadata.test.tsxverifying React hook inventory loading vialistAllPrompts.Summary by cubic
Fixes #2460 so servers with multi-page prompts load their entire catalog instead of silently truncating prompts past page 2+.
Bug Fixes
listAllPromptswhen available, with a fallback tolistPromptsfor older connectors.New Features
listPromptsonBaseConnectorandMCPSessionnow accept an optional cursor and request options.listAllPromptsauto-paginates with repeated-cursor detection and transport disconnect protection.@mcp-use/agentadapter,@mcp-use/servermcp-proxy, and React hooks preferlistAllPromptswhen present.listPromptsfallback, and delegation.Written for commit 4db6a84. Summary will update on new commits.