Skip to content
mentoor

Topic 1 of 5 · 4 min read

Workflow-level tools instead of thin API wrappers

Goal: Redesign a set of one-endpoint-per-tool definitions into fewer task-level tools and explain which agent mistakes the change prevents.

Design a tool around a task the agent is trying to finish, not around an endpoint your API happens to have. An agent has a limited context window and picks tools by reading their descriptions. Every extra tool and every extra call costs tokens and adds a chance to choose wrong.

Check yourself · 1 of 3

A server has one tool per REST endpoint. Agents often need four calls in a fixed order to finish one job. What is the best redesign?

Choose one answer

Why it matters

Wrapping a REST API one-to-one feels natural: list_users, list_events, create_event. But a human engineer can write a loop and keep results in memory. An agent that wants "find a free slot for Dana and book it" must call each tool in turn, carry every intermediate result through its own context, and decide each time what to call next. Anthropic's guide on writing tools for agents makes the same point: choose a few thoughtful tools aimed at high-impact workflows, and consolidate functionality that is always used together.

How to do it

  1. List the real tasks first. Write five to ten things users actually ask the agent to do. Ignore your endpoint list.
  2. Find call chains. If three calls always run in the same order, they are one tool.
  3. Merge reads, keep writes explicit. A tool that gathers context (schedule_find_slot) can bundle several lookups. A tool that changes something (schedule_book_slot) should stay separate, so the agent and the user can see the decision point.
  4. Drop tools nobody needs. A tool that exists only because the API has it still sits in the context and competes with the useful ones.
  5. Keep overlap low. Two tools that can both answer a request make the agent guess.

Before and after

Before, a calendar server exposes list_users, list_events, get_availability and create_event. To book a meeting the agent runs four calls and reads every user and event in its context.

After:

[
  { "name": "calendar_find_slot", "description": "Find the first time all listed people are free for a given length." },
  { "name": "calendar_book_slot", "description": "Create the event at a slot returned by calendar_find_slot." }
]

The agent makes two calls, the server does the joining, and the context holds two small results instead of four large ones.

What goes wrong

  • Too many tiny tools. The agent chooses among near-duplicates and sometimes calls the wrong one.
  • One mega-tool with a mode flag. Merging unrelated actions makes the schema hard to read and the description vague. Merge by task, not by size.
  • Hiding writes inside reads. A "find" tool that also books surprises the user and breaks approval flows.

Examples

Support desk server

A ticket server starts with get_ticket, get_customer, list_comments and get_order. Agents answer "why was this customer charged twice?" with four calls and many pasted records. Replace them with support_get_case_context(ticket_id), which returns the ticket, customer name, last five comments and linked order status in one compact result. Keep support_close_ticket separate.

Which merge is wrong

Merging search_files and delete_files into manage_files(action, ...) saves one tool but puts a destructive action behind a flag the agent can set by mistake. Merging search_files with read_file_summary is fine: both are reads that always follow each other.

Key points

  • Start from the tasks users ask for, not from the list of API endpoints.
  • Calls that always run in sequence belong in one tool that does the joining on the server.
  • Keep state-changing actions as separate, clearly named tools so the decision point stays visible.
  • Overlapping tools make the agent guess; remove tools that only exist because the API has them.
  • Merge by task, not by size: a catch-all tool with a mode flag is as hard to use as ten thin ones.

Common mistakes

  • Generating one tool per endpoint from an OpenAPI file and shipping all of them.
  • Merging reads and writes so one call can both look and change.
  • Judging a tool set by how complete the API coverage is instead of how many tasks it finishes.
  • Keeping a tool "just in case" although no task uses it.

Check yourself · 2 of 3

Which merge is a poor idea when designing MCP tools?

Choose one answer

Check yourself · 3 of 3

You are redesigning a billing MCP server. What should you do first?

Choose one answer

Practice items, not counted towards your mastery.

Start here