Every API Is a Tool for Agents - Matt Carey, Cloudflare
Matt Carey (Cloudflare) argues that code generation beats tool lists for giving agents full API access, using dynamic isolated workers as the execution primitive.
- Cloudflare’s OpenAPI spec is 2.3M tokens; naively converted to MCP tools it becomes ~1.1M tokens, exceeding any model context window.
- Splitting into 16 product-scoped MCP servers forced users to pick servers and left most endpoints uncovered — Cloudflare hit ~2,600 endpoints this way.
- Code mode: generate typed SDK from OpenAPI, let the model write TypeScript against it, execute in an isolated Cloudflare Worker; entire API accessible in ~1,000 tokens.
- Dynamic workers (WorkerD) provide a programmable, network-restricted sandbox for untrusted LLM-generated code; toggling internet access is a single boolean on the server.
- Deno and Pydantic Logfire (Monty) are building analogous untrusted-code execution primitives, signaling an industry shift toward code-as-tool-call.
- Carey predicts MCP server support will become a one-line flag in every major TypeScript full-stack framework by end of 2025, with the SDK shrinking to near-zero bundle size.
- Saved mini-scripts from programmatic tool calls enable persistent user automations (e.g., auto-healing cron scrapers) without the user understanding the underlying code.
2026-04-25 · Watch on YouTube