Resources / AI agents
How to build an AI tool your agents can call
A step-by-step guide to building a tool for AI agents: define the job, write the schema, implement and host it, secure it, and connect it over MCP or function calling.
A "tool" is just a function an AI model can ask your application to run: look up an order, create a ticket, fetch a report. Building one well takes five steps.
1. Pick one job
A good tool does one thing an agent will need repeatedly: get_order_status, refund_order, search_docs. If you can't name it as a verb and an object, split it.
2. Write the schema and description
The model chooses tools from their name, description and input schema alone:
{
"name": "get_order_status",
"description": "Return status, items and shipping date for one order. Use when the user gives an order number.",
"input_schema": {
"type": "object",
"properties": { "order_id": { "type": "string", "description": "Order number, e.g. A-1042" } },
"required": ["order_id"]
}
}
See designing MCP tools for naming and description tips.
3. Implement it as an API
Behind the schema is ordinary code: validate the input, call your systems, return compact JSON. Keep responses small — every field costs the model context.
4. Host it somewhere safe and scalable
Agents call tools in bursts — one task can fan out into dozens of calls. The tool needs:
- Authentication (an API key per client)
- Rate limits per client
- Timeouts and clear errors the model can act on
- Logging of every call
- Hosting that scales when an agent suddenly calls it 500 times
5. Connect it to the model
Two common ways:
- Function calling — define the tool in your API request to the model; your code runs it when the model asks.
- MCP — expose the tool from an MCP server, and any MCP client (Claude, ChatGPT, Cursor and others) can discover and call it. See what is an MCP server.
Building tools with Wisp
Describe the tool — "an endpoint that returns the status of an order from our Airtable base" — and Wisp writes it, generates the schema, and hosts it. Every Wisp project is also an MCP server, so the tool is immediately available to AI clients, behind API keys and per-client limits, logged, and scaling automatically with your agents' traffic.
Try it: Template: GitHub issue MCP tool · Template: Notion task MCP tool
Build it with Wisp — describe an API, get it live.