Package 

Class ClientToolRegistry


  • 
    public final class ClientToolRegistry
    
                        

    Registry for managing client-side tools that can be executed by ElevenLabs agents

    This class provides a comprehensive framework for registering, validating, and executing client tools with proper error handling, timeout management, and async execution.

    • Constructor Detail

      • ClientToolRegistry

        ClientToolRegistry()
    • Method Detail

      • registerTool

         final Unit registerTool(String name, ClientTool tool)

        Register a client tool that can be called by agents

        Parameters:
        name - Unique identifier for the tool that agents will use
        tool - Implementation of the tool functionality
      • unregisterTool

         final Boolean unregisterTool(String name)

        Unregister a previously registered client tool

        Parameters:
        name - Tool identifier to remove
      • executeTool

         final ClientToolResult executeTool(String name, Map<String, Object> parameters, Long timeoutMs)

        Execute a client tool with the provided parameters

        Parameters:
        name - Tool name to execute
        parameters - Parameters to pass to the tool
        timeoutMs - Maximum execution time in milliseconds
      • executeToolAsync

         final Unit executeToolAsync(String name, Map<String, Object> parameters, Function1<ClientToolResult, Unit> callback)

        Execute a tool in the background without waiting for the result

        Parameters:
        name - Tool name to execute
        parameters - Parameters to pass to the tool
        callback - Optional callback to receive the result
      • isToolRegistered

         final Boolean isToolRegistered(String name)

        Check if a tool with the given name is registered

        Parameters:
        name - Tool name to check
      • cleanup

         final Unit cleanup()

        Clean up resources when the registry is no longer needed