Class ToolRegistry
java.lang.Object
net.thevpc.naru.tool.ToolRegistry
Registry of all tools available to the agent.
Tools are kept in insertion order so the model always sees them in a deterministic sequence.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ToolDefinitionbuildDefinition(String name, String description, ToolParameter... params) Build aToolDefinitionfrom a list ofToolParameters.Dispatch a tool call by name and return its string result.Returns all registered tool definitions to be sent to the model.booleanisEmpty()names()Register a tool.
-
Constructor Details
-
ToolRegistry
public ToolRegistry()
-
-
Method Details
-
register
Register a tool. Overwrites any previous tool with the same name. -
dispatch
Dispatch a tool call by name and return its string result.- Throws:
IllegalArgumentException- if the tool name is unknown
-
getDefinitions
Returns all registered tool definitions to be sent to the model. -
isEmpty
public boolean isEmpty() -
names
-
buildDefinition
public static ToolDefinition buildDefinition(String name, String description, ToolParameter... params) Build aToolDefinitionfrom a list ofToolParameters. Intended to be used inside each tool's constructor.
-