Package-level declarations

Types

Link copied to clipboard

Represents a simplified tool base class that processes specific arguments and produces a textual result.

Link copied to clipboard
abstract class Tool<TArgs : Tool.Args, TResult : ToolResult>

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

Link copied to clipboard
data class ToolDescriptor(    val name: String,     val description: String,     val requiredParameters: List<ToolParameterDescriptor> = emptyList(),     val optionalParameters: List<ToolParameterDescriptor> = emptyList())

Represents a descriptor for a tool that contains information about the tool's name, description, required parameters, and optional parameters.

Link copied to clipboard
sealed class ToolException : Exception

A base sealed class representing exceptions specific to tools. This class provides a structure for exceptions with a custom message.

Link copied to clipboard
data class ToolParameterDescriptor(val name: String, val description: String, val type: ToolParameterType)

Represents a descriptor for a tool parameter. A tool parameter descriptor contains information about a specific tool parameter, such as its name, description, data type, and default value.

Link copied to clipboard
sealed class ToolParameterType

Sealed class representing different types of tool parameters.

Link copied to clipboard

A registry that manages a collection of tools for use by agents.

Link copied to clipboard
interface ToolResult

Represents a result produced by a tool operation. This is a marker interface implemented by various result types.

Functions

Link copied to clipboard
fun fail(message: String): Nothing

Throws a ToolException.ValidationFailure exception with the specified error message.

Link copied to clipboard
fun validate(expectation: Boolean, message: () -> String)

Validates a given condition and throws a ToolException.ValidationFailure exception if the condition is not met.

Link copied to clipboard
fun <T : Any> validateNotNull(value: T?, message: () -> String): T

Validates that the provided value is not null. If the value is null, a ToolException.ValidationFailure exception is thrown with the provided error message.