@simonecoelhosfo/optimizely-mcp-server
Version:
Optimizely MCP Server for AI assistants with integrated CLI tools
150 lines • 5.01 kB
TypeScript
/**
* Model-Friendly Entity Templates with Ref Pattern
* @description Machine-parsable templates using JSON Schema format with adopt-or-create ref helpers
*
* Key improvements over traditional templates:
* - Single source of truth per template
* - Standard JSON Schema format
* - Ref pattern for flexible entity references
* - Token-efficient (~200-300 tokens vs ~2000+)
* - Complete working examples
*
* @author Optimizely MCP Server
* @version 2.0.0
*/
export interface ModelFriendlyTemplate {
template_id: string;
entity_type: string;
schema: number;
platform: 'feature' | 'web' | 'both';
complexity_score: 1 | 2 | 3 | 4 | 5;
description: string;
fields: Record<string, FieldSchema>;
ref_schemas?: Record<string, any>;
example_filled: any;
[key: string]: any;
}
export interface FieldSchema {
type?: string;
enum?: string[];
required?: boolean;
description?: string;
min?: number;
max?: number;
default?: any;
properties?: Record<string, FieldSchema>;
items?: FieldSchema;
$ref?: string;
oneOf?: FieldSchema[];
const?: any;
variable_type_details?: Record<string, any>;
traffic_allocation_helper?: Record<string, any>;
weight_allocation_helper?: Record<string, any>;
change_type_details?: Record<string, any>;
examples_by_use_case?: Record<string, any>;
common_patterns?: any[];
descriptions?: Record<string, string>;
activation_code_examples?: Record<string, string>;
common_errors?: Record<string, string>;
validation_hints?: Record<string, any>;
default_behavior?: string;
examples?: Record<string, any>;
common_mistakes?: string[];
}
export interface RefHelper<T = any> {
ref: {
id?: string | number;
name?: string;
key?: string;
auto_create?: boolean;
template?: T;
};
}
/**
* Model-Friendly Templates by Entity Type
*/
export declare const MODEL_FRIENDLY_TEMPLATES: Record<string, ModelFriendlyTemplate>;
/**
* Get a single template by entity type
* @param entityType The entity type to get template for
* @param platform The platform (feature/web) if needed
* @returns Single model-friendly template or null
*/
export declare function getModelFriendlyTemplate(entityType: string, platform?: 'feature' | 'web'): ModelFriendlyTemplate | null;
/**
* Get template by entity type and complexity score
* @param entityType The entity type to get template for
* @param complexity The complexity score (1-5). If not provided, returns simplest template
* @param platform The platform (feature/web) if needed
* @returns Single model-friendly template matching complexity or null
*/
export declare function getModelFriendlyTemplateByComplexity(entityType: string, complexity?: number, platform?: 'feature' | 'web'): ModelFriendlyTemplate | null;
/**
* Validate a filled template against its schema
* @param entityType The entity type
* @param filledData The data to validate
* @returns Validation result with any errors
*/
export declare function validateFilledTemplate(entityType: string, filledData: any): {
valid: boolean;
errors: string[];
};
/**
* Extract all refs from a filled template for resolution
* @param data The filled template data
* @returns Array of refs found with their paths
*/
export declare function extractRefs(data: any, path?: string): Array<{
path: string;
ref: any;
}>;
/**
* Workflow template interface for modification operations
*/
export interface WorkflowTemplate {
template_id: string;
workflow_type: 'modification' | 'conceptual' | 'troubleshooting';
entity_type: string;
schema: number;
platform: 'feature' | 'web' | 'both';
complexity_score: 1 | 2 | 3 | 4 | 5;
description: string;
critical_rules?: string[];
sequence?: Array<{
step: number;
action: string;
purpose: string;
}>;
traffic_patterns?: Record<string, any>;
example_filled?: any;
prerequisites?: Record<string, any>;
steps?: Array<{
step: number;
operation: string;
description: string;
api_call?: string;
example?: any;
}>;
concepts?: Record<string, any>;
api_endpoints?: Record<string, any>;
common_errors?: Record<string, any>;
best_practices?: string[];
examples?: any[];
}
/**
* Workflow-specific templates for entity modification operations
*/
export declare const WORKFLOW_TEMPLATES: Record<string, WorkflowTemplate>;
/**
* Get workflow template by entity type
* @param entityType The workflow entity type
* @returns Workflow template or null if not found
*/
export declare function getWorkflowTemplate(entityType: string): WorkflowTemplate | null;
/**
* Check if entity type is a workflow template
* @param entityType The entity type to check
* @returns True if it's a workflow template
*/
export declare function isWorkflowTemplate(entityType: string): boolean;
//# sourceMappingURL=ModelFriendlyTemplates.d.ts.map