Skip to main content

Tool Calling

Updated 3 min read

Share this page

Send the link, quote the definition with a link back, or show it as a card on your own site.

https://softwaredictionary.org/terms/tool-calling

In short

Tool calling is an LLM feature in which the model asks the application to run a specific function with structured arguments, then uses the result in its answer.

What is tool calling in AI?

Tool calling, also known as function calling or tool use, lets a language model do more than produce text. The application tells the model which tools are available, such as get_weather, search_orders, or run_sql, and when a request needs one, the model replies with a structured request to call it with specific arguments. The application runs the function and sends the result back, and the model uses it to write its final answer.

Each tool is described with a name, a plain-language description, and a schema for its parameters, usually written in JSON Schema. The model never executes anything itself: it only outputs the tool's name and a JSON object of arguments, and your code decides whether to run it. Models can request several calls in one turn, and an application can keep looping, sending results back, until the model has everything it needs to answer.

An analogy is a manager who fills in a request form and hands it to an assistant: the manager decides what needs doing, but the assistant actually makes the phone call and reports back. Tool calling is how AI assistants fetch live data, look up records, book meetings, run code, and return reliably structured output, and it is the basic mechanism that AI agents are built on.

Tool calling is often confused with an AI agent or with the Model Context Protocol. Tool calling is the model's single capability to request a function call; an agent is a loop that uses many tool calls to pursue a goal, and MCP is a standard way for applications to discover and connect to tools provided by other programs. Because the model chooses the arguments, applications should validate them, give tools only the permissions they need, and ask a person to confirm risky actions.

Key takeaways

  • Tool calling lets a model request a function call with structured arguments.
  • Tools are described with a name, a description, and a parameter schema.
  • The application, not the model, runs the tool and returns the result.
  • AI agents are built from repeated tool calls in a loop.
  • Validate arguments and limit permissions, because the model chooses the inputs.

Example

Defining a tool and handling the model's tool calltypescript
// Describe a tool the model may call: name, description, and JSON Schema
const tools = [{
  name: "get_weather",
  description: "Get the current weather for a city",
  parameters: {
    type: "object",
    properties: { city: { type: "string" } },
    required: ["city"],
  },
}];

// llm and getWeather are placeholders for a real client and your own function
const reply = await llm.chat("Do I need an umbrella in Oslo?", { tools });
// The model only asks; your code runs the function and sends the result back
if (reply.toolCall) await getWeather(reply.toolCall.arguments.city);

Readers ask

Does the model run the function itself?

No. The model only returns the name of the tool and the arguments it wants to use. Your application decides whether to run it, executes the code, and sends the result back to the model.

Is tool calling the same as function calling?

Yes, the terms mean the same thing. Different AI APIs use different names, such as function calling, tool use, or tool calling, but the mechanism is the same.

What is the difference between tool calling and MCP?

Tool calling is the model's ability to request a function call. The Model Context Protocol is a standard for how applications find and connect to tools offered by separate servers, and the model then uses tool calling to invoke them.

See also

Spotted a mistake or something missing on this page?Suggest an edit

Read a random page
Open today's review
Switch to the dark theme
Read this page in Türkçe

More

Settings