Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions documentation/blog/2025-12-15-code-mode-mcp/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ posts. Since the approach and the benefits are clearly laid out in those posts I

## In goose

In v1.17.0 of goose, we've introduced an open source implementation of this idea in a new platform extension called: Code Execution.
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](https://github.com/boa-dev/boa) which is an embeddable JavaScript engine. One neat feature of boa we were able
to take advantage of was the concept of [NativeFunction](https://docs.rs/boa_engine/latest/boa_engine/native_function/struct.NativeFunction.html).
Expand All @@ -47,7 +47,7 @@ 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.

* Try out the feature by enabling the ["Code Execution" extension](https://github.com/block/goose/blob/main/crates/goose/src/agents/code_execution_extension.rs) in v1.17.0 or later of goose by clicking extensions on the left side of the desktop app or running `goose configure` on cli
* Try out the feature by enabling the ["Code Mode" extension](https://github.com/block/goose/blob/main/crates/goose/src/agents/platform_extensions/code_execution.rs) in v1.17.0 or later of goose by clicking extensions on the left side of the desktop app or running `goose configure` on cli
* Please give us feedback on how it works for you by joining our [discord](https://discord.gg/goose-oss).

Kudos to my colleague [Mic Neale](https://github.com/michaelneale) for collaborating with me on the implementation!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ When the concept of Code Mode landed on socials, many people claimed it was a re

### How goose Implemented Code Mode

[goose](/) took a unique approach by making [Code Mode](/blog/2025/12/15/code-mode-mcp) itself an extension called the Code Execution extension. When active, it wraps your other extensions and exposes them as JavaScript modules, allowing the LLM to see only three tools instead of eighty.
[goose](/) took a unique approach by making [Code Mode](/blog/2025/12/15/code-mode-mcp) itself an extension called the Code Mode extension. When active, it wraps your other extensions and exposes them as JavaScript modules, allowing the LLM to see only three tools instead of eighty.

When the agent needs to perform a complex task, it writes a script that looks something like this:

Expand Down Expand Up @@ -103,7 +103,7 @@ Code Mode helps us take a step forward in building agents that can scale to hand

---

*Ready to try Code Mode? Enable the "Code Execution" extension in [goose](/docs/quickstart) v1.17.0 or later. Join our [Discord](https://discord.gg/goose-oss) to share your experience!*
*Ready to try Code Mode? Enable the "Code Mode" extension in [goose](/docs/quickstart) v1.17.0 or later. Join our [Discord](https://discord.gg/goose-oss) to share your experience!*

<head>
<meta property="og:title" content="Code Mode Doesn't Replace MCP (Here's What It Actually Does)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ Code Mode wraps your MCP tools as JavaScript modules, allowing the agent to comb

## 2. goose Supports Code Mode

Code Mode support landed in goose v1.17.0 in December 2025. It ships as a platform extension called "Code Execution" that you can enable in the desktop app or CLI.
Code Mode support landed in goose v1.17.0 in December 2025. It ships as a platform extension called "Code Mode" that you can enable in the desktop app or CLI.

To enable it:

- **Desktop app:** Click the extensions icon and toggle on "Code Execution"
- **CLI:** Run `goose configure` and enable the Code Execution extension
- **Desktop app:** Click the extensions icon and toggle on "Code Mode"
- **CLI:** Run `goose configure` and enable the Code Mode extension

Since its initial implementation, we've added so many improvements!

Expand Down
3 changes: 2 additions & 1 deletion documentation/docs/getting-started/using-extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ Platform extensions are built-in extensions that provide global features like co

- [Apps](/docs/mcp/apps-mcp): Create, manage, and launch custom HTML apps in standalone windows
- [Chat Recall](/docs/mcp/chatrecall-mcp): Search conversation content across all your session history
- [Code Execution](/docs/mcp/code-execution-mcp): Execute JavaScript code for tool discovery and tool calling
- [Code Mode](/docs/mcp/code-mode-mcp): Execute JavaScript code for tool discovery and tool calling
- [Extension Manager](/docs/mcp/extension-manager-mcp): Discover, enable, and disable extensions dynamically during sessions (enabled by default)
- [Summon](/docs/mcp/summon-mcp): Load skills and recipes, and delegate tasks to subagents (enabled by default)
- [Todo](/docs/mcp/todo-mcp): Manage task lists and track progress across sessions (enabled by default)
- [Top of Mind](/docs/mcp/tom-mcp): Inject persistent instructions into goose's working memory every turn
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The extension name uses inconsistent capitalization. The code defines it as "Top Of Mind" with capital "O" (see crates/goose/src/agents/platform_extensions/mod.rs:109), and the documentation title also uses "Top Of Mind" (see documentation/docs/mcp/tom-mcp.md:2). This should be "Top Of Mind" to match the code and official documentation.

Suggested change
- [Top of Mind](/docs/mcp/tom-mcp): Inject persistent instructions into goose's working memory every turn
- [Top Of Mind](/docs/mcp/tom-mcp): Inject persistent instructions into goose's working memory every turn

Copilot uses AI. Check for mistakes.

### Toggling Built-in Extensions

Expand Down
6 changes: 3 additions & 3 deletions documentation/docs/guides/managing-tools/code-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import TabItem from '@theme/TabItem';
Code Mode is a method of interacting with MCP tools programmatically instead of calling them directly. Code Mode is particularly useful when working with many enabled extensions, as it can help manage context window usage more efficiently.

:::info
This functionality requires the built-in [Code Execution extension](/docs/mcp/code-execution-mcp) to be enabled.
This functionality requires the built-in [Code Mode extension](/docs/mcp/code-mode-mcp) to be enabled.
:::

Code Mode controls how tools are discovered and called:
Expand All @@ -21,7 +21,7 @@ Code Mode controls how tools are discovered and called:

## How Code Mode Works

The [Code Execution extension](/docs/mcp/code-execution-mcp) is an MCP server that uses the MCP protocol to expose three foundational meta-tools. When Code Execution is enabled, goose switches to Code Mode. For every request, the LLM writes JavaScript code that goose runs in a sandbox environment to:
The [Code Mode extension](/docs/mcp/code-mode-mcp) is an MCP server that uses the MCP protocol to expose three foundational meta-tools. When Code Mode is enabled, goose switches to Code Mode. For every request, the LLM writes JavaScript code that goose executes using [pctx (Port of Context)](https://github.com/AdrianCole/pctx), a custom Deno-based runtime, to:
- Discover available tools from your enabled extensions (if needed)
- Learn how to work with the tools it needs for the current task
- Call those tools programmatically to complete the task
Expand All @@ -32,7 +32,7 @@ Traditional MCP tool calling and Code Mode are two different approaches to the s

| Aspect | Traditional | Code Mode |
|--------|------------------|-----------|
| **Tool Discovery** | All tools from enabled extensions, for example:<br/>• `developer.shell`<br/>• `developer.text_editor`<br/>• `github.list_issues`<br/>• `github.get_pull_request`<br/>• `slack.send_message`<br/>• ... *potentially many more* | Code Execution extension's meta-tools:<br/>• `list_functions`<br/>• `get_function_details`<br/>• `execute`<br/><br/>The LLM uses these tools to discover tools from other enabled extensions as needed |
| **Tool Discovery** | All tools from enabled extensions, for example:<br/>• `developer.shell`<br/>• `developer.text_editor`<br/>• `github.list_issues`<br/>• `github.get_pull_request`<br/>• `slack.send_message`<br/>• ... *potentially many more* | Code Mode extension's meta-tools:<br/>• `list_functions`<br/>• `get_function_details`<br/>• `execute`<br/><br/>The LLM uses these tools to discover tools from other enabled extensions as needed |
| **Tool Calling** | • Sequential tool calls<br/>• Each result sent to the LLM before the next call | • May require tool discovery calls<br/>• Multiple tool calls batched in one execution<br/>• Intermediate results are chained and processed locally |
| **Context Window** | Every LLM call includes all tool definitions from enabled extensions | Every LLM call includes the 3 meta-tool definitions, plus any tool definitions previously discovered in the session |
| **Best For** | • 1-3 enabled extensions<br/>• Simple tasks using 1-2 tools | • 5+ extensions<br/>• Well-defined multi-step workflows |
Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/guides/tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Press `Cmd+Option+Shift+G` (macOS) or `Ctrl+Alt+Shift+G` (Windows/Linux) and sen
### Turn off unnecessary extensions or tool
Turning on too many extensions can degrade performance. Enable only essential [extensions and tools](/docs/guides/managing-tools/tool-permissions) to improve tool selection accuracy, save context window space, and stay within provider tool limits.

:::tip Code Execution for Many Extensions
:::tip Code Mode for Many Extensions
Consider enabling [Code Mode](/docs/guides/managing-tools/code-mode), an alternative approach to tool calling that discovers tools on demand.
:::

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Code Execution Extension
title: Code Mode Extension
description: Execute JavaScript code to interact with multiple MCP tools
---

Expand All @@ -8,9 +8,11 @@ import TabItem from '@theme/TabItem';
import { PlatformExtensionNote } from '@site/src/components/PlatformExtensionNote';
import GooseBuiltinInstaller from '@site/src/components/GooseBuiltinInstaller';

The Code Execution extension enables [Code Mode](/docs/guides/managing-tools/code-mode), a programmatic approach for interacting with MCP tools.
The Code Mode extension enables [Code Mode](/docs/guides/managing-tools/code-mode), a programmatic approach for interacting with MCP tools.

In Code Mode, the LLM discovers which tools are available from your enabled extensions and writes JavaScript code that goose runs in one execution instead of calling tools directly and one at a time. This helps manage context window usage more efficiently when multiple extensions are enabled and when performing workflows with multiple tool calls.
The Code Mode extension is an MCP server that exposes three meta-tools. When Code Mode is enabled, the LLM writes JavaScript code that goose executes using a Deno-based runtime called [Port of Context](https://github.com/AdrianCole/pctx) to discover tools, learn their interfaces, and call them programmatically.

This helps manage context window usage more efficiently when multiple extensions are enabled and when performing workflows with multiple tool calls.

## Configuration

Expand All @@ -19,7 +21,7 @@ In Code Mode, the LLM discovers which tools are available from your enabled exte
<Tabs groupId="interface">
<TabItem value="ui" label="goose Desktop" default>
<GooseBuiltinInstaller
extensionName="Code Execution"
extensionName="Code Mode"
description="Execute JavaScript code to interact with MCP tools efficiently"
/>
</TabItem>
Expand Down
44 changes: 44 additions & 0 deletions documentation/static/servers.json
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,17 @@
}
]
},
{
"id": "code_execution",
"name": "Code Mode",
"description": "Execute JavaScript code to interact with MCP tools efficiently",
"command": "",
"link": "https://github.com/block/goose/tree/main/crates/goose/src/agents/platform_extensions/code_execution.rs",
"installation_notes": "This is a built-in platform extension that comes with goose. No installation required.",
"is_builtin": true,
"endorsed": true,
"environmentVariables": []
},
{
"id": "developer",
"name": "Developer",
Expand Down Expand Up @@ -639,6 +650,17 @@
}
]
},
{
"id": "summon",
"name": "Summon",
"description": "Load skills and delegate tasks to subagents",
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Summon extension description is incomplete. According to the extension's documentation (documentation/docs/mcp/summon-mcp.md lines 11-15), Summon can load both skills and recipes, not just skills. The description should be "Load skills and recipes, and delegate tasks to subagents" to match the documentation at documentation/docs/getting-started/using-extensions.md line 42.

Suggested change
"description": "Load skills and delegate tasks to subagents",
"description": "Load skills and recipes, and delegate tasks to subagents",

Copilot uses AI. Check for mistakes.
"command": "",
"link": "https://github.com/block/goose/tree/main/crates/goose/src/agents/platform_extensions/summon.rs",
"installation_notes": "This is a built-in platform extension that comes with goose. No installation required.",
"is_builtin": true,
"endorsed": true,
"environmentVariables": []
},
{
"id": "supabase",
"name": "Supabase",
Expand Down Expand Up @@ -691,6 +713,28 @@
}
]
},
{
"id": "tom",
"name": "Top of Mind",
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The extension name uses inconsistent capitalization. The code defines it as "Top Of Mind" (see crates/goose/src/agents/platform_extensions/mod.rs:109), and the documentation also uses "Top Of Mind" (see documentation/docs/mcp/tom-mcp.md:2 and line 38). This should be "Top Of Mind" with capital "O" to match the code and documentation.

Suggested change
"name": "Top of Mind",
"name": "Top Of Mind",

Copilot uses AI. Check for mistakes.
"description": "Inject persistent instructions into goose's working memory every turn",
"command": "",
"link": "https://github.com/block/goose/tree/main/crates/goose/src/agents/platform_extensions/tom.rs",
"installation_notes": "This is a built-in platform extension that comes with goose and is enabled by default. Configure via GOOSE_MOIM_MESSAGE_TEXT or GOOSE_MOIM_MESSAGE_FILE environment variables.",
"is_builtin": true,
"endorsed": true,
"environmentVariables": [
{
"name": "GOOSE_MOIM_MESSAGE_TEXT",
"description": "Literal text injected into working memory each turn",
"required": false
},
{
"name": "GOOSE_MOIM_MESSAGE_FILE",
"description": "Path to a file whose contents are injected (supports ~/)",
"required": false
}
]
},
{
"id": "tutorial-mcp",
"name": "Tutorial",
Expand Down
Loading