Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

fix(cli): a Claude agent on a grid no longer offers its built-in WebSearch

Dev jacob09f8e29585a0
diff --git a/cli/src/lib/gridLaunch.spec.ts b/cli/src/lib/gridLaunch.spec.ts
index 56a37730f..d128d79a3 100644
--- a/cli/src/lib/gridLaunch.spec.ts
+++ b/cli/src/lib/gridLaunch.spec.ts
@@ -100,7 +100,8 @@ describe('the launch each engine gets', () => {
ANTHROPIC_AUTH_TOKEN: WIRE.apiKey,
ANTHROPIC_MODEL: 'GLM-4.7-Flash',
},
- args: [],
+ // The built-in search no grid can run — see "takes Claude Code's built-in WebSearch away".
+ args: ['--disallowedTools=WebSearch'],
})
// Setting it too makes Claude Code warn that auth may not work, and it decides nothing.
expect(launchOf('claude').env).not.toHaveProperty('ANTHROPIC_API_KEY')
@@ -607,9 +608,21 @@ describe('web tools (grid ADR 0041)', () => {
}
})
- it('adds nothing at all when the desktop sends no mcpUrl', () => {
- // An older desktop, and the no-regression promise: the launch is byte-for-byte what it was.
- expect(launchOf('claude', WITH_MODEL).args).toEqual([])
+ it("takes Claude Code's built-in WebSearch away on every grid launch, web tools or not", () => {
+ // `WebSearch` is an Anthropic SERVER tool (`web_search_20250305`) that no grid runs: the grid
+ // answers it with a 400, and a model offered it reaches for it before `mcp__grid-web__web_search`.
+ for (const override of [OVERRIDE, WITH_MODEL, WITH_MCP]) {
+ expect(launchOf('claude', override).args).toContain('--disallowedTools=WebSearch')
+ }
+ // ONE token. The flag is variadic, so the two-token form would swallow any positional after it as
+ // another tool name — measured on Claude Code 2.1.268, it then sent no request at all.
+ expect(launchOf('claude', WITH_MCP).args).not.toContain('--disallowedTools')
+ })
+
+ it('adds no web tools when the desktop sends no mcpUrl', () => {
+ // An older desktop, and the no-regression promise: no server it did not ask for. Claude's one flag
+ // is not a web tool but the removal of one no grid can run — see the test above.
+ expect(launchOf('claude', WITH_MODEL).args).toEqual(['--disallowedTools=WebSearch'])
expect(launchOf('claude', WITH_MODEL).env.GRID_API_KEY).toBeUndefined()
expect(launchOf('copilot', WITH_MODEL).args).toEqual([])
expect(launchOf('copilot', WITH_MODEL).env.GRID_API_KEY).toBeUndefined()
diff --git a/cli/src/lib/gridLaunch.ts b/cli/src/lib/gridLaunch.ts
index fbc4349cd..2ffbf5e7b 100644
--- a/cli/src/lib/gridLaunch.ts
+++ b/cli/src/lib/gridLaunch.ts
@@ -41,6 +41,7 @@ import { homedir } from 'node:os'
import { join } from 'node:path'
import type { AgentEngine } from '../engines/types.js'
import {
+ CLAUDE_DISALLOW_WEB_SEARCH_ARG,
mcpServersConfig,
codexMcpArgs,
GRID_MCP_AUTH_VAR,
@@ -512,7 +513,12 @@ const GRID_ENGINE_CONTRACTS: Partial<Record<AgentEngine, GridEngineContract>> =
// below, and setting it otherwise would leave a key in the pane that nothing reads.
...(override.mcpUrl ? { [GRID_KEY_VAR]: override.apiKey } : {}),
},
- args: override.mcpUrl ? ['--mcp-config', mcpServersConfig(override.mcpUrl, GRID_KEY_VAR)] : [],
+ args: [
+ // On every grid launch, web tools or not: the built-in search is an Anthropic server tool
+ // that no grid runs. See `CLAUDE_DISALLOW_WEB_SEARCH_ARG`.
+ CLAUDE_DISALLOW_WEB_SEARCH_ARG,
+ ...(override.mcpUrl ? ['--mcp-config', mcpServersConfig(override.mcpUrl, GRID_KEY_VAR)] : []),
+ ],
}),
},
diff --git a/cli/src/lib/gridWebMcp.ts b/cli/src/lib/gridWebMcp.ts
index 0a060a23d..a2e1c06a6 100644
--- a/cli/src/lib/gridWebMcp.ts
+++ b/cli/src/lib/gridWebMcp.ts
@@ -99,6 +99,36 @@ export function mcpServersConfig(mcpUrl: string, keyVar: string): string {
})
}
+/**
+ * Claude Code's own `WebSearch`, taken off every Claude agent launched onto a grid.
+ *
+ * It is the one web tool Claude Code does not run itself. Invoking it sends a second Messages request
+ * carrying the `web_search_20250305` SERVER tool, which Anthropic's API executes and nothing else
+ * does — and a grid is not Anthropic's API. The grid refuses it outright (autonomous-grid's CLI seat
+ * rejects every typed tool on the Anthropic wire, `_reject_server_tools` in `shared/agent/cli_seat.py`)
+ * and the pane prints `API Error: 400 Unsupported tool type: web_search_20250305`. The cost is not the
+ * one failed call: the model reaches for its built-in search FIRST, spends turns on the refusal, then
+ * scrapes pages with `WebFetch` — while `mcp__grid-web__web_search`, the search the grid actually
+ * serves, sits unused in the same tool list.
+ *
+ * On every grid launch, not only one carrying an MCP url: the refusal does not depend on whether web
+ * tools were wired, and a tool that can only fail is a trap either way. Moving the agent back to its
+ * own login rebuilds its argv without this, so the built-in search returns with the login it works
+ * against. A bare tool name here REMOVES the tool from what the model is offered rather than refusing
+ * the call, which is the point — a call-time refusal would still let the model reach for it first.
+ * `WebFetch` is left alone: it fetches from this machine and is not a server tool.
+ *
+ * ⚠️ **The `=` is load-bearing.** The flag is VARIADIC, so the two-token form swallows every argument
+ * after it up to the next flag. Nothing positional follows a grid's args today —
+ * `buildEngineCommandArgv` appends them last — but that is an ordering this should not depend on.
+ *
+ * Measured 2026-09-11 against a Messages listener on loopback, Claude Code 2.1.268: the main request
+ * offered 21 tools with `WebSearch` among them, and 20 with this flag — `WebSearch` gone, `WebFetch`
+ * still there, the prompt after the flag intact. The two-token form read that same prompt as a second
+ * tool name ("Permission deny rule … matches no known tool") and sent no Messages request at all.
+ */
+export const CLAUDE_DISALLOW_WEB_SEARCH_ARG = '--disallowedTools=WebSearch'
+
/**
* The same server as Codex `-c` overrides, which is how its provider is configured too — so this
* needs no config file either. Values are quoted as JSON because a `-c` value is parsed as TOML.