mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
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,
|
||||
},
|
||||
)
|
||||
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",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue