What it is
Code Mode gives the agent one extra tool,mcp_script. Instead of calling MCP tools one at a time and reading each result in the chat, the agent writes a short TypeScript script that calls the tools it needs, combines the results, and returns one small answer. This keeps long chains of tool calls out of the conversation and saves tokens.
The script runs in a sandbox with no files, network or environment of its own. The only things it can do are call your connected MCP tools and return a value.
When it is offered
Code Mode is offered only when two or more MCP tools are connected. With one tool, a normal call is simpler, so the agent does not getmcp_script.
It is on by default, in the app (Desktop, web, phone) and in the Gizzi terminal app, where it works with the MCP servers you added with gizzi mcp add.
Turn it off: set GIZZI_DISABLE_MCP_CODE_MODE=1 in the environment Gizzi runs in. The agent then gets no mcp_script tool and calls MCP tools one at a time.
Limits
Each script run has these limits:
If a script hits a limit it stops, and the agent sees which limit it was.