A tool returns huge JSON payloads that flood the context. Where is the best place to fix this?
Why D is the answer
Shape the tool response so that it returns only what the task needs
Tool output costs context whether or not it is used. Return less at the source, with a way to ask for more.
In detail
- Tool output costs context whether or not it is used.
- Return less at the source, with a way to ask for more.
- Design tool outputs for the agent reading them.
Use case
An illustrative scenario, not a real incident.
A tool returns a whole customer record for every call. A shaped response with a few fields, plus a way to request more, shrinks context use with no loss of ability.
See it in different ways
stateDiagram-v2 [*] --> HowManyApps HowManyApps --> DirectTool: one app HowManyApps --> McpServer: many apps McpServer --> Stdio: local process McpServer --> StreamableHttp: remote, with OAuth
flowchart LR S0["Tool reads the record"] --> S1["Selects what the task needs"] --> S2["Returns a short result"]
Key point: Return less at the source.
Why the other options are wrong
- A. Ask the model in the prompt to pay attention to only the fields it needs
- The data is still in context, even if the model ignores it.
- B. Raise the context budget by moving the whole agent to a larger model
- A larger model delays the problem and costs more.
- C. Compress the JSON into a shorter format before sending it to the model
- Compression hides the size but keeps the same useless fields.

