Class PluginRegistry

java.lang.Object
neqsim.mcp.runners.PluginRegistry

public final class PluginRegistry extends Object
Registry for MCP runner plugins.

Provides a central place to register, discover, and invoke custom runner plugins. Plugins are stored in a thread-safe map keyed by name. The registry can list all available plugins (with descriptions and schemas) for AI agent discovery.

Version:
1.0
Author:
Even Solbraa
  • Field Details

  • Constructor Details

    • PluginRegistry

      private PluginRegistry()
      Private constructor — all methods are static.
  • Method Details

    • register

      public static void register(McpRunnerPlugin plugin)
      Registers a plugin. Overwrites any existing plugin with the same name.
      Parameters:
      plugin - the plugin to register
      Throws:
      IllegalArgumentException - if plugin or its name is null
    • unregister

      public static McpRunnerPlugin unregister(String name)
      Unregisters a plugin by name.
      Parameters:
      name - the plugin name
      Returns:
      the removed plugin, or null if not found
    • get

      public static McpRunnerPlugin get(String name)
      Returns a plugin by name.
      Parameters:
      name - the plugin name
      Returns:
      the plugin, or null if not registered
    • has

      public static boolean has(String name)
      Checks whether a plugin with the given name is registered.
      Parameters:
      name - the plugin name
      Returns:
      true if registered
    • size

      public static int size()
      Returns the number of registered plugins.
      Returns:
      plugin count
    • listNames

      public static List<String> listNames()
      Returns all registered plugin names.
      Returns:
      unmodifiable list of names
    • runPlugin

      public static String runPlugin(String name, String json)
      Runs a plugin by name with the given JSON input.
      Parameters:
      name - the plugin name
      json - the input JSON
      Returns:
      the plugin output JSON, or an error JSON if not found
    • listPlugins

      public static String listPlugins()
      Lists all registered plugins with their metadata (for AI agent discovery).
      Returns:
      JSON string with plugin catalog
    • clear

      public static void clear()
      Clears all registered plugins. Primarily for testing.