Browse Source

refactor(tool): convert invalid tool internals to Effect

Kit Langton 1 week ago
parent
commit
835bc1cc52
1 changed files with 10 additions and 8 deletions
  1. 10 8
      packages/opencode/src/tool/invalid.ts

+ 10 - 8
packages/opencode/src/tool/invalid.ts

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