Execute an initial search, e.g., GET [base]/Observation?patient=[id]&_count=20; the server returns a Bundle with up to 20 entries.
Check the Bundle.link array for an element with relation 'next'; its url field contains the full URL for the next page.
Issue a GET request to the next-page URL exactly as provided; do not reconstruct or modify it, as servers embed cursor tokens or offsets in the URL.
Repeat until no 'next' link is present in the returned Bundle, indicating the final page.
Respect the Bundle.total field as the declared count; note it may be an estimate on some servers (indicated by a _total=none or _total=estimate preference).
Implement exponential backoff and retry on 429 or 503 responses; paginating large datasets can trigger rate limits.
Known gotchas
Never reuse a next-page URL after modifying the base query; the cursor encoded in the URL is bound to the original search context.
Bundle.total is sometimes omitted or set to zero even when results exist; rely on the presence of entries and the 'next' link for continuation logic.
Servers may expire pagination cursors after a short window (minutes); long-running pagination loops can receive a 410 Gone for stale next links.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp