Skip to content

Commit ef74377

Browse files
committed
fix: ensure only active tools are processed in base_chat_node.py
--bug=1061252 --user=刘瑞斌 【工具】MCP被禁用后,依然可以在应用中调用 https://www.tapd.cn/62980211/s/1765960
1 parent a8e8a05 commit ef74377

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

apps/application/flow/step_node/ai_chat_step_node/impl/base_chat_node.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ def _handle_mcp_request(self, mcp_enable, tool_enable, mcp_source, mcp_servers,
279279
mcp_servers_config = json.loads(mcp_servers)
280280
elif mcp_tool_id:
281281
mcp_tool = QuerySet(Tool).filter(id=mcp_tool_id).first()
282-
if mcp_tool:
282+
if mcp_tool and mcp_tool.is_active:
283283
mcp_servers_config = json.loads(mcp_tool.code)
284284

285285
if tool_enable:
@@ -288,6 +288,8 @@ def _handle_mcp_request(self, mcp_enable, tool_enable, mcp_source, mcp_servers,
288288
self.context['execute_ids'] = []
289289
for tool_id in tool_ids:
290290
tool = QuerySet(Tool).filter(id=tool_id).first()
291+
if not tool.is_active:
292+
continue
291293
executor = ToolExecutor(CONFIG.get('SANDBOX'))
292294
if tool.init_params is not None:
293295
params = json.loads(rsa_long_decrypt(tool.init_params))

0 commit comments

Comments
 (0)