Back to the wiki

Tool use (function calling)

When the model stops just talking and starts pressing buttons.

The analogy

A cook who only knows recipes by heart is limited; give them access to the pantry, the oven and the scale and they can really cook. Function calling means giving the model buttons it can press: search, calculate, check your calendar.

In detail

The developer describes functions (tools) with their parameters. Instead of replying with text, the model decides when to call a function and with what data; the program runs it and returns the result so it can continue. It's the basis of agents and is often wired up through MCP.

An example

You ask “what's the weather tomorrow in Bilbao?”. Rather than making it up, the model calls a weather function with “Bilbao” and “tomorrow”, gets the real data and answers with it.

Related concepts