What Is Tool Calling?
Tool calling (also called function calling) lets the model request external actions - searching the web, querying a database, calling an API - mid-generation. The model outputs a structured JSON payload, your application executes the tool, and you feed the result back.
Designing Good Tool Schemas
The most common mistake is vague tool descriptions. The model uses your description to decide when to call a tool. Be precise:
{
"name": "get_user_orders",
"description": "Retrieve a paginated list of orders for a specific user ID. Use this when the user asks about their order history, recent purchases, or order status.",
"parameters": {
"type": "object",
"properties": {
"user_id": { "type": "string", "description": "The user UUID" },
"limit": { "type": "number", "description": "Max orders to return (1–50)" }
},
"required": ["user_id"]
}
}

Error Handling
Always handle tool errors explicitly. If a tool fails, return an error message in the tool result - do not throw an exception that breaks the agent loop:
{ "role": "tool", "content": "Error: user_id not found in database", "tool_call_id": "call_abc123" }
The model will then decide whether to retry, ask for clarification, or gracefully tell the user it cannot complete the task.
Parallelism
Most frontier models support parallel tool calls - the model can request multiple tools in a single turn. Enable this by not setting tool_choice: "none" and processing all tool calls in the response array simultaneously.
Infyrence normalizes parallel tool calling syntax across all providers.
