From 05f0da063934256cb8cdb9ad6f64ae864f67937d Mon Sep 17 00:00:00 2001 From: Sakura-RanChen <1908198662@qq.com> Date: Mon, 26 Oct 2026 14:40:31 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E6=8E=A5=E5=85=A5=E7=82=B9?= =?UTF-8?q?=E5=B7=A5=E5=85=B7id=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/providers/tools/mcp_endpoint/mcp_endpoint_client.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main/xiaozhi-server/core/providers/tools/mcp_endpoint/mcp_endpoint_client.py b/main/xiaozhi-server/core/providers/tools/mcp_endpoint/mcp_endpoint_client.py index 4e9e5303f..b20ee6221 100644 --- a/main/xiaozhi-server/core/providers/tools/mcp_endpoint/mcp_endpoint_client.py +++ b/main/xiaozhi-server/core/providers/tools/mcp_endpoint/mcp_endpoint_client.py @@ -18,7 +18,9 @@ class MCPEndpointClient: self.name_mapping = {} self.ready = False self.call_results = {} # To store Futures for tool call responses - self.next_id = 1 + # Handshake hardcodes id=1 (initialize) and id=2 (tools/list) in + # mcp_endpoint_handler; tools/call must start at 3 to avoid id reuse. + self.next_id = 3 self.lock = asyncio.Lock() self._cached_available_tools = None # Cache for get_available_tools self.websocket = None # WebSocket连接