Skip to main content
Glama

improve_generation_prompt

Read-only

Revise a 3D generation prompt from print feedback by adding physical constraints that fix printability and structural issues while preserving creative intent.

Instructions

Generate an improved prompt from feedback.

        Adds physical constraints to the original prompt to address
        printability and structural issues, without modifying the
        creative intent.

        The improved prompt is run through a three-check sanity gate
        (no contradictions, fits the provider budget, ≥70% original-token overlap so intent
        is preserved).  When ``enforce_sanity=True`` (default) and
        the gate fails, this tool refuses with
        ``code="SANITY_GATE_FAILED"`` and returns the failure list
        instead of a contradictory prompt.  Callers that genuinely
        want the failed prompt — for inspection, repair, or model
        self-correction — set ``enforce_sanity=False`` and read
        ``improved_prompt.sanity`` from the response.

        Args:
            original_prompt: The original generation prompt.
            failure_mode: Optional failure mode if the model was printed
                and failed (e.g. ``"adhesion"``, ``"spaghetti"``).
            max_overhang_angle: Maximum overhang angle detected.
            min_wall_thickness: Minimum wall thickness detected.
            has_bridges: Whether bridges were detected.
            iteration: Which retry iteration this is.
            file_path: Optional path to the STL file for structural
                analysis.  When provided, the tool also analyzes
                structural risks and folds them into the improved
                prompt.
            enforce_sanity: When True (default), refuse the
                response if the prompt sanity gate fails.  Pass
                False to receive a contradictory prompt anyway —
                useful when the agent intends to repair it before
                sending to the generator.
        

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "original_prompt": "<original_prompt>"
    },
    "name": "improve_generation_prompt"
  }
}

Input Schema

NameRequiredDescriptionDefault
file_pathNoOptional path to the STL file for structural analysis. When provided, the tool also analyzes structural risks and folds them into the improved prompt.
iterationNoWhich retry iteration this is. Default: 1.
has_bridgesNoWhether bridges were detected. Default: false.
failure_modeNoOptional failure mode if the model was printed and failed (e.g. ``"adhesion"``, ``"spaghetti"``).
enforce_sanityNoWhen True (default), refuse the response if the prompt sanity gate fails. Pass False to receive a contradictory prompt anyway — useful when the agent intends to repair it before sending to the generator. Default: true.
original_promptYesThe original generation prompt.
max_overhang_angleNoMaximum overhang angle detected.
min_wall_thicknessNoMinimum wall thickness detected.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed8 schema fields changedv1.5.1
    • changedInput schema / properties / enforce_sanity / description
      Previous value: -"Default: true."New value: +"When True (default), refuse the response if the prompt sanity gate fails.  Pass False to receive a contradictory prompt anyway — useful when the agent intends to repair it before sending to the generator. Default: true."
    • addedInput schema / properties / failure_mode / description
      Added value: +"Optional failure mode if the model was printed and failed (e.g. ``\"adhesion\"``, ``\"spaghetti\"``)."
    • addedInput schema / properties / file_path / description
      Added value: +"Optional path to the STL file for structural analysis.  When provided, the tool also analyzes structural risks and folds them into the improved prompt."
    • changedInput schema / properties / has_bridges / description
      Previous value: -"Default: false."New value: +"Whether bridges were detected. Default: false."
    • changedInput schema / properties / iteration / description
      Previous value: -"Default: 1."New value: +"Which retry iteration this is. Default: 1."
    • addedInput schema / properties / max_overhang_angle / description
      Added value: +"Maximum overhang angle detected."
    • addedInput schema / properties / min_wall_thickness / description
      Added value: +"Minimum wall thickness detected."
    • addedInput schema / properties / original_prompt / description
      Added value: +"The original generation prompt."
  2. Changed10 schema fields changedv1.5.0
    • removedInput schema / properties / enforce_sanity / default
      Removed value: -true
    • addedInput schema / properties / enforce_sanity / description
      Added value: +"Default: true."
    • removedInput schema / properties / failure_mode / default
      Removed value: -null
    • removedInput schema / properties / file_path / default
      Removed value: -null
    • removedInput schema / properties / has_bridges / default
      Removed value: -false
    • addedInput schema / properties / has_bridges / description
      Added value: +"Default: false."
    • removedInput schema / properties / iteration / default
      Removed value: -1
    • addedInput schema / properties / iteration / description
      Added value: +"Default: 1."
    • removedInput schema / properties / max_overhang_angle / default
      Removed value: -null
    • removedInput schema / properties / min_wall_thickness / default
      Removed value: -null
  3. First observedv0.1.0

TDQS

A3.8/5.0
Behavior5/5

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

Annotations only declare read-only/non-destructive/no open-world, and the description goes well beyond them: it specifies the three-check gate, the 70% token-overlap threshold, the SANITY_GATE_FAILED error code, and that failure returns a list rather than a prompt. It even points at the field (improved_prompt.sanity) to read when enforcement is bypassed, which is exactly the behavioral context an agent needs.

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

Conciseness3/5

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

The purpose and sanity-gate explanation are front-loaded and well written, but the closing Args block duplicates a schema that already has full description coverage, adding bulk without new information. Trimmed to the gate/behavior paragraphs it would be materially stronger.

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 read-only, 8-parameter tool with full schema coverage and no output schema, the definition covers purpose, the transformation performed, the failure contract, and an escape hatch with the resulting response field. The main omission is what a successful response looks like beyond the sanity subfield.

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 already documents every parameter, and the Args block largely restates it. The one piece of genuine added meaning is the note that providing file_path causes structural risk analysis to be folded into the prompt, though the schema description already covers this too.

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 opening sentence gives a specific verb and resource: 'Generate an improved prompt from feedback', and the next sentence narrows the effect (adds physical constraints for printability, leaves creative intent intact). It never names a sibling such as build_generation_prompt or analyze_generation_feedback, so differentiation is left to inference.

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 gives real conditional guidance for one parameter: default enforce_sanity=True refuses on gate failure, while False is for callers who want the failed prompt 'for inspection, repair, or model self-correction'. However there is no guidance on when to call this at all versus the related prompt-building and feedback-analysis siblings.

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

Deploy Server

Other Tools