add catch for mcp tool execution

This commit is contained in:
Aiden Cline
2025-10-28 10:21:32 -05:00
parent 49ea5aa2ad
commit 74acd08ead

View File

@@ -582,7 +582,17 @@ export namespace SessionPrompt {
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(
"tool.execute.after",