Skip to content

Cursors are not sent to the server correctly #735

Open
@nbarbettini

Description

@nbarbettini

Describe the bug
The PaginatedRequest model has the cursor parameter in the wrong place: request.cursor instead of request.params.cursor as defined by the pagination spec.

Since the methods updated in #718 pass the cursor parameter down to the PaginatedRequest model, they are also affected by this bug.

To Reproduce

from mcp import types

list_tools_request = types.ListToolsRequest(
    method="tools/list",
    cursor="123",
)

client_request = types.ClientRequest(list_tools_request)

# Dump to JSON
client_request_json = client_request.model_dump_json()
print(client_request_json)
❯ python test.py
{"method":"tools/list","params":null,"cursor":"123"}

Expected behavior
A request that conforms to the pagination spec:

{"method":"tools/list","params":{"cursor":"123"}}

Metadata

Metadata

Assignees

No one assigned

    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