UNPKG

@simonecoelhosfo/optimizely-mcp-server

Version:

Optimizely MCP Server for AI assistants with integrated CLI tools

290 lines (281 loc) 10.1 kB
/** * Orchestration Tool Definition * @description MCP tool definition for template orchestration * @author Optimizely MCP Server * @version 1.0.0 */ export const ORCHESTRATION_TOOL = { name: 'orchestrate_template', description: `Execute orchestration templates to automate complex multi-entity workflows. Orchestration templates combine multiple operations into a single, reusable workflow with dependencies, conditions, and custom logic. 📋 USE CASES: - Create multiple campaigns with shared audiences and events - Progressive feature rollouts with monitoring - Complex A/B test setups across multiple entities - Bulk operations with conditional logic - Multi-step workflows with error handling 🔧 CAPABILITIES: - Execute system or user-defined orchestration templates - Parallel and sequential step execution - Conditional logic and loops - Custom JavaScript plugins (sandboxed) - Automatic dependency resolution - Rollback on failure support EXAMPLE: Create 3 campaigns with shared events { "template_name": "multi-campaign-launch", "parameters": { "campaigns": [ { "name": "Holiday Sale", "audience": {...} }, { "name": "Black Friday", "audience": {...} }, { "name": "Cyber Monday", "audience": {...} } ], "shared_events": [ { "key": "purchase", "name": "Purchase Event" }, { "key": "add_to_cart", "name": "Add to Cart" } ] } }`, inputSchema: { type: 'object', properties: { template_id: { type: 'string', description: 'ID of the orchestration template to execute' }, template_name: { type: 'string', description: 'Name of the orchestration template (alternative to template_id)' }, parameters: { type: 'object', description: 'Parameters to pass to the template', additionalProperties: true }, options: { type: 'object', properties: { dry_run: { type: 'boolean', description: 'Execute in dry-run mode (no actual changes)', default: false }, debug: { type: 'boolean', description: 'Include detailed execution information in response', default: false }, continue_on_error: { type: 'boolean', description: 'Continue execution even if some steps fail', default: false }, project_id: { type: 'string', description: 'Default project ID for all operations' }, environment: { type: 'string', description: 'Default environment for all operations' } } } }, oneOf: [ { required: ['template_id', 'parameters'] }, { required: ['template_name', 'parameters'] } ] } }; export const LIST_TEMPLATES_TOOL = { name: 'list_orchestration_templates', description: `List available orchestration templates with filtering options. 📋 RETURNS: - Template metadata (name, version, description) - Required parameters and their types - Platform compatibility (Feature/Web) - Usage examples 🔍 FILTERING: - By type: user or system templates - By platform: feature, web, or both - By tags: specific use cases or categories`, inputSchema: { type: 'object', properties: { type: { type: 'string', enum: ['user', 'system'], description: 'Filter by template type' }, platform: { type: 'string', enum: ['feature', 'web', 'both'], description: 'Filter by platform compatibility' }, tags: { type: 'array', items: { type: 'string' }, description: 'Filter by tags (e.g., "campaign", "rollout", "testing")' }, author: { type: 'string', description: 'Filter by template author' } } } }; export const GET_TEMPLATE_TOOL = { name: 'get_orchestration_template', description: `Get detailed information about a specific orchestration template. 📋 RETURNS: - Complete template definition - Parameter documentation - Step-by-step workflow - Example usage - Execution requirements`, inputSchema: { type: 'object', properties: { template_id: { type: 'string', description: 'ID of the template to retrieve' }, template_name: { type: 'string', description: 'Name of the template (alternative to template_id)' }, version: { type: 'string', description: 'Specific version (defaults to latest)' } }, oneOf: [ { required: ['template_id'] }, { required: ['template_name'] } ] } }; export const CREATE_TEMPLATE_TOOL = { name: 'create_orchestration_template', description: `Create a new orchestration template for reusable workflows. 🔧 TEMPLATE STRUCTURE: - Parameters: Input variables with types and validation - Steps: Sequential or parallel operations - Dependencies: Step ordering and requirements - Outputs: Values extracted from execution 📋 STEP TYPES: - template: Execute system templates (create/update entities) - conditional: If/then/else logic - loop: Iterate over arrays - plugin: Custom JavaScript code - wait: Delay or wait for conditions - parallel: Execute steps concurrently`, inputSchema: { type: 'object', properties: { template: { type: 'object', properties: { name: { type: 'string', description: 'Unique template name' }, description: { type: 'string', description: 'What this template does' }, version: { type: 'string', description: 'Semantic version (e.g., 1.0.0)', default: '1.0.0' }, platform: { type: 'string', enum: ['feature', 'web', 'both'], description: 'Platform compatibility' }, parameters: { type: 'object', description: 'Parameter definitions', additionalProperties: { type: 'object', properties: { type: { type: 'string', enum: ['string', 'number', 'boolean', 'array', 'object'] }, description: { type: 'string' }, required: { type: 'boolean' }, default: {} } } }, steps: { type: 'array', description: 'Workflow steps', items: { type: 'object', properties: { id: { type: 'string' }, name: { type: 'string' }, type: { type: 'string', enum: ['template', 'conditional', 'loop', 'plugin', 'wait', 'parallel'] }, depends_on: { type: 'array', items: { type: 'string' } } } } }, outputs: { type: 'object', description: 'Output value mappings', additionalProperties: { type: 'object', properties: { description: { type: 'string' }, value: { type: 'string' } } } } }, required: ['name', 'description', 'platform', 'steps'] } }, required: ['template'] } }; export const EXECUTION_HISTORY_TOOL = { name: 'get_orchestration_history', description: `Get execution history for orchestration templates. 📋 RETURNS: - Execution status and duration - Step-by-step results - Error details if failed - Performance metrics`, inputSchema: { type: 'object', properties: { execution_id: { type: 'string', description: 'Specific execution ID' }, template_id: { type: 'string', description: 'Filter by template ID' }, status: { type: 'string', enum: ['running', 'completed', 'failed', 'cancelled'], description: 'Filter by status' }, limit: { type: 'number', description: 'Maximum results to return', default: 10 } } } }; //# sourceMappingURL=OrchestrationTool.js.map