[Video Response] What Cloudflare's code mode misses about MCP and tool calling
Quick Overview
Cloudflare's Code Mode for agents, which converts Model Context Protocol (MCP) tools into TypeScript APIs, is superior to traditional MCP because it leverages the LLM's extensive training on real-world code, leading to more deterministic and reliable tool execution, especially when chaining multiple tool calls, by allowing the LLM to write and execute code directly within a secure sandbox environment.
Key Points: Agents using Code Mode (converting MCP tools to TypeScript APIs) handle many more tools and more complex tasks effectively compared to traditional MCP. The superiority stems from LLMs having enormous amounts of real-world TypeScript training data, unlike the contrived examples in traditional tool calls. Code Mode shines when agents need to string together multiple calls because the output of each tool call feeds directly into the LLM's neural network, avoiding the waste of time, energy, and tokens associated with parsing string outputs. The traditional MCP approach requires the LLM to output text/JSON which must be copied over as input for the next step, leading to inefficiencies, whereas Code Mode allows the LLM to write and execute code directly in a sandbox. Cloudflare Workers use V8 Isolates for secure sandboxing, which are far more lightweight than containers, allowing for rapid creation and destruction of execution environments for each tool call. The dynamic nature of Code Mode means the LLM decides the sequence of tool calls and how to handle intermediate outputs, leading to less brittle plans than the fixed sequence required by traditional MCP. The speaker agrees with the article's premise that MCP is useful for uniformity but argues that the complexity of real-world tasks exposes flaws in the traditional string-based output method.
Context: The video analyzes the Cloudflare article titled "Code Mode: the better way to use MCP," which argues against using the Model Context Protocol (MCP) as the primary abstraction layer for LLM tool calling. The presenter discusses how current agents often use MCP to expose tools, but Cloudflare is advocating for a 'Code Mode' approach where tools are presented as TypeScript APIs, allowing the LLM to generate and execute code directly within a sandboxed environment.