
What is Function Calling?
Function calling (also called tool use) is a capability that allows language models to request the execution of external functions or tools. Instead of generating a text answer, the model outputs a structured function call with specific parameters, which the application executes and returns results for the model to incorporate into its response.
Why It Matters
Function calling transforms LLMs from text generators into action-takers. It enables models to search the web, query databases, send emails, control smart devices, and interact with any API — grounding their responses in real data and enabling real-world actions. This is the fundamental building block of AI agents and the bridge between language understanding and practical capability.
How It Works
- Tool registration — the developer describes available functions (name, description, parameters with types) when making an API call
- Model reasoning — the model decides whether to answer directly or call a function based on the user's request
- Function call output — the model returns a structured call (function name + arguments as JSON)
- Execution — the application executes the function and returns the result to the model
- Response synthesis — the model incorporates the function result into a natural language response
- Multi-turn — the model can chain multiple function calls to accomplish complex tasks
How it differs from MCP:
- Function calling is a single model-to-application protocol
- MCP (Model Context Protocol) is a standardized protocol for connecting models to many tool servers
- Function calling is the mechanism; MCP is an interoperability standard built on top of it
Parallel function calling — modern APIs support the model requesting multiple function calls simultaneously, reducing latency for independent operations.
Forced function calling — developers can force the model to call a specific function, useful for structured extraction tasks.
Example
A user asks an AI assistant: "What's the weather in Amsterdam and do I have any meetings tomorrow?" The model generates two parallel function calls: get_weather({city: "Amsterdam"}) and get_calendar_events({date: "tomorrow"}). The application executes both, returns the results, and the model synthesizes: "It's 15°C and partly cloudy in Amsterdam. You have two meetings tomorrow: a standup at 9:00 and a client call at 14:00."