NestedTool

interface NestedTool : Tool

A Tool whose inner tools can be enumerated without an com.embabel.agent.core.AgentProcess. The minimal abstraction for "this tool is a facade over a fixed set of inner tools" — used by out-of-process consumers (REST gateway, typed-surface generators, documentation, tree-printers) that have no agent-process scope yet still need the children for namespacing or display.

Sits below ProgressiveTool in the type hierarchy: every ProgressiveTool also has an out-of-process inner-tools view via innerTools so callers that don't have a process don't have to pass a synthetic one. UnfoldingTool inherits innerTools from here unchanged.

Implement directly when a tool exposes a fixed inner-tool set but doesn't want the chat-loop revelation semantics of UnfoldingTool (e.g. agentic tools that run their own inner LLM loop and shouldn't have their parent replaced in the LLM toolset).

Inheritors

Properties

Link copied to clipboard

Tool definition for LLM

Link copied to clipboard
abstract val innerTools: List<Tool>

The inner tools this facade exposes. Must be safe to call without an com.embabel.agent.core.AgentProcess in scope.

Link copied to clipboard

Optional metadata

Functions

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

Execute the tool with JSON input.

open fun call(input: String, context: ToolCallContext): Tool.Result

Execute the tool with JSON input and out-of-band context.

Link copied to clipboard
inline fun <T : Any> Tool.requireType(message: String? = null): Tool

Wrap this tool to require a value of type T before execution (reified).

fun <T : Any> Tool.requireType(type: Class<T>, messageProvider: (String) -> String? = { null }): Tool

Wrap this tool to require a value of type T before execution.

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

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

Link copied to clipboard
inline fun <T : Tool> Tool.unwrapAs(): T?

Unwrap a tool to find a specific type, or return null if not found.

Link copied to clipboard

Wrap this tool to conditionally await before execution.

Link copied to clipboard
fun Tool.withConfirmation(messageProvider: (String) -> String): Tool

Wrap this tool to always require confirmation before execution.

Link copied to clipboard
open fun withDefinitionMetadata(entries: Map<String, Any>): Tool

Create a new tool with additional definition metadata entries merged in. Existing keys are overwritten by the new values.

open fun withDefinitionMetadata(key: String, value: Any): Tool

Create a new tool with a single definition metadata entry added.

Link copied to clipboard
open fun withDescription(newDescription: String): Tool

Create a new tool with a different description. Useful for providing context-specific descriptions while keeping the same functionality.

Link copied to clipboard
fun Tool.withEventPublication(agentProcess: AgentProcess, action: Action?, llmOptions: <Error class: unknown class>): Tool

Extension function to wrap a Tool with event publication.

Link copied to clipboard
open fun withName(newName: String): Tool

Create a new tool with a different name. Useful for namespacing tools when combining multiple tool sources.

Link copied to clipboard
open fun withNote(note: String): Tool

Create a new tool with an additional note appended to the description. Useful for adding context-specific hints to an existing tool.