From a9796806cf6e2c645c91494bc4d399c2f7f231cb Mon Sep 17 00:00:00 2001 From: sean Date: Thu, 12 Jun 2025 08:05:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20http=20=E8=BE=93?= =?UTF-8?q?=E5=87=BA=E9=80=82=E9=85=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/commands/MCPStreamableHttpCommand.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/lib/commands/MCPStreamableHttpCommand.js b/src/lib/commands/MCPStreamableHttpCommand.js index d9ad3b4..311d6b5 100644 --- a/src/lib/commands/MCPStreamableHttpCommand.js +++ b/src/lib/commands/MCPStreamableHttpCommand.js @@ -516,19 +516,12 @@ class MCPStreamableHttpCommand { const result = await cli.execute(toolName.replace('promptx_', ''), cliArgs, true); this.log(`✅ CLI执行完成: ${toolName}`); - // 返回新 MCP SDK 格式的响应 - return { - content: [ - { - type: 'text', - text: typeof result === 'string' ? result : JSON.stringify(result, null, 2) - } - ] - }; + // 使用输出适配器转换为MCP响应格式(与stdio模式保持一致) + return this.outputAdapter.convertToMCPFormat(result); } catch (error) { this.log(`❌ 工具调用失败: ${toolName} - ${error.message}`); - throw error; // 让 MCP SDK 处理错误 + return this.outputAdapter.handleError(error); } }