Skip to main content
Glama
sloth-wq

Prompt Auto-Optimizer MCP

by sloth-wq

gepa_start_evolution

Start the evolutionary process to automatically optimize AI prompts by configuring parameters and providing a seed prompt, improving performance through iterative testing and refinement.

Instructions

Initialize evolution process with configuration and seed prompt

Input Schema

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

Implementation Reference

  • The primary handler function for 'gepa_start_evolution' tool. It validates input, generates evolution ID, creates initial prompt population, and returns detailed initialization status.
      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.`,
            },
          ],
        };
      }
  • JSON schema definition and registration of the 'gepa_start_evolution' tool in the TOOLS array, used for MCP list tools and validation.
    {
      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']
      }
  • TypeScript interface defining the input parameters for the gepa_start_evolution tool handler, matching the JSON schema.
    export interface StartEvolutionParams {
      taskDescription: string;
      seedPrompt?: string;
      targetModules?: string[];
      config?: Partial<EvolutionConfig>;
    }
  • Registration of the tool handler in the MCP CallToolRequestSchema switch statement, dispatching calls to the startEvolution method.
    case 'gepa_start_evolution':
      return await this.startEvolution(args as unknown as StartEvolutionParams);
  • Constant definition of the tool name for type safety in GEPA MCP server.
    START_EVOLUTION: 'gepa_start_evolution',
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'Initialize evolution process' but fails to explain what the process does (e.g., genetic algorithm steps), what outputs or side effects to expect (e.g., creates populations, runs generations), or any constraints like rate limits or permissions needed. This leaves significant gaps for a tool that likely involves complex operations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core action ('Initialize evolution process') and key inputs. There is no wasted verbiage or redundancy, making it easy to parse quickly while covering essential elements.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity implied by 'evolution process' with 4 parameters (including nested config), no annotations, and no output schema, the description is inadequate. It doesn't explain what the tool returns (e.g., evolution ID, status), how it behaves over time, or error conditions, leaving too much undefined for effective agent use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all parameters. The description adds minimal value by naming 'configuration and seed prompt' as inputs, but it doesn't provide additional context beyond what's in the schema, such as explaining how 'targetModules' relate to evolution or typical values for config parameters. Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Initialize evolution process') and the key inputs ('configuration and seed prompt'), which distinguishes it from siblings like gepa_evaluate_prompt or gepa_select_optimal that focus on different stages of evolution. However, it doesn't specify what 'evolution' entails beyond optimization, leaving some ambiguity about the exact process.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like gepa_evaluate_prompt or gepa_select_optimal, nor does it mention prerequisites such as needing a task description. It implies usage for starting evolution but lacks context about timing or dependencies in the workflow.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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