In short
An LLM can't check the weather or your order status by itself. With tool calling, it asks your code to do it, then uses the result. This is how chatbots become assistants that act.
Letting a model choose to call a predefined function (with structured arguments) instead of just generating text — the mechanism that turns an LLM from a chatbot into an agent that takes actions.

Think of it like this
The hotel receptionist
The receptionist can't cook, but when you ask for dinner, she phones the kitchen with a clear order slip. The kitchen cooks, and she tells you it's on the way. The model is the receptionist. Your functions are the kitchen.
Watch it happen
One tool call, start to finish
Where is order 4821?
1/7The user asks a question the model can't answer from memory.
The big ideas
What you need to know
Tools are described in JSON Schema
Each tool has a name, a description and parameters. Clear descriptions help the model pick the right one.
The model only asks
Your code decides whether to run the call. Always validate arguments before doing anything real.
It's a loop
The model may call several tools in turn. Your app keeps looping until it gets a final text answer.
Guard risky actions
For payments, deletions or emails, ask the user to confirm before your code executes the tool.
See it in code
Walk through the code
1{2 "type": "function",3 "function": {4 "name": "get_order_status",5 "description": "Get the delivery status of a customer's order by its id.",6 "parameters": {7 "type": "object",8 "properties": {9 "order_id": { "type": "integer", "description": "The order number, e.g. 4821" }10 },11 "required": ["order_id"]12 }13 }14}1/3The name your code will match on, and a description the model reads to decide when to use it.
A tool definition in the OpenAI-style format. Other providers use very similar JSON Schema shapes.
Save yourself the pain
Common mistakes
Oops
Running whatever arguments the model returns, straight away.
Do this instead
Validate types and permissions first. Check the user is allowed to see order 4821 before fetching it.
Oops
Giving vague tool descriptions like 'does stuff with orders'.
Do this instead
Say exactly what it does and when to use it. The model chooses tools mostly from these descriptions.
Your mission
A fake weather tool
Quick check
In tool calling, who actually executes the function?
Go deeper
- 1Define a simple tool (e.g. a calculator or weather lookup) and wire it into an LLM API call.
- 2Learn how the model decides when to call a tool vs. respond directly.
- 3Practice handling tool-call errors and feeding results back into the conversation.
More topics at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.