Function Calling
Also known as: function calling, tool calling, API calling
What is Function Calling?
Function calling is the mechanism by which a large language model generates structured requests to invoke external functions or APIs. Instead of producing only natural language text, a model with function calling capability outputs a function name and its arguments in a machine-readable format (typically JSON), which the host application then executes and returns results from. The model incorporates those results into its next response. This is the technical implementation behind what is more broadly called “tool use.”
How It Works
Developers define a set of available functions with names, descriptions, and parameter schemas, then include these definitions in the API request alongside the user’s message. The model decides whether any function is relevant to the user’s request, selects the appropriate function, generates valid arguments, and returns a structured function call object. The application executes the function, passes the result back to the model, and the model uses that result to formulate its response. Modern models can chain multiple function calls in sequence or issue them in parallel when the calls are independent.
Why Function Calling Matters
Function calling is what transforms language models from text generators into software that can do things. It provides a standardized, type-safe interface between the model’s reasoning and the outside world. Every major model provider (OpenAI, Anthropic, Google) supports function calling natively, and Anthropic’s Model Context Protocol (MCP) builds on this foundation to create a universal standard for tool integration. For practitioners, reliable function calling is the foundation of agent development — without it, agents cannot read databases, send emails, manage files, or interact with any external system. The quality of a model’s function calling (correct argument generation, appropriate tool selection, graceful error handling) directly determines how trustworthy an agent built on it can be.