Code execution with MCP
Having agents write code to call MCP tools cut one example's token use from 150,000 to 2,000, a 98.7% saving.
Direct tool calls load every tool definition and pass results through the model. Presenting MCP servers as code APIs lets agents load only needed definitions and process data in a sandbox, saving context and cost. Cloudflare reported a similar finding.
- Date
- Tuesday, 4 November 2025
- Lab
- Anthropic
- Kind
- paper
- Access
- paper only
Figures
| Measure | Value | Measured by |
|---|---|---|
| Token use in example workflow | 150,000 to 2,000 tokens (-98.7%) code execution instead of direct tool calls | company |
Single illustrative example, not a benchmark; the same idea underlies programmatic tool calling.
Sources
This record was checked against its sources on 6 October 2026. How we check