AfterToolCallHook typedef

AfterToolCallHook = FutureOr<AfterToolCallResult?> Function(AfterToolCallContext context, CancelToken? cancelToken)

Called after a tool finishes executing, before tool_execution_end and the tool-result message events are emitted (pi's afterToolCall).

A throw turns the result into an error tool result (pi semantics).

Implementation

typedef AfterToolCallHook =
    FutureOr<AfterToolCallResult?> Function(
      AfterToolCallContext context,
      CancelToken? cancelToken,
    );