UNPKG

@simonecoelhosfo/optimizely-mcp-server

Version:

Optimizely MCP Server for AI assistants with integrated CLI tools

69 lines 2.12 kB
/** * Template Schema Integration * @description Bridges the gap between parser and rich template schemas * * Purpose: Ensure the intelligent parser uses the same validation rules, * enums, and constraints that AI agents are primed with. * * @author Optimizely MCP Server * @version 1.0.0 */ import { FieldSchema, ModelFriendlyTemplate } from '../templates/ModelFriendlyTemplates.js'; export interface ValidationResult { isValid: boolean; errors: string[]; warnings: string[]; suggestions: string[]; } export interface EnumValidation { field: string; allowedValues: string[]; providedValue: any; isValid: boolean; } /** * Integrates rich template schemas with the parser */ export declare class TemplateSchemaIntegration { private readonly logger; private templateCache; constructor(); /** * Get rich template schema for entity type */ getTemplateSchema(entityType: string, operation?: string): ModelFriendlyTemplate | undefined; /** * Extract field definitions with full validation rules */ extractFieldDefinitions(template: ModelFriendlyTemplate): Map<string, FieldSchema>; /** * Validate field value against schema constraints */ validateFieldValue(fieldName: string, value: any, schema: FieldSchema): ValidationResult; /** * Find closest enum match using string similarity */ private findClosestEnumMatch; /** * Apply template constraints to a payload */ applyTemplateConstraints(payload: any, entityType: string, operation?: string): Promise<{ constrainedPayload: any; validationResult: ValidationResult; appliedConstraints: string[]; }>; /** * Get field value from payload using dot notation */ private getFieldValue; /** * Set field value in payload using dot notation */ private setFieldValue; /** * Coerce value to expected type */ private coerceType; } export declare const templateSchemaIntegration: TemplateSchemaIntegration; //# sourceMappingURL=TemplateSchemaIntegration.d.ts.map