From 3b6c0ec0b3b4f2224311888d8f7be178ed2335da Mon Sep 17 00:00:00 2001 From: Dax Date: Thu, 18 Sep 2025 03:58:21 -0400 Subject: support custom tools (#2668) --- packages/plugin/src/tool.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 packages/plugin/src/tool.ts (limited to 'packages/plugin/src/tool.ts') diff --git a/packages/plugin/src/tool.ts b/packages/plugin/src/tool.ts new file mode 100644 index 000000000..7c1d3d7c5 --- /dev/null +++ b/packages/plugin/src/tool.ts @@ -0,0 +1,20 @@ +import { z } from "zod/v4" + +export type ToolContext = { + sessionID: string + messageID: string + agent: string + abort: AbortSignal +} + +export function tool( + input: (zod: typeof z) => { + description: string + args: Args + execute: (args: z.infer>, ctx: ToolContext) => Promise + }, +) { + return input(z) +} + +export type ToolDefinition = ReturnType -- cgit v1.2.3