Tool schema
{
"name": "get_weather",
"description": "Get current weather for a city",
"input_schema": {
"type": "object",
"properties": {
"city": {"type": "string"}
},
"required": ["city"]
}
}Advertisement
Best practices
Descriptions matter — model uses them to pick tool. Enum types for restricted choices. Provide examples in system prompt for complex tools.
Advertisement
Tool selection failures
Wrong tool chosen. Args hallucinated. Mitigate: fewer tools (<20), clear descriptions, similar-named tools disambiguated.
Parallel tool calls
Modern APIs support batch calls per turn. Use when tools are independent (2 lookups, 2 API calls). Reduces round trips.