What is function calling in AI?
Function calling lets a language model produce a structured request to run a software function, so it can use calendars, databases and APIs.
What is function calling?
On its own a language model only produces text. It cannot know the weather, add a meeting to a calendar or check whether an order has shipped. Function calling, also called tool use, opens that door. The developer gives the model a list of functions it may use and a description of each. When needed, the model picks one and writes the values to run it with in a structured form, usually JSON.
A step by step example
- The user writes: "Set up a meeting with Ms. Aylin tomorrow at 3 pm."
- The app has already told the model about a function called create_meeting, with date, time and attendee as parameters.
- Instead of a plain text reply, the model produces a call: create_meeting, date tomorrow, time 15:00, attendee Ms. Aylin.
- The app runs the function, adds the entry to the calendar and returns the result to the model.
- The model tells the user the meeting has been created.
The application runs the function; the model only decides what to call and with which values. That is why permissions and safety checks are enforced in the application.
Why does it matter?
This mechanism is how AI agents reach the outside world. Accessing live data such as stock, prices and exchange rates, taking actions such as orders and bookings, and handing calculations to reliable code all go through function calling. In automation projects, connecting the model to CRM, calendar and email systems works the same way.
Open standards such as the Model Context Protocol (MCP), introduced by Anthropic in late 2024, are spreading as a common way to connect tools from different applications to models.
Things to watch
A model can pick the wrong function or fill a parameter incorrectly, so the application must validate each call before running it. Irreversible actions such as deletions, payments and bulk emails should never run without user approval. Clear function descriptions matter as much as the prompt in helping the model choose the right tool.