Interface Tools

All Known Subinterfaces:
ToolRegistry
All Known Implementing Classes:
DefaultToolRegistry

public interface Tools
Registry for server tools.
  • Method Details

    • register

      Tools register(ToolDescriptor descriptor, ToolFn fn)
      Registers a tool descriptor with a synchronous function.
      Parameters:
      descriptor - the tool descriptor
      fn - the tool function
      Returns:
      this registry
    • register

      default Tools register(Consumer<ToolDescriptor.Builder> configurer, ToolFn fn)
      Builds and registers a tool descriptor with a synchronous function.
      Parameters:
      configurer - the descriptor builder configurer
      fn - the tool function
      Returns:
      this registry
    • registerAsync

      Tools registerAsync(ToolDescriptor descriptor, AsyncToolFn fn)
      Registers a tool descriptor with an asynchronous function.
      Parameters:
      descriptor - the tool descriptor
      fn - the asynchronous tool function
      Returns:
      this registry
    • registerAsync

      default Tools registerAsync(Consumer<ToolDescriptor.Builder> configurer, AsyncToolFn fn)
      Builds and registers a tool descriptor with an asynchronous function.
      Parameters:
      configurer - the descriptor builder configurer
      fn - the asynchronous tool function
      Returns:
      this registry
    • unregister

      boolean unregister(String name)
      Removes the registered tool with the specified name.
      Parameters:
      name - the name of the tool to remove
      Returns:
      true if a tool was removed, false if no tool was registered with that name
    • find

      Finds a registered tool descriptor by name.
      Parameters:
      name - the name of the tool to find
      Returns:
      the matching tool descriptor, or an empty optional if no tool is registered with that name
    • descriptors

      List<ToolDescriptor> descriptors()
      Lists the descriptors of all registered tools.
      Returns:
      the registered tool descriptors