Does dynamic tool discovery break prompt caching benefits?
When agentic systems discover tools dynamically through protocols like MCP, does the changing tool set invalidate cached prompt prefixes? Understanding this matters for cost-conscious production workflows.
Beyond its headline cost numbers, "Don't Break the Cache" identifies a second, architectural cause of lost cache benefit: "dynamic function calling can break the cache when tool definitions change between requests." It names the Model Context Protocol (MCP) specifically — "modern agentic systems increasingly leverage dynamic tool discovery through protocols such as [MCP], where available tools may vary based on connected servers or runtime context" — and states the fix as "a practical strategy is to maintain a fixed set of general-purpose, reusable functions while implementing dynamic capabilities through code generation rather than traditional function calling."
The mechanism follows directly from how prompt caching works: a cache hit requires the new request's prefix to match a previously cached prefix token-for-token. When tool definitions are serialized into that prefix and the available tool set shifts — because an MCP server was added, dropped, or returned a different manifest — the prefix no longer matches, and the cache breaks for that request. The same logic indicts common context-hygiene practices: "techniques such as summarizing or pruning old tool calls... break cached representations, making tool call caching counterproductive." Context management and cache preservation pull in opposite directions once a session is long enough to want both.
This gives Why do protocol-based tool integrations fail in production workflows? a second, independent reason to avoid MCP in production: that note's case was reliability (MCP's protocol-metadata reasoning produced ambiguous tool selection and non-reproducible failures), argued from a podcast-generation workflow with no caching angle. This paper's case is cost (MCP's variable tool manifests invalidate the cached prefix), argued from controlled caching measurements with no reliability angle. The two papers reach the same prescription — fixed, explicit functions over protocol-mediated discovery — from mechanisms that do not overlap, which is a stronger basis for the prescription than either paper alone. It is the direct companion to Does prompt caching actually reduce agentic LLM costs?, which covers this paper's cost/latency headline.
The excerpt does not isolate how much of the 41-80% cost range or 13-31% TTFT range is attributable to dynamic tool discovery specifically, as opposed to other cache-breaking content (timestamps, session identifiers, pruned history) — the fixed-functions-plus-code-generation recommendation is presented as a design heuristic that follows from the caching mechanism, not as a separately ablated result. It likewise does not report having tested code generation as a dynamic-capability substitute; it is proposed, not measured, in this excerpt. The implication holds at the strength of a mechanism-based argument: any practice that varies the tool set or prunes tool-call history across requests trades cache yield for that practice's own benefit, and the trade should be made deliberately rather than by default.
Inquiring lines that read this note 7
This note is a source for these research framings, grouped by the broader line of inquiry each explores. Scan the bold lines of inquiry; follow any specific question forward.
How should context management strategies balance efficiency with agent reliability?- Why does context pruning and tool summarization break cached prompt representations?
- Do cache benefits hold with different system prompt sizes and tool counts?
- Which caching strategy works best for coding agents and support tasks?
- Why does dynamic tool discovery break prompt cache reuse in agentic systems?
Related concepts in this collection 4
This note in its neighbourhood — explore the map, then jump to a related concept in the list below.
Click a node to walk · click center to open · click Open in graph to see this note in the full knowledge graph
-
Why do protocol-based tool integrations fail in production workflows?
Explores whether standardized tool protocols like MCP introduce non-determinism that undermines agent reliability, and what causes ambiguous tool selection in production systems.
same prescription (fixed functions over MCP), reached from an independent mechanism: reliability there, cache cost here
-
Does prompt caching actually reduce agentic LLM costs?
Explores whether prompt caching—reusing computed attention tensors across repeated prompt prefixes—delivers claimed cost and latency gains across major LLM providers, and whether naive implementation strategies backfire.
sibling note: the same paper's quantified cost and latency headline, of which this is the tool-calling-architecture mechanism
-
Can an external manager handle context for frozen agents?
Exploring whether a separate trained system can effectively manage a frozen agent's context window. This matters because many deployed agents are closed-source and can't be retrained, yet they suffer from context degradation.
qualifies: learned context compression is also a pruning strategy, so its gains should be weighed against the cache-breaking cost this note describes
-
Can models decide better than retrievers which tools to use?
Traditional retrieval picks tools upfront based on initial queries, but do models themselves make better decisions about tool needs as they reason? This explores whether authority over tool selection should move from external systems to the LLM.
Contradicts A's fixed-function fix: B recommends more dynamic, iterative model-driven tool retrieval instead of passive single-round retrieval for multi-step tasks
Related papers in this collection 8
Papers most semantically related to this note, ranked by cosine similarity in the embedding space.
- Don't Break the Cache: An Evaluation of Prompt Caching for Long-Horizon Agentic Tasks
- Towards a Science of Scaling Agent Systems
- LiveMCP-101: Stress Testing and Diagnosing MCP-enabled Agents on Challenging Queries
- A Practical Guide for Designing, Developing, and Deploying Production-Grade Agentic AI Workflows
- MCP-Zero: Proactive Toolchain Construction for LLM Agents from Scratch
- AgentFly: Fine-tuning LLM Agents without Fine-tuning LLMs
- Dynamic Prompting: A Unified Framework for Prompt Tuning
- LMCache: An Efficient KV Cache Layer for Enterprise-Scale LLM Inference
Original note title
dynamic tool discovery through MCP breaks prompt cache reuse in agentic systems — fixed function sets with code generation preserve it