From 48a3f7b62a40acc932001ec7dbad31004ef8824d Mon Sep 17 00:00:00 2001 From: karl Date: Tue, 29 Apr 2025 17:40:50 +0800 Subject: [PATCH] fix: The Error display of the failed mcp call shows that the Error type cannot be displayed (#5492) * fix: The Error display of the failed mcp call shows that the Error type cannot be displayed * Update src/renderer/src/utils/mcp-tools.ts Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> --------- Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> --- src/renderer/src/utils/mcp-tools.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/src/utils/mcp-tools.ts b/src/renderer/src/utils/mcp-tools.ts index 1e7c01dfc8..a9c48a7f61 100644 --- a/src/renderer/src/utils/mcp-tools.ts +++ b/src/renderer/src/utils/mcp-tools.ts @@ -228,7 +228,7 @@ export async function callMCPTool(tool: MCPTool): Promise { content: [ { type: 'text', - text: `Error calling tool ${tool.name}: ${JSON.stringify(e)}` + text: `Error calling tool ${tool.name}: ${e instanceof Error ? (e.stack || e.message || "No error details available") : JSON.stringify(e)}` } ] })