Tool

constructor(argsSerializer: KSerializer<TArgs>, resultSerializer: KSerializer<TResult>, descriptor: ToolDescriptor)(source)

Parameters

TArgs

The type of arguments the tool accepts.

TResult

The type of result the tool returns. Provides a textual explanation of what the tool does and how it can be used (for the LLM).


constructor(argsSerializer: KSerializer<TArgs>, resultSerializer: KSerializer<TResult>, name: String, description: String)(source)

Convenience constructor for the base tool class that generates ToolDescriptor from the provided name, description and argsSerializer using asToolDescriptor

Parameters

argsSerializer

A KSerializer responsible for encoding and decoding the arguments required for the tool execution.

resultSerializer

A KSerializer responsible for encoding and decoding the result returned by the tool execution.

name

The name of the tool.

description

Textual explanation of what the tool does and how it can be used (for the LLM).