# beforeTool

open suspend fun beforeTool(context: ToolContext, tool: BaseTool, args: Map<String, Any>): CallbackChoice<Map<String, Any>, Map<String, Any>>

Callback executed before a tool is invoked.

Provides a way to audit, log, or modify the arguments being passed to a tool, or to short-circuit the tool call.

#### Return

A CallbackChoice representing the tool response/arguments. When CallbackChoice.Break is returned, the value will be used as the tool response and the framework will skip calling the actual tool. When CallbackChoice.Continue is returned, the value will be used as the arguments to be passed to the tool.

#### Parameters

context

The context of the current tool execution.

tool

The tool about to be executed.

args

The arguments to be passed to the tool.