Skip to content

Commit 3c7b229

Browse files
authored
fix: allow tool.execute.after hook to modify MCP tool output (#3381)
1 parent 9ab4414 commit 3c7b229

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎packages/opencode/src/session/prompt.ts‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -588,10 +588,7 @@ export namespace SessionPrompt {
588588
},
589589
)
590590
const result = await execute(args, opts)
591-
const output = result.content
592-
.filter((x: any) => x.type === "text")
593-
.map((x: any) => x.text)
594-
.join("\n\n")
591+
595592
await Plugin.trigger(
596593
"tool.execute.after",
597594
{
@@ -602,6 +599,11 @@ export namespace SessionPrompt {
602599
result,
603600
)
604601

602+
const output = result.content
603+
.filter((x: any) => x.type === "text")
604+
.map((x: any) => x.text)
605+
.join("\n\n")
606+
605607
return {
606608
title: "",
607609
metadata: {},

0 commit comments

Comments
 (0)