Skip to main content

Module pagination

Module pagination 

Source
Expand description

Opaque cursor pagination helpers for MCP tool responses.

Implements the cursor conventions described in the MCP specification (cursor / nextCursor, opaque tokens, JSON-RPC -32602 on invalid input). Cursors are base64url-encoded JSON objects of the form {"offset": <offset>}. The encoding is an implementation detail — clients MUST treat cursors as opaque strings.

Tool requests declare their cursor as Option<Cursor>; the custom Serialize/Deserialize impls encode to / decode from the base64url wire string, so handlers never see the raw cursor string. Decode errors surface as serde errors, which rmcp automatically maps to JSON-RPC code -32602 when parsing tool arguments.

Structs§

Cursor
Opaque pagination cursor carried on paginated tool requests / responses.
Pager
A single page request resolved from an optional cursor and a page size.