Interface McpToolRegistry
public interface McpToolRegistry
Registry for MCP (Model Context Protocol) tools.
Manages the lifecycle of MCP tools provided by plugins and built-in sources. Tools can be registered, unregistered, searched, and executed through this registry.
This replaces the legacy AgentToolRegistry with MCP-compatible tool management.
-
Method Summary
Modifier and TypeMethodDescriptionexecuteTool(String toolName, AgentToolContext context, Map<String, Object> parameters) Execute a tool by name.Get all registered tools.Get a tool definition by name.intGet the total number of registered tools.getToolsByPlugin(String pluginId) Get all tools registered by a specific plugin.booleanCheck if a tool is registered.booleanregisterTool(String pluginId, McpToolDefinition definition) Register an MCP tool definition.searchTools(String keyword) Search tools by keyword (matches name, description, or keywords).intunregisterAll(String pluginId) Unregister all tools from a plugin.booleanunregisterTool(String toolName) Unregister a tool by name.
-
Method Details
-
registerTool
Register an MCP tool definition.- Parameters:
pluginId- the plugin ID registering the tooldefinition- the tool definition- Returns:
- true if registered successfully, false if a tool with this name already exists
-
unregisterTool
Unregister a tool by name.- Parameters:
toolName- the tool name- Returns:
- true if the tool was found and removed
-
unregisterAll
Unregister all tools from a plugin.- Parameters:
pluginId- the plugin ID- Returns:
- the number of tools unregistered
-
getTool
Get a tool definition by name. -
getAllTools
Collection<McpToolDefinition> getAllTools()Get all registered tools. -
getToolsByPlugin
Get all tools registered by a specific plugin. -
searchTools
Search tools by keyword (matches name, description, or keywords). -
hasTool
Check if a tool is registered. -
getToolCount
int getToolCount()Get the total number of registered tools. -
executeTool
Execute a tool by name.- Parameters:
toolName- the tool namecontext- the execution contextparameters- the tool parameters- Returns:
- the tool's result
-