Function calling, also called tool calling or structured tool use, is a way for an AI model to ask your app to run a specific function with specific arguments instead of guessing the answer itself.
Large language models are good at language, but they are not reliable sources of fresh facts, private data, or side effects like “send the email” or “look up today’s weather.” Function calling solves that by letting the model produce a structured request that your code can execute.
You reach for it when you want the model to:
In practice, most teams use function calling when they want an LLM to plan or route work, while the application stays in control of execution.
You describe available functions.
Your app sends the model a list of functions it may call, along with each function’s name, purpose, and expected input schema.
The model decides whether to call one.
Instead of replying only in natural language, the model can return a structured call such as “call get_weather with city = Paris.”
Your application executes the function.
The model does not actually run the function. Your code receives the request, validates it, and performs the real action.
You send the result back if needed.
The model can then use the function output to generate a final user-facing answer.
This pattern shows up in official LLM APIs under names like function calling, tool calling, or structured tool use. The exact JSON shape varies by provider, but the core idea is the same: the model emits structured intent; your app does the actual work.
User: “What’s the weather in Paris right now?”
The model might respond with a tool request like:
{
"name": "get_weather",
"arguments": {
"city": "Paris"
}
}
Your app calls the weather API, gets the result, then sends it back to the model:
{
"city": "Paris",
"temperature_c": 18,
"condition": "Cloudy"
}
The model then answers:
It’s 18°C and cloudy in Paris right now.
If you need only a plain text answer, function calling is overkill. It shines when the model must interact with systems, not just talk.