Skip to main content
Glama

Apply safe fixes to a Formhaus definition

fix_definition
Read-only

Repair form definitions after validation flags safe issues like misspelled keys, missing IDs, or empty labels. Applies each safe fix automatically and returns the repaired form plus remaining issues.

Instructions

Call this when validate_definition reports issues with safe fixes, such as a misspelled property name, a missing id or key, an empty label, a one-letter typo in a condition field, a duplicate key nothing refers to or a missing submit button. Applies every safe fix and returns { definition, applied, valid, issues }: the repaired definition, the fixes applied in order, and the issues left, the same as validate_definition returns for the repaired definition. Safe fixes never change what the form does beyond the repair. Unsafe fixes, such as pointing a condition at a field two edits away, stay in issues[].fixes for you to check and apply by hand. Save the returned definition, then fix the remaining errors.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
definitionYesFormhaus form definition as a JSON object or a JSON string. JSON Schema: https://formhaus.dev/schema/form-definition.json. Top level: id, title, submit { label }, and fields (one step) or steps [{ id, title, fields }]. Field: { key, type, label, validation?, options?, show?, showAny? }. Rules go inside "validation": { required, minLength, maxLength, min, max, pattern, matchField }. Condition: { field, eq | neq | in | notIn | notEmpty | gt | gte | lt | lte } with exactly one operator, on a field of the same or an earlier step. Optional: lang, messages and labels catalogs, and i18n objects that map texts to translation keys.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
validYesfalse when at least one issue has severity "error".
issuesYesIssues left after the safe fixes. Errors first, then warnings. Fix them by hand or apply one of their unsafe fixes after checking it.
appliedYesFixes applied, in order. path is where the issue was before the fix.
definitionNoThe definition with every safe fix applied. Missing when the input is not a JSON object.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.13.3

TDQS

A4.8/5.0
Behavior5/5

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

readOnlyHint=true only tells the agent this is non-mutating; the description adds far more — the exact return tuple, the guarantee that safe fixes never change form behavior beyond the repair, that unsafe fixes are deliberately withheld, and crucially that the tool does not persist so the caller must 'Save the returned definition'. That last point resolves the subtle tension between a mutating name and a read-only annotation.

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?

The trigger condition is front-loaded correctly and every sentence carries information. It is one dense paragraph with a long example enumeration, which is slightly run-on, but there is no padding or repetition.

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?

An output schema exists, yet the description still explains the specific fields that matter (definition, applied, valid, issues) and the safe/unsafe split the output schema cannot express, then closes the loop with the next action. For a repair tool feeding a validate loop, nothing an agent needs is missing.

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 100% and the definition parameter is exhaustively described in the schema, so the baseline would be 3. The description still adds semantic meaning not in the schema — the criteria distinguishing a safe fix from an unsafe one (e.g. 'pointing a condition at a field two edits away') — which tells the agent what kind of input this tool can actually repair.

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?

Specific verb (apply safe fixes / fix) plus a named resource (Formhaus definition), with a concrete enumeration of what counts as a safe fix. It explicitly frames itself relative to validate_definition, so an agent can separate the two siblings without opening either schema.

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?

States the exact trigger ('Call this when validate_definition reports issues with safe fixes'), names the alternative and its output, and draws the boundary of when NOT to expect a fix ('Unsafe fixes ... stay in issues[].fixes for you to check and apply by hand'). Nothing is left to inference.

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