Lecture 5 · COMS W4995 Agentic Engineering

Agent tools in pictures

Chapter five

Many tools

Why more tools can hurt, and what to try, in order, before you hand the model another one.

After this chapter you can

  1. Explain why adding tools can lower selection accuracy and raise cost, and why the published tool-count thresholds are vendor guidance rather than measured laws.
  2. Apply the order of moves (subtract and merge, group, load on demand, call from code) to a tool set, and say what each move costs.
  3. Explain why changing the tool list in the middle of a conversation can throw away the prompt cache, and describe the two vendor answers to that.
  4. Cut the context a tool result uses, and say what plain truncation loses.
  5. Design a small experiment that finds the tool-count threshold for your own setup.

22 minutes to read9 sections10 quiz questions

Start reading →

Connect five MCP servers to an agent: GitHub, Slack, Sentry, Grafana, and Splunk. Anthropic’s example uses “58 tools consuming approximately 55K tokens before the conversation even starts”14. GitHub alone includes 35 tools and about 26K tokens14. Anthropic states that internally, “we’ve seen tool definitions consume 134K tokens before optimization”14. Nobody has asked the agent anything yet. This chapter answers one question: how much should the model see at once?

Section 5.1

Why more tools hurt

Four studies of tool-set size, each with its own measure. RAG-MCP, 2025: tool selection accuracy rose from 13.62 percent with all descriptions in the prompt to 43.13 percent with a retrieved few. ToolMenuBench, 2026: task success rose from 32.1 percent with all tools visible to 85.7 percent with the paper's own filtering method, averaged across seven model backends. LongFuncEval, 2025: performance dropped by 7 to 85 percent as the number of tools grew. A 2026 shortlist study on 370 tools: showing 7 tools on average reached nearly the same coverage as showing 50, 90.3 versus 90.8 percent. RAG-MCP · 2025 Tool selection accuracy 13.62% 43.13% all descriptions in the prompt, then a retrieved few model not named in the abstract ToolMenuBench · 2026 Task success 32.1% 85.7% all tools visible, then the paper's own filter seven model backends LongFuncEval · 2025 Performance drop as tools are added 7% to 85% range across several long-context models models not named in the abstract Shortlist study · 2026 Tools shown for nearly the same coverage 50 7 coverage 90.8% versus 90.3% BFCL, 370 tools; 7 is an average
Four studies, four different measures, one direction. Each number belongs to its own benchmark and models; they are not points on one curve.

Every tool you add has two costs.

The first cost is context and money. Chapter 3 showed that tool definitions travel as ordinary text in the prompt. OpenAI explains the consequence: “callable function definitions count against the model’s context limit and are billed as input tokens”1. You pay for every definition on every turn, whether the model uses that tool or not.

The second cost is the choice itself. A 2026 study of shortlist length describes this dilemma in three sentences: “How long should that shortlist be? Show too many tools and the model struggles to choose. Show too few and the correct tool may not appear”2.

Several research groups have measured the first part of that sentence. Each group used different models, tasks, and measures. So, read every number with its specific conditions:

  • RAG-MCP (2025) retrieved the few most relevant tool descriptions before calling the model, instead of putting all of them in the prompt. It reports that this “more than triples tool selection accuracy (43.13% vs 13.62% baseline)” and cuts prompt tokens by over 50%4. The abstract does not name the model.
  • LongFuncEval (IBM, 2025) grew the catalog step by step across several long-context models and saw “a performance drop of 7% to 85% as the number of tools increases”5.
  • ToolMenuBench (2026) compared six ways of filtering the visible menu across seven model backends, three menu sizes and seven evaluation settings. Its own method, causal minimal tool filtering, raised average task success “from 32.1% under all-tools exposure to 85.7%”6.
  • Less-is-More (2024) moved the question to edge hardware: offering fewer tools cut execution time by up to 70% and power use by up to 40%7.

The effect is not the same for every model. MCPVerse (2025) found that “most models suffer performance degradation when confronted with larger tool sets”, but that agentic models such as Claude-4-Sonnet “can effectively leverage expanded exploration spaces to improve accuracy”8. LiveMCPBench (2025), with 70 servers and 527 tools, found that retrieval errors “account for nearly half of all failures”9. A bigger catalog can help an agentic model such as Claude-4-Sonnet and still hurt most others. Much of the damage happens when the model tries to find the right tool.

So, where is the line? Vendors give rules of thumb. OpenAI says: “Aim for fewer than 20 functions available at the start of a turn at any one time, though this is just a soft suggestion”1. Anthropic says: “Claude’s ability to pick the right tool degrades once you exceed 30–50 available tools”3. OpenAI’s namespace advice adds a third number: “fewer than 10 functions” per namespace10. These are three different kinds of statements about three different setups. Read them as vendor guidance for their own models, not as measured laws. ToolMenuBench varied “tool-menu size, distractor type, state-dependent task structure, and risk exposure”6; each of those changes the result. There is no universal threshold, only yours.

Check yourselfYour agent has 12 tools and works well. You add 6 more from a new MCP server. What two things can get worse, and which published number tells you if you crossed the line?

Cost, because all 18 definitions are billed as input tokens on every turn1, and selection, because the model has more options to confuse2. No published number tells you: OpenAI calls its 20 “just a soft suggestion”1, and Anthropic’s 30–50 is about Claude3. You measure it yourself, as the last section shows.

Section 5.2

Subtract first

The order of moves as a ladder, cheapest first. One, subtract and merge: costs design time. Two, group into namespaces or prefixes: costs naming discipline, and saves little until a group is deferred. Three, load on demand with tool search: costs a lookup that can miss. Four, call from code: costs a sandbox with limits and monitoring, and writes stay direct. Under all four: measure your own threshold. Move What it costs 1 Subtract and merge Design time. Drop unused tools and known arguments; merge chains. 2 Group Naming discipline. Namespaces or prefixes; saves little until deferred. 3 Load on demand A lookup that can miss. Tool search; the model must notice and find the tool. 4 Call from code A sandbox to run and secure. Good for bulk reads; writes stay as direct calls. Under every rung: measure your own threshold in the setup you will ship.
The order of moves, cheapest first, with what each one costs. This section is the first rung.

The cheapest tool is the one you never define. Before you consider search indexes or sandboxes, first remove tools.

Start by looking at arguments. OpenAI’s guide offers a small example worth remembering: “Don’t make the model fill arguments you already know. For example, if you already have an order_id based on a previous menu, don’t include an order_id parameter. Instead, define submit_refund() with no parameters and pass the order_id in your code”1. The next sentence states the second rule: “Combine functions that are always called in sequence”1. If your agent always calls get_user, then get_user_orders, then get_user_address, these three actions are effectively one tool, even if you wrote them as three separate ones.

Next, remove entire tools. The Claude Code team writes: “Claude Code currently has ~20 tools, and our team frequently revisits if we need all of them for Claude to be most effective. The bar to add a new tool is high, because this gives the model one more option to think about”11. They also remove tools that newer models no longer need: “As model capabilities increase, the tools that your models once needed might now be constraining them”11. As we saw in chapter 4, Sierra went further. They replaced the GitHub MCP server’s hundreds of tools with the gh command line and a read-only token for specific repositories13. CMU’s slides state the principle behind all of this: “Call tools only when their benefit outweighs latency, cost, failure, and risk”12.

Consider a made-up support agent with 30 tools. Eight are admin tools the support agent never uses; delete them. Three order lookups always run together; merge them into one. The refund tool asks for an order ID the application already has; remove that parameter. You are now down to about 18 tools before you write any infrastructure.

The second step is grouping. When tools belong to different systems, OpenAI suggests using namespaces: “Use namespaces to group related tools by domain, such as crm, billing, or shipping“1. They recommend keeping each namespace “to fewer than 10 functions for better token efficiency and model performance”10. Anthropic’s approach uses a naming convention: “prefix by service or resource (for example, github_, slack_) so one search matches the whole group”3. Grouping alone does not shorten the prompt. It helps when the model must first choose between systems1. It also prepares for the next step, where an entire group can be loaded at once.

What do these moves cost? Design time, and a tool set that fits your task instead of mirroring someone’s API. That is usually a price worth paying.

Check yourselfA teammate wants to add a get_weather tool to your billing agent, just in case someone asks about the weather. Based on this section, what would you say?

Leave it out. Each tool is “one more option to think about”11, and its definition is billed on every turn1. Add a tool only when its benefit outweighs its latency, cost, failure, and risk12.

Section 5.4

The cache cost of changing tools

The prompt cache follows the order tools, then system, then messages. In the first row, editing the tools at the front invalidates the cache for the tools, the system prompt and every message after it. In the second row, the tools array is unchanged and the tool change is added at the end of the conversation, so the whole earlier prefix is still a cache hit and only the new part is processed. Edit the tools array tools (edited) system messages, turns 1 to 30 Everything from the edit onward is processed again at the full input rate. Append the change at the end tools system messages, turns 1 to 30 tool added here Cache hit: the prefix is identical. Only this is new. Anthropic: tool_addition blocks. OpenAI: tool search injects discovered tools at the end.
The cached prefix runs tools, then system, then messages. An edit to the tools invalidates everything after it; appending a change later keeps the prefix.

Tools have a third cost, one that is not obvious in the bill. To see it, you need to understand what a prompt cache is.

In a long conversation, most of each request repeats the previous one. It includes the same tool definitions, the same system prompt, and the same earlier messages, with only one new message added at the end. Providers save work by storing the model’s internal state for this repeated beginning. OpenAI calls this a reusable prefix: “the unchanged tokens at the beginning of a prompt”20. Reused tokens are cheaper. OpenAI discounts them “up to 95%” and turns caching on by default for supported models20. For GPT-5.6 and later, writing the cache costs 1.25 times the normal input rate, and reading it costs 0.1 times on most models20.

The cache only works if the prefix is exactly the same. Anthropic states this: “Cache hits require 100% identical prompt segments”18. The order of elements also matters: “the cache follows the hierarchy: tools → system → messages. Changes at each level invalidate that level and all subsequent levels”18. Tool definitions come first. Anthropic’s table explains it in one line: “Modifying tool definitions (names, descriptions, parameters) invalidates the entire cache”18.

Consider what this means. Your agent is 30 turns into a task, with a long, cached history. You decide to remove a tool the agent no longer needs. This edit goes at the very front of the prefix. As a result, every token after it — the system prompt and all 30 turns — is processed again at the full rate. Saving a few hundred tokens in a definition can cost you the entire conversation’s cache.

The two major vendors address this issue the same way: put tool changes at the end of the prompt, not the front.

  • Anthropic lets you “declare the full tool set in tools up front, then use tool_addition and tool_removal blocks to offer a tool to the model, or withdraw it, from a specific point in the conversation onward. The tools array itself never changes, so the cached prefix stays intact”19. This works on a listed set of recent Claude models and “is not available on Claude Sonnet 5”19.
  • OpenAI builds the same idea into tool search: “When new tools are discovered by the model, they are injected at the end of the context window”10. The page gives the reason: tool search “is designed to preserve the model’s cache”10.

The idea is older than either product. Prompt Cache, a 2023 paper from Yale, stored the attention states of reusable “prompt modules” and reported time-to-first-token improvements “from 8× for GPU-based inference to 60× for CPU-based inference” on document question answering and recommendation workloads21. Tool lists were not among its tests21.

Check yourselfSuppose you want to give the agent a new export_csv tool only after the user has approved a report. Where should that tool appear in the request to keep the cache?

Do not edit the tools array, which “invalidates the entire cache”18. Instead, declare the tool up front and add it at that point with a tool_addition block on Anthropic19, or let OpenAI’s tool search inject it at the end of the context10.

Section 5.5

Results cost context too

Two ways to handle a long tool result. Truncation keeps only the first part in the context and throws the rest away, so data can be lost. Writing to a file keeps the whole output outside the context; the agent reads the end with tail and reads more only if it needs to. Truncate Write to a file first part, in context the rest is cut the line you needed may be here File line 1 line 2 ... last lines Context tail then read more if needed nothing is lost the agent reads only what it needs Cursor's approach. No number is published for it.
Truncating a long result throws its middle away. Writing it to a file keeps everything outside the context and lets the agent read only what it needs.

Definitions are only half of what tools put into context. Every call also returns a result. Results can be much longer than definitions.

Length hurts. LongFuncEval found “a 7% to 91% degradation in answer retrieval as the tool responses length increases”5. Anthropic’s context-engineering post names the general effect context rot: “as the number of tokens in the context window increases, the model’s ability to accurately recall information from that context decreases”23. Chroma’s 2025 report tested 18 models, including GPT-4.1, Claude 4, Gemini 2.5 and Qwen3, and found that “their performance grows increasingly unreliable as input length grows”24.

Design results the way you design definitions: return only what the next step needs. Anthropic’s tool guide suggests letting the agent choose: “You can enable both by exposing a simple response_format enum parameter in your tool, allowing your agent to control whether tools return ‘concise’ or ‘detailed’ responses”22. In its Slack example, the concise form used about a third of the tokens22. This is one example, not a general ratio. For anything that can grow, the guide recommends “some combination of pagination, range selection, filtering, and/or truncation with sensible default parameter values”, and notes: “For Claude Code, we restrict tool responses to 25,000 tokens by default”22. The same guide does not expect bigger windows to remove the problem: “We expect the effective context length of agents to grow over time, but the need for context-efficient tools to remain”22.

Truncation is the blunt tool on that list. Cursor’s engineers describe the problem: “The common approach coding agents take is to truncate long shell commands or MCP results. This can lead to data loss”16. Their fix keeps the whole result outside the context: “In Cursor, we instead write the output to a file and give the agent the ability to read it. The agent calls tail to check the end, and then read more if it needs to”16. Cursor gives no number for this change16; the 46.9% in the tool-search section belongs to a different change in the same post.

Old results also linger. Anthropic’s context-engineering post calls clearing them low-hanging fruit: “once a tool has been called deep in the message history, why would the agent need to see the raw result again?”23 Some agents make the cleanup a tool. ReSum (2025) has a web agent periodically call “an external tool to condense interaction histories into compact summaries” and reports “a 4.5% improvement over ReAct in training-free settings”, on search tasks the abstract does not name25.

Check yourselfYour search_logs tool sometimes returns 80,000 tokens of log lines. List two fixes from this section. What would plain truncation risk?

Add filtering or pagination with sensible defaults, or a concise mode the agent can choose22; or write the output to a file and let the agent read the parts it needs16. Truncation can lose data16, and the error you are looking for may be in the part you cut.

Section 5.6

Let code carry intermediate data

Chapter 4’s section on code execution showed the mechanism: the model writes one program, the program calls the tools, and intermediate results stay in a sandbox. Here is why that matters more as things grow.

When you use direct calls, every result goes through the model’s context. The context size increases with the number of calls multiplied by the size of each result. With a program, the context grows only with the size of the final answer. Anthropic describes this scaling problem clearly: “as the number of connected tools grows, loading all tool definitions upfront and passing intermediate results through the context window slows down agents and increases costs”26. Cloudflare’s post argues for this approach from the selection perspective: “If you present an LLM with too many tools, or overly complex tools, it may struggle”28.

This rung brings two costs. The first is the sandbox, with the limits and monitoring that chapter 4 described26. The second is how it interacts with the earlier rungs. OpenAI’s documentation states: “Tool search runs as a top-level Responses API tool, not from inside generated JavaScript. Function, custom, and MCP tools with defer_loading: true are not initially available to a program”27. For “Writes or approval-sensitive actions”, OpenAI’s table shows: “Use direct tool calling by default to preserve a clear authorization boundary”27. So code carries the bulk reads well, while writes stay as direct calls the harness can see and approve.

Check yourselfAn agent checks 300 open support tickets for customers who appear twice, then merges the two duplicate records it finds. As the ticket count grows, which part benefits from code, and which stays a direct call?

The 300 lookups and the comparison: with direct calls, every ticket would pass through the context; in a program only the list of duplicates does26. The merge is a write, and OpenAI keeps writes on direct calls27.

Section 5.7

Finding tools in big catalogs

MCP-Zero's routing in two stages. The agent writes a request describing the capability it lacks. The first stage matches the request to a server among many. The second stage matches it to a tool on that server. Only that tool's definition enters the context. Agent "I need to read a calendar." Stage 1 pick a server from many Stage 2 pick a tool on that server Context one tool definition Evaluated on 308 MCP servers and 2,797 tools from the official repository. The request in the first box is an illustration, not an example from the paper.
MCP-Zero’s two-stage routing. The agent describes what it lacks; the router picks a server first, then a tool.

Loading tools on demand shifts the problem. Instead of choosing from all tools in the prompt, a system must find the right few in an index. That search is a problem in itself, and research shows it is harder than it appears.

ToolRet (2025) created a benchmark of 7.6k retrieval tasks using a corpus of 43k tools30. Its finding was: “Surprisingly, even the models with strong performance in conventional IR benchmarks, exhibit poor performance on ToolRet. This low retrieval quality degrades the task pass rate of tool-use LLMs”30. It also highlighted a blind spot in many evaluations: “Most tool-use benchmarks simplify this step by manually pre-annotating a small set of relevant tools for each task, which is far from the real-world scenarios”30.

Fixed shortlists also miss hard cases. On ToolBench’s 3,251 tools (the API benchmark described at the end of this section), the 2026 shortlist study found that a fixed shortlist of 5 tools had slightly higher coverage overall than its adaptive agent, 64.7% against 61.9%, where coverage is how often the correct tool makes the list2. But the fixed list “finds nothing on hard queries (correct tool ranked 6th–20th)”, while the adaptive agent found 16.7% of them “by searching deeper”2.

Two designs give the agent more control over the search:

  • ScaleMCP (2025) gives the agent a retriever it can call again mid-conversation and keeps the tool index in sync with live MCP servers, which act as “the single source of truth”29. It was evaluated on a self-built set of 5,000 financial-metric MCP servers29.
  • MCP-Zero (2025) has the model write a structured request for the capability it lacks, then routes it in two stages, to servers and then to tools31. The authors built a set of 308 MCP servers and 2,797 tools from the official repository31. Their headline token figure comes from a different benchmark: “98% reduction in token consumption on APIBank while maintaining high accuracy”31.

Large catalogs also change over time. ToolLLM (2023) collected 16,464 real APIs from RapidAPI and paired its model with a neural API retriever32. When StableToolBench (2024) later re-ran that benchmark, it found “a notable decline in the performance of all methods over time”33. Live tools change, so a setup that scored well last month needs to be measured again.

Check yourselfYour tool search returns the top 5 matches. Users complain that one rarely used tool is never selected. What might be happening?

The correct tool might rank just below the cut-off. In the 2026 shortlist study, a fixed shortlist of 5 found nothing when the correct tool ranked 6th–20th2. You could improve that tool’s name and description, or let the agent search deeper or re-query29.

Section 5.8

Measure your own threshold

A threshold experiment as a grid. Three rows of tool sets: 3 core tools, 8 tools, and 8 tools including look-alikes. The same fixed task set runs in every row, several times each. For each run, record failures at four levels, selection, arguments, trajectory and task, plus tokens per run. Tool sets, same tasks Record each failure 3 core tools 8 tools 8 tools with look-alikes Selection Arguments Trajectory Task Tokens right tool? right values? right order? goal met? per run Your threshold: where selection or task success starts to fall, or where tokens rise faster than success. Write down model, tasks and date.
A small threshold experiment. Hold the tasks fixed, change only the tool set, repeat each run, and record where each failure happened.

Every number in this chapter comes from someone else’s model, tasks, and harness. Your threshold depends on all three. The setup alone can significantly change results.

Take one model on the Berkeley Function Calling Leaderboard snapshot of 2026-04-12. Claude-Opus-4-5-20251101 scores 77.47 overall with native function calling and 33.47 when the same model is prompted to call functions in text34. Same model, same leaderboard, a different way of asking. Format matters too: BFCL’s format-sensitivity study found that “even large LLMs (watt-tool-70B, claude-3.7-sonnet) show significant performance drops when return format is in XML format”35. Chapter 8 returns to how setup shapes results. For this chapter, the lesson is narrow: measure in the setup you will ship.

A threshold experiment requires four elements.

  1. Fixed tasks. Use the same set of tasks for every condition, with known correct tool calls.
  2. One variable. Change only the tool set. For example, run your 3 core tools, then a set of 8, then a set of 8 that includes a few look-alikes. ToolMenuBench varied “distractor type” alongside menu size6; include look-alikes as one condition.
  3. Repeats. Run each task multiple times per condition. A single run can be due to luck.
  4. Failure levels. Record where each failure occurred. CMU’s slides divide evaluation into four levels: selection (“Right tool?”), arguments (“Right values?”), trajectory (“Right order?”), and task (“Goal achieved?”)12. Also record tokens per run.

One more correction helps you make fair comparisons between shortlists of different lengths. The shortlist study notes that “Most systems apply a fixed shortlist size to every query, but no standard metric exists to evaluate whether that size was appropriate”2. Their method corrects for chance, because a longer list will find the right tool more often just by luck2. On BFCL’s 370 tools, their learned policy “nearly matches the coverage of showing 50 tools (90.3% vs 90.8%) while presenting only 7 on average”2.

Your threshold is the tool count where selection or task success begins to decline, or where tokens increase faster than success does. Document this threshold with your model, tasks, and the date. It will change when any of these factors change.

Check yourselfYour Studio tool server has 3 tools, and the agent picks the correct one every time. A teammate wants to add 5 more tools. What do you run before agreeing?

The same task set with 3 tools and with 8, several runs each, recording selection, argument, trajectory and task failures12 and tokens per run. Include tools that look like your existing ones, since distractor type changes results6.

Before you go on

Close the book

  1. List the four moves in order without looking back: subtract and merge, group, load on demand, call from code. For each move, state its cost.
  2. Explain to a classmate why removing a tool in the middle of a long conversation might cost more than keeping it. What are the two vendor answers to this?
  3. Look at your Studio tool server. Which of its tools could you merge or drop? Which result could be shorter? What experiment would tell you how many tools it can carry?

Chapter five · quiz

Test yourself

Most questions have more than one right answer, so select every option that is true. Check each question, then open “Answer and why” for the reasoning.

Question 1Which statements about adding tools are supported by this chapter?Select all that apply.
Answer and why
  • RightEvery tool definition is billed as input tokens, whether the model uses that tool or not. Definitions count against the context limit and are billed as input tokens1.
  • RightSeveral studies found selection or task success improved when the model saw fewer tools. RAG-MCP and ToolMenuBench both report large gains from showing a filtered set4,6.
  • WrongA bigger catalog lowers accuracy for every model. MCPVerse found agentic models such as Claude-4-Sonnet improved with a larger space8.
  • RightRetrieval errors can be a large share of failures in multi-server settings. LiveMCPBench attributes nearly half of all failures to retrieval errors9.
  • WrongSelection accuracy is unaffected by how similar the tools are. ToolMenuBench varies distractor type because it changes results6.
Question 2OpenAI suggests fewer than 20 functions and Anthropic mentions 30–50 tools. What is the best way to treat these numbers for your own agent?Select one.
Answer and why
  • RightAs vendor guidance for their own models, to be checked with your own measurement. OpenAI calls its number ‘just a soft suggestion’1; Anthropic’s is about Claude3.
  • WrongAs a law: above 20 tools accuracy always falls. The guide itself calls it a soft suggestion1.
  • WrongAs the average of the published research studies. The studies use different models and measures5,6; the vendor numbers are guidance on the vendors’ own pages1,3.
  • WrongAs a hard API limit that rejects longer tool lists. Claude Code, for example, sets no fixed per-server tool cap15.
Question 3A support agent has 30 tools. Which of these are ‘subtract first’ moves?Select all that apply.
Answer and why
  • RightRemove admin tools the agent never calls. Each tool is one more option to think about11.
  • RightMerge three lookups that are always called in sequence into one tool. OpenAI: combine functions that are always called in sequence1.
  • RightDrop an order_id parameter the application already knows. Don’t make the model fill arguments you already know1.
  • WrongMark all 30 tools defer_loading: true. That is load on demand, a later and more expensive rung14.
  • WrongMove the tools into a sandbox and let the model call them from code. That is the code rung, which needs a secure sandbox26.
Question 4Match each move to a cost it brings. Which pairings are correct?Select all that apply.
Answer and why
  • RightLoad on demand: the model must find the tool, and the search can miss. Retrieval errors cause nearly half of LiveMCPBench’s failures9.
  • RightCall from code: you must run a sandbox with limits and monitoring. Agent-written code needs sandboxing, resource limits and monitoring26.
  • RightSubtract and merge: design time and a tool set that fits your task. This is the cheapest rung; it changes your definitions, not your infrastructure.
  • WrongGroup into namespaces: the prompt automatically gets much shorter. Grouping organizes tools; savings come when a group is deferred10.
  • WrongLoad on demand: approval is turned off for deferred tools. Deferral and approval are separate settings; one OpenAI example happens to set both17.
Question 5Cursor reports a 46.9% cut in total agent tokens. Which change was that number measured for?Select all that apply.
Answer and why
  • RightShowing MCP tools by name only and letting the agent look them up when needed. Measured in an A/B test of runs that called an MCP tool16.
  • WrongWriting long outputs to files instead of truncating them. Same post, different change, and it has no number16.
  • WrongClearing old tool results from the history. That is Anthropic’s context-engineering advice, with no such figure23.
  • WrongLetting the model call tools from code. The 46.9% is attached to the name-only MCP change, not to code execution16.
  • WrongEvery Cursor run, whether or not it used MCP. The figure is for runs that called an MCP tool, with high variance by number of MCPs installed16.
Question 6An agent is 40 turns into a cached conversation on Anthropic’s API. Which actions keep the cached prefix?Select all that apply.
Answer and why
  • RightAppending the next user message. Earlier segments stay identical, and caching resumes from a matching prefix18.
  • RightAdding a tool with a tool_addition block, when it was declared up front. The tools array never changes, so the cached prefix stays intact19.
  • WrongEditing one tool’s description in the tools array. Modifying tool definitions invalidates the entire cache18.
  • WrongRemoving an unused tool from the tools array. Tools come first in the hierarchy, so the change invalidates everything after it18.
  • WrongEditing the top-level system field. That changes the beginning of the prompt and invalidates what follows19.
Question 7Why can a small change to the tool list be expensive?Select all that apply.
Answer and why
  • RightCached input is much cheaper than uncached input. OpenAI discounts cached input up to 95%20.
  • RightTool definitions sit at the front of the cached prefix. The hierarchy is tools, then system, then messages18.
  • RightA cache hit needs an identical prefix. Cache hits require 100% identical prompt segments18.
  • RightOn OpenAI, caching may be saving you money even if you never turned it on. OpenAI enables prompt caching by default for supported models20.
  • WrongProviders bill a penalty fee for every tool change. The cost is losing the cache discount, not a separate fee20.
Question 8A log-search tool returns 80,000 tokens. Which changes reduce the context it uses without silently losing data?Select all that apply.
Answer and why
  • RightAdd filtering or pagination with sensible defaults. Anthropic recommends pagination, range selection, filtering and truncation with sensible defaults22.
  • RightWrite the output to a file and let the agent read parts of it. Cursor writes long outputs to files and lets the agent read more as needed16.
  • RightOffer a concise response mode the agent can choose. A response_format parameter let one example use about a third of the tokens22.
  • WrongCut every result at the first 2,000 tokens. Truncating long results can lead to data loss16.
  • WrongKeep raw results in the history forever so the agent can reread them. Anthropic suggests clearing old raw results deep in the history23.
Question 9A teammate says long tool results are harmless because the model has a huge context window. Which findings answer that?Select all that apply.
Answer and why
  • RightLongFuncEval saw large drops in answer retrieval as tool responses grew. It reports a 7% to 91% degradation as response length increases5.
  • RightChroma found performance grows increasingly unreliable as input length grows. Tested across 18 models24.
  • WrongNeedle-in-a-haystack scores prove long contexts are used uniformly. Chroma argues near-perfect needle scores hide non-uniform use24.
  • RightAnthropic expects context windows to grow but the need for context-efficient tools to remain, and caps Claude Code’s tool responses at 25,000 tokens. Its tool guide says both22.
Question 10You design an experiment to find how many tools your agent can carry. Which design choices belong in it?Select all that apply.
Answer and why
  • RightKeep the task set fixed and change only the tool set. Otherwise you cannot tell what moved the result.
  • RightInclude look-alike tools in one condition. ToolMenuBench varies distractor type because it changes results6.
  • RightRecord failures at the selection, arguments, trajectory and task levels. CMU’s four levels of evaluation12.
  • WrongRun the experiment with prompt-based calling even if you ship native function calling. The same model scored 77.47 native and 33.47 prompted on one leaderboard snapshot34.
  • WrongRun each condition once to save cost. One run can be luck; repeat each task several times.
  • WrongAdopt the threshold you find for every future model. Results depend on model and setup34,35; re-measure when they change.

Sources

  1. OpenAI Function Calling Guide. OpenAI. developers.openai.com/api/docs/guides/function-calling ↗
  2. How Many Tools Should an LLM Agent See? A Chance-Corrected Answer. Repantis et al., Meta Platforms (arXiv). arxiv.org/abs/2605.24660 ↗
  3. Tool search tool - Claude Platform Docs. Anthropic. platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool ↗
  4. RAG-MCP: Mitigating Prompt Bloat in LLM Tool Selection via Retrieval-Augmented Generation [round-1 C18]. Gan & Sun (arXiv). arxiv.org/abs/2505.03275 ↗
  5. LongFuncEval: Measuring the effectiveness of long context models for function calling (abstract). arXiv (Kate et al., IBM Research). arxiv.org/abs/2505.10570 ↗
  6. ToolMenuBench: Benchmarking Tool-Menu Filtering Strategies for Reliable and Efficient LLM Agents. arXiv (Suresh Babu & Ganesh Iyer; authors state personal capacity). arxiv.org/abs/2606.15508 ↗
  7. Less is More: Optimizing Function Calling for LLM Execution on Edge Devices (abstract). arXiv (Paramanayakam et al.). arxiv.org/abs/2411.15399 ↗
  8. MCPVerse: An Expansive, Real-World Benchmark for Agentic Tool Use. arXiv (Lei et al.). arxiv.org/abs/2508.16260 ↗
  9. LiveMCPBench: Can Agents Navigate an Ocean of MCP Tools?. arXiv (Mo et al., ICIP-CAS). arxiv.org/abs/2508.01780 ↗
  10. Tool search | OpenAI API. OpenAI. developers.openai.com/api/docs/guides/tools-tool-search ↗
  11. Seeing like an agent. Anthropic (Thariq Shihipar). claude.com/blog/seeing-like-an-agent ↗
  12. Tool Use for Language Model Agents (Lecture 2 slides). CMU LTI / Graham Neubig. www.cmu-agents.com/slides/lecture-02-tool-use.pdf ↗
  13. Building Sierra's MCP Gateway: An engineering iceberg. Sierra (Mihai Parparita). sierra.ai/blog/building-sierras-mcp-gateway-an-engineering-iceberg ↗
  14. Introducing advanced tool use on the Claude Developer Platform. Anthropic. www.anthropic.com/engineering/advanced-tool-use ↗
  15. Connect Claude Code to tools via MCP - Claude Code Docs. Anthropic. code.claude.com/docs/en/mcp ↗
  16. Dynamic context discovery · Cursor. Cursor (Anysphere). cursor.com/blog/dynamic-context-discovery ↗
  17. MCP servers. OpenAI. developers.openai.com/api/docs/guides/tools-connectors-mcp ↗
  18. Prompt caching - Claude Platform Docs. Anthropic. platform.claude.com/docs/en/build-with-claude/prompt-caching ↗
  19. Mid-conversation system messages and tool changes - Claude Platform Docs. Anthropic. platform.claude.com/docs/en/build-with-claude/mid-conversation-system-messages ↗
  20. Prompt caching | OpenAI API. OpenAI. developers.openai.com/api/docs/guides/prompt-caching ↗
  21. Prompt Cache. arxiv.org/abs/2311.04934 ↗
  22. Writing effective tools for AI agents—using AI agents. Anthropic. www.anthropic.com/engineering/writing-tools-for-agents ↗
  23. Rajasekaran et al. "Effective Context Engineering for AI Agents." Anthropic (2025).. www.anthropic.com/engineering/effective-context-engineering-for-ai-agents ↗
  24. Context Rot: How Increasing Input Tokens Impacts LLM Performance. Chroma Research (2025). research.trychroma.com/context-rot ↗
  25. ReSum. arxiv.org/abs/2509.13313 ↗
  26. Code execution with MCP. Anthropic. www.anthropic.com/engineering/code-execution-with-mcp ↗
  27. Programmatic Tool Calling. OpenAI. developers.openai.com/api/docs/guides/tools-programmatic-tool-calling ↗
  28. Code Mode. Cloudflare. blog.cloudflare.com/code-mode ↗
  29. ScaleMCP: Dynamic and Auto-Synchronizing Model Context Protocol Tools for LLM Agents. arXiv (Lumer et al.). arxiv.org/abs/2505.06416 ↗
  30. Retrieval Models Aren't Tool-Savvy: Benchmarking Tool Retrieval for Large Language Models (ToolRet). arXiv (Shi et al.). arxiv.org/abs/2503.01763 ↗
  31. MCP-Zero: Active Tool Discovery for Autonomous LLM Agents. arXiv (Fei et al.). arxiv.org/abs/2506.01056 ↗
  32. ToolLLM: Facilitating Large Language Models to Master 16000+ Real-world APIs (abstract). arXiv (Qin et al.; ICLR 2024). arxiv.org/abs/2307.16789 ↗
  33. StableToolBench: Towards Stable Large-Scale Benchmarking on Tool Learning of LLMs. Guo et al.. arxiv.org/abs/2403.07714 ↗
  34. Berkeley Function Calling Leaderboard (BFCL) V4. UC Berkeley Gorilla project. gorilla.cs.berkeley.edu/leaderboard.html ↗
  35. BFCL V4. Format Sensitivity. gorilla.cs.berkeley.edu/blogs/17_bfcl_v4_prompt_variation.html ↗