NEWCloud agents are live.See how

Tooling

Tool call

Also called Function calling, Tool use

A model's request to run something outside itself (read a file, query a database, hit an API), emitted as structured arguments that the surrounding program executes before feeding the result back. Tool calls are the mechanism that turns a text generator into an agent.

At a glance

Also called
Function calling, tool use
Emitted by
The model, as structured JSON
Executed by
The host program
Defined with
Name, description, JSON Schema
Where permissions apply
At each call

How it works

The program calling the model sends a list of tools, each with a name, a description, and a JSON Schema for its inputs. When the model decides it needs one, it emits a structured block naming the tool and its arguments. The model executes nothing. The host parses the block, runs the real function, and sends the result back tied to the call's ID. The model reads the result and either answers or calls another tool.

Repeat that loop and you have an agent: read a file, edit it, run the tests, read the failure, edit again. Most coding agents are a small set of tools (read, write, edit, search, shell) plus this loop.

Why it matters

The model picks tools from their names and descriptions alone, so vague descriptions produce wrong choices. Tool output is also context: a search that returns ten matching lines is far kinder to the session than one that returns whole files. Tool calls are where risk lives, too, since a shell command or database write is the point where text becomes action. Approval prompts, allowlists, and sandboxes all operate at that boundary.

Good tools are designed for the model rather than for a human caller: small, structured results, clear error messages it can recover from ("file not found, did you mean src/lib/auth.ts?"), and parameters that make the common case easy. Many APIs also let the model request several independent tool calls in one turn, such as reading three files at once, which shortens the loop considerably.

Tool call vs. MCP

A tool call is the model-level mechanism. MCP, the Model Context Protocol Anthropic introduced in November 2024, is a standard way for a host to discover and connect to tools served by external processes. MCP servers expose tools; the model still invokes them through ordinary tool calls.

Example

A tool definition and the model's call
// offered to the model
{ "name": "read_file",
  "description": "Read a UTF-8 file from the repo",
  "input_schema": { "type": "object",
    "properties": { "path": { "type": "string" } },
    "required": ["path"] } }

// the model's tool call
{ "type": "tool_use", "id": "toolu_01", "name": "read_file",
  "input": { "path": "src/server/auth.ts" } }

Common mistakes

  1. Executing the model's arguments without validating them against the schema, so an invented file path or field crashes the host.
  2. Writing one-line tool descriptions and expecting the model to infer behavior it cannot see in the implementation.
  3. Returning huge raw payloads from a tool, which floods the context window on every later turn.

Frequently asked questions

Is function calling the same as a tool call?

Yes. Function calling, tool use, and tool calls are different vendors' names for the same mechanism: the model emits structured arguments and the host runs the function.

Can a model run code on its own?

No. It can only request a tool call. Something outside the model executes it, which is where permissions and sandboxes apply.

Sources

Know the words. Run the work.