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 Details

    • registerTool

      boolean registerTool(String pluginId, McpToolDefinition definition)
      Register an MCP tool definition.
      Parameters:
      pluginId - the plugin ID registering the tool
      definition - the tool definition
      Returns:
      true if registered successfully, false if a tool with this name already exists
    • unregisterTool

      boolean unregisterTool(String toolName)
      Unregister a tool by name.
      Parameters:
      toolName - the tool name
      Returns:
      true if the tool was found and removed
    • unregisterAll

      int unregisterAll(String pluginId)
      Unregister all tools from a plugin.
      Parameters:
      pluginId - the plugin ID
      Returns:
      the number of tools unregistered
    • getTool

      Optional<McpToolDefinition> getTool(String toolName)
      Get a tool definition by name.
      Parameters:
      toolName - the unique name of the tool to retrieve
      Returns:
      an Optional containing the tool definition if registered, otherwise empty
    • getAllTools

      Get all registered tools.
    • getToolsByPlugin

      Collection<McpToolDefinition> getToolsByPlugin(String pluginId)
      Get all tools registered by a specific plugin.
      Parameters:
      pluginId - the identifier of the plugin whose tools should be returned
      Returns:
      the collection of tool definitions owned by the plugin
    • searchTools

      Collection<McpToolDefinition> searchTools(String keyword)
      Search tools by keyword (matches name, description, or keywords).
      Parameters:
      keyword - the search term to match against tool metadata
      Returns:
      the collection of tool definitions matching the keyword
    • hasTool

      boolean hasTool(String toolName)
      Check if a tool is registered.
      Parameters:
      toolName - the name of the tool to check
      Returns:
      true if a tool with the given name is registered
    • getToolCount

      int getToolCount()
      Get the total number of registered tools.
    • executeTool

      ToolResult executeTool(String toolName, AgentToolContext context, Map<String,Object> parameters)
      Execute a tool by name.
      Parameters:
      toolName - the tool name
      context - the execution context
      parameters - the tool parameters
      Returns:
      the tool's result