/** * Validation Utilities for MCP Tools * * Provides comprehensive input validation and error handling for all MCP tools. * Validation is run before each tool call to ensure proper argument types and formats. */ export { type TicketComplexity, type WarningSeverity, type StrictnessLevel, type ValidationWarning, type TicketValidationResult, type ComplexityRules, type TicketValidationInput, validationRules, validateTicket, filterWarningsByStrictness, getComplexityRules, isValidComplexity, getComplexityDescription, suggestComplexity, } from './ticket-validation.js'; /** * Custom error class for validation failures * Includes field name and error code for structured error handling */ export declare class ValidationError extends Error { field: string; code: string; constructor(message: string, field: string, code: string); } /** * API Error class for handling HTTP errors from the backend */ export declare class ApiError extends Error { statusCode: number; errorCode?: string | undefined; constructor(message: string, statusCode: number, errorCode?: string | undefined); } /** * Validate that a value is present (not null, undefined, or empty string) */ export declare function validateRequired(value: unknown, fieldName: string): void; /** * Validate that a value is a valid UUID format */ export declare function validateUUID(value: string, fieldName: string): void; /** * Validate that a value is one of the allowed enum values */ export declare function validateEnum(value: string, fieldName: string, allowedValues: string[]): void; /** * Validate that a number is within a range */ export declare function validateRange(value: number, fieldName: string, min: number, max: number): void; /** * Validate that a value is an array, with optional item validation */ export declare function validateArray(value: unknown, fieldName: string, itemValidator?: (item: unknown, index: number) => void): void; /** * Validate a 40-character hex SHA */ export declare function validateSha(value: string, fieldName?: string): void; /** * Validate an ISO 8601 date string */ export declare function validateDate(value: string, fieldName: string): void; /** * Validate a string length */ export declare function validateStringLength(value: string, fieldName: string, minLength: number, maxLength: number): void; type ValidatorFn = (args: Record) => void; /** * Validators for each tool * These are applied before the tool handler is called */ export declare const toolValidators: Record; /** * MCP error response format */ export interface MCPErrorResponse { content: Array<{ type: 'text'; text: string; }>; isError: true; } /** * Transform an error into MCP error response format */ export declare function formatMCPError(error: Error): MCPErrorResponse; /** * Transform HTTP/network errors into ApiError */ export declare function transformError(error: unknown): Error; /** * Run validation for a specific tool * @throws ValidationError if validation fails */ export declare function validateToolArgs(toolName: string, args: Record): void; //# sourceMappingURL=index.d.ts.map