/** * Tools - AI SDK Wrapper * * Provides tool definition utilities compatible with AI SDK. */ export interface ToolDefinition { /** Tool description */ description: string; /** Input parameters schema (Zod or JSON schema) */ parameters: any; /** Execute function */ execute: ToolExecuteFunction; } export type ToolExecuteFunction = (args: TInput, options?: ToolExecutionOptions) => Promise | TOutput; export interface ToolExecutionOptions { /** Tool call ID */ toolCallId?: string; /** Abort signal */ abortSignal?: AbortSignal; /** Messages context */ messages?: any[]; } export type ToolInput = T extends ToolDefinition ? I : never; export type ToolOutput = T extends ToolDefinition ? O : never; /** * Define a tool for use with AI SDK. * * @example With Zod schema * ```typescript * import { z } from 'zod'; * * const weatherTool = defineTool({ * description: 'Get weather for a city', * parameters: z.object({ * city: z.string().describe('City name'), * unit: z.enum(['celsius', 'fahrenheit']).optional() * }), * execute: async ({ city, unit }) => { * return { temperature: 20, unit: unit || 'celsius', city }; * } * }); * ``` * * @example With JSON schema * ```typescript * const searchTool = defineTool({ * description: 'Search the web', * parameters: { * type: 'object', * properties: { * query: { type: 'string', description: 'Search query' } * }, * required: ['query'] * }, * execute: async ({ query }) => { * return { results: [`Result for: ${query}`] }; * } * }); * ``` */ export declare function defineTool(definition: ToolDefinition): ToolDefinition; /** * Create a tool set from multiple tool definitions. * * @example * ```typescript * const tools = createToolSet({ * weather: weatherTool, * search: searchTool * }); * * const result = await generateText({ * model: 'gpt-4o', * prompt: 'What is the weather in Paris?', * tools * }); * ``` */ export declare function createToolSet>(tools: T): T; /** * Convert a simple function to a tool definition. * * @example * ```typescript * const addTool = functionToTool( * 'add', * 'Add two numbers', * z.object({ a: z.number(), b: z.number() }), * ({ a, b }) => a + b * ); * ``` */ export declare function functionToTool(name: string, description: string, parameters: any, execute: ToolExecuteFunction): ToolDefinition;