import type { RequestContext } from '../request-context/index.js';
import type { PublicSchema, StandardSchemaWithJSON, StandardSchemaIssue } from '../schema/index.js';
declare const TOOL_OUTPUT_VALIDATION_SCHEMA: unique symbol;
type ToolWithOutputSchema = {
    outputSchema?: unknown;
    [TOOL_OUTPUT_VALIDATION_SCHEMA]?: StandardSchemaWithJSON;
};
export declare function registerToolOutputValidationSchema(tool: object, schema: unknown): void;
export declare function resolveToolOutputValidationSchema(tool: ToolWithOutputSchema): StandardSchemaWithJSON | undefined;
/**
 * Formatted validation errors structure.
 * Contains `errors` array for messages at this level, and `fields` for nested field errors.
 */
export type FormattedValidationErrors<T = unknown> = {
    errors: string[];
    fields: T extends object ? {
        [K in keyof T]?: FormattedValidationErrors<T[K]>;
    } : unknown;
};
export interface ValidationError<T = unknown> {
    error: true;
    message: string;
    validationErrors: FormattedValidationErrors<T>;
}
export declare function isValidationError(value: unknown): value is ValidationError;
/**
 * What the model may see of a validation error when a tool's `toModelOutput` is skipped for it:
 * the failing field paths and a generic issue kind per field. It never quotes issue messages,
 * arguments, tool output, request context or suspend data, because `toModelOutput` is where a
 * tool keeps those out of the prompt.
 */
export interface ModelFacingValidationError {
    error: true;
    message: string;
    validationErrors?: FormattedValidationErrors;
}
/**
 * Returns the model-facing form of a validation error that Mastra's own validation produced, or
 * `undefined` for any other value, including one that only has a validation error's fields.
 *
 * The marker is a non-enumerable symbol property set where the error is created. JSON, spreads
 * and structured clones drop it, so tool output, results a client sent over HTTP, and anything
 * that crossed a serialization boundary never carry it. Read it in the process that ran the tool.
 */
export declare function getModelFacingValidationError(value: unknown): ModelFacingValidationError | undefined;
/**
 * Lists the dotted paths that failed validation (`root` for top-level issues), for log lines.
 * `message` echoes the submitted values back to the caller, so logs carry these paths instead.
 * Only property names declared by `schema` and array indexes are kept; any other segment (a record
 * key, or anything under a schema that can't be resolved) came from the submitted data and is logged as `*`.
 */
export declare function getValidationIssuePaths(error: ValidationError, schema: PublicSchema | undefined, io?: 'input' | 'output'): string[];
/**
 * Builds a path-aware Error from Standard Schema issues.
 * The `errors` array lets consumers (e.g. the @mastra/mcp 1.x tools/call handler) report one line per field.
 */
export declare function createStandardSchemaIssuesError(issues: ReadonlyArray<StandardSchemaIssue>): Error & {
    errors: {
        path: string[];
        message: string;
    }[];
};
/**
 * 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<T = unknown>(schema: StandardSchemaWithJSON<T> | undefined, suspendData: unknown, toolId?: string): {
    data: T;
    error?: undefined;
} | {
    data?: undefined;
    error: ValidationError<T>;
};
/**
 * 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<T = unknown>(schema: StandardSchemaWithJSON<T> | undefined, input: unknown, toolId?: string): {
    data: T;
    error?: undefined;
} | {
    data?: undefined;
    error: ValidationError<T>;
};
/**
 * 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<T = unknown>(schema: StandardSchemaWithJSON<T> | undefined, output: unknown, toolId?: string, suspendCalled?: boolean): {
    data: T;
    error?: undefined;
} | {
    data?: undefined;
    error: ValidationError<T>;
};
/**
 * 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<T = any>(schema: PublicSchema<T> | undefined, requestContext: RequestContext | undefined, identifier?: string): {
    data: T | Record<string, any>;
    error?: ValidationError<T>;
};
export {};
//# sourceMappingURL=validation.d.ts.map