Paper commentary
Beyond Plain MCP: Do Decision Models and Code Mode Make Tool Use Cheaper and Faster?
- Problem Large MCP tool catalogs make every agent turn expensive, and it is unclear whether a decision layer adds value in front of code mode.
- Method Compares four gateway configurations across three open-weight agents on a sealed test split of 119 instances, with pre-registered Holm-corrected comparisons and a family-level bootstrap as a second analysis.
- Results On the sealed split, code mode raised utility over plain MCP by +0.364 for Qwen3.8-27B and +0.861 for Nemotron-3-Nano-30B-A3B, while return-shape hints changed code-mode success by 22.7 points for Gemma and 39.5 points for Nemotron.

Table 2 : Confirmatory results, sealed test split, 119 matched instances per cell.U=success− 0.01tokens/1000−0.002latency s (mean). Medians are shown because a few runs are very long (GemmaC: one 890s run and three others above 60s, so its mean latency is 20.9s versus a 6.4s median).
Original paper · CC BY 4.0 · Abhishek Rai · Beyond Plain MCP: Do Decision Models and Code Mode Make Tool Use Cheaper and Faster? · Original paper figure · Extracted the figure area from page 5 of the original PDF.Why large MCP catalogs get expensive
Every tool in a large MCP catalog costs something on each turn, because its schema occupies the prompt and each result travels back through the model before the next call. The cost therefore grows with the size of the catalog, not with the number of tools the task actually needs.
The other remedy is a decision layer, a cheap model placed ahead of the agent that chooses which tools the agent may see.
The study began with the hypothesis that a decision layer in front of code mode beats either approach alone; it was pre-registered and tested on a sealed split, and the result did not confirm it.
Four gateway configurations
All four configurations run inside one gateway process that sits between the agent and the MCP servers, and switching configurations changes only the gateway's behaviour. Servers, tasks, seeds, turn caps and the sandbox are held constant, so differences between configurations come from the gateway design.
Plain MCP shows the agent every tool schema and uses JSON calls, with each result returned to the model. Router plus JSON still uses JSON calls and returned results, but only over the subset of schemas that a decision model selected. Router plus code mode runs the same script interface over the router's subset, with a JSON fallback. The sandbox is an rlimit-restricted subprocess rather than a container, which the authors list among their infrastructure limits.
D-oracle receives the gold tool list at zero router cost, so it marks a ceiling rather than a realistic router.
Return-shape hints in code-mode stubs
Without hints, a code-mode stub states only that a tool returns a dict or a list. Return-shape hints extend each stub with a description of the tool's return value: its keys, their types, and whether the result is a list or a dict. The agent sees the same tools in both settings, but with hints it knows the shape of each result before it writes a script.
The decision layer and its fallback
Given the task and a candidate list, a decision layer returns a subset of tools. The study compares a prompted LLM router, the zero-shot spark-s1 model and a fine-tuned spark-s1-based router, and in the development runs the prompted routers came from a different model family than the agent.
Only if that also fails does it fall back to JSON over the subset, with request_more_tools calls capped at two; this is the bounded fallback. An earlier unbounded variant, json_more, is kept as a baseline.
spark-s1-mcp-router-4b-r1 is a 4B tool selector made by LoRA fine-tuning of spark-s1. In the confirmatory runs this router, with top-30 candidates and threshold 0.05, serves configurations B and D for all three agents.
How success, tokens and latency become utility
Success is the verifier's pass rate, and tokens are the total prompt and completion tokens, including router tokens. The primary weights are λt = 0.01 and λℓ = 0.002, chosen before the D and B results were seen, and λℓ = 0.02 is also reported. Latency is measured only in serial passes, with concurrency 1 and nothing else generating.
Holm correction is applied across the 12 primary comparisons, which are H1 to H4 for each agent, and a run that exceeds the 900 s cap counts as a failure.
Development analyses were exploratory, because the first part of the protocol was written after the pilots.
Confirmatory results on the sealed split
The confirmatory evaluation ran 3 agents by 5 configurations by 119 instances, which is 1,785 serial runs.
For H1, code mode minus plain MCP gives a utility difference of +0.364 for Qwen, with an instance-level interval of [+0.251,+0.504] and a family-level interval of [+0.158,+0.654], both with Holm p of 0.0012. For Nemotron the utility difference is +0.861, with intervals of [+0.674,+1.046] at instance level and [+0.470,+1.184] at family level.
For Gemma the difference is +0.118, and its instance-level interval [-0.011,+0.244] includes zero, as does its family-level interval. Code mode cut tokens by 84% for Qwen, 70% for Gemma and 90% for Nemotron, and success rose by 13.4 points for Qwen and 19.3 points for Nemotron.
Router plus JSON beat plain MCP on utility only for Nemotron, with a difference of +0.571 and Holm p of 0.0012 at instance level and 0.045 at family level. For Qwen and Gemma the router cut tokens without a significant change in utility.
Router plus code over router plus JSON held at instance level for all three agents, with Holm p at most 0.0084. At family level only Qwen stayed significant, at p = 0.042, while Gemma's interval [-0.001,+0.309] is borderline. The two H4 results for Gemma and Nemotron are among the six instance-level significant results that do not survive Holm correction under family resampling.
The fine-tuned router reached complete recall of 0.975 on the test split, with 3 of 119 instances missing a needed tool, mean recall of 0.987 and 2.6 exposed tools on average. Each decision took 1.55 to 1.61 s, and the JSON fallback fired in 1.7%, 0% and 13.4% of D runs for the three agents. D-oracle exceeds C by +0.022 for Qwen, +0.165 for Gemma and +0.114 for Nemotron, which bounds how much a better router could add.
Does removing the return-shape hints matter?
Extension 1 reran code mode on the same 119 test instances with hints removed and compared it with the hinted code-mode configuration. Intervals resample families, and Holm correction covers the three agents.
For Gemma, success was 0.664 without hints and 0.891 with them, a difference of +0.227 with interval [+0.119,+0.361]; utility rose by +0.296 with interval [+0.162,+0.459], Holm p 0.0003. For Nemotron, success was 0.160 without hints and 0.555 with them, a difference of +0.395, with utility +0.478 and Holm p 0.0003.
The development set gave 0.66 and 0.19 success without hints for Gemma and Nemotron, close to the 0.66 and 0.16 found on the sealed split. On the utility scale the hints are worth +0.30 and +0.48 for the two lower-performing agents, while a router in front of code mode is worth +0.10 and +0.11 and is not significant. For Qwen neither effect is large.
Does the decision layer help with more instances?
The new sample is pooled with the original 119 instances, giving 238 instances in total.
For Gemma the new sample gives +0.121 and the pooled difference is +0.099 with interval [−0.011,+0.273], Holm p 0.21. For Nemotron the new sample gives +0.123 and the pooled difference is +0.109 with interval [−0.071,+0.294], Holm p 0.22.
The new sample reproduces the signs of the original: the router costs Qwen about 1 s and a little success, and it helps Gemma and Nemotron. For Gemma the new sample alone gives +9.2 points of success and +0.121 utility with an interval above zero, before adjustment.
Latency and scale
On the 39-task development latency set, a front-door router cost about 1.6 s at 42 tools, roughly 50 ms per candidate question.
For Gemma, mean latency is dominated by a few runaway C runs, one of which took 890 s, so medians and p90 values are more informative. With λℓ = 0.02 the Gemma D minus C difference is +0.282 with interval [+0.018,+0.699], which the authors attribute to the tail.
In the Qwen scale arm of 10 tasks, plain MCP used 148,047 tokens per task at 200 tools and failed by context overflow at 2,000 tools. Code mode rose from 4,112 tokens per task at 42 tools to 11,942 at 2,000 tools. With the bounded fallback, D matched C's success at 200 and 2,000 tools but was slower: mean latency was 9.3 s against 4.2 s at 200 tools and 16.8 s against 6.0 s at 2,000 tools.
With the unbounded fallback at 2,000 tools, D averaged 222.7 s and 370,482 tokens per task, with success 0.40. Bounding the fallback brought that to 16.1 s and 34,490 tokens, with success 0.90, a 14× reduction in time. Even so, D did not beat C for Qwen at any catalog size, and the authors describe the scale arm as a 10-task mechanism check rather than a precise estimate.
Development hints and stub quality
Early runs gave code-mode stubs no return information, and under those stubs Nemotron's code mode scored 0.185 success against 0.412 for plain MCP. With hints, Qwen moved from 0.950 to 0.975, Gemma from 0.664 to 0.864 and Nemotron from 0.185 to 0.504, while the plain MCP references were 0.832, 0.831 and 0.412.
Hints also reduced tokens, from 6.2K to 4.5K for Qwen and from 14.2K to 8.2K for Nemotron. They also flipped the preferred shape for Gemma and Nemotron: without hints plain MCP beat code mode for both, and with hints code mode won.
Conclusions about which shape is best are therefore conditional on stub quality.
When shape routing failed on development seeds
On development seeds, with a Qwen-selected subset averaging 2.4 tools, Gemma's D reached 0.966 success against 0.864 for C, +10.2 points with interval [+4.2,+16.1]. D also used 18% fewer tokens with router tokens included, and utility rose by +0.109 with interval [+0.046,+0.178].
For Qwen, D tied C (∆U tok −0.009, interval [−0.032,+0.005]), and C was already near ceiling at 0.975.
Router plus JSON was non-inferior and cheaper only when the subset was small and accurate, and zero-shot spark-s1 subsets of about 12 tools saved no tokens.
Every shape router tried scored below always-code-plus-fallback for Qwen and Gemma. A held-out Gemma analysis gained +0.051 utility over always-code, but it compared against C without a subset or fallback, and an offline analysis found only +0.036 oracle headroom.
The fine-tuned router's profile
On the reworded tasks, recall was 0.873 for zero-shot and 0.964 for the fine-tuned model, with paired differences of +10.1 points [+3.8,+17.7] and +9.1 points [+1.8,+18.2].
With a Gemma agent, D using this router reached 0.932 success against 0.864 for C, a difference of +6.8 points with interval [+1.7,+12.7]. The prompted Qwen router reached 0.966 and had lower tool recall, and the authors read the gap between the two routers as agent-side noise at n = 118.
The fine-tuned router is not faster: a prompted 26 to 27B router answered in 0.75 to 0.9 s, while the 4B router took 1.6 s at 30 candidates, or 0.41 s at 15 candidates with a 2.5 to 5.5 point recall loss. Its advantage is footprint, 8.4GB against about 52GB, and precision rather than speed. On the base model's own benchmark accuracy dropped by 1.5 to 2.8 points, so the router is not a drop-in replacement.
Exploratory security observations
These observations are exploratory, covering one agent, six tasks and one seed for injection, and one poisoned tool for routing.
The authors read the A and C difference as within noise, and they attribute D's zero largely to structure: with about 2.4 tools exposed, the attacker's goal tools are usually not callable.
The fine-tuned router exposed it in 62% of tasks for the insistent phrasing, against 69% for the zero-shot model, a difference that is not distinguishable at n = 39. The authors conclude that a router's output should not serve as an authorization decision.
What the evidence supports
Router plus code over router plus JSON is supported for Qwen and directionally for the other agents.
For gateway design the authors suggest publishing or inferring an output contract for each tool, defaulting to code mode with a bounded fallback, keeping any front-door router's fallback bounded and non-authoritative, and measuring end-to-end latency. Learning return shapes from traffic is proposed but not tested in the study.
Limits of the evidence
The world is synthetic, the tools return instantly, and the test split uses the same 21 template families as development, so instances are clustered.
Several intervals include zero, each cell has one run at temperature 0, and the scale arm has 10 tasks.
The family-level analysis was added after the core results were seen, and it changes some conclusions. The utility weights are a choice, although the qualitative conclusions do not depend on them.
The stub hints were hand-written and tuned on development data, and harness bugs were fixed on development worlds.
The sandbox is not a container, the agents are quantized, and thinking was disabled. One extension run hit the 900 s cap and is scored as a failure, and about 5 of roughly 3,000 development runs hung and were excluded.
Paper info
- Authors
- Abhishek Rai
- Venue
- arXiv · Preprint
- First published
- 2026-11-14
- Added
- 2026-11-17
- Updated
- 2026-11-14
- Version
- v1
- arXiv
- 2611.19123
- Category
- cs.SE · cs.AI · cs.CL
- Original paper terms
- CC BY 4.0
- What we show
- Paper info, commentary and permitted figures from the original paper
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Abstract
Model Context Protocol (MCP) gateways manage tool catalogs for language model agents using two primary paradigms: code mode where agents write scripts against tool stubs and decision layers which are cheap routers that preselect tool subsets. Using a controlled harness across 12 servers, up to 1,958 distractor tools, and three open-weight agents including Qwen, Gemma, and Nemotron, we present a preregistered evaluation on a sealed test split to determine when each approach succeeds. Code mode substantially outperforms plain MCP, cutting token usage by 70 to 90 percent while significantly boosting utility. Declaring return-shape hints in code mode stubs is a first-order variable, swinging success by up to 39.5 points for lower-performing agents, an effect larger than adding a router. The central hypothesis that a decision layer in front of code mode beats code mode alone is not confirmed, showing minor, statistically non-significant improvements for weaker agents and a slight cost for the strongest. We publicly release our harness, a finetuned 4B tool selection model, and all evaluation traces to support robust community experimentation on local AI privacy and agent architectures.
Quote from the paper
Abhishek Rai (2026). Beyond Plain MCP: Do Decision Models and Code Mode Make Tool Use Cheaper and Faster?. arXiv:2611.19123v1. https://arxiv.org/abs/2611.19123v1
BibTeX
@misc{rai2026beyond,
title = {{Beyond Plain MCP: Do Decision Models and Code Mode Make Tool Use Cheaper and Faster?}},
author = {Abhishek Rai},
year = {2026},
eprint = {2611.19123},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2611.19123v1}
}