@tool decorator and Field helper for type-safe tool definitions.
The @tool Decorator
Decorator Parameters
str
Optional description of what the tool does. If omitted, ai-query uses the function docstring or a generated fallback.
The Field Helper
Field Parameters
str
required
Description of the parameter shown to the AI.
Any
Default value. If provided, the parameter becomes optional.
list[Any]
Optional fixed set of allowed values for the parameter.
float
Optional minimum numeric value.
float
Optional maximum numeric value.
Supported Types
Unrecognized annotations fall back to
string inference. If you need full control, use the factory form and pass parameters explicitly.