call

abstract suspend fun call(context: ToolContext, tool: BaseTool, args: Map<String, Any?>, result: Map<String, Any?>): Map<String, Any?>

Callback executed after a tool runs, or after a before-tool callback answers the call in its place.

This callback allows for inspecting, logging, or modifying the tool result.

Return

The potentially updated or replaced dictionary / map to propagate downstream.

Parameters

context

The context specific to the tool execution.

tool

The tool for the call; for a name that matches no registered tool, a placeholder carrying that name.

args

The arguments for the tool call, including any changes from before-tool callbacks.

result

The tool's result as a map, or the result a before-tool or on-tool-error callback supplied instead. Values may be null.