What is function calling in AI?
The developer's name for tool use. The model replies with the name of a function and its arguments in a fixed format, and your code runs it.
intermediate · Also called Tool Calling
Tool useTool UseGiving a model a list of things it can ask to have done, such as search the web or read a file. The model asks; the program around it does the work and hands back the result. is the idea: a model asks for something to be done. Function calling is how a developer builds it. The 2 names are used for the same thing, and OpenAI's documentation now calls it tool calling too.
What the developer writes
For each function, the developer gives the model a name, a description in plain words and a schema: a strict list of the inputs, their types and which ones are required. For a refund tool that might be an order number (text, required) and an amount (a number, required).
The description matters more than people expect. It is the only thing the model reads to decide when to use the function, so "Refunds an order. Use only after the customer has confirmed" does real work.
The round trip
OpenAI describes the flow in 5 steps, and Claude's works the same way.
- Your code sends the conversation plus the list of functions.
- The model replies with a function call instead of text: the name, and the arguments filled in.
- Your code checks the call and runs the real function.
- Your code sends the result back to the model.
- The model writes its answer, or asks for another call.
The model never touches your systems. It produces a small block of structured text, and your code decides whether to act on it.
Making the arguments reliable
A model writes arguments the way it writes everything else, by prediction, so it can occasionally leave out a field or give the wrong type. OpenAI offers a strict mode for this. With strict turned on, the arguments follow the schema reliably instead of on a best-effort basis.
Strict mode guarantees the shape, not the sense. A perfectly formed refund call can still name the wrong order.
What to take from it
If you build with a model, treat every function call as a request, not a command. Check the arguments, limit what each function can reach, and put a person in front of anything you cannot undo. If you only use AI apps, this is what is happening when a chatbot "books", "searches" or "files" something for you: it wrote a request, and someone's code carried it out.
Sources
Where each fact comes from
This page was last checked against these sources on 14 October 2026.
- 1Function calling
OpenAI API documentation · 14 October 2026
Function calling lets OpenAI models interface with external systems. A tool call is a special kind of response the model can give. The flow is 5 steps. Make a request with the tools the model could call, receive a tool call, execute code on the application side, make a second request with the tool output, and receive a final response or more tool calls. Setting strict to true makes function calls reliably follow the function schema instead of being best effort, using structured outputs.
- 2How tool use works
Anthropic, Claude API documentation · 25 September 2026
The model never executes anything on its own. It emits a structured request, your code or the provider's servers run it, and the result comes back into the conversation.
- 3Define tools
Anthropic, Claude API documentation · 25 September 2026
A tool is given to the model as a name, a description and the inputs it takes.