ToolHookContext class
Context for tool-related hooks (HookType.preToolExecution, HookType.postToolExecution).
- Inheritance
-
- Object
- HookContext
- ToolHookContext
Constructors
-
ToolHookContext({required HookType hookType, required DateTime timestamp, String? sessionId, Map<
String, dynamic> metadata = const {}, List<HookResult> previousResults = const [], int? turnIndex, required String toolName, required Map<String, dynamic> toolInput, String? toolOutput, bool? toolIsError, String? permission, Duration? executionDuration}) -
const
Properties
- executionDuration → Duration?
-
Duration of tool execution (only set in post-execution hooks).
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hookType → HookType
-
The type of hook being executed.
finalinherited
-
metadata
→ Map<
String, dynamic> -
Arbitrary metadata that hooks can read and contribute to.
finalinherited
- permission → String?
-
Permission decision for this tool execution, if any.
final
-
previousResults
→ List<
HookResult> -
Results from previously executed hooks in the same chain.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sessionId → String?
-
The active session ID, if any.
finalinherited
- timestamp → DateTime
-
When this hook execution was initiated.
finalinherited
-
toolInput
→ Map<
String, dynamic> -
Input arguments passed to the tool.
final
- toolIsError → bool?
-
Whether the tool output is an error.
final
- toolName → String
-
Name of the tool being executed.
final
- toolOutput → String?
-
Output from the tool (only set in post-execution hooks).
final
- turnIndex → int?
-
The current conversation turn index, if applicable.
finalinherited
Methods
-
copyWith(
{HookType? hookType, DateTime? timestamp, String? sessionId, Map< String, dynamic> ? metadata, List<HookResult> ? previousResults, int? turnIndex}) → HookContext -
Create a copy with updated fields.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
withOutput(
{required String output, bool isError = false, Duration? duration}) → ToolHookContext - Create a post-execution context from a pre-execution context.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited