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>
This commit is contained in:
karl 2025-04-29 17:40:50 +08:00 committed by GitHub
parent 3f1045b936
commit 48a3f7b62a

View File

@ -228,7 +228,7 @@ export async function callMCPTool(tool: MCPTool): Promise<MCPCallToolResponse> {
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)}`
}
]
})