From f2ea86875d86a4e373a27f179145a613bc838245 Mon Sep 17 00:00:00 2001 From: Zino Date: Mon, 24 Nov 2025 14:57:55 +0800 Subject: [PATCH] Apply suggestions from code review Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- api/core/mcp/auth_client.py | 2 +- api/core/mcp/mcp_client.py | 2 +- api/core/tools/mcp_tool/tool.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/core/mcp/auth_client.py b/api/core/mcp/auth_client.py index 908ce1b967..bbf18ab780 100644 --- a/api/core/mcp/auth_client.py +++ b/api/core/mcp/auth_client.py @@ -180,7 +180,7 @@ class MCPClientWithAuthRetry(MCPClient): """ return self._execute_with_retry(super().list_tools) - def invoke_tool(self, tool_name: str, tool_args: dict[str, Any], _meta: dict[str, Any]) -> CallToolResult: + def invoke_tool(self, tool_name: str, tool_args: dict[str, Any], _meta: dict[str, Any] | None = None) -> CallToolResult: """ Invoke a tool on the MCP server with auth retry. diff --git a/api/core/mcp/mcp_client.py b/api/core/mcp/mcp_client.py index 0fd6816493..5e9f1f4058 100644 --- a/api/core/mcp/mcp_client.py +++ b/api/core/mcp/mcp_client.py @@ -96,7 +96,7 @@ class MCPClient: response = self._session.list_tools() return response.tools - def invoke_tool(self, tool_name: str, tool_args: dict[str, Any], _meta: dict[str, Any]) -> CallToolResult: + def invoke_tool(self, tool_name: str, tool_args: dict[str, Any], _meta: dict[str, Any] | None = None) -> CallToolResult: """Call a tool""" if not self._session: raise ValueError("Session not initialized.") diff --git a/api/core/tools/mcp_tool/tool.py b/api/core/tools/mcp_tool/tool.py index c33ea3894c..60cf2ab925 100644 --- a/api/core/tools/mcp_tool/tool.py +++ b/api/core/tools/mcp_tool/tool.py @@ -133,7 +133,7 @@ class MCPTool(Tool): if value is not None and not (isinstance(value, str) and value.strip() == "") } - def invoke_remote_mcp_tool(self, tool_parameters: dict[str, Any], _meta: dict[str, Any]) -> CallToolResult: + def invoke_remote_mcp_tool(self, tool_parameters: dict[str, Any], _meta: dict[str, Any] | None) -> CallToolResult: headers = self.headers.copy() if self.headers else {} tool_parameters = self._handle_none_parameter(tool_parameters)