voyage-and-consumption-mcp-server
Version:
Voyage and consumption management server handling vessel voyages, fuel consumption, performance monitoring, and operational data with ERP access for data extraction
73 lines (72 loc) • 1.82 kB
TypeScript
export interface ValidationError {
field: string;
message: string;
value?: any;
code: string;
}
export declare class ValidationException extends Error {
errors: ValidationError[];
constructor(errors: ValidationError[], message?: string);
}
export declare class ValidationMiddleware {
private toolSchemas;
constructor();
private initializeSchemas;
/**
* Validates tool input arguments against the tool's schema
* @param toolName - Name of the tool
* @param args - Input arguments to validate
* @returns Validated and sanitized arguments
* @throws ValidationException if validation fails
*/
validateToolInput(toolName: string, args: any): any;
/**
* Validates arguments against a JSON schema
*/
private validateAgainstSchema;
/**
* Validates a single field against its schema
*/
private validateField;
/**
* Validates and converts types
*/
private validateType;
/**
* Validates format constraints
*/
private validateFormat;
/**
* Validates number range constraints
*/
private validateNumberRange;
/**
* Validates string constraints
*/
private validateStringConstraints;
/**
* Validates array constraints
*/
private validateArray;
/**
* Performs tool-specific validation
*/
private performToolSpecificValidation;
/**
* Validates coordinate ranges
*/
private validateCoordinates;
/**
* Validates date range
*/
private validateDateRange;
/**
* Validates search query parameters
*/
private validateSearchQuery;
/**
* Validates casefile data
*/
private validateCasefileData;
}
export declare const validationMiddleware: ValidationMiddleware;