Tool

interface Tool

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).

Inheritors

Types

Link copied to clipboard
object Companion
Link copied to clipboard
interface Definition

Framework-agnostic tool definition.

Link copied to clipboard
fun interface Function

Functional interface for simple tool implementations.

Link copied to clipboard

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

Link copied to clipboard
interface InputSchema

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

Link copied to clipboard
interface Metadata

Optional metadata about a tool's behavior.

Link copied to clipboard
data class Parameter constructor(val name: String, val type: Tool.ParameterType, val description: String = name, val required: Boolean = true, val enumValues: List<String>? = null)

A single parameter for a tool.

Link copied to clipboard

Supported parameter types.

Link copied to clipboard
sealed interface Result

Result of tool execution with optional artifacts.

Properties

Link copied to clipboard

Tool definition for LLM

Link copied to clipboard

Optional metadata

Functions

Link copied to clipboard
abstract fun call(input: String): Tool.Result

Execute the tool with JSON input.

Link copied to clipboard
fun Tool.toSpringToolCallback(): <Error class: unknown class>

Extension function to convert an Embabel Tool to a Spring AI ToolCallback.