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 interfaceTool.DefinitionFramework-agnostic tool definition.
public interfaceTool.InputSchemaInput schema for a tool, supporting both simple and complex parameters.
public final classTool.ParameterA single parameter for a tool.
public enumTool.ParameterTypeSupported parameter types.
public interfaceTool.MetadataOptional metadata about a tool's behavior.
public interfaceTool.ResultResult of tool execution with optional artifacts.
public interfaceTool.FunctionFunctional interface for simple tool implementations.
public interfaceTool.HandlerJava-friendly functional interface for tool implementations. Uses
handlemethod name which is more idiomatic in Java thaninvoke.public classTool.Companion
-
Method Summary
Modifier and Type Method Description abstract Tool.Resultcall(String input)Execute the tool with JSON input. ToolwithName(String newName)Create a new tool with a different name. ToolwithDescription(String newDescription)Create a new tool with a different description. ToolwithNote(String note)Create a new tool with an additional note appended to the description. -
-
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
-
withName
Tool withName(String newName)
Create a new tool with a different name. Useful for namespacing tools when combining multiple tool sources.
- Parameters:
newName- The new name to use- Returns:
A new Tool with the updated name
-
withDescription
Tool withDescription(String newDescription)
Create a new tool with a different description. Useful for providing context-specific descriptions while keeping the same functionality.
- Parameters:
newDescription- The new description to use- Returns:
A new Tool with the updated description
-
-
-
-