Back to course

Optimization: Pagination and Large Data

Model Context Protocol (MCP) Server Engineering

Handling Large Resources

If a resource is too large (e.g., a million log lines), it will crash the LLM's context. Use Pagination tokens.

Implementation

Use the nextCursor field in the response to tell the client there's more data.

Assignment: Modify your SQLite tool to support LIMIT and OFFSET via pagination tokens.