onToolError
open suspend override fun onToolError(context: ToolContext, tool: BaseTool, args: Map<String, Any>, error: Throwable): CallbackChoice<Unit, Map<String, Any>>
Callback executed when an error occurs during a tool invocation.
Provides an opportunity to handle tool errors gracefully, potentially providing alternative responses or recovery mechanisms.
Return
A CallbackChoice where returning CallbackChoice.Break with a custom map intercepts the error and resolves execution using that fallback value. Returning CallbackChoice.Continue with Unit permits the error to be propagated naturally.
Parameters
context
The context for the current tool execution.
tool
The tool instance that encountered an error.
args
The arguments that were passed to the tool.
error
The exception that was raised.