Function Calling and Tools
"Where is my order 4417?" is the most common question Pedal Point gets. The model cannot know the answer; it lives in the shop's order system, and changes by the hour. RAG helps with documents, but here the assistant needs to do something: look up a live record. That is function calling, also called tool use.
The rule
The model asks for a tool; your code decides and runs it.
You describe each tool to the model: a name, a plain-language description of when to use it, and a schema for its arguments.
{
"name": "get_order_status",
"description": "Look up the shipping status of one order by its number.",
"parameters": {
"type": "object",
"properties": {"order_id": {"type": "string"}},
"required": ["order_id"]
}
}When a question needs the tool, the model does not answer in words. It replies with a structured tool call: "call get_order_status with order_id = 4417". The model never runs anything itself. Your code runs the tool, sends back the result, and the model writes the final reply using it.
Some tasks need several tools in sequence. A common pattern, known as ReAct (reason and act), repeats a loop: the model thinks about what it needs, calls a tool, reads the result, and decides the next step, until it can answer. This loop is the heart of what people call AI agents.
Tool descriptions matter as much as prompts. A vague description ("gets data") leads to the wrong tool or wrong arguments. Keep the list short and each tool focused on one job. Every description is sent with each request, so twenty loosely named tools cost tokens and blur the choice, while three clear ones make it easy.
The shortcut
Four beats: describe, request, run, return. Between request and run, your code is the gatekeeper.
Describe
The app sends the question plus the description of
get_order_status.
The trap is running every tool call blindly. The model will request order 5000 if a user asks for it. Check permissions and arguments in code, and require a human confirmation before actions that spend money or cannot be undone, like refunds.
Drills
Answer fast — trust the rule.
When the model decides it needs get_order_status, what does it produce?
Which part of a tool definition most helps the model choose the right tool?
A logged-in customer asks about order 5000, which belongs to someone else. What should happen?
In a ReAct-style loop, what happens after a tool returns its result?
Remember
- The model asks for a tool; your code decides and runs it.
- Describe, request, run, return.
- Check ownership and arguments; confirm risky actions with a human.
