ToolRegistry

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

ToolRegistry serves as a central repository for all tools available to an agent. It provides functionality to register tools and retrieve them by name or type.

Key features:

  • Maintains a unique collection of named tools

  • Provides methods to retrieve tools by name or type

  • Supports merging multiple registries

Usage examples:

  1. Creating a registry:

     val registry = ToolRegistry {
    tool(MyCustomTool())
    tool(AnotherTool())
    }
  2. Merging registries:

     val combinedRegistry = registry1 + registry2

Types

Link copied to clipboard
class Builder
Link copied to clipboard
object Companion

Companion object providing factory methods and constants for ToolRegistry.

Properties

Link copied to clipboard
val tools: List<Tool<*, *>>

The list of tools contained in this registry

Functions

Link copied to clipboard
fun add(tool: Tool<*, *>)
Link copied to clipboard
fun addAll(vararg tools: Tool<*, *>)
Link copied to clipboard
inline fun <T : Tool<*, *>> getTool(): T

Retrieves a tool by its type from registry.

fun getTool(toolName: String): Tool<*, *>

Retrieves a tool by its name from the registry.

Link copied to clipboard
operator fun plus(toolRegistry: ToolRegistry): ToolRegistry