Tool Use
Definition
The ability of an AI model to invoke external functions, APIs, or services during generation — pausing its response to call a tool, receive the result, and continue reasoning with that data. Tool use is the mechanism that transforms a language model from a static text generator into an agent that can take actions in the world. It is implemented via structured function-calling schemas (JSON describing available tools, their parameters, and return types) that the model uses to decide when and how to invoke a tool. The model does not execute the tool itself — it generates a structured call specification that the host application executes on its behalf.
Builder Context
Tool use is the foundation of every agent you build. When designing tools for agent consumption, follow three rules: (1) each tool should do exactly one thing — narrow, focused tools reduce the model's decision surface; (2) return structured data (JSON), not prose — agents parse results programmatically; (3) include failure information in the return value, not just exceptions — agents need to reason about tool failures, not crash on them. Common mistake: passing too many tools at once. Models degrade in tool selection accuracy above ~20 tools. Use tool filtering, dynamic tool loading, or tool routing to stay within this limit.