← Glossary AI

Function Calling

The technical mechanism behind tool use. How a model formally requests to run a specific function.

Explained simply.

Function calling is the same idea as tool use, told from a programmer's perspective. You define a function (name, parameters, description) and register it with the model. When the model decides it needs that function, it outputs a structured JSON object naming the function and its arguments. Your code parses that JSON, runs the real function, and sends the return value back to the model as a new message.

An example.

You register a function: get_weather(city: str). The model, given 'what's it like in Tokyo?', outputs: {'function': 'get_weather', 'args': {'city': 'Tokyo'}}. Your code calls get_weather('Tokyo'), gets '72°F sunny', sends that back. The model then writes: 'It's 72°F and sunny in Tokyo.'

Why it matters.

Function calling is the precise, structured form of tool use. If you're building on an API like Claude's or OpenAI's, this is the term you'll actually see in the docs.