Anthropic's MCP Code Mode Cuts Agent Tool Context From 150K Tokens to 2K (98.7% Savings)

blaizedsouza · x · 2026-11-21

A widely shared thread breaks down Anthropic's MCP "code mode" paper: instead of calling tools directly, the agent writes code that calls them — same tools, same task, same model, but tool context drops from 150,000 tokens to 2,000, a 98.7% saving in time and cost. Key parts: tools as .ts files loaded on demand, filtering 10,000-row sheets in the sandbox so the model sees 5 rows, running polling loops in code instead of round-tripping through the model, and PII masking ([EMAIL1], [PHONE1]) before data hits the model. The quoted article "Harness, Loop and Graph" adds that better prompts won't fix failing agents — the architecture around the model is what's broken.

Original post →

More from coding & agent

coding & agent channel →