Class PluginRegistry
java.lang.Object
neqsim.mcp.runners.PluginRegistry
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 Summary
FieldsModifier and TypeFieldDescriptionprivate static final com.google.gson.Gsonprivate static final ConcurrentHashMap<String, McpRunnerPlugin> Registered plugins keyed by name. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivatePrivate constructor — all methods are static. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidclear()Clears all registered plugins.static McpRunnerPluginReturns a plugin by name.static booleanChecks whether a plugin with the given name is registered.Returns all registered plugin names.static StringLists all registered plugins with their metadata (for AI agent discovery).static voidregister(McpRunnerPlugin plugin) Registers a plugin.static StringRuns a plugin by name with the given JSON input.static intsize()Returns the number of registered plugins.static McpRunnerPluginunregister(String name) Unregisters a plugin by name.
-
Field Details
-
GSON
private static final com.google.gson.Gson GSON -
PLUGINS
Registered plugins keyed by name.
-
-
Constructor Details
-
PluginRegistry
private PluginRegistry()Private constructor — all methods are static.
-
-
Method Details
-
register
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
Unregisters a plugin by name.- Parameters:
name- the plugin name- Returns:
- the removed plugin, or null if not found
-
get
Returns a plugin by name.- Parameters:
name- the plugin name- Returns:
- the plugin, or null if not registered
-
has
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
-
runPlugin
-
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.
-