A language model on its own can only produce text. Function calling — also called tool use — is the mechanism that lets it act: search the web, query a database, send an email, run code. It's the foundation of every agent.
How it works
You describe the available tools to the model — each with a name, a description of what it does, and the inputs it expects. When the model decides a tool would help, instead of answering, it outputs a structured request: "call get_weather with city = Tashkent." Your application executes that function, returns the result to the model, and the model continues — now armed with real information.
The model doesn't run the tool. It asks to, in a structured way; your code runs it and hands back the result. The model orchestrates; your system executes.
Designing good tools
The quality of your tools decides the quality of your agent. A few rules:
- Clear names and descriptions — the model chooses tools based on these. Be specific about when to use each.
- Tight input schemas — well-defined parameters prevent malformed calls.
- Few, sharp tools beat many overlapping ones — ambiguity confuses the model.
- Honest error results — when a tool fails, return a clear error so the model can recover.
Why it matters
Function calling is the difference between a model that talks and a system that does. Everything agentic — from research assistants to coding agents to customer-service bots that actually resolve issues — is built on it. Get the tool design right, and even a modest model becomes capable; get it wrong, and the smartest model flails.