Skip to main content
Glama

gepa_start_evolution

Initiate the evolution process for prompt optimization by specifying task descriptions, seed prompts, and configuration parameters to enhance AI performance, creativity, and reliability.

Instructions

Initialize evolution process with configuration and seed prompt

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
configNoEvolution configuration parameters (optional)
seedPromptNoInitial prompt to start evolution from (optional)
targetModulesNoSpecific modules or components to target (optional)
taskDescriptionYesDescription of the task to optimize prompts for

Implementation Reference

  • The primary handler function for the 'gepa_start_evolution' MCP tool. Initializes an evolution ID, creates initial prompt population (seed + generated dummies), and returns a detailed markdown status report instructing to use next tools for evaluation.
    private async startEvolution(params: StartEvolutionParams): Promise<{ content: { type: string; text: string; }[]; }> { const { taskDescription, seedPrompt, targetModules, config } = params; // Validate required parameters if (!taskDescription) { throw new Error('taskDescription is required'); } // Merge with default evolution config const evolutionConfig = { taskDescription, populationSize: 20, maxGenerations: 10, mutationRate: 0.15, ...config, }; // Generate evolution ID const evolutionId = `evolution_${Date.now()}_${Math.random().toString(36).substring(7)}`; // Initialize evolution with seed prompt if provided const initialPrompts: GEPAPromptCandidate[] = []; if (seedPrompt) { initialPrompts.push({ id: `seed_${evolutionId}`, content: seedPrompt, generation: 0, taskPerformance: new Map(), averageScore: 0, rolloutCount: 0, createdAt: new Date(), lastEvaluated: new Date(), mutationType: 'initial', }); } // Generate initial population (simplified for now) const additionalPrompts: GEPAPromptCandidate[] = []; const remainingCount = (evolutionConfig.populationSize || 20) - initialPrompts.length; for (let i = 0; i < remainingCount; i++) { additionalPrompts.push({ id: `generated_${evolutionId}_${i}`, content: `Generated prompt ${i + 1} for: ${taskDescription}`, generation: 0, ...(seedPrompt && { parentId: `seed_${evolutionId}` }), taskPerformance: new Map(), averageScore: 0, rolloutCount: 0, createdAt: new Date(), lastEvaluated: new Date(), mutationType: 'random', }); } const totalCandidates = initialPrompts.length + additionalPrompts.length; return { content: [ { type: 'text', text: `# Evolution Process Started ## Evolution Details - **Evolution ID**: ${evolutionId} - **Task**: ${taskDescription} - **Target Modules**: ${targetModules?.join(', ') || 'All'} - **Seed Prompt**: ${seedPrompt ? 'Provided' : 'Auto-generated'} ## Configuration - **Population Size**: ${evolutionConfig.populationSize || 20} - **Max Generations**: ${evolutionConfig.maxGenerations || 10} - **Mutation Rate**: ${evolutionConfig.mutationRate || 0.15} ## Initial Population - **Total Candidates**: ${totalCandidates} - **Seed Candidates**: ${initialPrompts.length} - **Generated Candidates**: ${additionalPrompts.length} Evolution process initialized successfully. Use \`gepa_evaluate_prompt\` to begin evaluating candidates.`, }, ], }; }
  • Input schema definition for the gepa_start_evolution tool, including required taskDescription and optional seedPrompt, targetModules, and config.
    { name: 'gepa_start_evolution', description: 'Initialize evolution process with configuration and seed prompt', inputSchema: { type: 'object', properties: { taskDescription: { type: 'string', description: 'Description of the task to optimize prompts for' }, seedPrompt: { type: 'string', description: 'Initial prompt to start evolution from (optional)' }, targetModules: { type: 'array', items: { type: 'string' }, description: 'Specific modules or components to target (optional)' }, config: { type: 'object', properties: { populationSize: { type: 'number', default: 20 }, generations: { type: 'number', default: 10 }, mutationRate: { type: 'number', default: 0.15 }, crossoverRate: { type: 'number', default: 0.7 }, elitismPercentage: { type: 'number', default: 0.1 } }, description: 'Evolution configuration parameters (optional)' } }, required: ['taskDescription'] } },
  • Registration of the tool handler in the MCP CallToolRequestSchema switch statement, dispatching to the startEvolution method.
    case 'gepa_start_evolution': return await this.startEvolution(args as unknown as StartEvolutionParams);
  • TypeScript interface defining the StartEvolutionParams used by the handler, matching the input schema.
    export interface StartEvolutionParams { taskDescription: string; seedPrompt?: string; targetModules?: string[]; config?: Partial<EvolutionConfig>; }
  • Initialization of core components like TrajectoryStore and ParetoFrontier used across GEPA tools including evolution tracking.
    }, performanceWeight: { type: 'number', default: 0.7, description: 'Weight for performance in selection criteria' }, diversityWeight: { type: 'number', default: 0.3, description: 'Weight for diversity in selection criteria' } } } }, // Disaster Recovery Tools { name: 'gepa_create_backup', description: 'Create system backup including evolution state and trajectories', inputSchema: { type: 'object', properties: { label: { type: 'string', description: 'Optional label for the backup' }, includeTrajectories: { type: 'boolean', default: true, description: 'Include trajectory data in backup' } } } }, { name: 'gepa_restore_backup', description: 'Restore system from a specific backup', inputSchema: { type: 'object', properties: { backupId: { type: 'string', description: 'ID of the backup to restore from' }, validateIntegrity: { type: 'boolean', default: true, description: 'Perform integrity validation before restore' }, createPreRestoreBackup: { type: 'boolean', default: true, description: 'Create backup before restoration' } }, required: ['backupId'] } }, { name: 'gepa_list_backups', description: 'List available system backups', inputSchema: { type: 'object', properties: { limit: { type: 'number', default: 20, description: 'Maximum number of backups to return' }, filterLabel: { type: 'string', description: 'Filter backups by label (optional)' } } } }, { name: 'gepa_recovery_status', description: 'Get comprehensive disaster recovery status and health information', inputSchema: { type: 'object', properties: { includeMetrics: { type: 'boolean', default: true, description: 'Include detailed metrics in response' } } } }, { name: 'gepa_recover_component', description: 'Recover a specific GEPA component', inputSchema: { type: 'object', properties: { componentType: { type: 'string', enum: ['evolution_engine', 'pareto_frontier', 'llm_adapter', 'trajectory_store', 'memory_cache'], description: 'Type of component to recover' }, strategy: { type: 'string', enum: ['restart', 'restore_from_backup', 'rebuild', 'reset_to_defaults'], default: 'restart', description: 'Recovery strategy to use' } }, required: ['componentType'] } }, { name: 'gepa_integrity_check', description: 'Perform comprehensive data integrity check', inputSchema: { type: 'object', properties: { component: { type: 'string', enum: ['all', 'evolution_state', 'trajectories', 'configuration', 'cache'], default: 'all', description: 'Component to check integrity for' }, autoRepair: { type: 'boolean', default: false, description: 'Attempt automatic repair of detected issues' } } } } ]; /** * Initialize and configure the MCP server */ class GEPAMCPServer {

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sloth-wq/prompt-auto-optimizer-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server