afterTool
open suspend override fun afterTool(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 before it is returned to the agent.
Return
The potentially modified result 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.