Tool use is the mechanism by which a large language model requests execution of a function defined by the developer. Instead of generating a text answer, the model generates a structured tool call: a function name and a set of arguments. The runtime executes the function, returns the result, and the model continues reasoning with that result in context. This is how agents interact with APIs, databases, search engines, and any external system.
Getting tool use right is primarily a design problem, not a capability problem. The model can use tools reliably when the tools are well-designed. Most tool use failures come from bad tool design, not model limitations.
The Two Main Syntaxes
Anthropic tool use defines tools as JSON schemas passed to the API alongside the messages:
import anthropic
client = anthropic.Anthropic()
tools = [
{
"name": "search_web",
"description": "Search the web for current information. Use this when the user asks about recent events, current prices, or anything that requires up-to-date information.",
"input_schema": {
"type": "object",
"properties": {
"query": {"type": "string", "description": "The search query"},
"num_results": {"type": "integer", "description": "Number of results to return (1-10)", "default": 5}
},
"required": ["query"]
}
}
]
response = client.messages.create(
model="claude-opus-4-5",
max_tokens=1024,
tools=tools,
messages=[{"role": "user", "content": "What is the current price of Bitcoin?"}]
)
OpenAI function calling uses a similar structure under the tools parameter with type: "function" wrappers. The core schema format is the same JSON Schema standard.
Both produce a structured tool call object that the developer must execute and return as a tool result message.
Design Pattern 1: Clear, Specific Tool Names
Tool names are part of the model's decision-making signal. A model seeing search has to guess from context what it searches. A model seeing search_web_for_current_info knows exactly when to use it.
Good names:
search_web(notsearch)get_customer_by_email(notlookup)create_calendar_event(notevent)send_slack_message(notnotify)
The name should encode the action AND the target. When you have multiple search tools (web search, database search, file search), the name is the primary disambiguation signal.