hack to return tool call errors back to model
This commit is contained in:
parent
b05decc572
commit
0a42068fbb
2 changed files with 41 additions and 0 deletions
17
packages/opencode/src/tool/invalid.ts
Normal file
17
packages/opencode/src/tool/invalid.ts
Normal 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: {},
|
||||
}
|
||||
},
|
||||
})
|
||||
|
|
@ -10,9 +10,11 @@ import { TaskTool } from "./task"
|
|||
import { TodoWriteTool, TodoReadTool } from "./todo"
|
||||
import { WebFetchTool } from "./webfetch"
|
||||
import { WriteTool } from "./write"
|
||||
import { InvalidTool } from "./invalid"
|
||||
|
||||
export namespace ToolRegistry {
|
||||
const ALL = [
|
||||
InvalidTool,
|
||||
BashTool,
|
||||
EditTool,
|
||||
WebFetchTool,
|
||||
|
|
|
|||
Loading…
Reference in a new issue