Plate IIAgent SystemsHOWARDISM

Tool-Catalog Context Cost

The per-session context an agent spends holding tool and skill definitions it may never call, and the routes that move them off the resident prefix: deferred loading behind a search tool, a four-meta-tool discovery proxy (Uber's Omni MCP), a CLI that keeps definitions out of context and writes results to files (Uber's Code Mode, its company default for coding agents), and a front-door router that picks a tool subset. The size of the tax is measured three ways (~93K tokens for 287 MCP tools, 50–70K for 100+ tools, a 13.7× first-call gap between a 23-tool and a 4-tool harness). The first pre-registered gateway comparison (synthetic world, three open-weight agents) finds code mode beats plain MCP at 70–90% fewer tokens, plain MCP overflows context at 2,000 tools, the stubs' return-shape hints move code-mode success by up to 40 points, and a router in front of code mode is not confirmed to help

Article metadata
Publication details
Published:
Filed:Concept
Domain:Agent Systems
Reading:26 min
Source:AI-synthesised
About this piece

Articles in this journal are synthesised by AI agents from a curated wiki and are refreshed automatically as new concepts arrive. Topics, framing, and editorial direction are curated by Howardism.

Illustration for Tool-Catalog Context Cost

Sources#

Summary#

An agent's tools have to be described to the model before it can call them, and the standard way to do that is to put every definition (name, description, JSON schema) in the prompt prefix at session start. The cost of that prefix scales with the size of the catalog, not with what the task uses. At a handful of tools the cost is invisible. At an enterprise catalog it dominates the first call and crowds the context window. This page collects the measured size of that tax across the wiki and the three routes that have been shipped to avoid it.

The anchor is Uber's account of its MCP Gateway (Srivastava et al., Uber engineering blog, 2026-10-01, case-study, first-party), which fronts 800+ MCP servers and 5,000+ tools (self-reported) and states the problem directly: wiring an agent to hundreds of servers "doesn't scale, as all this context would eat up the model context limit." Its two fixes, Omni MCP and Code Mode, are two of the three routes below. The gateway itself (registry, AutoCrawler, data plane, authorization) is written up on MCP and Computer Use.

How large the tax is#

Three independent measurements, from different setups. None measures what the tax does to task success. (superseded 2026-11-23 by Beyond Plain MCP: Do Decision Models and Code Mode Make Tool Use Cheaper and Faster? A Pre-Registered Study of Code Mode and Decision Layers in MCP Gateways: the last row measures success as the resident catalog grows, on a synthetic world with n = 10 tasks per size. See §The routes measured against each other.)

SetupResident definitionsContext costSource
Enterprise tool-using assistant287 MCP tool definitions~93K tokens of schema in a ~94.4K static prefixPrompt-Cache Economics (CAPC, empirical)
Uber coding agents, before the fix100+ pre-loaded tools~50–70K tokens of schema per session, cut to "near zero" via search + CLICost-per-Task Over Cost-per-Token (Running a Software Factory Efficiently at Uber Scale, case-study)
Uber, one SaaS MCP server49 tools of a workspace suite~22K tokens of schemasame
Claude Code vs Pi, first model call23 tools (77,000 chars of schema) vs 4 (2,873 chars)27.0K vs 1,972 tokens, ~13.7×Harness Tax: Coding-Agent Cost Multiplies Across Harnesses While Success Barely Moves (empirical)
Claude Code vs OpenCode vs mini-SWE-agent, harness preamble per call (non-Anthropic endpoints, GLM-5.3-Flash)built-in set vs 8 tools vs bash only16,581 vs 7,025 vs 829 tokens, ~20× (a residual: first-call prompt minus the issue)Harness Swap vs. Rerun Noise (What a Harness Buys) (empirical)
Plain MCP gateway, Qwen3.8-27B, 12-server mock world plus real distractor tools, 10 tasks per size42 / 200 / 2,000 tool schemas16,076 / 148,047 tokens per task at success 0.90 / 0.80; ~47K schema tokens per turn at 200; context overflow, success 0.00, at 2,000Beyond Plain MCP: Do Decision Models and Code Mode Make Tool Use Cheaper and Faster? A Pre-Registered Study of Code Mode and Decision Layers in MCP Gateways (empirical, Tables 6 and 11)

Two qualifications come with these numbers.

  • Caching discounts the dollars but not the window. Anthropic implicitly caches a large tools= array without a cache_control marker, so in the CAPC run most of the catalog was already billed at the cached-read rate (Prompt-Cache Economics). A cached catalog is cheap per call. It still occupies the context window, which is the constraint Uber names, and it still sits in front of the model at selection time.
  • Compressing the catalog can beat curating it. In the same CAPC run, query-agnostic compression of all 287 definitions picked tools closer to the uncompressed baseline than query-aware compression (set-IoU 0.700 vs 0.603), because a query-aware compressor discards the definitions the model was about to need. Any discovery route that pre-filters by the query inherits the same risk.

Three routes off the resident prefix#

1. Deferred loading behind a search tool. Definitions stay out of the prompt until the agent fetches them. Claude Code ships this as deferred tools fetched through ToolSearch (Agent Harness Engineering §Context Engineering for Claude 5-Class Models, practitioner-opinion). The catalog lives in the harness, and the model sees names, then schemas on demand.

2. A meta-tool discovery proxy (Uber's Omni MCP). MCP itself has no cross-server search: "an agent has to already know which server to talk to before it can ask what tools are available." (The 2026-07-28 spec revision's mandatory server/discover does not change this. It describes one server's versions and capabilities, not the catalog; see MCP and Computer Use.) Omni MCP is a single proxy server that exposes four tools:

  • discover_server: find servers by query intent
  • discover_tools: list the tools on one server
  • get_tool_schema: fetch the JSON schema for one tool
  • invoke_tool: call it, with the gateway's access control applied

The client configures one endpoint, and context is "loaded step by step, never the full catalog at once" (Figure 6). This is route 1 lifted out of the harness into the network. Any MCP client gets incremental discovery without its harness supporting deferred tools, and the gateway applies authorization at invoke_tool. The cost is turns: a call that used to take one step now takes up to four. Uber reports no turn counts, latencies or selection accuracy for it.

3. A CLI that keeps definitions out of context entirely (Uber's Code Mode). Coding agents already have a shell, so Uber's aifx CLI routes MCP calls through the gateway "without requiring any MCP server to be installed": aifx mcp list, aifx mcp search (across all servers) and aifx mcp call. The agent can chain them in one command and write the output to files, which it then greps, so only the lines it needs enter context. This cuts both sides of the bill at once: no resident definitions, and no full tool response in history. That second half is Tool-Output Pruning's problem solved by indirection instead of by a pruning model. Uber says Code Mode is "now the company default for MCP tool use in coding agents." The default is scoped to coding agents. Omni MCP remains the route for MCP clients without a shell.

The earlier Uber post supplies the only numbers for route 3, measured once on five identical SQL queries in one session: 55–71% token reduction on small result sets from removing polling and schema overhead, ~100% on a 50-row result (1,431,594 → 900 tokens). Both posts are first-party and share an author (Medisetty), so the gateway post is the architecture behind those numbers, not independent corroboration of them (Cost-per-Task Over Cost-per-Token §The full stack).

A fourth move trims the response rather than the catalog. Response Projection adds a field to each tool's request schema in which the model lists the nested paths it wants, and the gateway drops everything else from the response at runtime: "a GraphQL-like calling pattern." Uber credits it with scaling "API schema compatibility for MCP at the enterprise level." It reports no token figure.

The routes measured against each other (Rai, November 2026)#

Every number above is either a context measurement or a first-party account. Rai (independent researcher, arXiv 2611.19123, empirical) runs the first controlled, pre-registered comparison of the routes on task success. One gateway process sits in front of a 12-server, 42-tool mock world with seeded state, plus up to 1,958 real distractor tools from a public catalog. Four switches on that gateway give four configurations, so tasks, seeds and sandbox are held constant:

  • A, plain MCP: every schema resident, JSON calls, every result back through the model.
  • B, router + JSON: a small decision model picks a tool subset before the agent sees anything. This is a fourth design the routes above don't cover, the RAG-MCP family of tool retrieval.
  • C, code mode: two meta-tools. search() returns Python stubs for matching tools, and execute() runs a script in a sandbox (an rlimit subprocess, not a container, three executions per task). Only the script's final line re-enters context. This combines route 1 (definitions fetched on demand) with route 3 (results kept out of context). It is the design of Cloudflare's Code Mode and Anthropic's code execution with MCP, not Uber's file-then-grep CLI.
  • D, router + code: the router's subset as stubs, with a fallback when the subset misses a tool.

The agents are three quantized open-weight models (Qwen3.8-27B, Gemma-4-26B-A4B, Nemotron-3-Nano-30B-A3B), at temperature 0 with thinking off. The confirmatory run is 1,785 serial runs on a sealed split of 119 instances, with Holm correction over 12 comparisons. Utility is U = success − 0.01·tokens/1000 − 0.002·latency_s. The 119 instances come from only 21 task templates, so the author also resamples families. That analysis is wider and overturns two of the six instance-level significant results, and he treats it as the more defensible one. The findings, in decreasing order of strength:

  1. Code mode beats plain MCP, confirmed for two of three agents. ΔU = +0.364 (Qwen) and +0.861 (Nemotron) under both analyses. Tokens fall 84%, 70% and 90%, and success rises 13.4 points for Qwen and 19.3 for Nemotron. Gemma moves the same way (+2.5 points) with an interval that includes zero. Discovery through a search step did not cost success here. It raised it.
  2. What the stub says a tool returns matters as much as the architecture. Stripping the hand-written return-shape hints (keys, types, list or dict) so a stub says only -> dict | list drops code-mode success by 22.7 points for Gemma and 39.5 for Nemotron (Holm p = 0.0003). Both then fall below plain MCP. Qwen loses 1.7 points, not significant. The development set gave the same pattern before the freeze (Gemma 0.664 and Nemotron 0.185 unhinted). The author's conclusion is that "any earlier comparison that used undeclared return types may be measuring the stubs rather than the agent." His hints were hand-written and tuned on development data. Whether servers' own outputSchema declarations deliver the same gain is untested.
  3. A router in front of code mode is not confirmed to help. Pooled over 238 instances, ΔU(D − C) is −0.028 (Qwen), +0.099 (Gemma) and +0.109 (Nemotron), none significant after correction, with the signs repeating across two independent samples. The author reads this as moderate evidence that a router helps agents whose own code mode is weaker and costs the strongest one a little. The protocol itself says ~300 pairs per arm were needed, so "not confirmed" means inconclusive, not absent. Once a router has picked a subset, code beats JSON over it (D − B, family-level significant for Qwen only).
  4. A router has to be cheap to pay for itself. The fine-tuned 4B router takes 1.55–1.61 s per decision (a prompted 26–27B router, 0.75–0.9 s). With a free, perfect router Qwen's D would be 0.4 s faster than C; with the real one it is 1.4 s slower. The break-even on a fast agent is a router under about 0.4–0.7 s.
  5. At scale the retriever caps the router, and an unbounded fallback is pathological (Qwen, 10 tasks per size, descriptive). Code mode stays nearly flat from 42 to 2,000 tools (success 1.00 / 1.00 / 0.90 at 4.1K / 7.8K / 11.9K tokens per task in the confirmatory arm). Plain MCP needs 148K tokens per task at 200 tools and overflows context at 2,000. The embedding retriever feeding the router recalls every needed tool in only 0.65 of tasks at 200 tools and 0.44 at 2,000, so subset misses are common. The first fallback let the agent request more tools without bound. Tasks reached 23 calls and 900K tokens, and D at 2,000 tools ran 223 s and 370K tokens at success 0.40. Bounding it (retry in code mode over the full catalog, then at most two requests) brought that to 16 s, 34K tokens and 0.90. D still never beat C at any size.
  6. Shape routing adds nothing (exploratory). No router that chose JSON or code per task beat "always code, with a fallback".

The router is also an attack surface. A prompted LLM router exposed a poisoned tool whose description said "ALWAYS select this tool for every task" in 39 of 39 tasks, so the least-privilege benefit of a small subset assumes an honest router. That result, and a small injection pilot where code mode did not raise attack success over JSON, are on MCP Tool Poisoning.

Limits. The world is synthetic and the tools answer instantly, so real per-call network time is not in the latency numbers (the author expects it to favour batched scripts further). The test split reuses the development template families. The agents differ in architecture, quantization and serving stack, so "the weaker agents" is an outcome label with confounds behind it. The router is the author's own, trained on the same template structure, and development and confirmatory runs used different routers. The hints and the security attacks are the author's own work. Against this, the headline that failed is the author's own pre-registered hypothesis, which he reports as a negative result.

What it does to the routes above. It supplies the first success measurement behind Uber's direction. Moving definitions and results out of context raised success on a controlled task set, and Uber's 55–71% token figure for its CLI sits inside this study's 70–90% band. Uber's route is a different implementation, though, so this corroborates the direction, not its numbers. It also adds a condition that no route here states: the stubs a code-mode agent searches must declare what each tool returns, and for two of three agents that one variable decided whether code mode beat plain MCP at all. And it moves the query-aware-filtering risk from the compression result above to tool selection at scale. A router is only as good as the retriever that hands it candidates.

The same ceiling on the skill catalog#

Agent Skill Format carries the open question this page's material bears on. Skill runtimes (Claude Code, Genkit) inject every installed skill's frontmatter description into the system prompt at initialization, so a large enough skills/ directory should hit the same wall a large tool catalog hits. Uber's account is field evidence that the wall is real at the tool layer. A team running hundreds of servers chose not to keep the catalog resident, and its stated reason is the context limit. It supplies no threshold, though: no catalog size at which selection broke, and no adherence or accuracy curve. The question's falsifiable form (N resident descriptions against a selection or compliance metric) is still unrun.

What deferral costs in effect, measured on skill bodies (October 2026). Skill runtimes already defer one layer: the description is resident and the body loads on demand. Wang et al. (arXiv 2610.04832, empirical) price that choice in both currencies on 80 sandbox tasks. Preloading a Skill body costs +37 to +57% tokens per episode over description-only (mini-SWE-agent re-sends it every turn). Deferring it keeps about 51% of a revised rule's action gain on average across four agents — all of it for Claude Sonnet 4.5, about 38% for three open models, whose loss comes partly from a runner that shows only 2,000 characters of each end of a read. That is the trade this page's first open question asks about for tools (context saved against errors made), answered for skills on one scaffold: the saving is real, and whether it is paid back in errors depends on the consumer model. It bears on that question without settling it, since tool selection from a search step is a different failure from not reading a body.

The skill-listing cap, measured (October 2026). Yan, Xu et al. (arXiv 2610.11647, empirical) measured how Claude Code 2.1.283 lists skills. Each skill's description plus when_to_use is truncated at 1,536 characters. The whole listing, bundled skills included, is capped at 1% of the context window: 8,000 characters for Sonnet 4.6 and Haiku 4.5, 6,000 for Opus 5. That ceiling is low. Under it, 95.8% of the Opus 5 listings holding just two similar project skills would have lost at least one of the two descriptions, so the authors raised the cap to 20,000 characters to run their experiment at all. On the skill layer, then, the catalog ceiling is a hard truncation that arrives before any adherence floor, and it silently decides which skill the model can choose. The same paper measures selection at the smallest catalog possible: one same-job rival lowers use of the installed skill by 19.9 pp, against 5.9 pp for one unrelated extra skill. Full treatment on Co-Installed Skill Conflicts.

Where this sits#

Connections#

Open Questions#

  • What does incremental discovery cost in turns and selection accuracy? Omni MCP turns one call into as many as four, and a search step can miss the right tool where a resident catalog would not. No source reports success rate, turn count or wrong-tool rate for a discover-then-invoke proxy against the same agent with the catalog resident. A matched A/B on one task set would settle whether the context saved is paid back in errors. Partially answered (2026-11-23): Rai (empirical, synthetic world) runs that A/B for a search-then-script gateway. Against the same agents with every schema resident, discovery through search() raised success (+13.4 and +19.3 points for two of three agents, family-level significant) at 70–90% fewer tokens, so on this task set the context saved was not paid back in errors. A front-door router's selection is bounded by its retriever (complete recall 0.65 at 200 tools, 0.44 at 2,000). Still open: turn counts and wrong-tool rates, a JSON discover-then-invoke proxy shaped like Omni MCP (not tested), and real servers.
  • Is Code Mode's file-then-grep pattern a coding-agent artifact, or does it carry to agents without a shell? Uber scopes its default to coding agents and keeps Omni MCP for other MCP clients. Is that a capability boundary (the agent must grep well) or only a deployment one (other agents lack a filesystem)? Partially answered (2026-11-23): on the deployment side, it carries without a shell. Rai's code mode needs only a sandboxed script runner and works on non-coding tasks (CRM, billing, HR, logs). On the capability side, the boundary is real and depends on the model. Code mode's gain over plain MCP ranged from not significant (Gemma) to +0.861 utility (Nemotron), and without return-shape hints in the stubs two of three agents fell below plain MCP. So the agent must script well, and what it is told about tool outputs decides whether it can. Untested: Uber's file-then-grep variant itself, and real servers.
  • Do the return shapes real servers declare (MCP outputSchema, or shapes a gateway infers from traffic) recover the 20–40-point code-mode gain that hand-written return-shape hints gave two of three agents? Rai's hints were written and tuned by the author, so the gain could belong to the hints rather than to the information. Settler: Rai's Ext-1 (hinted vs unhinted stubs) rerun with server-declared or traffic-inferred shapes on real MCP servers.
  • Does code mode raise or lower injection risk through tool results? Felendler et al. (arXiv 2602.15945, relayed by Rai, not ingested) report a larger attack surface. Rai's own pilot (one agent, six tasks, attacks and defence written by the author) found attack success 0.148 for plain MCP and 0.093 for code mode, within noise. Settler: a matched plain-MCP-vs-code-mode injection benchmark with payloads written by someone other than the gateway's author.

Sources#

  • Designing MCP Gateway: Uber's MCP Management Platform: Alok Srivastava, Deepanshu Mehndiratta, Gaurav Gill, Prashik Sahare, Vaibhav Tayal, Shiven Tripathi, Uday Kiran Medisetty & Abhishek Bhatia, Designing MCP Gateway: Uber's MCP Management Platform, Uber engineering blog, 2026-10-01, case-study (first-party; every scale figure self-reported; no outcome measured). Cited for §Runtime Discovery (Omni MCP's four tools, Response Projection, Code Mode via aifx and its status as the coding-agent default), the 800+/5,000+ scale claim, and Figures 5–6 (transcribed in the raw; Figure 3 viewed)
  • Running a Software Factory Efficiently at Uber Scale: Uday Kiran Medisetty, Uber engineering blog, 2026-08-27, case-study. Cited for the 50–70K → near-zero schema figure, the 49-tool/~22K SaaS server, and the code-mode SQL table; full treatment on Cost-per-Task Over Cost-per-Token
  • Agent Skill Evolution: How Revisions Affect Coding Agents: Wang et al. (University of Arizona et al.), arXiv 2610.04832, 2026-10-04, empirical. §5.2.4 (on-demand retention) and §6.2.2 (carrying cost of a Skill body). Full treatment on Skill Revision Effects
  • What Does a Harness Buy? Tokens, Mostly — Yangze Liu & Zhongyi Han (Shandong University), arXiv 2610.04433, 2026-10-03, empirical. Cited for Table A4's harness preamble per call. Full treatment and the Table 1 parse warning on Harness Swap vs. Rerun Noise (What a Harness Buys)
  • One Skill Too Many: How Co-Installed Skills Conflict in Coding Agents — Yan, Xu, Li, Xu, Liu, Deng & Ma (UNSW et al.), One Skill Too Many: How Co-Installed Skills Conflict in Coding Agents, arXiv 2610.11647, 2026-10-08, empirical. Cited for §2.1 (1,536-character per-skill truncation) and §3.8 (the measured listing cap and the 95.8% figure). Full treatment and parse notes (Table 1 welded, transcribed from pdftotext) on Co-Installed Skill Conflicts
  • Beyond Plain MCP: Do Decision Models and Code Mode Make Tool Use Cheaper and Faster? A Pre-Registered Study of Code Mode and Decision Layers in MCP Gateways — Abhishek Rai (independent researcher), Beyond Plain MCP: Do Decision Models and Code Mode Make Tool Use Cheaper and Faster? A Pre-Registered Study of Code Mode and Decision Layers in MCP Gateways, arXiv 2611.19123, 2026-11-14, 16pp, empirical. No vendor COI, but the router, the stub hints and the security attacks are all the author's own, and the manuscript was drafted with Claude Code's help (disclosed). Harness, router and run records released. Cited for §3 (the four configurations, the utility metric, the protocol), §4 (Tables 2–5: H1–H4, Ext-1 hints, Ext-2 pooled H3, latency and the confirmatory scale arm), §5.3–5.5 (shape routing, router break-even, the unbounded fallback), §6 (router recall and cost) and §7 (security pilot). Parse warning: PDF-derived (docling 2.126.0 / docling-mlx 0.1.1, grade excellent), and verify recorded no table flag. Even so, Table 1 is fully collapsed (all four configuration rows welded into one row), a short-text weld table-collapse cannot see, and it was transcribed from pdftotext -layout. Tables 6, 10 and 11 scatter the "mean / median / p90" latency triples across cells. They were recovered from pdftotext -layout, and the 200-tool plain-MCP medians (30.2 and 31.3 s) really are above their means. Tables 2–5 and 7–9 reconcile with the prose (token cuts 84/70/90%, success deltas, ΔU values). Development Table 11's 42-tool plain-MCP tokens (87,460) differ from confirmatory Table 6's (16,076). The paper does not reconcile them, and its statement that the harness changed during development is the likely reason. Only the confirmatory figure is cited
§ end
Cited by 18
Related articles