Skip to main content
Glama
yanlong-iao

Ultimate Prompt Optimizer

by yanlong-iao

Auto-optimize prompt (score-driven)

auto_optimize_prompt

Optimizes prompts with metric-driven test cases: scores the original, tests rewrites across train/dev, and returns the improved prompt plus a candidate scoreboard.

Instructions

DSPy-style, metric-driven optimization: builds a test set (given or auto-generated with per-case criteria), splits it into train/dev, scores the original prompt, then for several rounds proposes candidates — reflect (analyse failing outputs → targeted edits, GEPA-like), template (rewrite with a different optimization strategy, MIPRO-like), fewshot (insert the best passing outputs as Examples, BootstrapFewShot-like) — evaluates them on train, confirms finalists on dev, and keeps a candidate only if the dev score improves. Returns the best prompt, a scoreboard of every candidate, per-case before/after, cost, and a saved report. Budget-guarded: the search is scaled down to fit maxCalls and stops early on no improvement or time limit. Typical light run with 6 cases: ~40-60 API calls.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
goalNoWhat a good response looks like — used for grading and reflection, e.g. 'short interview-style answers, always asks for missing info'
seedNo
modelNoModel the prompt will run on (default EVAL_MODEL)
assertNoAssertions applied to every case (e.g. is-json, max-length)
budgetNolight: 2 rounds × 2 candidates · medium: 3×3 · heavy: 5×4light
promptYesThe prompt to optimize
roundsNo
rubricNollm-rubric applied to every case
maxCallsNoHard cap on API calls (default UPO_MAX_CALLS)
numCasesNoCases to generate when none are given
testCasesNo
testsFileNoYAML/JSON/CSV tests file
maxMinutesNo
promptModeNosystem
strategiesNo
temperatureNo
candidatesPerRoundNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.0

TDQS

A4.3/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does well: it discloses the multi-round search loop, the three named strategies, the dev-set gate for keeping candidates, budget guarding against maxCalls, early stopping on no improvement or time limit, and even a concrete cost estimate ('~40-60 API calls' for 6 cases). This is unusually rich behavioral disclosure for a mutation/expensive operation.

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

Conciseness4/5

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

Front-loaded with the pipeline and dense with substance rather than filler; every clause (strategies, dev gate, budget guard, cost, return contents) earns its place. It is a single long block, which slightly hurts scannability, but it is appropriately sized for a tool of this complexity.

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

Completeness4/5

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

For a 17-param tool with no output schema, the description usefully enumerates what is returned (best prompt, scoreboard, per-case before/after, cost, saved report) and the stopping/budget behavior. Minor gaps remain: where the report is saved, and the model/env dependencies (EVAL_MODEL, UPO_MAX_CALLS) that only appear in the schema.

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

Parameters4/5

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

Schema coverage is only 53% across 17 params, so the description has to compensate, and it does for the key knobs: it explains what reflect/template/fewshot do (GEPA-like, MIPRO-like, BootstrapFewShot-like), how the test set is sourced, and how budget/maxCalls shape the search. It still leaves several params (seed, temperature, promptMode, testsFile, maxMinutes) to the schema, but adds real meaning beyond it.

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

Purpose5/5

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

States a specific verb+resource+scope: metric-driven prompt optimization that builds a test set, splits train/dev, proposes candidates, and keeps only dev-improving ones. This is clearly distinguishable from siblings like optimize_prompt_via_api or evaluate_prompt_preview without opening any schema.

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

Usage Guidelines3/5

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

It explains the internal conditions that drive behavior ('given or auto-generated' test set, budget scaling, early stop on no improvement), which is helpful context, but never states when to choose this over the sibling optimizer (auto_optimize_prompt vs optimize_prompt_via_api vs suggest_prompts). Usage is implied rather than routed.

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