One tool per operation: the per-endpoint catalog
After this page you will know what changes when Cloudflare’s MCP server offers one tool per API operation instead of one execute tool: what Box does with 3,053 tools before the agent may use any of them, why that takes about a minute, and what the tool names alone cost in tokens. The story needs it because act b2 showed that a rule on execute can only allow everything or nothing. With one tool per operation, the security engineer can name the operations the team agreed on.
Text description of the diagram
Stage 4 of 5.
Pieces in the picture:
- the macOS keychain, which holds the three secrets; the developer reads them into shell variables
- the developer's terminal
- Claude Code, the agent
- the contained filesystem view: only the paths the profile grants exist for the agent
- the box CLI and Box Core, which build the box and run its trusted process
- stand-in secrets: the agent gets placeholders, the real values stay in the trusted process
- the egress gateway, which every network request from the box goes through
- the MCP broker, which starts local MCP servers and decides their calls
- the staged tool catalog: Box types each tool from the server's tools/list before the agent may call it (new at this stage)
- the policy engine, which reads the Cedar and Dogwood policy files
- the records: every decision, written where the agent cannot reach
- the Anthropic API
- Cloudflare's MCP server (changed at this stage: it now runs in per-endpoint mode)
- the Cloudflare API
- the sample app: the Worker box-poc-workshop with its D1 database, KV namespace and Workers Logs; the logs and the database hold attendee names and email addresses
- Boundaries: the box, agent's sandbox, trusted process.
New in the picture: the Cloudflare MCP server is marked as changed (per-endpoint mode, 3,053 tools), and there is a new piece: the tool catalog, staged and typed per tool, which the egress gateway builds and the policy engine reads.
The same server, one tool per operation
Section titled “The same server, one tool per operation”Cloudflare’s MCP server at https://mcp.cloudflare.com/mcp has two modes. The default is code mode (Part 1): five tools, search, docs, execute, whoami and submit_feedback. Add ?codemode=false to the address and the same server offers one tool per operation of Cloudflare’s API. This is the per-endpoint mode.
Each tool is named after its operation and takes the operation’s parameters as arguments. Some names from the catalog, all of them in the list Claude Code received in the workshop’s checks:
| Tool | What the operation does (in the story) |
|---|---|
workers_legacy_scripts_list |
lists the Workers on the account |
workers_deployments_list |
lists the deployments of one Worker, such as box-poc-workshop |
workers_list, workers_get |
newer operations for the Worker list and one Worker |
o11y_telemetry_query |
queries Workers Logs: the leaderboard’s request lines and attendee events |
d1_query |
runs SQL on a D1 database: the attendee registry |
On 2026-11-21 the catalog held 3,053 tools, and the free checks of this workshop on 2026-11-22 saw the same count. (The catalog grows: on 2026-11-14 it had 11 tools fewer, and a day later 9 fewer. Older notes give the older count.)
For the security engineer this is the point of the mode. A request to read the logs is now a call to o11y_telemetry_query, a different name from a request to list deployments. A rule on tool names can tell them apart.
How Box stages the catalog
Section titled “How Box stages the catalog”When Box identifies an MCP server (the [mcp.cloudflare] table), it does not send its own request for the server’s tools. It waits for the agent’s request, tools/list, and reads the reply as it passes through the egress gateway. Then, before it hands the reply to the agent, it:
- builds one action per tool, such as
cloudflare::Action::"workers_deployments_list"; - turns each tool’s input description into a typed schema, so a rule can read the tool’s arguments (Part 4’s Rules on a tool’s arguments uses this);
- gives the actions and schemas to the policy engine and loads the per-tool rules that were waiting for them;
- only then releases the reply.
Box’s design note gives the reason for the order: “a tool is not callable until the engine enforces its rules”. This is called staging the catalog. With four tools it is instant. With 3,053 it is not.
About a minute of staging
Section titled “About a minute of staging”Measured: from Box’s decision on tools/list to Claude Code’s next request, 61.5 to 66.2 seconds on every newer local build, 65.9 seconds on the workshop’s build in its first check, and 64.0 to 70.8 seconds in the free checks run while writing this workshop (one check whose per-tool rule never loaded took 162.8 seconds; whether the rule caused it was not checked). The catalog is 6,540,316 bytes. Generating the schemas offline used 6.03 seconds of CPU time (user time, not wall time) on the workshop’s build, so the minute is not schema generation alone; where the rest goes was not measured.
What Claude Code’s start timeout does about it
Section titled “What Claude Code’s start timeout does about it”Claude Code waits a limited time for an MCP server to start: the variable MCP_TIMEOUT, in milliseconds, 30,000 by default (Claude Code’s environment variable reference). Box gives no sign that it is staging. So with the default, Claude Code gave up after 29.9 seconds and started with the server pending and 0 Cloudflare tools. The agent then had nothing to call.
The fix is on Claude Code’s side: set MCP_TIMEOUT in the agent’s environment in the profile. Act b3 adds MCP_TIMEOUT = "300000" (300 seconds), and the server then connects with all 3,053 tools. Box has no setting for this.
One more effect, measured: box run returns only when staging has ended, even when the agent gave up long before. In one check the agent stopped after about 30 seconds and box run returned at 150 seconds.
Why this part needs a local build
Section titled “Why this part needs a local build”Box’s released command line refuses this catalog. Some tools describe their input with shared definitions that Box could not turn into a schema, and one bad tool stops schema generation for the whole server: of the 3,053 tools, 441 had such a definition. The installed box 0.1.8 failed with unexpected token '-' and refused every call to the server. The workshop’s box is built from public Box source plus a fix for exactly this, which is not released. Builds and gaps says what the build is and how to make one.
Tool search: names first, definitions on demand
Section titled “Tool search: names first, definitions on demand”An agent’s request to the model carries the definition of every tool it may use. For 3,053 tools that does not fit.
- Every definition up front. The definitions of the catalog count 2,382,210 tokens (measured with Anthropic’s token counter on the list of 2026-11-14, 11 tools fewer). With tool search off, Claude Code’s first request was refused by the API: “Prompt is too long … the request is ~2246167 tokens (limit 1000000)”. The run cost nothing and did nothing.
- Tool search. Claude Code can instead send only the tool names, plus one built-in tool,
ToolSearch. When the model wants a tool, it callsToolSearchwith the name, and Claude Code loads that one definition. In act b3 the model’s first call is, for example,ToolSearchwithselect:mcp__cloudflare__workers_deployments_list.
Tool search still sends every name on every request. The names alone are 75,349 tokens (list of 2026-11-14), and the first request of a b3 run is about 78,600 input tokens before the agent has done anything.
Two Claude Code flags change in Part 4 because of this. --tools ToolSearch leaves ToolSearch as the only built-in tool. --bare, used until now, also removes ToolSearch (measured: no tools at all with --bare --tools ToolSearch), so Part 4 uses --setting-sources "" instead to keep the reader’s own settings out.
What the tool list costs
Section titled “What the tool list costs”The sizes differ by more than a factor of 100, so they are a table, not a chart:
| What the model is sent | Code mode | Per-endpoint mode | Source |
|---|---|---|---|
| All tool definitions | 3,510 tokens | 2,382,210 tokens | Anthropic token counter, 2026-11-14 |
| Tool names only (tool search) | not measured (the names are 26 bytes) | 75,349 tokens | same |
| First request of a run, input tokens | 1,306 to 1,316 | 78,588 to 78,593 | Claude Code’s own usage figures |
The code-mode figures were counted on the 4 tools of that day; the per-endpoint figures on the list of 2026-11-14, 11 tools fewer than today. Neither was re-counted for 3,053 tools.
The whole run shows the same thing. The chart puts the two acts side by side, one run per task:
Most of a b3 run’s input is the tool names: a run writes them to the prompt cache on the first turn (about 77,000 to 82,000 tokens) and reads them back on every later turn (about 160,000 to 240,000 tokens over three or four turns). Every per-endpoint run cost between $0.22 and $0.24, whatever the task.
The two seats
Section titled “The two seats”Each API operation now has its own name, and Box gives each one a typed action before the agent may call it. A rule can allow workers_deployments_list and refuse o11y_telemetry_query, and the records will say which tool was refused. The policy can also read each tool’s arguments, which act b3-args uses. What the policy still cannot see is what an allowed tool returns.
Every run in this mode waits about a minute before the agent has its tools, and needs MCP_TIMEOUT raised or it starts with none. Every run costs about $0.22 to $0.24 because of the tool names, against about $0.01 to $0.07 for act b2 in code mode. And it needs a local build of Box.
What to remember
Section titled “What to remember”?codemode=falseturns Cloudflare’s oneexecutetool into 3,053 tools, one per operation.- Box stages the catalog before the agent sees it: one typed action per tool, loaded into the policy engine first. That takes about a minute.
- Claude Code’s
MCP_TIMEOUT(30 seconds by default) must be raised in the profile, or the agent starts with no Cloudflare tools. - With tool search the names alone are about 75,000 tokens on every request; without it the request is too large for the model.
Read moreHow Box discovers and stages an MCP server’s toolsBox docs
Read moreMCP server configurationBox docs
Read moreMCP in Claude Code, including tool searchClaude Code docs
Read moreEnvironment variables, including MCP_TIMEOUTClaude Code docs
Read moreCloudflare’s own MCP serversCloudflare docs
Read moreBuilds and gaps: the local build this part needsThis workshop