Before diagnosing a missing tool, check whether your client stopped at the first discovery page. MCP supports pagination for tools/list, resources/list, resources/templates/list, and prompts/list. A successful response is not necessarily the whole collection.[1]

Discovery lists the capabilities a server exposes. Search tools can also paginate the records they return; that separate contract is covered in our guide to paginating MCP tool results.

1. Decide whether you need a page or an inventory

Start with the caller’s job. A tool picker can display one page at a time. A regression snapshot needs the complete inventory before it can reliably report that a tool disappeared. Write that expectation next to the discovery call.

Do not infer completeness from a method name. The C# SDK documents convenience methods such as ListToolsAsync() that fetch every page, alongside raw overloads that expose individual paginated responses.[2] The Ruby SDK likewise distinguishes single-page list_tools from whole-collection tools.[3]

Check the documentation for your installed SDK release. Record whether your chosen method returns one page, an iterator, or a materialized collection. Prefer the supported whole-collection helper when you need everything and its limits fit your application. Use a lower-level method when you need explicit control over budgets, streaming, or diagnostics.

2. Follow each continuation cursor

For manual discovery, make the initial list request without a cursor. Process its items, then pass the returned nextCursor unchanged as the next request’s cursor. Keep requesting the same list operation until the continuation is absent. Servers choose page size, so a short page is not an end marker.[1]

Treat the cursor as opaque. Do not decode it, increment it, trim it, or manufacture the next value. In the July 2026 specification, even an empty string is a valid continuation token. A truthiness check can therefore terminate too early in languages where an empty string is false.[1]

Put the pagination loop in your protocol client. The client can track each request and check when discovery finishes; leaving that bookkeeping to the language model makes completeness harder to test.

3. Bound the walk and expose incomplete results

Set a page budget, an overall deadline, and an item budget appropriate to your host. Choose those limits for your application; MCP does not prescribe them. Track previously returned continuation tokens so a repeated cursor cannot trap the collector in a loop.

The Ruby SDK’s whole-collection helpers document repeated-cursor protection and a configurable page limit. Its documented default is 1,000 pages; exceeding that limit raises MCP::Client::PaginationLimitError.[3] Other SDKs may make different choices. Inspect the helper you actually use rather than assuming identical protections.

When a guard fires in a custom collector, mark the result incomplete. Include the stopping reason and the page and item counts. Do not silently hand a partial inventory to a caller expecting a complete one. An upgrade check should fail the snapshot at that point. For an interactive picker, show that discovery stopped and offer a retry.

Log the server identity, list method, elapsed time, and stopping reason. Avoid logging raw cursor values by default. You need enough evidence to investigate a loop without turning diagnostic output into a copy of server-issued tokens.

4. Test the collector with deliberately awkward pages

Use a fake list endpoint or transport fixture before connecting a production agent. These fixtures cover the cases your collector should handle:

FixtureExpected collector behavior
One page, no continuationFinish with that page’s items
Two pages with different sizesFetch both; ignore size as a stopping signal
Empty first page with a continuationRequest the next page
Empty-string continuationPass the empty string back unchanged
Repeated continuationStop with an explicit incomplete outcome
Fresh continuations beyond the budgetStop at the configured page budget
Error on page twoMark discovery as failed or incomplete

Assert the exact requested cursor sequence as well as the final item set. Otherwise, a fixture that accidentally returns every item on page one can make a broken loop look correct.

Then connect a development server through the local MCP debugging workflow. Confirm which SDK method your application invokes. A working Inspector session does not exercise your custom collector.

5. Keep partial discovery out of upgrade decisions

Only save an inventory baseline after the collector completes successfully. Include the server version and test identity in your own snapshot metadata, and repeat the same discovery conditions when testing an upgrade. Those conditions belong in the test harness; pagination alone cannot keep them consistent.

Feed that complete inventory into MCP tool contract regression tests. Handle later capability changes separately with the tool-list change review workflow. After discovery, apply your tool-access policy before exposing the inventory to an agent.

FAQ

Does a short page mean discovery is complete?

No. Check the continuation field. The server controls how many items appear on a page.[1]

Does every SDK list method fetch every page?

No. The C# and Ruby documentation both distinguish page-level access from helpers that collect all pages. Choose deliberately and verify the installed release’s behavior.[2][3]

Should I reuse this loop for search results inside tools/call?

A search tool defines its own result format. This guide follows protocol list cursors. Design and document a search tool’s own pagination separately, as covered in the tool-result pagination guide.

Sources

  1. MCP pagination specification, revision 2026-07-28.
  2. MCP C# SDK: automatic and manual pagination.
  3. MCP Ruby SDK: client pagination and collection limits.