Execute your CQL query with a page size set on the statement: in the DataStax Java driver, call `statement.setPageSize(100)` before executing.
After receiving the first result set, check if more pages exist: `resultSet.isFullyFetched()` returns false when more rows are available.
Fetch the paging state: `PagingState pagingState = resultSet.getExecutionInfo().getPagingState();` — serialize it to bytes or a string to pass to the client.
On the next request, attach the paging state to the same query: `statement.setPagingState(PagingState.fromString(serializedState));` and re-execute.
Continue until `isFullyFetched()` returns true or no paging state is returned, indicating the last page.
Known gotchas
Paging state is opaque and query-specific — it is only valid for the exact same query and partition key; changing the query invalidates the token.
Do not use OFFSET/LIMIT for deep pagination in Cassandra — it causes full table scans; driver-level paging is the correct approach.
Paging state tokens can expose internal cluster topology details — do not expose raw paging tokens directly to end users without encryption or signing.
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