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

Function verify_tools

backend/app/services/tool/tool.py:18–37  ·  view source on GitHub ↗

Verify tools, raise error if any tool is invalid :param tools: the tools :return: None

(tools: List[ToolRef])

Source from the content-addressed store, hash-verified

16
17
18async def verify_tools(tools: List[ToolRef]):
19 """
20 Verify tools, raise error if any tool is invalid
21 :param tools: the tools
22 :return: None
23 """
24
25 for tool in tools:
26 if tool.type == "action":
27 await action_ops.get(action_id=tool.id)
28
29 elif tool.type == "plugin":
30 if "/" not in tool.id:
31 raise_request_validation_error(f"Invalid plugin tool ID: {tool.id}")
32 bundle_instance_id, plugin_id = tool.id.split("/")
33 bundle: BundleInstance = await bundle_instance_ops.get(bundle_instance_id=bundle_instance_id)
34 get_plugin(bundle_id=bundle.bundle_id, plugin_id=plugin_id)
35
36 else:
37 raise_request_validation_error(f"Invalid tool type: {tool.type}")
38
39
40async def fetch_tools(tool_refs: List[ToolRef]) -> List[Tool]:

Callers 1

_validate_toolsFunction · 0.90

Calls 3

get_pluginFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected