Code Mode Doesn't Replace MCP (Here's What It Actually Does)

Published: (December 21, 2025 at 08:37 PM EST)
6 min read
Source: Dev.to

Source: Dev.to

The “Dial‑up Era” of Agentic Workflows

One day we’ll tell our kids that we had to wait for agents, but they won’t know that world because the agents of their day will be so fast. I joked about this with Nick Cooper, an MCP Steering Committee member from OpenAI, and Bradley Axen, the creator of goose. They both chuckled because they understand how clunky and experimental our current “dial‑up era” of agentic workflows can feel.

Model Context Protocol (MCP)

MCP has moved the needle by introducing a new norm: the ability to connect agents to everyday apps. The experience isn’t perfect, though—we’re still figuring out how to balance the power of these tools with the technical constraints of the models themselves.

Quick note: In goose we call MCP servers extensions. I’ll use extensions from here on out.

Why People Write Off MCP

Many users experience lag or instability, often without realizing they’ve fallen into the trap of “tool bloat.” There’s a lot of “don’t do this” advice to help you have a good experience. For example, a best practice that the goose team and power users follow is:

Don’t turn on too many extensions at once.
Otherwise, sessions degrade faster, hallucinations increase, and task execution slows down.

The “Too Many Extensions” Problem

First‑time users often turn on a bunch of extensions in excitement:

“This is so cool. I need it to access GitHub, Vercel, Slack, my database…”

What actually happens is that the agent’s context window gets flooded with hundreds of tokens worth of tool definitions. Each tool call forces the model to keep all those definitions in its “active memory,” which leads to:

  • Noticeable performance degradation
  • Increased hallucinations
  • Errors that make users think the platform isn’t ready for prime time

Dynamic Extensions – A First Attempt at Mitigation

The goose team initially combated this by adding dynamic extensions, which keep most tools dormant until the agent explicitly needs them. While this was a massive step toward efficiency, it remained a somewhat hidden feature that many casual users rarely discovered.

I spent a lot of time watching people operate with a huge list of active extensions, cringing as I realized they were wasting tokens on tools they weren’t even using.

Code Mode – Solving Extension Bloat

Code Mode takes the idea of limiting tools a step further. I first learned about it from a Cloudflare blog post that proposed agents should write JavaScript/TypeScript to decide which tools to call and then run that logic in a single execution instead of calling tools one step at a time.

How It Works

  1. Provide only three foundational tools:

    • search_modules
    • read_module
    • execute_code
  2. The agent learns to discover what it needs on the fly and writes a custom script that chains those actions together in a single execution.

When the concept of Code Mode landed on socials, many claimed it was a replacement for MCP. It isn’t. Code Mode still uses MCP under the hood—the tools it discovers and executes are still MCP tools.

Analogy:

  • HTTP is the underlying protocol that makes communication possible.
  • REST is an architectural pattern built on top of HTTP.

Similarly, MCP is the protocol that standardizes how agents connect to tools, and Code Mode is a pattern for how agents interact with those tools more efficiently. In the goose ecosystem, Code Mode is treated as an MCP server (extension).

Code Mode as an Extension

goose made Code Mode itself an extension called the Code Execution extension. When active, it:

  • Wraps your other extensions
  • Exposes them as JavaScript modules
  • Allows the LLM to see only three tools instead of dozens

Example Script

import { shell, text_editor } from "developer";

const branch = shell({ command: "git branch --show-current" });
const commits = shell({ command: "git log -3 --oneline" });
const packageJson = text_editor({ path: "package.json", command: "view" });
const version = JSON.parse(packageJson).version;

text_editor({
  path: "LOG.md",
  command: "write",
  file_text: `# Log

Branch: ${branch}

Commits:
${commits}

Version: ${version}`
});

Experiment: Code Mode vs. No Code Mode

To truly understand how Code Mode works, I ran an experiment comparing the experience with and without Code Mode.

  • Model: Claude Opus 4.5

  • Extensions enabled: 8 different extensions

  • Prompt:

    “Create a LOG.md file with the current git branch, last 3 commits, and the version from package.json

Without Code Mode

  • The agent performed five separate tool calls to gather data and write the file.
  • Because all eight extensions had their full definitions loaded, the task consumed 16 % of the total context window.
  • This illustrates the scalability issues of standard workflows: as more tools are loaded, the system becomes unstable and prone to failure.

With Code Mode

  • The agent used its discovery tools to find the necessary modules and wrote a single, unified JavaScript script to handle the entire workflow.
  • Only 3 % of the context window was used.

Result: With Code Mode, I can have a longer session before the model’s performance degrades or hallucinations appear due to the weight of too many tools.

Takeaways

  • Code Mode doesn’t necessarily make tasks execute faster; its primary benefit is context‑window efficiency.
  • By reducing the number of tool definitions the model must keep in active memory, Code Mode delays performance degradation and reduces hallucinations.
  • It’s a pattern built on top of MCP, not a replacement.

Feel free to experiment with Code Mode in your own goose sessions and see how much more you can fit into a single context window!

Code Mode Overview

“Code Mode helps us take a step forward in building agents that can scale to handle all your tools without falling apart.” – MCP team

Why Code Mode Can Feel Heavy

  • Extra round‑trips – the LLM must discover the appropriate tools, generate JavaScript, and then execute it.
  • Overhead vs. direct calls – for a task that only needs one or two tools, writing and running code can be more work than simply invoking the tool.

When Code Mode Shines

  • Many extensions enabled – it can coordinate a large toolbox.
  • Multi‑step orchestration – complex workflows that require several sequential actions.
  • Long‑running sessions – maintaining coherence over time.

When It Doesn’t Make Sense

  • You have 1‑2 extensions only.
  • The task is single‑step.
  • Speed matters more than context longevity.

Recent Improvements (Goose v1.17.0 – December 2025)

AreaWhat’s new
Better UXShows which tools are being called instead of raw JavaScript.
Better reliabilityRefined type signatures so LLMs generate correct code on the first try.
More capabilitiesEnables sub‑agents to operate inside Code Mode.

Looking Ahead

The team is continuously refining Code Mode, making it more user‑friendly and powerful. As the platform evolves, agents will become increasingly limitless, eliminating the need to “ration” tools for simple tasks.

Get Started

  1. Enable the “Code Execution” extension in Goose v1.17.0 or later.
  2. Join our Discord to share your experience and learn from the community.

Ready to try Code Mode? Give it a spin and see how it transforms your workflows!

Back to Blog

Related posts

Read more »