/** * @mzhub/plexus - Tool Definition Utility * * The defineTool() function with Zod->JSON Schema conversion. * This is the core API for creating agent tools. */ import { type ZodType } from "zod"; import type { ToolDefinition, ToolContext, ToolResult, OpenAITool } from "../shared/types.js"; /** * Define a tool for the agent to use. * * @example * ```ts * const searchProducts = defineTool({ * name: "search_products", * description: "Search for products by query", * schema: z.object({ query: z.string(), limit: z.number().optional() }), * execute: async ({ query, limit = 10 }) => { * const results = await db.products.search(query, limit); * return { success: true, data: results }; * } * }); * ``` */ export declare function defineTool(config: { name: string; description: string; schema: ZodType; critical?: boolean; execute: (args: TInput, ctx: ToolContext) => Promise>; }): ToolDefinition; /** * Convert a ToolDefinition to OpenAI's function calling format. */ export declare function toolToOpenAI(tool: ToolDefinition): OpenAITool; /** * Convert multiple tools to OpenAI format. */ export declare function toolsToOpenAI(tools: ToolDefinition[]): OpenAITool[]; /** * Find a tool by name from a list of tools. */ export declare function findTool(tools: ToolDefinition[], name: string): ToolDefinition | undefined; /** * Validate tool arguments against the schema. * Returns parsed arguments or throws on validation failure. */ export declare function validateToolArgs(tool: ToolDefinition, rawArgs: unknown): T; //# sourceMappingURL=tools.d.ts.map