Tool calling is how an AI model asks your software to do something. The model never runs code itself: it outputs a structured request, your application executes it and returns the result.
The loop
- You describe each tool with a name, purpose and parameter schema.
- The model reads the user request and may respond with a tool call and arguments.
- Your code validates the arguments, checks permissions, executes and returns the result.
- The model uses the result to answer or call another tool.
Designing good tools
- Small and specific: "get_order_status" beats "run_query".
- Clear descriptions: the model chooses tools from the description, so write it for the model.
- Typed inputs: validate with a schema; see structured outputs.
- Safe by default: read tools first; write tools need approval or tight limits.
- Useful errors: return messages the model can act on.
Permissions
Authorisation belongs in your code, using the end user's identity. Never rely on the prompt to enforce access. Prompt-injection risks are covered in AI agent security.
Standardising tools
MCP provides a common protocol so tools can be reused across clients. For when to use which, see MCP vs function calling vs REST.
Frequently asked questions
What is tool calling in AI?
It is a mechanism where the model outputs a structured request to use a tool, your application runs it and returns the result for the model to use.
Does the AI model execute the function itself?
No. The model only proposes the call. Your code validates and executes it.
How do I make tool calling reliable?
Use small, well-described tools with typed inputs, validate arguments, enforce permissions in code and return clear errors.
Related: AI agent development · MCP server development · MCP vs function calling
Want a straight answer for your project?
Book a 30-minute call. I will tell you what I would do, and a fixed price if it makes sense.