import { ToolDefinition } from '../core/types.js'; import type { MatimoInstance } from '../matimo-instance.js'; /** * Set the global Matimo instance for decorator usage * * Must be called before any @tool decorated methods are invoked * * @param instance - The MatimoInstance to use globally * * @example * ```typescript * const matimo = await MatimoInstance.init('./tools'); * setGlobalMatimoInstance(matimo); * * class MyAgent { * @tool('calculator') * async calculate(operation: string, a: number, b: number) { } * } * * const agent = new MyAgent(); * await agent.calculate('add', 5, 3); * ``` */ export declare function setGlobalMatimoInstance(instance: MatimoInstance | null): void; /** * Get the global Matimo instance * * @throws {Error} If no global instance is set */ export declare function getGlobalMatimoInstance(): MatimoInstance; /** * Tool decorator - transforms a method into a tool executor * * Automatically calls matimo.execute() with the method's arguments mapped to tool parameters. * Must be used in a class that has a `matimo` property or after setGlobalMatimoInstance() is called. * * Works with both traditional and modern TypeScript decorator syntax. * * @param toolName - Name of the tool to execute (e.g., 'calculator', 'github-get-repo') * * @example * ```typescript * // Using global instance * const matimo = await MatimoInstance.init('./tools'); * setGlobalMatimoInstance(matimo); * * class MyAgent { * @tool('calculator') * async calculate(operation: string, a: number, b: number) { * // Automatically executes: matimo.execute('calculator', { operation, a, b }) * } * * @tool('github-get-repo') * async getRepo(owner: string, repo: string) { * // Automatically executes: matimo.execute('github-get-repo', { owner, repo }) * } * } * * const agent = new MyAgent(); * const result = await agent.calculate('add', 5, 3); * ``` * * @example * ```typescript * // Using instance property * class MyAgent { * constructor(public matimo: MatimoInstance) {} * * @tool('calculator') * async calculate(operation: string, a: number, b: number) { } * } * * const matimo = await MatimoInstance.init('./tools'); * const agent = new MyAgent(matimo); * const result = await agent.calculate('add', 5, 3); * ``` */ export declare function tool(toolName: string): (_target: (this: This, ...args: Args) => Return, _context: any) => (this: any, ...args: Args) => Promise; /** * Execute tool via decorator - shared logic for both decorator syntaxes * Exported for testing purposes */ export declare function executeToolViaDecorator(toolName: string, thisArg: unknown, args: any[]): Promise; /** * Convert positional arguments to named parameters object * Maps function arguments to tool parameter names in order * Exported for testing purposes * * @example * ``` * Tool has parameters: { operation, a, b } * Args: ['add', 5, 3] * Result: { operation: 'add', a: 5, b: 3 } * ``` */ export declare function convertArgsToParams(args: unknown[], toolDef: ToolDefinition): Record; //# sourceMappingURL=tool-decorator.d.ts.map