UNPKG

@simonecoelhosfo/optimizely-mcp-server

Version:

Optimizely MCP Server for AI assistants with integrated CLI tools

84 lines 2.25 kB
/** * OpenAPI Error Enhancer * * This class enhances API error messages with prescriptive guidance * by querying the OpenAPI specification to show exactly what the API expects. */ interface OpenAPIEndpointInfo { endpoint: string; description: string; pathParams: Array<{ name: string; required: boolean; type: string; description?: string; }>; queryParams: Array<{ name: string; required: boolean; type: string; description?: string; example?: any; }>; requestBody?: { required: boolean; contentTypes: string[]; schema: any; }; responses: Array<{ statusCode: string; description: string; schema?: any; }>; } export declare class OpenAPIErrorEnhancer { private webParser; private flagsParser; private initialized; private logger; constructor(); /** * Initialize both OpenAPI parsers (Web and Feature Experimentation) */ private initialize; /** * Determine which parser to use based on the endpoint path */ private getParserForEndpoint; /** * Enhance an API error with OpenAPI schema information */ enhanceError(error: any, operation: string, entityType: string, apiMethod?: string, apiPath?: string): Promise<{ originalError: string; enhancedGuidance?: { message: string; expectedSchema?: any; requiredFields?: string[]; examples?: any; apiDocumentation?: OpenAPIEndpointInfo; }; }>; /** * Extract error message from various error formats */ private extractErrorMessage; /** * Infer API endpoint from operation and entity type */ private inferEndpoint; /** * Generate guidance based on the error and OpenAPI schema */ private generateGuidance; /** * Find a specific property in a nested schema */ private findSchemaProperty; /** * Extract required fields from a schema */ private extractRequiredFields; } export declare const openAPIErrorEnhancer: OpenAPIErrorEnhancer; export {}; //# sourceMappingURL=OpenAPIErrorEnhancer.d.ts.map