Every result takes a seat.
The model asks for one tool and waits. The whole result is pasted into its context. Then it decides the next call. Each step is a round trip, and the model reads every row, even the ones it only passes along.
→ get_expenses("ops")+38,400→ get_expenses("dev")+48,800→ get_expenses("hr")+15,500→ get_budgets()+21,300→ compare(rows)+24,000Example task: find the three biggest overspends across three teams. One cell is 2,000 tokens.
75 times less context

Less context for the same job. Anthropic reported one agent task falling from 150,000 tokens to 2,000 once tools were handled as code.
Anthropic Engineering, “Code execution with MCP”, November 2025.
Not for every call.
- A task needs many tool calls
- Results are big, the answer is small
- Sensitive rows should skip the model
- One simple call does the job
- You need to review every step
- You can’t run a sandbox
Code does the work.
Tools become functions. The model writes one program, the sandbox runs it, and only what it prints comes back. MCP still connects the tools; the model just reaches them through code.
You mark the tool once
{
"name": "get_expenses",
"description": "Expense rows for one team.",
"input_schema": {
"type": "object",
"properties": {"team": {"type": "string"}}
},
"allowed_callers": [
"code_execution_20260120"
]
}
The lit lines are the only new part. They let code call the tool.
The model writes a programThirteen lines. About 400 tokens, and that is all it sends.
The calls run in the sandbox12,857 rows arrive. None of them reach the model.
The filtering happens there tooLoop, compare, keep what is over budget.
So does the sortingThe three biggest gaps come first.
Only the print comes backThree lines. About 1,600 tokens.
import json over = []for t in ["ops", "dev", "hr"]: raw = await get_expenses({"team": t}) for r in json.loads(raw): gap = r["spent"] - r["budget"] if gap > 0: over.append((gap, r["item"])) over.sort(reverse=True)for gap, item in over[:3]: print(f"{item}: +{gap:,}")
Cloud hosting: +4,200Team offsite: +1,850Software seats: +930