Function calling is the mechanism by which a large language model invokes external functions with structured, typed parameters instead of generating free-form text.
When a model "calls a function," it outputs a JSON object specifying the function name and arguments. Your application executes the function and feeds the result back into the model's context for the next reasoning step.
Function calling vs. tool use
The terms are often used interchangeably. In practice:
- Function calling describes the API-level capability (OpenAI, Anthropic, Google all support it)
- Tool use describes the agent-level pattern of selecting and invoking capabilities to achieve goals
Function calling is the plumbing. Tool use is the architecture.
Schema design matters
Models choose tools based on name and description. A function defined as query_db(sql: string) will be misused. One defined as get_tenant_maintenance_history(unit_id: string, limit: number) gives the model enough context to call it correctly.
Parameter schemas should be explicit, validated, and as narrow as possible.
Related reading
See Tool Use for how function calling fits into the broader agent architecture.