Trail content
8 minEnglish narration, Portuguese subtitlesPodcast (RSS)
Chapters
  1. 0:00Opening
  2. 1:07The diagnosis
  3. 2:04Why it happens
  4. 3:09What it costs
  5. 4:22A challenge
  6. 5:16The treatment
  7. 7:08When to ignore
  8. 7:46Wrap-up
Transcript

Opening

An internal operations agent started with five tools. Every sprint, some team asked for one more. A year later, the list sent with every call looked like this.

Get user. Fetch user. Get user profile. Look up customer. Search users. Five tools, all saying, more or less, gets a user.

Then get account, and get account version two, described as: gets an account, new. And thirty-three more.

The trace shows the effect. A request comes in: which plan does the customer with this tax ID have?

The model calls get user, with the tax ID in the id field. Type error.

It tries search users, with the tax ID as free text. Nothing useful.

And only on the third try, it finds look up customer. Three turns, for one lookup. In this lesson, you'll learn to recognize this smell, what it really costs, and the order of work to shrink the list.

The diagnosis

Here's the shape. A simple request comes in.

The model has to pick among dozens of vaguely described options.

It picks the one whose name looks most like the request.

The result is an error, or data that doesn't help.

And after extra turns, it gets it right. Or gives up.

How do you spot it? More than fifteen or twenty tools available in the same call.

Similar names, like get something, fetch something, and something version two, with nearly identical descriptions.

One line descriptions that say what the tool does, but never when to use it.

Traces where the wrong tool gets called first, and corrected later. And tool definitions adding up to thousands of tokens on every call.

And nobody can say which tools are still used.

Why it happens

Each team adds its own. A new tool is the easiest way to give the agent a new capability, and nobody owns the whole list.

Removing feels risky. With no usage data, removing a tool might break a flow someone uses once a month.

Internal APIs become tools one by one. Each endpoint turns into a tool, named after the endpoint. The agent inherits the shape of your backend, not the shape of the task.

New versions live next to old ones. Version two came in so version one wouldn't break, and both stayed.

And connecting a tool server through MCP, the model context protocol, often exposes dozens of tools at once. The team flips the server on, and forgets to filter what the agent actually needs.

The trap for people starting out is treating more tools as more capable. The opposite is often true. Few tools, clearly distinct, beat a toolbox the model can't read in full.

What it costs

Now the cost. Accuracy first. Tool choice gets worse when the options are many, and alike. Each mistake costs an extra turn, or a wrong answer.

Then money, with illustrative numbers. Say each tool definition is about one hundred fifty tokens, and the agent makes ten thousand calls a day. With forty tools, that's about six thousand tokens per call, and about sixty million tokens a day. Just for the catalog.

With eight tools, about twelve million. And each wrong pick still pays an extra turn, with the full history again.

And security. More tools means more surface. Picture a marketplace agent with three payment tools. Pay a bank slip, send an instant payment, and wire a transfer. All three described as: pays the customer. A refund request can fire the wrong one. Now the mistake isn't just cost. Money goes down the wrong rail. And a forgotten write tool on the list is an open door. In security, this has a name. They call it excessive agency. The model has more power than the task needs.

A challenge

Here's one for you. You connected an internal product's tool server, and the agent now sees eighty tools, most of them admin. In production, a user asked for an order status, and the model called delete workspace. What does this case show, first?

That the list sent to the model is far too wide for the task, with destructive tools in the same set as simple reads. An order status doesn't need delete workspace.

It's not that the protocol is bad. It's a way to expose tools, not the cause. And blaming the user with an input filter comes second. The design already handed a destructive tool to a read task. Filter what the server exposes, consolidate, and keep side effects apart from reads.

The treatment

There are three refactorings. Consolidate tools, when there are duplicates, near twins, or tools nobody calls. It's almost always the first step.

Introduce a router, when even after consolidating there are many tools, because the agent covers several topics. Each route gets only its own tools. The orders agent doesn't need to see the HR tools.

And move instructions into the tool description, when the rules for when to use each tool live in the system prompt, far from where the model actually chooses.

In practice, the order is this. Measure usage in the traces from the last ninety days. A tool that never appears is a candidate to go.

Group tools that do the same thing with different keys. One tool, several parameters.

Rewrite each description for the moment of choice. What it does, when to use it, when not to, and what it returns.

And if the list still has more than a dozen, and the topics are distinct, route.

Back to the tax ID request. Before, forty visible tools, five of them for users, and three turns. After, eight tools, and one of them is find customer, with a key and a value. The first call uses the tax ID as the key. One turn.

And say you consolidated, and you still have twenty-eight tools, because the same agent serves HR, orders and finance. Choice is still poor on orders. Don't add a block to the system prompt saying, if the topic is orders, use only these. The model still sees all twenty-eight. The restriction has to be in the list you send, not in the prose. That's what the router does.

When to ignore

When can you ignore it? Twenty tools from different domains, with clear names and descriptions, can work fine. The smell is confusion, not the count. And the other way around, too. Eight tools, where three run the same customer lookup with different keys, is this smell.

If your provider lets the model see only an index, and load definitions on demand, the token cost goes away. The confusion between similar tools stays.

And in a prototype, starting wide to discover what the agent needs, and pruning later, is fine.

Wrap-up

So here's the idea to take with you. The model chooses from what you hand it, at the moment of choice. Hand it fewer doors, one per job, each with a sign that says when to walk through it. You get fewer turns, fewer tokens, and fewer ways to do damage.

In the next lesson, we'll do the first cut step by step: consolidate tools. See you there.

SmellBloaters

Tool Sprawl

Ferramentas Demais

Tool Sprawl is an AI code smell, a sign of trouble in LLM systems, in the Bloaters group. The agent has 40 similarly named tools and often picks the wrong one.

Element
02/37
Level
Intermediate
Read
4 min
Updated
On this page 7
  1. 01Signs and symptoms
  2. 02Reasons
  3. 03Cost of ignoring
  4. 04Treatment
  5. 05Payoff
  6. 06When to ignore
  7. 07Is it this smell?
  8. ··Quick answers

Signs and symptoms

The internal operations agent started with five tools. Every sprint, some team asked for one more. A year later, the list sent with every call had this excerpt (anonymized):

get_user(id)                 Gets a user.
fetch_user(email)            Gets a user.
get_user_profile(id)         Returns the user profile.
lookup_customer(document)    Looks up a customer.
search_users(query)          Searches users.
get_account(id)              Gets an account.
get_account_v2(id)           Gets an account (new).
...
[33 more tools]

The trace shows the effect. Request: “which plan does the customer with tax ID 123.456.789-00 have?” (a Brazilian CPF). The model called get_user with the tax ID in the id field, got a type error, tried search_users with the tax ID as free text, and only on the third try found lookup_customer. Three turns for one lookup.

Signs of Tool Sprawl:

  • More than 15 or 20 tools available in the same call.
  • Similar names, like get_x, fetch_x, and x_v2, with nearly identical descriptions.
  • One-line descriptions that say what the tool does but not when to use it.
  • The trace shows wrong tools called first and corrected later.
  • Tool definitions add up to thousands of tokens on every call.
  • Nobody can say which tools are still used.
flowchart LR
  P(["1. Request"]):::io --> M(["2. Model with 40 tools"]):::llm
  M --> W["3. Similar but wrong tool"]:::tool
  W --> E["4. Error or useless data"]:::tool
  E --> M
  M --> R["5. Right tool, late"]:::tool
  1. A simple request comes in.
  2. The model has to pick among dozens of vaguely described options.
  3. It picks the one whose name looks most like the request.
  4. The result is an error or data that does not help.
  5. After extra turns, it gets it right. Or gives up.
Check +20 XP on first tryYour agent calls get_user, fails, calls search_users, fails, then finally calls lookup_customer with the tax ID. All three descriptions say 'looks up a user'. What is the most useful diagnosis?

Reasons

  • Each team adds its own. A new tool is the easiest way to give the agent a new capability, and nobody owns the whole list.
  • Removing feels risky. With no usage traces, removing a tool might break a flow someone uses once a month.
  • Internal APIs become tools one by one. Each endpoint turns into a tool, named after the endpoint. The agent inherits the backend’s shape, not the task’s.
  • New versions live next to old ones. get_account_v2 came in so get_account would not break, and both stayed.
  • MCP (Model Context Protocol) widens the list with no review. Connecting an MCP server often exposes dozens of tools at once. The team flips the server on and forgets to filter what the agent actually needs.

The usual trap for people starting out: treating “more tools” as “more capable”. The opposite is often true. Anthropic’s “Building effective agents” (Dec 2024) recommends few tools, clearly distinct. Confusion among similar options is the cost of ignoring that.

Cost of ignoring

  • Accuracy. Tool choice gets worse when the options are many and alike. Each mistake costs an extra turn or a wrong answer.
  • Money and latency. Every definition goes out on every call. Dozens of tools add thousands of input tokens per loop turn.
  • Security. More tools means more surface. A forgotten write tool on the list is an open door. The OWASP Top 10 for LLM Applications frames this as excessive agency: the model has more power than the task needs.
  • Maintenance. Changing an internal API contract means hunting down every tool that wraps it.

A back-of-the-envelope cost

The numbers below are illustrative. Suppose each tool definition (name, parameters, description) is about 150 tokens. The agent makes 10,000 calls per day.

List Definition tokens per call Definition tokens per day
40 tools about 6,000 about 60 million
8 tools about 1,200 about 12 million

That is only the catalog. Each wrong pick still pays an extra turn, with the full history again. In the tax-ID trace, three attempts turned a cheap lookup into three calls.

Picture a Brazilian marketplace where the agent also has pagar_boleto (pay a bank slip), enviar_pix (instant payment), and transferir_ted (wire), all described as “pays the customer”. A Pix refund request can fire a bank slip instead. The mistake is no longer just cost: money goes to the wrong rail.

Treatment

Refactoring Choose it when
Consolidate Tools There are duplicated, near-identical, or unused tools. It is almost always the first step.
Introduce Router Even after consolidating, there are many tools because the agent covers several topics. Each route gets only its own, as in the Tool Router.
Move Instruction to Tool Description The rules for when to use each tool live in the system prompt, far from where the model chooses.

Practical order:

  1. Measure usage in traces from the last 90 days. A tool that never appears is a candidate to go. If the signal is “it exists but nobody calls it”, see also Unused Tools.
  2. Group tools that do the same thing with different keys. One tool, several parameters.
  3. Rewrite the description for the moment of choice: what it does, when to use it, when not to, what it returns.
  4. If the list still exceeds a dozen and the topics are distinct, route. The orders agent does not need to see HR tools.

Before and after, on the same tax-ID request:

Before After
Visible tools 40, five of them “user” 8, one of them find_customer(key, value)
First call get_user with the wrong type find_customer with key=cpf
Turns 3 1
Check +20 XP on first tryYou consolidated duplicates and still have 28 tools, because the same agent serves HR, orders, and finance. The tool-choice eval is still poor on orders. What is the next step?

Payoff

  • Fewer wrong calls and fewer turns per task.
  • Fewer input tokens on every call.
  • A list someone can read and review in ten minutes.
  • A smaller attack surface.

When to ignore

  • Very distinct, well described tools. Twenty tools from different domains, with clear names and descriptions, can work fine. The smell is confusion, not the count.
  • Provider-side tool search. If you use a mechanism where the model sees only an index and loads definitions on demand, the token cost goes away. Confusion between similar tools stays.
  • Prototype. To discover which capabilities the agent needs, starting wide and pruning later is acceptable.

Is it this smell?

Check +20 XP on first tryThe agent has 8 tools, but three of them run the same customer lookup with different keys (id, email, and tax ID). The trace shows frequent swaps between them. Is this Tool Sprawl?

Check +20 XP on first tryThe agent has 35 tools, but 30 of them have not appeared in traces for 3 months. What is the most precise diagnosis?

Check +20 XP on first tryAn agent has 12 clear tools. The system prompt has a paragraph for each saying when to use it, and the model sometimes ignores those rules. What do you do first?

Check +20 XP on first tryYou connected an internal product's MCP server and the agent now sees 80 tools, most of them admin. In production, a user asked for an order status and the model called delete_workspace. What does the case show first?

Quick answers

What is Tool Sprawl?

Tool Sprawl is an AI code smell, a sign of trouble in LLM systems, in the Bloaters group. The agent has 40 similarly named tools and often picks the wrong one.

How do you fix Tool Sprawl?

With Consolidate Tools, Introduce Router, and Move Instruction to Tool Description. Each refactoring has safe step-by-step mechanics with an eval before and after.

Where does Tool Sprawl show up in practice?

In the real-world scenarios Coding agent and Back-office automation with durable execution.

Go further

Relations

Part of the tracks 1
Search