Skip to main content

An AI Agent Tool Should Be a Boring API

Clear schemas, narrow actions, predictable errors, and traceable results make agent tools safer.

Updated 3 min readMarkdown

Clear schemas, narrow actions, predictable errors, and traceable results make tools easier for both agents and humans to use safely.

The word “agent” can make a tool integration sound more mysterious than it is. An AI system still needs to call a piece of software with inputs, permissions, side effects, and failure modes. That is an API design problem, even if a model chooses when to call it.

A tool called manage_project with a vague description and a dozen optional fields leaves too much room for interpretation. A narrow tool such as create_draft_issue or read_deployment_status makes the intended capability easier to understand and easier to constrain.

Specify the contract, not just the name

A useful tool contract should describe:

  • The exact input fields, types, allowed values, and required fields
  • What the tool reads or changes
  • What a successful result looks like
  • What error states can occur and whether retrying is safe
  • Which actions are destructive, externally visible, or costly
  • What identity and authorization context the server checks

Validate inputs at the server boundary. Do not rely on the model to obey a sentence in the prompt. If a field can be an enum, make it an enum. If a free-form string could become a shell command, query, or URL, constrain or validate it before execution.

Make effects visible

A response should tell the caller what happened, not simply return “success.” Include a stable resource identifier, a clear status, and a trace or operation ID where appropriate. For a long-running operation, return a job handle and a way to check status. For an error, say whether the problem is a bad argument, a permission denial, a missing resource, or a temporary upstream failure.

Retries deserve particular care. A read-only tool can often be retried safely. A tool that creates invoices, sends messages, or changes access may need an idempotency key, an explicit confirmation step, or both. The control should live in the tool's implementation and authorization policy, not only in the agent's system prompt.

Test the tool as a boundary

Test malformed input, missing permissions, timeouts, duplicate calls, stale resource IDs, and partial failures. Log enough to reconstruct what action was requested and what the tool returned, while avoiding unnecessary sensitive content.

The Model Context Protocol tools specification uses structured tool definitions and input schemas. The broader lesson applies to any agent integration: the model may choose a tool, but the service still owns validation, authorization, and side effects.

A tool interface should be boring in the best way. Predictable contracts let an agent be useful without asking the model to become your security boundary.

More on my product, research, and delivery interests: umer-amin.vercel.app.

#AIAgents #APIDesign #ResponsibleAI

About the author

  • I'm Umer Amin Durrani, an AI Technical Project Manager, DevOps practitioner, brand builder and researcher. I write about Linux, reliable systems, AI agents, software architecture and the decisions behind technical delivery. My work connects research, business goals and practical execution. US registered and mailing address: Umer Amin Durrani, 145 Tyee Dr, PMB 59738, Point Roberts, WA 98281, United States. Operations are based in Karachi, Pakistan.

No comments yet. Be the first to comment.