summaryrefslogtreecommitdiffhomepage
path: root/packages/plugin
diff options
context:
space:
mode:
authorJason Quense <[email protected]>2026-04-16 22:38:21 -0400
committerGitHub <[email protected]>2026-04-16 21:38:21 -0500
commit7b3bb9a76181c478553b9319b734354f988cdac3 (patch)
tree58aefcae2d5578de7251c8bcea68a3d8825c6228 /packages/plugin
parentdc38f22bd8fcb77347759069f7082d15d1c95f29 (diff)
downloadopencode-7b3bb9a76181c478553b9319b734354f988cdac3.tar.gz
opencode-7b3bb9a76181c478553b9319b734354f988cdac3.zip
fix: preserve plugin tool metadata in execute result (#22827)
Co-authored-by: jquense <[email protected]> Co-authored-by: Aiden Cline <[email protected]>
Diffstat (limited to 'packages/plugin')
-rw-r--r--packages/plugin/src/tool.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/packages/plugin/src/tool.ts b/packages/plugin/src/tool.ts
index b568d0371..3105bf534 100644
--- a/packages/plugin/src/tool.ts
+++ b/packages/plugin/src/tool.ts
@@ -27,10 +27,12 @@ type AskInput = {
metadata: { [key: string]: any }
}
+export type ToolResult = string | { output: string; metadata?: { [key: string]: any } }
+
export function tool<Args extends z.ZodRawShape>(input: {
description: string
args: Args
- execute(args: z.infer<z.ZodObject<Args>>, context: ToolContext): Promise<string>
+ execute(args: z.infer<z.ZodObject<Args>>, context: ToolContext): Promise<ToolResult>
}) {
return input
}