What is tool calling?#
A language model only produces text. Tool calling is a way for the model to touch the outside world too. You introduce a list of functions with their descriptions to the model; when it decides it needs one, instead of writing an answer it sends a defined structure (usually JSON) saying, "run this function with these inputs".
How it works#
- You define the tools: name, description and parameters.
- The user asks a question.
- The model decides which tool it needs and with what input.
- Your application actually runs the function.
- The result goes back to the model, and the model writes the final answer.
An example#
On a store site, a customer asks, "How many black size-42 shoes are in stock?" The model calls the "check inventory" function with the name and size, the application reads from the database, and the model states the exact answer in plain language.
Where it is used#
Agents, chatbots connected to internal systems, calendar and email assistants, and anywhere the answer must come from live data.
Important notes#
- Write the tool description clearly; the model decides based on it.
- Validate the model's inputs; they are not always correct.
- Run sensitive actions with user approval.
Relation to MCP#
Tool calling is the request mechanism in the model, and MCP is a standard for describing and providing tools to different assistants.