ai.tools.Tool

class in the ai package.

Reference version

Signature

class ai.tools.Tool

Source:<builtin>/ai/ns_tools/tools.bamlbytes 3762142

Fields

name

string

description

string

input_schema

map<string, unknown>

handler

reflect.AnyFunction<Returns = unknown, Throws = unknown> | null

raw_handler

((map<string, unknown>) -> string throws unknown) | null

Instance methods

function

call

(self, args: map<string, unknown>) -> string throws unknown

The 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).