Skip to content

Building with agents, lesson 3.2

Designing tools an agent can use well

A model chooses and uses a tool from a few words and whatever comes back. This lesson walks through how to design tools around the job, with names, answers and errors a model can use well.

What do you run?

Every example below changes to fit what you pick. The businesses are made up for teaching.

The picture, one step at a time

Each box is one stage. The picture lights up as you scroll.

Step 1 of 6

A tool is a note to a model

The model never sees your code. It sees each tool's name, its description and the inputs it takes, and picks from those words alone. So every tool you build for your support agent is really a short piece of writing, aimed at a reader with no other context.

Step 2 of 6

Start from the job, not your system

The easy way is to make one tool for each thing your system can already do. That hands the agent all the joining-up. Build tools for the jobs it actually does instead, even if one tool does several things inside. Fewer, better tools beat a long list.

Anthropic's September 2025 guide warns against tools that "merely wrap existing software functionality or API endpoints". Its example: a search_contacts tool, not list_contacts, and one schedule_event tool that finds a slot and books it.

Step 3 of 6

Name it, describe it, and ask for little

Write the description as you would for a new colleague: what it does, when to use it, and what comes back. Ask for as few inputs as possible, each named for what it is. customer_email beats q, and user_id beats user. Mark which inputs are required.

Anthropic reports that careful changes to tool descriptions alone helped one of its models reach the top score of the time on SWE-bench Verified, a test of fixing real code bugs.

Step 4 of 6

Answer with what the job needs

Everything a tool returns is read by the model and paid for. Return names, not long codes the model cannot interpret. Keep answers short by default, with a way to ask for more detail. Page, filter or cut anything that could run long.

The same guide says that Claude Code limits a tool's answer to 25,000 tokens by default, and that swapping long IDs for plain names made the model more precise.

Step 5 of 6

Errors that teach

A tool will be called wrongly. What matters is what happens next. An error that says what was wrong and what to send instead lets the model fix the call itself. An error code or a stack trace leaves it guessing, or trying the same thing again.

The MCP specification marks these as tool errors (isError: true) and says they should be passed back to the model so it can self-correct. Its example: "Invalid departure date: must be in the future."

Which error helps the model most?

Step 6 of 6

Test with real tasks

You cannot tell from the code whether a model will use a tool well. Write ten real tasks, run them through an agent, and read the record of each run: which tool it picked, what it sent, and where it went wrong. Fix the words, and run the same tasks again.

The agent keeps picking the wrong one of two similar tools. What do you change first?

What would you fix?

Here are four tools that trip up the agent in your business. Sort each one into the fix it needs.

  1. 1The only way to find a customer's order is list_all_orders. The agent reads through thousands to find one.

  2. 2A tool is called process, and its description says "handles order stuff". The agent calls it for everything.

  3. 3get_order returns 40 fields, including warehouse codes and long IDs. The agent quotes a warehouse code to a customer.

  4. 4track_parcel fails with "Error 422" and the agent tries the same call 14 times.

0 of 4 right so far, 4 to go.

A starter MCP server

This is what you keep: the steps for building your first server, in order. The downloadable starter follows them.

A starter MCP server

  1. List the five jobs an agent does most in your system. Make one tool for each job, not one for each endpoint.
  2. Give each tool a plain name and a description for a new colleague: what it does, when to use it, what it returns.
  3. Name every input for what it is, like customer_email, and mark which ones are required.
  4. Return names and short summaries, not raw codes or full records. Page or trim anything that could run long.
  5. When a call fails, mark it as an error and say what was wrong and what to send instead.
  6. Before you rely on it, run ten real tasks through an agent and read which tool it picked each time.

If a new colleague could not pick the right tool from its name and description alone, neither can the model.

Next: Lesson 4.1: What skills are. How to package a way of doing a job so an agent loads it only when the job needs it.