documentation/blog/2025-12-15-code-mode-mcp/index.md
There is an emerging approach to MCP tool calling referred to as "sandbox mode" or "code mode". These ideas were initially presented by Cloudflare in their Code Mode: the better way to use MCP post and Anthropic in their Code execution with MCP: Building more efficient agents posts. Since the approach and the benefits are clearly laid out in those posts I will summarize them here.
<!-- truncate -->In v1.17.0 of goose, we've introduced an open source implementation of this idea in a new platform extension called: Code Mode. Our implementation generates a JavaScript interface representing the connected MCP tools and then lets the model write code to run against it in boa which is an embeddable JavaScript engine. One neat feature of boa we were able to take advantage of was the concept of NativeFunction.
In boa, a NativeFunction is something which exposes a function in the embedded JavaScript environment which calls back into a
natively implemented rust function. This is perfect for the calls originating in JS and then routing the tool call to the underlying
MCP server with ease!
Our hope is that we improve tool calling performance and handling of large numbers of tools in goose, but also provide an open source implementation of this emerging approach.
goose configure on cliKudos to my colleague Mic Neale for collaborating with me on the implementation!
<head> <meta property="og:title" content="Code Mode MCP in goose" /> <meta property="og:type" content="article" /> <meta property="og:url" content="https://goose-docs.ai/blog/2025/12/15/code-mode-mcp-in-goose" /> <meta property="og:description" content="An emerging approach to MCP tool calling gets an open source implementation in goose" /> <meta property="og:image" content="https://goose-docs.ai/assets/images/header-image-1fa39f1d26aea7722e2c10fc424804f5.jpg" /> <meta name="twitter:card" content="summary_large_image" /> <meta property="twitter:domain" content="goose-docs.ai" /> <meta name="twitter:title" content="Code Mode MCP in goose" /> <meta name="twitter:description" content="An emerging approach to MCP tool calling gets an open source implementation in goose" /> <meta name="twitter:image" content="https://goose-docs.ai/assets/images/header-image-1fa39f1d26aea7722e2c10fc424804f5.jpg" /> </head>