Query instead of paging
Let the agent run code over results
When a task chains many tool calls, the agent can write a short program that calls the tools and returns only the final result, so intermediate results stay out of context. Anthropic and OpenAI call it programmatic tool calling; Pi runs it by default, OpenCode runs its MCP tools through it by default, and Claude Code and Codex have an experimental code mode.
Anthropic reported 37% fewer tokens, and no gain on flows of one or two calls. Vendor-reported
Where it fits
Programmatic tool calling on the Claude and OpenAI APIs; Pi codemode.
Experimental in Claude Code and Codex, on by default in OpenCode.
Not offered in enterprise assistants.
Use a code step instead.
The setting in each harness
Read on each vendor's own page, linked next to the setting.
| Harness | Setting |
|---|---|
| Claude API and Agent SDK |
|
| OpenAI Responses and Agents SDK | The |
| Pi | On by default MCP tools default to codemode exposure: the model calls them from one script instead of one call per tool github.com, read 30 Nov 2026 |
| Claude Code | Experimental
|
| Codex | |
| OpenCode | On by default MCP servers run through Code Mode by default in OpenCode 2; |
Not offered
-
Cursor has no code mode for MCP tools
github.com, read 30 Nov 2026 -
ChatGPT has no code mode for MCP tools
github.com, read 30 Nov 2026 -
The Claude app has no code mode for MCP tools
github.com, read 30 Nov 2026