MCPcopy Index your code
hub / github.com/TaskingAI/TaskingAI / get_plugin_handler

Function get_plugin_handler

plugin/app/cache/plugin_handler.py:24–46  ·  view source on GitHub ↗

Get the plugin handler for the given bundle id and plugin id. :param bundle_id: bundle id. :param plugin_id: plugin id. :return: the plugin.

(bundle_id: str, plugin_id: str)

Source from the content-addressed store, hash-verified

22
23
24def get_plugin_handler(bundle_id: str, plugin_id: str):
25
26 """
27 Get the plugin handler for the given bundle id and plugin id.
28 :param bundle_id: bundle id.
29 :param plugin_id: plugin id.
30 :return: the plugin.
31 """
32 if __plugin_handlers.get(bundle_id, {}).get(plugin_id):
33 return __plugin_handlers[bundle_id][plugin_id]
34
35 if bundle_id not in __plugin_handlers:
36 __plugin_handlers[bundle_id] = {}
37
38 try:
39 # Get the corresponding plugin class
40 model_class = __load_plugin_handler_class(bundle_id, plugin_id)
41 # Instantiate the model class
42 __plugin_handlers[bundle_id][plugin_id] = model_class()
43 except (ImportError, AttributeError):
44 raise Exception(f"get_plugin_handler: error loading plugin_handler of {bundle_id}/{plugin_id}")
45
46 return __plugin_handlers[bundle_id][plugin_id]
47
48
49# Automatically search and import all providers

Callers 2

api_executeFunction · 0.90
load_all_plugin_handlersFunction · 0.85

Calls 2

getMethod · 0.45

Tested by

no test coverage detected