Skip to main content
Glama

optimize_prompt

Rewrite a prompt to score higher on the PQS rubric, AND show before/after output comparisons so the user can see the impact. Returns the optimized prompt, the original PQS score, the optimized PQS score, and side-by-side sample outputs from a frontier model using both versions.

USE WHEN:

  • The user got a low score from score_prompt and asks how to improve.

  • The user explicitly asks to "improve" / "rewrite" / "fix" / "optimize" a prompt they pasted.

  • The user is dissatisfied with output quality from a previous prompt and asks how to get better results.

  • score_prompt returned a suggestion to invoke this tool.

DO NOT USE WHEN:

  • The user just asked for a score (use score_prompt only — don't double up).

  • The user wants you to write a new prompt from scratch (write it directly).

REQUIRES: A PQS API key from a Pro subscription ($19.99/month, 1,000 calls/mo, includes batch + A/B comparison). If the user has not provided one, the tool returns a clear subscription URL — pass that response to the user verbatim. Do not invent or guess API keys. There is no free trial of this tool; the user must subscribe before the first call.

COST: Counted against your Pro subscription's monthly call quota.

LATENCY: ~6-8 seconds.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYesThe prompt to optimize. Max 8000 characters.
api_keyNoPQS API key from a Pro subscription. Required. Format: pqs_live_… (32+ characters). Subscribe at https://promptqualityscore.com/pricing?utm_source=mcp&utm_medium=schema_description_v140&utm_campaign=2026-05-mcp-tools-v140 if you don't have one, or look up an existing key at https://promptqualityscore.com/account?utm_source=mcp&utm_medium=schema_description_v140&utm_campaign=2026-05-mcp-tools-v140.

TDQS

A4.9/5.0
Behavior5/5

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

With no annotations provided, the description fully carries the behavioral burden. It discloses API key requirements, cost/quota implications, latency, no-free-trial policy, and the exact behavior when a key is missing (returns a subscription URL to pass verbatim). It also warns against guessing keys, covering failure modes and side effects comprehensively.

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 uses clear section headers (USE WHEN, DO NOT USE WHEN, REQUIRES, COST, LATENCY) that front-load the most actionable information. Each sentence earns its place, and the structure makes scanning effortless without unnecessary verbosity.

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

Completeness5/5

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

Given the tool's complexity (external API, authentication, costs, multiple return values), the description covers what it does, when to use/avoid it, requirements, cost, latency, and return values. It, also, clarifies integration with score_prompt and handles the missing-key scenario. No output schema exists, so the explicit listing of return values is essential and well covered.

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?

The input schema already provides 100% description coverage for both parameters, so the baseline is 3. The description adds meaningful context for api_key by explaining why it is required, the subscription model, and the no-trial policy, which is valuable beyond the schema's format hints. However, it does not add anything for the 'prompt' parameter beyond what the schema states, so a modest 4 is appropriate.

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?

The description opens with a specific verb+resource statement: 'Rewrite a prompt to score higher on the PQS rubric' and clearly enumerates the return values (optimized prompt, original/optimized PQS scores, side-by-side outputs). It distinguishes itself from the sibling tool score_prompt by including 'AND show before/after output comparisons', making the purpose unambiguous.

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

Usage Guidelines5/5

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

The 'USE WHEN' section lists four concrete trigger scenarios, including 'user got a low score from score_prompt' and explicit user requests. The 'DO NOT USE WHEN' section provides clear exclusions and names the alternative (score_prompt or direct writing). This is exemplary guidance for an agent deciding between tools.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

TDQS

A4.6/5.0
Disambiguation5/5

The two tools have clearly distinct purposes: score_prompt evaluates prompt quality, while optimize_prompt rewrites prompts to improve scores. There is no overlap in their primary functions, and their descriptions emphasize when each should be used.

Naming Consistency5/5

Both tool names follow a consistent verb_noun pattern (score_prompt, optimize_prompt) with past-tense verbs and a common noun. The naming is perfectly predictable and matches the tool's action.

Tool Count3/5

With only two tools, the server feels minimal but appropriately scoped for a focused prompt-quality service. The count is borderline thin, yet the pair covers the core evaluation and improvement cycle.

Completeness4/5

The set provides a complete loop: score a prompt, then optimize it, with the optimization returning a new score and comparison. Minor gaps exist (e.g., no batch operation or history view), but these are hinted at in descriptions and not essential for the core purpose.

Resources