add catch for mcp tool execution
This commit is contained in:
parent
49ea5aa2ad
commit
74acd08ead
1 changed files with 11 additions and 1 deletions
|
|
@ -582,7 +582,17 @@ export namespace SessionPrompt {
|
||||||
args,
|
args,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
const result = await execute(args, opts)
|
const result = await execute(args, opts).catch((err) => {
|
||||||
|
log.error("Error executing tool", { error: err, tool: key })
|
||||||
|
return {
|
||||||
|
content: [
|
||||||
|
{
|
||||||
|
type: "text",
|
||||||
|
text: `Failed to execute tool: ${err instanceof Error ? err.message : String(err)}`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
await Plugin.trigger(
|
await Plugin.trigger(
|
||||||
"tool.execute.after",
|
"tool.execute.after",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue