aiaimodel.cards
Capabilities19

Tool use

Letting the model call your functions

Tool use

Also called function calling. The model asks your code to run a function you described (search, database query, API call) and uses the result.

Why it matters. The basis of agents and of any app where the model takes actions.

How it works

Tool use, also called function calling, lets you describe functions to the model with names, descriptions and parameter schemas. When the model decides a tool would help, it returns a structured request to call it; your code runs the function, sends back the result, and the model continues.

The model does not execute anything itself unless the provider offers server-side tools such as web search or code execution. APIs differ in how tools are declared, whether several can be called in parallel and whether you can force a specific tool. Tool definitions and results count as input tokens.

Clear tool names and descriptions matter as much as the prompt. Validate every argument before executing it, and treat tool results as untrusted content.

Worked example

Illustrative: you define get_weather(city). A user asks 'Do I need an umbrella in Oslo?'; the model returns a call to get_weather with {"city": "Oslo"}, your code returns {"rain_mm": 6}, and the model replies that about 6 mm of rain is expected, so yes.

Common mistakes

  • Executing model-supplied arguments without validation, for example passing them into SQL or shell commands.
  • Defining many overlapping tools with vague descriptions, so the model picks the wrong one.
  • Passing tool results back without treating them as a possible source of prompt injection.

See it on a real card: Feature support on Claude Opus 5.5.

Related terms