import type { RequestContext } from '../request-context/index.js'; import type { PublicSchema, StandardSchemaWithJSON } from '../schema/index.js'; /** * Formatted validation errors structure. * Contains `errors` array for messages at this level, and `fields` for nested field errors. */ export type FormattedValidationErrors = { errors: string[]; fields: T extends object ? { [K in keyof T]?: FormattedValidationErrors; } : unknown; }; export interface ValidationError { error: true; message: string; validationErrors: FormattedValidationErrors; } export declare function isValidationError(value: unknown): value is ValidationError; /** * Validates raw suspend data against a schema. * * @param schema The schema to validate against * @param suspendData The raw suspend data to validate * @param toolId Optional tool ID for better error messages * @returns The validated data or a validation error */ export declare function validateToolSuspendData(schema: StandardSchemaWithJSON | undefined, suspendData: unknown, toolId?: string): { data: T; error?: undefined; } | { data?: undefined; error: ValidationError; }; /** * Validates raw input data against a schema. * * @param schema The schema to validate against (or undefined to skip validation) * @param input The raw input data to validate * @param toolId Optional tool ID for better error messages * @returns The validated data or a validation error */ export declare function validateToolInput(schema: StandardSchemaWithJSON | undefined, input: unknown, toolId?: string): { data: T; error?: undefined; } | { data?: undefined; error: ValidationError; }; /** * Validates tool output data against a schema. * * @param schema The schema to validate against * @param output The output data to validate * @param toolId Optional tool ID for better error messages * @returns The validated data or a validation error */ export declare function validateToolOutput(schema: StandardSchemaWithJSON | undefined, output: unknown, toolId?: string, suspendCalled?: boolean): { data: T; error?: undefined; } | { data?: undefined; error: ValidationError; }; /** * Validates request context data against a schema. * This is used to validate the request context before tool execution. * * @param schema The schema to validate against (PublicSchema which accepts Zod, JSONSchema, etc.) * @param requestContext The request context to validate * @param identifier Optional identifier (tool/step ID) for better error messages * @returns The validated data or a validation error */ export declare function validateRequestContext(schema: PublicSchema | undefined, requestContext: RequestContext | undefined, identifier?: string): { data: T | Record; error?: ValidationError; }; //# sourceMappingURL=validation.d.ts.map