Skip to content

feat: wire run_evolver as MCP tool (#156)#421

Open
yxlyx wants to merge 1 commit intomainfrom
feat/156-run-evolver-tool
Open

feat: wire run_evolver as MCP tool (#156)#421
yxlyx wants to merge 1 commit intomainfrom
feat/156-run-evolver-tool

Conversation

@yxlyx
Copy link
Copy Markdown
Collaborator

@yxlyx yxlyx commented Apr 10, 2026

Summary

  • Adds run_evolver to the Tool enum, JSON schema in tools_list, dispatch switch, and handler
  • Required params: problem_statement, fitness_cmd (returns JSON error if missing)
  • Optional params: max_generations (default 5, clamped 1-20), population_size (default 4, clamped 1-16)
  • Initializes PopulationManager from evolver.zig, runs the evolution loop, and returns structured JSON:
    • best_diff, explanation, best_fitness, generations_run, population_evaluated, converged

Test plan

  • zig ast-check src/tools.zig — clean parse
  • zig test src/evolver.zig — 18/18 evolver tests pass (PopulationManager tests on separate branch)
  • Handler follows existing pattern: mj.getStr for required params, writeErr on missing

Closes #156

Made with Cursor

Adds run_evolver to Tool enum, JSON schema, dispatch, and handler:
- Schema: problem_statement (required), fitness_cmd (required),
  max_generations (default 5, max 20), population_size (default 4, max 16)
- Handler: initializes PopulationManager with config, runs evolution
  loop, returns JSON with best_diff, explanation, best_fitness,
  generations_run, population_evaluated, converged
- Missing required params return proper JSON error messages

Tool appears in tools/list MCP response.

Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tools.zig: wire run_evolver as MCP tool

1 participant