hack to return tool call errors back to model

This commit is contained in:
Dax Raad
2025-08-04 11:59:42 -04:00
parent b05decc572
commit 0a42068fbb
4 changed files with 41 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
import { z } from "zod"
import { Tool } from "./tool"
export const InvalidTool = Tool.define("invalid", {
description: "Do not use",
parameters: z.object({
tool: z.string(),
error: z.string(),
}),
async execute(params) {
return {
title: "Invalid Tool",
output: `The arguments provided to the tool are invalid: ${params.error}`,
metadata: {},
}
},
})