Package io.openliberty.mcp.tools
Interface ToolManager
- All Superinterfaces:
FeatureManager<ToolManager.ToolInfo>,Iterable<ToolManager.ToolInfo>
Allows registering new tools, removing tools and getting information about registered tools.
An instance can be obtained by injecting with @Inject.
In an enterprise application, each web module has its own ToolManager. Calling methods on the ToolManager will affect the current web module.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordThe MCP annotations of a tool.static interfaceInformation about a tool argumentstatic interfaceThe input to a tool handler, providing access to the arguments.static interfaceA builder to define a new tool.static interfaceTool info.Nested classes/interfaces inherited from interface io.openliberty.mcp.features.FeatureManager
FeatureManager.FeatureArguments, FeatureManager.FeatureDefinition<INFO extends FeatureManager.FeatureInfo,ARGUMENTS extends FeatureManager.FeatureArguments, RESPONSE, THIS extends FeatureManager.FeatureDefinition<INFO, ARGUMENTS, RESPONSE, THIS>>, FeatureManager.FeatureInfo, FeatureManager.RequestFeatureArguments -
Method Summary
Modifier and TypeMethodDescriptionGets information about a tool.Adds a tool.removeTool(String name) Removes a tool previously added withnewTool(String).Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
getTool
Gets information about a tool.- Parameters:
name- the name of the tool- Returns:
- the tool with the given name, or
null
-
newTool
Adds a tool.- Parameters:
name- the name of the tool. Must be unique.- Returns:
- a new tool definition builder
- Throws:
IllegalArgumentException- if a tool with the given name already exits- See Also:
-
removeTool
Removes a tool previously added withnewTool(String).- Returns:
- the removed tool or
nullif no such tool existed
-