Tool calling
Definition
A model emitting a structured request to call a defined function, which your code runs and whose result is then fed back to the model.
In more detail
You describe each tool with a name, a description and a JSON Schema for its arguments. When the model decides a tool would help, it returns the tool name and arguments instead of plain text. Your code runs the function and sends back the result.
The model never runs anything itself. Your application decides whether to honour each request, which is where permission checks belong.
When a task needs many calls in a row, some platforms let the model write a short program that makes the calls and filters the results itself, which is known as programmatic tool calling.
Related terms
Agent
A system where a model decides which actions or tools to use, in a loop, until a goal or stop condition is met, rather than following fixed steps.
MCP tool
A function that a Model Context Protocol server exposes for a model to call, described by a name, a description and a JSON Schema for its input.
Model Context Protocol (MCP)
An open protocol that lets AI apps reach external tools, data and prompts through small servers that each wrap one service.
Programmatic tool calling
A model using tools by writing a short program that makes several calls and filters the results, instead of one call per turn.
Structured outputs
Constraining or validating model output so it matches a schema, usually JSON Schema, and can be parsed reliably by your code.
Agent loop
The repeating cycle of model call, tool call, observation and next decision that drives an agent until the task is done or a limit is hit.
Read more about Tool calling
- Tool calling
Letting a model request function calls, running them, and feeding results back.
- MCP vs function calling vs a plain API
The same tool call wired three ways, compared on who defines, runs and reuses it, and which to pick.