Topic 4 of 6 · 5 min read
Fewer, task-shaped tools
Goal: Merge a set of overlapping low-level tools into fewer task-level tools and justify each cut.
Give the agent a few tools shaped like the jobs it does, not one tool per endpoint of your API. Every tool definition costs context and adds one more choice the model can get wrong.
Check yourself · 1 of 3
Run logs show search_orders is followed by get_order on the first result almost every time. What is the best design change?
Why it matters
Wrapping a REST API one endpoint at a time is the easy first design, and it is usually the wrong one. To "schedule a meeting with Priya next week" the agent would call list_users, list_events, get_availability and create_event, carrying each large result to the next call. That is many turns, many tokens and many places to slip. Meanwhile all those definitions sit in the prompt on every request. Anthropic reports that tool definitions from several connected MCP servers can add up to a large share of the context before the agent starts work (see the advanced tool use article).
How to do it
- Start from tasks, not endpoints. List the five to ten jobs users actually give the agent. Design a tool for each job.
- Merge chained calls. If two tools are nearly always called together, with the output of one fed straight into the next, make one tool that does both.
schedule_eventcan resolve the person, check availability and create the event on the server. - Merge near-duplicates.
get_user_by_emailandget_user_by_idcan becomeget_userwith one of two parameters. - Keep tools separate when their risks differ. A read tool and a delete tool should not share a name just to save a slot (see side effects).
- For large toolsets, load lazily. When you truly need dozens or hundreds of tools (many MCP servers), use tool search or deferred loading: the agent sees a short index and loads full definitions only for tools it picks.
- Justify every cut. For each tool you remove, write why: "always called after X", "same job as Y".
Before and after
Before (7 tools): list_users, get_user, list_events, get_event, get_availability,
create_event, update_event
After (3 tools): find_people, schedule_event, reschedule_event
schedule_event(attendee_emails, duration_minutes, earliest, latest) finds a free slot and books it, returning a short confirmation with the time.
What goes wrong
- Mega-tools. One
manage_calendartool with twelve modes is a new kind of confusion. Merge by task, not by system. - Cutting needed control. If users sometimes want to inspect free slots before booking, keep an availability tool.
- Lazy loading with bad index text. Tool search only finds tools whose short names and descriptions match how the agent phrases its need.
Examples
Merging a chain
Run logs show search_customers followed by get_customer in 94 of 100 support runs, always with the first result's id.
Merge into find_customer(query) that returns name, plan, open tickets and the id. Removing one tool and one turn makes runs shorter, and the id remains for the rare follow-up call.
Deferred loading for a big toolset
An agent is connected to five MCP servers exposing 120 tools. Instead of sending all 120 definitions, the harness sends a search_tools tool plus the five most-used tools. When the agent needs "create a Stripe refund", it searches, gets the matching definition and uses it.
Check the trade: one extra step on rare tools, in exchange for a much smaller prompt on every request.
Key points
- One tool per API endpoint multiplies definitions, choices and turns; design for the agent's tasks instead.
- If two tools are almost always called back to back, merge them into one task-level tool.
- Do not merge tools with different risks: reads and destructive writes stay separate.
- A tool with a dozen modes is not consolidation; split along tasks, not along systems.
- Tool search or deferred loading keeps large toolsets out of context until a tool is actually needed.
Common mistakes
- Wrapping every API endpoint as its own tool because it is the quickest mapping.
- Merging everything into one tool with many modes, which only moves the confusion into a parameter.
- Combining a harmless read and a destructive write in one tool so the agent cannot tell the risk.
- Removing tools without reading transcripts to see which calls actually happen together.
Check yourself · 2 of 3
Why is wrapping every endpoint of a REST API as a separate tool usually a poor start?
Check yourself · 3 of 3
An agent must reach 150 tools across many MCP servers. Which approach keeps the prompt small?
Practice items, not counted towards your mastery.
Start here
- Writing effective tools for AI agents (Anthropic) (opens in a new tab)ArticleFree
Naming, namespacing, response design and evaluation loops for agent tools, from a team that builds them.
- Introducing advanced tool use (Anthropic) (opens in a new tab)ArticleFree
Tool search, programmatic calling and tool use examples for large toolsets.
- Define tools (Claude API docs) (opens in a new tab)DocsFree
How a tool definition is structured: name, description, input schema and examples.