Tool

Represents a tool that, when executed, makes changes to the environment.

Inheritors

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
interface Args

Base type, representing tool arguments.

Link copied to clipboard
@Serializable
data object EmptyArgs : Tool.Args

Args implementation that can be used for tools that expect no arguments.

Properties

Link copied to clipboard
abstract val argsSerializer: KSerializer<TArgs>

Serializer responsible for encoding and decoding the arguments required for the tool execution. This abstract property is used to define the specific KSerializer corresponding to the type of arguments expected by the tool.

Link copied to clipboard

Provides a descriptor detailing the tool's metadata, including its name, description, and parameter requirements. This property defines the structure and characteristics of the tool, offering an overview of its functionality and how it should be used.

Link copied to clipboard

Represents the name property of the tool, derived from the tool's descriptor. This property provides an immutable reference to the tool's unique name, which is used for identification within tool registries.

Functions

Link copied to clipboard
fun decodeArgs(rawArgs: JsonObject): TArgs

Decodes the provided raw JSON arguments into an instance of the specified arguments type.

Link copied to clipboard

Decodes a raw string representation of arguments into the corresponding object of type TArgs.

Link copied to clipboard
fun encodeArgs(args: TArgs): JsonObject

Encodes the given arguments into a JSON representation.

Link copied to clipboard

Encodes the provided arguments into a JSON string representation using the configured serializer.

Link copied to clipboard

Encodes the given result of type TResult to its string representation for the LLM.s

Link copied to clipboard

Encodes the provided result object into a JSON string representation without type safety checks.