Skip to content
Glossary Architecture

Tool use

An LLM's ability to call external functions (tools) during generation, to execute actions or retrieve data.

Definition

Tool use (or function calling) is the mechanism by which an LLM can, during its generation, decide to invoke a predefined function rather than generating free-form text. The model produces a structured call (function name + arguments), the environment executes it, the result is sent back to the model, and it continues its generation incorporating that result. This is the fundamental mechanism that transforms an LLM into an agent capable of acting on its environment: reading a file, running a command, calling an API, writing code and executing it.

postcursors perspective

Tool use is what distinguishes an agent from a chatbot. Without tool use, an LLM produces text that describes what should be done. With tool use, it does it. Modern coding agents (OpenCode, Kilo Code, Claude Code) are essentially wrappers that expose the right tools to the model: file read/write, shell command execution, Git calls. Agent quality depends as much on which tools are exposed as on the model used.

In practice

When you ask OpenCode to "run the tests and fix the errors", it uses tool use to execute `php bin/phpunit`, read the result, identify the files to modify, read them, modify them, and rerun the tests — without you intervening at each step. Each action is a tool call.

Common misconceptions

  • Confusing tool use with ChatGPT plugins — same principle but on the API side, not the user interface side
  • Thinking all LLMs support tool use — older models or some local models don't implement it, which limits their use as agents

See also