MCPcopy Index your code
hub / github.com/google/adk-python / register_plugin

Method register_plugin

src/google/adk/plugins/plugin_manager.py:107–119  ·  view source on GitHub ↗

Registers a new plugin. Args: plugin: The plugin instance to register. Raises: ValueError: If a plugin with the same name is already registered.

(self, plugin: BasePlugin)

Source from the content-addressed store, hash-verified

105 self._skip_closing_plugins = value
106
107 def register_plugin(self, plugin: BasePlugin) -> None:
108 """Registers a new plugin.
109
110 Args:
111 plugin: The plugin instance to register.
112
113 Raises:
114 ValueError: If a plugin with the same name is already registered.
115 """
116 if any(p.name == plugin.name for p in self.plugins):
117 raise ValueError(f"Plugin with name '{plugin.name}' already registered.")
118 self.plugins.append(plugin)
119 logger.info("Plugin '%s' registered.", plugin.name)
120
121 def get_plugin(self, plugin_name: str) -> Optional[BasePlugin]:
122 """Retrieves a registered plugin by its name.

Calls 1

appendMethod · 0.45