fix: preserve plugin tool metadata in execute result (#22827)
Co-authored-by: jquense <jquense@ramp.com> Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user