Skip to content

fix(mcp): follow nextCursor in prompts/list, resources/list and resources/templates/list #855

Description

@0xKT

Problem

#825 (fixing #301) made Raven follow nextCursor for tools/list. The other three list operations the MCP spec makes paginated are still fetched as a single page:

Verb Call site Model-facing tool
resources/list raven/mcp/resources.py:130 list_mcp_resources
resources/templates/list raven/mcp/resources.py:189 list_mcp_resource_templates
prompts/list raven/mcp/prompts.py:115 list_mcp_prompts

Each site calls session.list_*() once and renders the items without looking at nextCursor. The Python SDK does not walk pages for the caller: in the pinned mcp 1.30.0, every ClientSession.list_* method sends exactly one request.

When a server paginates any of these lists, the model sees only the first page, and nothing tells it the list is incomplete. This is the same silent truncation as #301, on the remaining three verbs.

Evidence

Impact

Lower than #301:

  • read_mcp_resource (by URI) and get_mcp_prompt (by name) still work for an item the model already knows; only discovery through the three list tools is truncated.
  • No user report yet, and we have not found a public server that paginates these lists today.

The gap is still deterministic: any server that pages one of these lists triggers it, and resource lists (files, documents, table rows) are where large counts are most plausible.

Proposed fix

  • One shared helper in raven/mcp/ that walks a list verb page by page with params=PaginatedRequestParams(cursor=...) and stops on an empty or repeated cursor (the stop rule fix(mcp): page through tools/list nextCursor #825 introduced).
  • Use it at the three call sites above, and move the tools/list loop from fix(mcp): page through tools/list nextCursor #825 onto it, so all four verbs share one implementation.
  • Keep each list tool's existing 30s timeout, now around the whole walk, so a server that never stops paging fails visibly instead of stalling the turn.

Acceptance criteria

  • Single-page servers behave exactly as before.
  • Multi-page prompt, resource and resource-template lists return every item.
  • A repeated cursor ends the walk.
  • New tests in tests/test_mcp_prompts.py and tests/test_mcp_resources.py fail on current main and pass with the fix.
  • make lint-types stays clean (no deprecated cursor= overload).

Related: #301, #825

Activity

  1. yudongyouqing commented on Oct 3, 2026

    @yudongyouqing
    Contributor

    Hi @0xKT — #825 was mine, so this is a natural follow-up and I have the page-walking context fresh. I'd like to take it unless you'd rather split it.

  2. added a commit that references this issue on Oct 10, 2026
    289426c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions