Paginate MCP tool results
Listing tools using the size and cursor fields, keep searches stable on pages and stop when next_cursor is absent.
If the input scheme of an instrument includes size and cursor, proceed through its results by passing the returned next_cursor in the next call.
Pagination loop
Section entitled “Pagination loop”- Call the listing tool without
cursor. - Read the items in the instrument-specific result field.
- If the result includes
next_cursor, call the same tool again with the valuecursor. - Stop when
next_cursoris absent.
Treat cursor values as opaque. Do not decode, edit or build them.
Example with listRisks
Section entitled “Example with listRisks”The first call includes the organization and, optional, a page size:
{ "organization_id": "organization-id", "size": 50}listRisks returns its items in risks. When another page is available, the result also includes next_cursor:
{ "risks": [ { "id": "risk-id", "name": "Unauthorized production access" } ], "next_cursor": "cursor-value"}Use this value in the following call:
{ "organization_id": "organization-id", "size": 50, "cursor": "cursor-value"}Continue until the result no longer includes ___ZBT_I18N_RUNTIME_BLOCK_183__.
Keep the query unchanged
“Keep the query unchanged”Keep page arrangement, filters, order and size unchanged when requesting the following page:
{ "organization_id": "organization-id", "size": 50, "filter": { "query": "access" }, "cursor": "cursor-value"}Check the tool input scheme in the clientMCP instead of assuming that each list tool supports the same fields.
Result fields differ by tool
“Result fields differ by tool”For example, listRisks returns risks, while listThirdParties returns thirdParties. Use the server-published output scheme to determine the field for a specific tool.
For long-lasting tasks, process each page before requesting the next, instead of accumulating the full set result in memory.