import z from "zod/v4" export namespace Tool { interface Metadata { [key: string]: any } export type Context = { sessionID: string messageID: string agent: string abort: AbortSignal callID?: string extra?: { [key: string]: any } metadata(input: { title?: string; metadata?: M }): void } export interface Info { id: string init: () => Promise<{ description: string parameters: Parameters execute( args: z.infer, ctx: Context, ): Promise<{ title: string metadata: M output: string }> }> } export function define( id: string, init: Info["init"] | Awaited["init"]>>, ): Info { return { id, init: async () => { if (init instanceof Function) return init() return init }, } } }