AgentTool<C extends AgentToolContext> class final

A named, declared operation on behalf of an agent.

Constructors

AgentTool({required String name, required String summary, required String result, required AgentToolInvoke<C> invoke, AgentToolSchema arguments = AgentToolSchema.empty, bool isWrite = false, bool needsExecution = false})
const

Properties

arguments → AgentToolSchema
final
hashCode → int
The hash code for this object.
no setterinherited
isWrite → bool
Drives the guard's write gate: every target a write tool names is guarded as written, every target a read tool names as read. Declared once, here, and read by AgentToolContext.guard — not restated at each target.
final
name → String
Stable, snake_case.
final
needsExecution → bool
Drives the execution-consent gate, and the derived program tool set.
final
result → String
Prose description of the returned shape. Prose rather than a second schema because nothing validates a result — the caller is the model, and a schema nobody checks is a claim nobody keeps.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
summary → String
final

Methods

call(C context, Map<String, Object?> raw) → FutureOr<Object?>
Validates, then dispatches — in one place, so no presentation can skip a step — inside the audit recording of this call.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJsonSchema() → Map<String, Object?>
The tool as MCP's tools/list entry.
toString() → String
A string representation of this object.
inherited

Operators

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