ToolResult class
The outcome of a tool execution.
Constructors
-
ToolResult({required String toolName, required bool success, dynamic output, String? error, Map<
String, dynamic> metadata = const {}, DateTime? executedAt}) -
const
- ToolResult.failure(String toolName, String error)
-
Creates a failure result.
factory
-
ToolResult.success(String toolName, dynamic output, {Map<
String, dynamic> ? metadata}) -
Creates a success result.
factory
Properties
- error → String?
-
Human-readable error if success is false.
final
- executedAt → DateTime?
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
metadata
→ Map<
String, dynamic> -
Optional metadata about the execution (duration, source URL, etc.).
final
- output → dynamic
-
The data returned by the tool. May be a String, Map, List, or num.
final
- outputText → String
-
Formats output as a compact string for LLM context injection.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- success → bool
-
Whether execution succeeded without error.
final
- toolName → String
-
Which tool produced this result.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited