Skip to content
AX Principles
AX-SYS-29Foundational

Size responses for a context window, not a database dump

Dimensiona las respuestas para una ventana de contexto, no como un volcado de base de datos

#all-industries#saas#mcp

Return only what the agent needs for the task, in pages it can ask for, with sensible defaults, and say so when you cut something off and how to get the rest.

Why

Everything a tool returns lands in the agent's context window, which is limited and shared with the task, the conversation and every other tool result. A search that returns 5,000 rows or a record with every internal field can push out the information the agent actually needs, or simply be cut off by the client. Anthropic's guidance for tool builders is direct: implement some combination of pagination, range selection, filtering and truncation, with sensible defaults, for any response that could use up lots of context. Claude Code caps tool responses at 25,000 tokens by default, so a larger response does not reach the model whole unless the server sizes it. When you do truncate, Anthropic says to steer the agent with instructions, and it suggests a response_format parameter so the agent can ask for a concise or a detailed answer (in its example, 72 tokens against 206). MCP standardizes paging: the server picks the page size, returns a nextCursor when more results exist, and should keep cursors stable. OpenAI's app guidelines add what to leave out entirely: return only data relevant to the request and the tool's purpose, without diagnostic fields, trace or request IDs, or logging metadata unless the query needs them.

Do

Paginate and filter by default, offer a concise mode, and mark truncation with a hint on how to fetch more.

Don't

Return every row and every internal field, or truncate silently.

Artifact

{
  "results": [
    { "id": "ord_812", "customer": "Acme Ltd", "total": "129.00 EUR", "status": "shipped" }
  ],
  "nextCursor": "eyJwYWdlIjogMn0=",
  "truncated": true,
  "hint": "Showing 20 of 1,284 orders. Filter by status or date range, or pass nextCursor for the next page."
}

Tool input: { "query": "orders", "status": "shipped", "limit": 20, "response_format": "concise" }

Citations

  1. [01]
    Anthropic Engineering: Writing effective tools for AI agents ↗

    We suggest implementing some combination of pagination, range selection, filtering, and/or truncation with sensible default parameter values for any tool responses that could use up lots of context. For Claude Code, we restrict tool responses to 25,000 tokens by default. If you choose to truncate responses, be sure to steer agents with helpful instructions. A response_format enum lets the agent choose concise or detailed responses; in Anthropic's example the detailed response used 206 tokens and the concise one 72

  2. [02]
    MCP Specification 2026-07-28: Pagination ↗

    Pagination allows servers to yield results in smaller chunks rather than all at once; page size is determined by the server, results carry an optional nextCursor if more exist, and servers SHOULD provide stable cursors

  3. [03]
    OpenAI Apps SDK: App submission guidelines ↗

    Tool responses must return only data that is directly relevant to the user's request and the tool's stated purpose. Do not include diagnostic, telemetry, or internal identifiers (session IDs, trace IDs, request IDs, timestamps, or logging metadata) unless they are strictly required to fulfill the user's query