mirror of
https://github.com/hanzoai/code.git
synced 2026-09-30 20:53:35 +00:00
mcp errors handling
This commit is contained in:
@@ -716,8 +716,6 @@ class ChatThreadService extends Disposable implements IChatThreadService {
|
||||
const toolResult_ = toolResult as RawMCPToolCall
|
||||
if (toolResult_.event === 'text') {
|
||||
toolResultStr = toolResult_.text
|
||||
} else if (toolResult_.event === 'error') {
|
||||
toolResultStr = `Error: ${toolResult_.text}`
|
||||
} else if (toolResult_.event === 'image') {
|
||||
toolResultStr = `[Image: ${toolResult_.image.mimeType}]`
|
||||
} else if (toolResult_.event === 'audio') {
|
||||
|
||||
@@ -298,6 +298,9 @@ class MCPService extends Disposable implements IMCPService {
|
||||
|
||||
public async callMCPTool(toolData: MCPToolCallParams): Promise<{ result: RawMCPToolCall }> {
|
||||
const result = await this.channel.call<RawMCPToolCall>('callTool', toolData);
|
||||
if (result.event === 'error') {
|
||||
throw new Error(`Error: ${result.text}`)
|
||||
}
|
||||
return { result };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user