CalculatorTool class

A tool for performing basic arithmetic operations.

Supports addition, subtraction, multiplication, and division.

Inheritance

Constructors

CalculatorTool()

Properties

description String
A description of what the tool does, for the agent's understanding.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
name String
The name of the tool, used for identification in tool calls.
no setteroverride
parameters Map<String, dynamic>
JSON Schema describing the parameters this tool accepts.
no setteroverride
requiresConfirmation bool
Whether this tool normally requires human confirmation before execution. If you need dynamic confirmation logic based on the arguments, override requiresConfirmationFor instead.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
timeout Duration
Maximum time this tool is allowed to run before being cancelled. Defaults to 30 seconds.
no setterinherited

Methods

execute(CalculatorArgs args) Future<String>
Executes the tool with the given arguments.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parseArgs(Map<String, dynamic> json) CalculatorArgs
Parses the JSON arguments into the typed arguments object.
override
requiresConfirmationFor(CalculatorArgs args) bool
Dynamic evaluation of whether this specific execution requires confirmation. By default, this simply returns requiresConfirmation. Override this to skip confirmation for low-risk operations (e.g., deleting a trivial resource).
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited