On this page
- Key takeaways
- What the agent-computer interface is
- Principle 1: Design around tasks, not endpoints
- Principle 2: Names and descriptions are prompts
- Principle 3: Make parameters hard to get wrong
- Principle 4: Return what the agent needs, not what the API returns
- Principle 5: Write errors the agent can act on
- Principle 6: Build safety into the tool
- Principle 7: Test tools like you test prompts
- Distributing tools with MCP
- A tool review checklist
- FAQ
- Working with TechnoKeen
The tools you give an agent shape its behavior more than almost any prompt you write. A tool’s name, description, parameters, and response format are the agent-computer interface: the only way the model can perceive and change your systems. Design that interface for a capable reader who has no memory of your codebase and no way to ask clarifying questions, and the agent becomes far more reliable.
Key takeaways
- Design tools around the tasks an agent performs, not around your existing API endpoints. Fewer, higher-level tools usually beat many thin wrappers.
- Tool names, descriptions, and parameter docs are prompts. Write them with the same care, and test them the same way.
- Return only what the agent needs, in a form it can act on: meaningful fields, readable identifiers, and truncation with guidance.
- Error messages should tell the agent what to do next, not just what went wrong.
- Separate reads from writes, make writes idempotent, and enforce permissions in the tool, never in the prompt.
What the agent-computer interface is
Developers get documentation, autocomplete, type errors, and colleagues to ask. An agent gets a JSON schema and a few sentences of description, plus whatever the tool returns when called.
Anthropic’s Building effective agents makes the point directly: invest as much effort in the agent-computer interface (ACI) as teams typically invest in human-computer interfaces. The guide notes that, on its coding agent work, the team spent more time optimizing tools than the overall prompt. That matches what we see. When an agent misbehaves, the cause is often a tool that was ambiguous, too granular, or returned the wrong information.
If you are still deciding whether you need an autonomous agent or a workflow, start with Workflows vs. Agents: Six Architecture Patterns That Actually Ship. Tool design matters in both, but agents depend on it most.
Principle 1: Design around tasks, not endpoints
The fastest way to build tools is to wrap every API endpoint one-to-one. It is also the fastest way to get an agent that wastes steps and makes mistakes.
Consider a scheduling assistant. A thin wrapper approach exposes list_users, get_user_calendar, list_rooms, get_room_availability, and create_event. To book a meeting, the agent must call four or five tools, hold all the intermediate results in context, compute overlaps itself, and hope it does not drop an attendee. A task-shaped design exposes find_meeting_slots(attendees, duration, window) and book_meeting(slot_id, title, attendees). The overlap logic lives in code, where it is deterministic and testable.
Ask of every tool: what would a competent person want to do in one action here? That is usually the right granularity.
A related rule: keep the toolset small and non-overlapping. If two tools could plausibly serve the same request, the agent will sometimes pick the wrong one. Merge them, or make the distinction explicit in both names and descriptions.
Principle 2: Names and descriptions are prompts
The model chooses tools based on their names and descriptions. Write them as if onboarding a sharp new hire who will never get to ask you a question.
A good description covers:
- What the tool does, in one plain sentence.
- When to use it, and when to use a different tool instead.
- What it returns, at a high level.
- Important constraints, such as rate limits, required formats, or side effects.
Use consistent, namespaced names when tools come from different systems: crm_search_contacts and billing_search_invoices are clearer than two tools both called search. Use verbs that signal side effects: get_ and search_ for reads, create_, update_, and cancel_ for writes.
| Weak definition | Stronger definition |
|---|---|
search(q): “Searches.” |
crm_search_contacts(query, limit): “Find contacts by name, email, or company. Use for people lookups; use crm_search_accounts for companies.” |
update(id, data) with a free-form object |
update_ticket_status(ticket_id, status, note) with status as an enum |
date parameter with no format |
start_date: “ISO 8601 date, e.g. 2026-03-09. Interpreted in the account’s timezone.” |
user parameter accepting name or ID |
user_id: “Internal ID like usr_8f2k. Use crm_search_contacts to find it.” |
| Returns raw API payload | Returns only fields the agent needs, with readable labels |
Principle 3: Make parameters hard to get wrong
Every ambiguity in a parameter is a chance for the model to guess. Remove the guesswork.
- Use enums for any field with a fixed set of values. Do not ask the model to remember that status codes are lowercase.
- Prefer explicit formats. Specify date formats, currency units, and whether amounts are in minor units such as cents.
- Require what matters. Make essential parameters required instead of relying on defaults the agent cannot see.
- Avoid formats that are hard to produce. Asking the model to emit a precise diff with correct line counts, or JSON nested inside a string, invites errors. Anthropic’s guide gives the example of switching a coding tool from relative to absolute file paths after the agent kept making mistakes with relative paths.
- Design out mistakes. If a combination of parameters is invalid, consider splitting it into two tools rather than documenting the rule and hoping.
Principle 4: Return what the agent needs, not what the API returns
Tool responses go straight into the context window. Every irrelevant field costs tokens and dilutes attention. Raw API payloads, with internal IDs, nested metadata, and fields the agent will never use, are the most common offender.
Good responses are:
- Selective. Return the fields relevant to the task.
- Readable. Prefer names and labels over opaque UUIDs where possible, and include the ID only when the agent needs it for a follow-up call.
- Bounded. Paginate or truncate large results, and say so in the response so the agent knows to narrow its query.
- Actionable. If a result implies a next step, the response can hint at it.
Here is a TypeScript tool that applies these principles, using Zod for input validation:
import { z } from "zod";
const SearchInvoicesInput = z.object({
customer_id: z.string().regex(/^cus_[a-z0-9]+$/, "Expected an ID like cus_a1b2c3"),
status: z.enum(["open", "paid", "overdue", "void"]).optional(),
limit: z.number().int().min(1).max(25).default(10),
});
export const searchInvoicesTool = {
name: "billing_search_invoices",
description:
"Find invoices for one customer, newest first. Use this to answer questions about " +
"balances, payment status, or specific charges. Requires a customer_id; if you only " +
"have a company name, call crm_search_accounts first. Read-only.",
input_schema: {
type: "object",
properties: {
customer_id: { type: "string", description: "Customer ID, e.g. cus_a1b2c3." },
status: {
type: "string",
enum: ["open", "paid", "overdue", "void"],
description: "Optional filter. Omit to return all statuses.",
},
limit: { type: "integer", minimum: 1, maximum: 25, description: "Default 10." },
},
required: ["customer_id"],
},
async run(rawInput: unknown, ctx: { billing: BillingClient }): Promise<string> {
const parsed = SearchInvoicesInput.safeParse(rawInput);
if (!parsed.success) {
return `Invalid input: ${parsed.error.issues.map((i) => i.message).join("; ")}`;
}
const { customer_id, status, limit } = parsed.data;
const page = await ctx.billing.listInvoices({ customer_id, status, limit: limit + 1 });
if (page.length === 0) {
return status
? `No ${status} invoices for ${customer_id}. Try again without the status filter.`
: `No invoices found for ${customer_id}. Confirm the ID with crm_search_accounts.`;
}
const shown = page.slice(0, limit);
const lines = shown.map(
(inv) =>
`${inv.number} | ${inv.status} | ${formatMoney(inv.amount_due_minor, inv.currency)} ` +
`due ${inv.due_date}${inv.status === "overdue" ? ` (${inv.days_overdue} days overdue)` : ""}`,
);
const more =
page.length > limit ? `\nMore invoices exist. Narrow with status or raise limit (max 25).` : "";
return `Invoices for ${customer_id} (newest first):\n${lines.join("\n")}${more}`;
},
};
Notice what the tool does on the agent’s behalf. It validates the ID format, converts minor currency units into a readable amount, computes days overdue so the model does not have to, and tells the agent what to try when results are empty or truncated. Each of those decisions removes a step where the model could go wrong. (BillingClient and formatMoney stand in for your own code.)
Principle 5: Write errors the agent can act on
Agents read error messages and try to recover. A stack trace or 400 Bad Request gives them nothing to work with, so they retry the same call or give up.
A good error message says what was wrong and what to do instead:
- Weak:
Error: invalid date - Strong:
start_date "03/09/2026" is not ISO 8601. Use YYYY-MM-DD, e.g. 2026-03-09.
Distinguish errors the agent can fix (bad input, missing prerequisite) from errors it cannot (service down, permission denied). For the second kind, tell it plainly to stop and escalate rather than retry. That one line prevents many expensive loops.
Principle 6: Build safety into the tool
Tools are where an agent’s decisions become real-world effects, so they are where safety controls belong. Instructions in a system prompt are guidance; checks in tool code are enforcement.
- Separate reads from writes. Give read and write operations different tools, so you can grant read access broadly and write access narrowly.
- Scope credentials per tool and per user. A tool should act with the permissions of the user on whose behalf the agent is working, not with a shared admin key.
- Make writes idempotent. Accept an idempotency key on create and update operations so a retried call does not double-charge or duplicate a ticket.
- Offer a dry run for consequential actions. Let the agent preview the effect of a bulk update before committing.
- Gate irreversible actions. Refunds above a threshold, deletions, and external emails can return a pending-approval status instead of executing immediately.
- Enforce limits in code. Maximum refund amounts, rate limits, and allowed recipients belong in the tool, where a manipulated prompt cannot change them.
- Treat tool output as untrusted. A tool that fetches web pages, emails, or documents may return text containing instructions aimed at the agent. Mark it clearly as data, and never let it expand the agent’s permissions.
The OWASP Top 10 for LLM Applications lists excessive agency and prompt injection among the leading risks for LLM systems, and both are mitigated primarily at the tool layer. We cover the threat model in depth in Securing AI Agents: Prompt Injection, Tool Abuse, and Least Privilege.
Principle 7: Test tools like you test prompts
You cannot judge a tool definition by reading it. You have to watch an agent use it.
- Read transcripts. Run realistic tasks and read exactly which tools the agent chose, with which arguments, and how it reacted to responses. Patterns of misuse show up fast.
- Build tool-focused evals. Include cases where the right answer is a specific tool with specific arguments, and cases where the right answer is not to call a tool at all.
- Track tool-level metrics in production. Error rate per tool, average calls per task, and how often a tool’s output is followed by a retry are strong signals of a confusing interface.
- Change one thing at a time. When you revise a description or schema, rerun the eval set and compare.
For a broader treatment of measurement, see How to Evaluate AI Agents: Metrics, Evals, and Benchmarks.
Distributing tools with MCP
Once you have well-designed tools, you will want to reuse them across agents and clients. The Model Context Protocol is an open standard for exposing tools, resources, and prompts to any compatible client through a server. Every principle in this post applies unchanged to MCP tools: the server still provides a name, a description, and an input schema, and the model still depends on their quality.
MCP is a delivery mechanism: you still design the tools. It also makes it easy to give an agent too many, so be deliberate about which servers each agent can see. Our Model Context Protocol field guide covers server design and deployment.
A tool review checklist
Before a tool ships, check that:
- It maps to a task an agent actually performs, not just an endpoint.
- Its name is namespaced and signals whether it reads or writes.
- Its description says what it does, when to use it, and when not to.
- Every constrained parameter uses an enum or an explicit format.
- Responses are selective, readable, and bounded, with truncation notes.
- Errors explain how to recover, or state clearly that the agent should escalate.
- Writes are idempotent, scoped to the acting user, and limited in code.
- Consequential actions support dry runs or approval gates.
- It has eval cases and per-tool metrics in production.
FAQ
How many tools should one agent have?
Fewer than most teams start with. There is no universal number, but accuracy in choosing tools tends to fall as tools multiply and overlap. If an agent needs a large toolset across several domains, consider task-shaped consolidation first, then splitting into specialist agents with smaller sets.
Should I wrap my existing REST API directly as tools?
Use your API as the implementation, not the interface. Wrapping endpoints one-to-one usually produces tools that are too granular and return too much data. Design the tool surface around agent tasks, then call your existing endpoints from inside each tool.
Where should input validation happen?
In the tool, every time. The model’s output is a suggestion that happens to be shaped like a function call, so validate types, formats, ranges, and permissions before acting. Return validation failures as clear, actionable messages so the agent can correct itself.
Working with TechnoKeen
TechnoKeen designs and builds tool layers for production agents, including task-shaped interfaces, scoped permissions, and evals that catch confusing tools before users do. To review the tools your agents depend on, reach out to our engineers or see our services.
- #tool design
- #function calling
- #agent-computer interface
TechnoKeen Engineering
TechnoKeen is an enterprise agentic AI company. Our engineers design, deploy, and govern AI agents for organizations in regulated and complex industries, and share what we learn in the field.
About TechnoKeen →