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.
    • getAllTools

      Get all registered tools.
    • getToolsByPlugin

      Collection<McpToolDefinition> getToolsByPlugin(String pluginId)
      Get all tools registered by a specific plugin.
    • searchTools

      Collection<McpToolDefinition> searchTools(String keyword)
      Search tools by keyword (matches name, description, or keywords).
    • hasTool

      boolean hasTool(String toolName)
      Check if a tool 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