import type { ToolHandler, ToolValidator, ValidationErrorDetail } from '../types/core.js';
import { validateArgsAgainstSchema } from '../utils/schema-validate.js';
/**
 * Thrown by a validated tool handler when its arguments fail validation.
 * Carries the structured details so callers can render a field-level message
 * for a self-correcting LLM rather than a flat sentence.
 */
export declare class ToolValidationError extends Error {
    readonly details?: ValidationErrorDetail[];
    constructor(message: string, details?: ValidationErrorDetail[]);
}
/**
 * Render a validation failure into the string that goes back to the model.
 * Appends one line per structured detail when present.
 */
export declare function formatValidationError(error: string, details?: ValidationErrorDetail[]): string;
/**
 * Convert any error thrown during tool execution into the string content the
 * model sees. Validation failures get structured field-level formatting;
 * everything else falls back to the generic error message.
 */
export declare function toolErrorToContent(error: unknown): string;
/**
 * Wrap a tool handler so type-checking and its validator run immediately
 * before execution.
 *
 * This is the single place tool validation lives: because every execution
 * path (interactive loop, plain shell, subagents) ultimately invokes the
 * registry handler, validating here means no path can bypass it. On failure
 * the wrapper throws a {@link ToolValidationError}; callers already catch
 * handler exceptions and turn them into an error tool-result.
 *
 * When a `schema` is supplied, arguments are first type-checked against it.
 * A wrong-typed argument (e.g. an object where a string is expected) is
 * returned to the model as a structured error so it can correct itself and
 * retry — instead of the bad value reaching execution or the UI.
 */
export declare function withValidation(handler: ToolHandler, validator?: ToolValidator, schema?: Parameters<typeof validateArgsAgainstSchema>[1]): ToolHandler;
//# sourceMappingURL=tool-validation.d.ts.map