SE Hub
AI Fundamentals

Tool Calling

How AI models call tools, why it matters for coding, tool anatomy, cost, and MCP.

Models become much more useful when they can call tools.

A tool is an action the model can request: read a file, run a command, search documentation, query an API, create an image, or update a ticket.

Why tool calling matters

Without tools, the model can only answer from context and training. With tools, it can inspect the real world around the task.

For coding, this is the difference between guessing and checking. A coding agent can read the actual implementation, run tests, see errors, and iterate.

Anatomy of a tool

A tool usually has:

  • A name.
  • A description.
  • An input schema.
  • A result returned to the model.

The model chooses when to call the tool and what arguments to pass. The tool runner executes the action and returns output.

Good tool descriptions matter because the model uses them to decide which tool fits the task.

Tools have cost

Tool calls can cost time, money, and attention.

Running a full test suite may be slower than running one focused test. Reading a giant file may crowd out better context. Calling a remote API may require credentials or have rate limits.

Effective agents choose the smallest tool call that can answer the current question.

MCP

MCP, the Model Context Protocol, is a standard way to connect AI tools to external systems.

An MCP server can expose tools and resources for services such as GitHub, Slack, databases, observability systems, or internal documentation.

For engineers, MCP matters because it lets an agent use the systems where the work actually lives instead of relying only on pasted text.

What to remember

Tool calling turns a model from a text generator into an operator that can inspect and act.

The model still needs verification. But when it can read files, run commands, and query the right systems, it can build a much tighter feedback loop.

On this page