RepairToolCall typedef
RepairToolCall =
FutureOr<RawToolCall?> Function(ToolCallRepairContext context)
A host-side hook that repairs one invalid tool call (RFC-0035), mirroring
the AI SDK's repairToolCall. See GenerateTextOptions.repairToolCall.
Return a RawToolCall to replace the call, or null to leave it as it is.
Throwing means the repair failed: the call stays invalid and carries a
ToolCallRepairError whose cause is the thrown object's toString().
The hook runs on the caller's isolate, after the native call has returned,
so it may itself call back into aimux (including another model call).
A Future return is only awaited on the streaming path, which is the only
asynchronous entry point; the synchronous entry points
(TypedModel.generateText and friends) reject one with a StateError.
Implementation
typedef RepairToolCall = FutureOr<RawToolCall?> Function(
ToolCallRepairContext context);