Interface Tool

  • All Implemented Interfaces:
    com.embabel.agent.api.tool.ToolInfo

    
    public interface Tool
     implements ToolInfo
                        

    Framework-agnostic tool that can be invoked by an LLM. Adapters in SPI layer bridge to Spring AI ToolCallback or LangChain4j ToolSpecification/ToolExecutor.

    All nested types are scoped within this interface to avoid naming conflicts with framework-specific types (e.g., Spring AI's ToolDefinition, ToolMetadata).

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      public interface Tool.Definition

      Framework-agnostic tool definition.

      public interface Tool.InputSchema

      Input schema for a tool, supporting both simple and complex parameters.

      public final class Tool.Parameter

      A single parameter for a tool.

      public enum Tool.ParameterType

      Supported parameter types.

      public interface Tool.Metadata

      Optional metadata about a tool's behavior.

      public interface Tool.Result

      Result of tool execution with optional artifacts.

      public interface Tool.Function

      Functional interface for simple tool implementations.

      public interface Tool.Handler

      Java-friendly functional interface for tool implementations. Uses handle method name which is more idiomatic in Java than invoke.

      public class Tool.Companion
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract Tool.Result call(String input) Execute the tool with JSON input.
      • Methods inherited from class com.embabel.agent.api.tool.ToolInfo

        getDefinition, getMetadata
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • call

         abstract Tool.Result call(String input)

        Execute the tool with JSON input.

        Parameters:
        input - JSON string matching inputSchema
        Returns:

        Result to send back to LLM