Code Mode for MCP
by Cloudflare · Technique · Text & code
Turns a long list of MCP server tools into a small code API that the model writes programs against, running them in a sandbox with API keys kept hidden.
Sharply cuts the tokens spent describing tools to a model; others are adopting it
Latest · Nov 23Predates Anthropic's release: converts MCP tools into a TypeScript API that models code against in sandboxed Workers, where bindings keep API keys away from generated code.
Who says what
Early daysCloudflare, Агенты Романа (Roman's Agents) and Daniel Dominguez, all reporting rather than testing
Cloudflare cut 2,600 API tools to two (search and execute), shrinking tool descriptions from about 1.1M tokens to about 1,000, with code run in a sandbox. Агенты Романа (Roman's Agents) says other companies including Datadog adopted it. Dominguez notes it predates Anthropic's release and keeps API keys away from generated code via bindings.
What would settle it. An independent test of task success and accuracy, not just token savings, against ordinary tool calling.
Evidence
- Nov 20Cloudflare cut 2,600 API tools to two (search and execute), shrinking tool descriptions from about 1.1M tokens to about 1,000, with code run in a sandbox.ReportedCloudflarevia
Агенты Романа (Roman's Agents) - Nov 20The approach was adopted by other companies, including Datadog.Reported
Агенты Романа (Roman's Agents)