diff --git a/astrbot/dashboard/routes/tools.py b/astrbot/dashboard/routes/tools.py index b19385c28..67ff25dc6 100644 --- a/astrbot/dashboard/routes/tools.py +++ b/astrbot/dashboard/routes/tools.py @@ -324,9 +324,15 @@ class ToolsRoute(Route): tools = self.tool_mgr.func_list tools_dict = [] for tool in tools: - if isinstance(tool, MCPTool): + # Use the source field added to FunctionTool + source = getattr(tool, "source", "plugin") + + if source == "mcp" and isinstance(tool, MCPTool): origin = "mcp" origin_name = tool.mcp_server_name + elif source == "internal": + origin = "internal" + origin_name = "AstrBot" elif tool.handler_module_path and star_map.get( tool.handler_module_path ): @@ -344,6 +350,7 @@ class ToolsRoute(Route): "active": tool.active, "origin": origin, "origin_name": origin_name, + "source": source, } tools_dict.append(tool_info) return Response().ok(data=tools_dict).__dict__ @@ -361,6 +368,11 @@ class ToolsRoute(Route): if not tool_name or action is None: return Response().error("缺少必要参数: name 或 action").__dict__ + # Internal tools cannot be toggled by users + for t in self.tool_mgr.func_list: + if t.name == tool_name and getattr(t, "source", "") == "internal": + return Response().error("内置工具不支持手动启用/停用").__dict__ + if action: try: ok = self.tool_mgr.activate_llm_tool(tool_name, star_map=star_map) diff --git a/dashboard/src/components/extension/componentPanel/components/ToolTable.vue b/dashboard/src/components/extension/componentPanel/components/ToolTable.vue index 7fa4ef167..fb2d29b76 100644 --- a/dashboard/src/components/extension/componentPanel/components/ToolTable.vue +++ b/dashboard/src/components/extension/componentPanel/components/ToolTable.vue @@ -25,6 +25,7 @@ const toolHeaders = computed(() => [ ]); const parameterEntries = (tool: ToolItem) => Object.entries(tool.parameters?.properties || {}); +const isInternal = (tool: ToolItem) => tool.source === 'internal';