Package-level declarations

Types

Link copied to clipboard
abstract class SimpleTool<TArgs>(argsType: TypeToken, name: String, description: String) : Tool<TArgs, String>

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

Link copied to clipboard
abstract class Tool<TArgs, TResult>(argsType: TypeToken, resultType: TypeToken, descriptor: ToolDescriptor, metadata: Map<String, String> = emptyMap()) : ToolBase<TArgs, TResult>

A tool with a no-metadata execute shape. The runtime dispatches it through ToolBase.execute; this subclass's final override forwards to execute and discards any per-call ToolCallMetadata supplied by the caller or contributed by features.

Link copied to clipboard
abstract class ToolBase<TArgs, TResult>(val argsType: TypeToken, val resultType: TypeToken, val descriptor: ToolDescriptor, val metadata: Map<String, String> = emptyMap())

The runtime contract that every tool dispatched by the agent satisfies.

Link copied to clipboard
class ToolCallMetadata(content: Map<String, Any?>) : Map<String, Any?>

Immutable, caller-contributed context threaded into Tool.execute alongside the typed arguments.

Link copied to clipboard
open class ToolDescriptor(val name: String, val description: String, val requiredParameters: List<ToolParameterDescriptor> = emptyList(), val optionalParameters: List<ToolParameterDescriptor> = emptyList(), val cacheControl: CacheControl? = null)

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

Link copied to clipboard

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
expect class ToolRegistryBuilder

A builder class for creating a ToolRegistry instance. This class provides methods to configure and register tools, either individually or as a list, and then constructs a registry containing the defined tools.

actual class ToolRegistryBuilder

A builder class for creating a ToolRegistry instance. This class provides methods to configure and register tools, either individually or as a list, and then constructs a registry containing the defined tools.

actual class ToolRegistryBuilder

A builder class for creating a ToolRegistry instance. This class provides methods to configure and register tools, either individually or as a list, and then constructs a registry containing the defined tools.

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.