AAI SDK
    Preparing search index...

    Function useToolResult

    • Fire a callback when a tool call settles, with the tool's JSON result.

      For new code prefer explicit events — ctx.send(event, data) in the tool paired with useEvent here — over listening to tool results.

      Type Parameters

      • R = any

        The result shape. Defaults to DefaultToolResult (any) so the ordinary untyped spelling compiles; pass the shape — useToolResult<Quote>(…) — for real checking.

      Parameters

      • toolName: string
      • callback: (result: R, toolCall: ToolCallInfo) => void

      Returns void

    • Fire a callback when a tool call settles, with the tool's JSON result.

      For new code prefer explicit events — ctx.send(event, data) in the tool paired with useEvent here — over listening to tool results.

      Type Parameters

      • R = any

        The result shape. Defaults to DefaultToolResult (any) so the ordinary untyped spelling compiles; pass the shape — useToolResult<Quote>(…) — for real checking.

      Parameters

      • callback: (name: string, result: R, toolCall: ToolCallInfo) => void

      Returns void