Package com.embabel.agent.api.tool
Interface MatryoshkaTool
-
- All Implemented Interfaces:
-
com.embabel.agent.api.tool.Tool,com.embabel.agent.api.tool.ToolInfo
public interface MatryoshkaTool implements Tool
A tool that contains other tools, enabling progressive tool disclosure.
Named after Russian nesting dolls, a MatryoshkaTool presents a high-level description to the LLM. When invoked, its inner tools become available and (optionally) the MatryoshkaTool itself is removed.
This pattern is useful for:
Reducing tool set complexity for the LLM
Grouping related tools under a category facade
Progressive disclosure based on LLM intent
Example:
val databaseTool = MatryoshkaTool.of( name = "database_operations", description = "Use this to work with the database. Invoke to see specific operations.", innerTools = listOf(queryTableTool, insertRecordTool, updateRecordTool) )
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classMatryoshkaTool.Companion
-
Method Summary
Modifier and Type Method Description List<Tool>selectTools(String input)Select which inner tools to expose based on invocation input. abstract List<Tool>getInnerTools()The inner tools that will be exposed when this tool is invoked. BooleangetRemoveOnInvoke()-
-
Method Detail
-
selectTools
List<Tool> selectTools(String input)
Select which inner tools to expose based on invocation input.
Override this method to implement category-based or argument-driven tool selection. Default implementation returns all inner tools.
- Parameters:
input- The JSON input string provided to this tool- Returns:
The tools to expose (subset of innerTools or all)
-
getInnerTools
abstract List<Tool> getInnerTools()
The inner tools that will be exposed when this tool is invoked.
-
getRemoveOnInvoke
Boolean getRemoveOnInvoke()
-
-
-
-