From 71cd681c91871ecbf570d895c3477cd66c682aef Mon Sep 17 00:00:00 2001 From: Zino Date: Tue, 18 Nov 2025 10:48:33 +0800 Subject: [PATCH] Update api/core/tools/mcp_tool/tool.py Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- api/core/tools/mcp_tool/tool.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/api/core/tools/mcp_tool/tool.py b/api/core/tools/mcp_tool/tool.py index d11f32e885..8afa9df776 100644 --- a/api/core/tools/mcp_tool/tool.py +++ b/api/core/tools/mcp_tool/tool.py @@ -51,9 +51,10 @@ class MCPTool(Tool): ) -> Generator[ToolInvokeMessage, None, None]: # If inputs is provided, flatten its key/value pairs into the tool_parameters. # This is a conservative merge: only add a key from inputs if it does not already exist in tool_parameters. - for key, value in inputs.items(): - if key not in tool_parameters: - tool_parameters[key] = value + if inputs: + for key, value in inputs.items(): + if key not in tool_parameters: + tool_parameters[key] = value result = self.invoke_remote_mcp_tool(tool_parameters) # handle dify tool output for content in result.content: