Tool calling is how a model checks the weather, searches your files or creates a ticket; it underlies every AI agent.
On its own a model can only write text. It cannot check today's weather, look up an order or send an email. Tool calling (also called function calling) bridges that gap. A function here is just a named action your program can perform, such as get_order_status.
The flow:
1. In the request you describe the available tools: a name, a plain-language description of when to use it, and a JSON Schema for its inputs. 2. The model decides whether a tool would help. If so, instead of a final answer it returns a tool call: the tool's name and the input values, as structured data. 3. Your code runs the tool, for example queries the order database. The model never runs anything itself. 4. You send the result back in a follow-up request, linked to that call by an id. 5. The model uses the result to answer, or asks for another tool.
The model may request several tools at once, so handle a list of calls. Some providers also offer built-in server tools that run on their side, such as web search or code execution, with no code from you.
Descriptions matter a lot: the model chooses tools only from their names and descriptions. Say what the tool does, when to use it, and what each input means.
To share tools between apps there is the Model Context Protocol (MCP), an open standard that lets an AI app connect to a "server" offering tools and data (for example your calendar, Notion, or a database). Claude, ChatGPT, many coding tools and automation platforms such as Zapier and n8n can connect to MCP servers.
Example
1) Tool you describe in the request:
{"name": "get_order_status",
"description": "Look up the shipping status of an order by its id.",
"parameters": {"type": "object",
"properties": {"order_id": {"type": "string"}},
"required": ["order_id"]}}
2) Model's reply (a tool call, not an answer):
{"tool_call": {"id": "call_1", "name": "get_order_status", "arguments": {"order_id": "A-4471"}}}
3) Your code runs it and sends back:
{"tool_result": {"id": "call_1", "content": "Shipped 12 May, arriving 15 May"}}
4) Model's final answer: "Your order A-4471 shipped on 12 May and should arrive on 15 May."Remember
- The model only requests a tool call; your code (or the provider) runs it
- Tools are described by name, description and an input schema
- MCP is an open standard for plugging tool servers into AI apps