mirror of
https://github.com/voideditor/void
synced 2026-05-23 09:28:23 +00:00
mcp errors handling
This commit is contained in:
parent
4f4af9b8b9
commit
b56cc0d662
2 changed files with 3 additions and 2 deletions
|
|
@ -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 };
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue