← Glossary / 62 of 100

n. / Agents and tools

Function calling

Definition

Function calling is the model provider feature that lets a model return a structured request to run one of your named functions with arguments that match a schema. It is the mechanism behind most tool use.

In more detail

You declare functions with names, descriptions and JSON schemas for their parameters. The model returns the chosen function and arguments instead of plain text. Clear names and descriptions matter a lot, since the model picks tools using only that text. Validate arguments before running anything with side effects.

Example

You declare create_refund(order_id: string, amount: number). The model returns create_refund({"order_id": "A-1042", "amount": 19.0}) and your code checks the amount before acting.

Definitions are the start.

Open a real trace and watch these terms move.