← All writing

Designing tool calls for agents that act

The model asks. The tool decides what that request is allowed to mean.

AI agentsTool callingProduct design
A cut-paper smartphone beside a small card-index box; one card, marked with a wrench, is lifted out and tied to the phone by a thin coral thread while cards with an envelope and a calendar wait behind it.
One tool at a time, each with a clear job.

A tool call looks tidy in a transcript: a name, some arguments and a result. When the tool taps a button on a phone or deletes a contact, every part of that exchange needs design. Most of what I know about it came from building Aster, the Android companion, and the agent inside OpenAlly, and from failures where an agent did something reasonable with information that was slightly wrong. This piece keeps to the principles. They hold for any agent that’s allowed to act, and most of them match the public guidance I cite along the way.

In short

  • Treat a tool definition as an interface for a reader who never asks a follow-up question.
  • Report what actually happened, write errors as directions, and treat “unknown” as an answer.
  • Check permission where the action happens, and show people what an agent can reach.

A tool is a contract with a model that can be wrong

A tool definition sits between two very different parties. On one side is a model that reads a description and makes its best guess. On the other is software that has to be dependable, sometimes on a screen where a wrong tap sends money. The definition is the only thing they share, so I treat it like an interface for a person who reads quickly and never asks a follow-up question.

Anthropic’s engineering team makes the same point in Writing effective tools for agents. Their advice is to build a few thoughtful tools for the workflows that matter, give each one a distinct job and name parameters unambiguously, for example “user_id” rather than “user”. They also note that small refinements to a description can change results dramatically. That matched my experience. A vague sentence in a description cost more than a missing feature.

Describe what’s valid, including the either-or cases

Many schemas mark every parameter as required, and for most tools that’s a sensible default. A few tools accept one of two forms. On a phone, an agent might tap an element it has already seen on screen, or tap a position when no element fits. A schema that requires both forms rejects every valid call.

The fix is to say exactly that in the description, mark neither form as required and let the tool check the combination. When neither form arrives, the tool answers with one plain sentence saying what to send. The principle is broader than taps: the schema should describe what’s actually valid, and when it can’t, the tool should explain the rule in words the model can follow.

Accept arguments the way models write them

Models follow the schema they’re shown, but they aren’t perfectly consistent about naming. For a while in Aster, an argument spelled slightly differently from what an older part of the code expected was simply ignored. The model had chosen it carefully, and it never arrived.

I fixed it once, in a shared place, instead of teaching each tool two spellings. The rule lives in one place, and a new tool can’t forget it.

Tip

If you find yourself patching the same mismatch in several tools, that’s usually a sign it belongs one level up.

Report the outcome, not the attempt

A result that says only “success” invites the agent to assume the world changed. In Aster, screen actions report what happened afterwards: whether anything on screen changed, which app is in front and whether the screen settled. “Nothing changed” is an allowed answer. If a tap landed and nothing moved, the agent should hear that before it carries on.

The MCP tools specification supports this with structured results and optional output schemas, so a client can check a result’s shape before passing it to the model. Anthropic’s guidance points the same way from the other side: return context the agent can act on, not low-level identifiers.

Audit records follow the same rule. A log entry should record what actually happened. When a value is missing, store nothing for it rather than a plausible default, because a plausible default is the hardest kind of wrong to notice later.

Write errors as directions

An error message is part of the interface for the model, and a vague one leads to a guess. The MCP specification separates protocol errors from tool execution errors and reports the second kind inside the result, so the model can see the problem and correct itself. Anthropic goes further and suggests writing error responses that say specifically what to change.

If a model calls a tool that doesn’t exist, the reply should help it find the right one. One refusal I wrote early on told the model, and through it the phone’s owner, to look for a setting that didn’t exist. It now tells the model which piece of information from its last look at the screen to pass. That’s the actual fix, and the model can do it without bothering anyone.

Treat “unknown” as an answer

Some outcomes can’t be known. A request can time out after it has done its work, and a dropped connection doesn’t prove that nothing happened. The specification asks clients to put timeouts on tool calls. What matters is what the agent hears when one fires.

Both Aster and OpenAlly say the outcome is unknown and ask the agent to check the real state before trying again.

Watch out

On a payment screen, a blind retry is the dangerous choice. If the same request arrives twice, the second should find the first instead of acting again.

Decide permission where the action happens

Offering a tool and allowing it are separate decisions, and I enforce both. An agent is only shown the tools its role needs. Models still sometimes call a name they were never shown, so the permission check happens again at the moment of the call, and an unpermitted call is refused in plain words.

This is the “complete mediation” idea from OWASP’s guidance on excessive agency: implement authorisation in the system that performs the action, rather than relying on a model to decide whether an action is allowed. The same guidance recommends human approval for high-impact actions.

The owner decides

On a phone, high-impact actions wait for the owner instead of running, and that decision doesn’t rest with the model.

Show people what the agent can reach

The MCP specification says applications should make clear which tools are exposed to a model, show when tools are invoked and ask for confirmation where needed. Aster’s tool catalogue lists every tool an agent can call, grouped by what it touches. The owner of a phone shouldn’t have to read source code to find out what an agent could do with it.

Aster’s Permissions screen on a phone: seven of ten permissions granted, each listed with what it allows, from notifications and location to contacts, with the camera still waiting to be granted.
Aster’s permissions screen. The owner can see, line by line, what the app has been allowed to reach.

Send smaller models fewer tools

Every tool description costs context each time it’s sent. On a small model running on the device, a full tool list can fill the window before the conversation starts. Anthropic’s guidance puts it simply: more tools don’t always lead to better outcomes.

For smaller models it helps to send fewer tools. Whatever you trim, the trimming should never change what the agent is permitted to reach.

Where the fixes usually land

Looking back through these changes, the model was rarely the part that needed fixing. More often it was a schema that rejected valid calls, a result that hid what happened, or an error message that pointed somewhere unhelpful. If an agent keeps making the same mistake, read the tool definition the way the model does, quickly and literally, and the problem is often sitting there. Three ways into one Android phone covers how Aster applies the same checks on every path an agent can take.

Sources & further reading

Another question worth following?

Explore the workGet in touch

A good project often starts here.

Leave me
a what if.

All the places to find me ↗
To Satyajit

There’s an app I wish existed.

Tell me who would use it and what they are trying to do. A rough sketch is plenty to start with.

Talk to me on LinkedInLet’s follow the question.