@mastra/core
Version:
Mastra is the Typescript framework for building AI agents and assistants. It’s used by some of the largest companies in the world to build internal AI automation tooling and customer-facing agents.
18 lines • 715 B
TypeScript
import type { z } from 'zod';
export interface ValidationError<T = any> {
error: true;
message: string;
validationErrors: z.ZodFormattedError<T>;
}
/**
* Validates input against a Zod schema and returns a structured error if validation fails
* @param schema The Zod schema to validate against
* @param input The input to validate
* @param toolId Optional tool ID for better error messages
* @returns The validation error object if validation fails, undefined if successful
*/
export declare function validateToolInput<T = any>(schema: z.ZodSchema<T> | undefined, input: unknown, toolId?: string): {
data: T | unknown;
error?: ValidationError<T>;
};
//# sourceMappingURL=validation.d.ts.map