@mastra/core
Version:
The core foundation of the Mastra framework, providing essential components and interfaces for building AI-powered applications.
20 lines • 1.43 kB
TypeScript
import type { z } from 'zod';
import type { Mastra } from '../mastra';
import type { ToolAction, ToolExecutionContext } from './types';
export declare class Tool<TSchemaIn extends z.ZodSchema | undefined = undefined, TSchemaOut extends z.ZodSchema | undefined = undefined, TContext extends ToolExecutionContext<TSchemaIn> = ToolExecutionContext<TSchemaIn>> implements ToolAction<TSchemaIn, TSchemaOut, TContext> {
id: string;
description: string;
inputSchema?: TSchemaIn;
outputSchema?: TSchemaOut;
execute?: ToolAction<TSchemaIn, TSchemaOut, TContext>['execute'];
mastra?: Mastra;
constructor(opts: ToolAction<TSchemaIn, TSchemaOut, TContext>);
}
export declare function createTool<TSchemaIn extends z.ZodSchema | undefined = undefined, TSchemaOut extends z.ZodSchema | undefined = undefined, TContext extends ToolExecutionContext<TSchemaIn> = ToolExecutionContext<TSchemaIn>, TExecute extends ToolAction<TSchemaIn, TSchemaOut, TContext>['execute'] = ToolAction<TSchemaIn, TSchemaOut, TContext>['execute']>(opts: ToolAction<TSchemaIn, TSchemaOut, TContext> & {
execute?: TExecute;
}): [TSchemaIn, TSchemaOut, TExecute] extends [z.ZodSchema, z.ZodSchema, Function] ? Tool<TSchemaIn, TSchemaOut, TContext> & {
inputSchema: TSchemaIn;
outputSchema: TSchemaOut;
execute: (context: TContext) => Promise<any>;
} : Tool<TSchemaIn, TSchemaOut, TContext>;
//# sourceMappingURL=tool.d.ts.map