ai.tools.Tool
class in the ai package.
Reference version
Signature
class ai.tools.ToolSource:<builtin>/ai/ns_tools/tools.bamlbytes 376–2142
Fields
name
stringdescription
stringinput_schema
map<string, unknown>handler
reflect.AnyFunction<Returns = unknown, Throws = unknown> | nullraw_handler
((map<string, unknown>) -> string throws unknown) | nullon_error
ai.tools.ErrorMode | nullInstance methods
function
call
(self, args: map<string, unknown>) -> string throws unknownThe total boundary around one call. A throw here is the tool's failure, not the run's.
A raw tool (raw_tool) hands the argument map straight to its
raw_handler and returns that string as-is. A schema-derived tool
validates, dispatches through reflection, and JSON-serializes the
result; that reflection boundary widens exactly representable integral
arguments into float parameters (see reflect.call_any).