callTool

Executes the specified tool with the given arguments and returns the result within a SafeTool.Result wrapper.

Return

a SafeTool.Result containing the tool's execution result of type TResult.

Parameters

TArgs

the type of arguments required by the tool, extending Tool.Args.

TResult

the type of result returned by the tool, implementing ToolResult.

tool

the tool to be executed.

args

the arguments required to execute the tool.


inline suspend fun <TArgs : Tool.Args> callTool(toolName: String, args: TArgs): SafeTool.Result<out ToolResult>(source)

Executes a tool by its name with the provided arguments.

Return

A SafeTool.Result containing the result of the tool execution, which is a subtype of ToolResult.

Parameters

toolName

The name of the tool to be executed.

args

The arguments required to execute the tool, which must be a subtype of Tool.Args.


inline suspend fun <TArgs : Tool.Args, TResult : ToolResult> callTool(toolClass: KClass<out Tool<TArgs, TResult>>, args: TArgs): SafeTool.Result<TResult>(source)

Executes a tool operation based on the provided tool class and arguments.

Return

A result wrapper containing either the successful result of the tool's execution or an error.

Parameters

TArgs

The type of arguments required by the tool.

TResult

The type of result produced by the tool.

toolClass

The class of the tool to be executed.

args

The arguments to be passed to the tool for its execution.


inline suspend fun <ToolT : Tool<*, *>> callTool(args: Tool.Args): SafeTool.Result<out ToolResult>(source)

Invokes a tool of the specified type with the provided arguments.

Return

A SafeTool.Result containing the outcome of the tool's execution, which may be of any type that extends ToolResult.

Parameters

args

The input arguments required for the tool execution, represented as an instance of Tool.Args.