Skip to main content

Tools

The MCP server provides tools the AI can call to perform tasks. Which ones is decided by the REFORMER_SURFACE environment variable (surfaces). By default there are two, search and execute. The set of ten tools — reference, building a form from its intent, code checking — comes with REFORMER_SURFACE=tools.

Default: search and execute​

Both tools take JavaScript — the body of an async function. The code runs in the server sandbox: no imports, no file system, no network.

execute creates and changes the form. The form is one program: reformer.form opens it with the folder, the stack and the whole task text (a task by a spec also passes specPath), method chains record edits, and save() applies them, builds the module, checks the types and checks the form against the task:

const f = reformer.form({
dir: 'form',
target: 'renderer-react', // the stack from the task: core, renderer-react or renderer-json
task: '<the whole task>',
});
f.add('password', 'Password')
.required('Enter a password')
.min(8, 'At least 8 characters')
.digit('At least one digit');
f.add('confirm', 'Repeat password')
.required('Repeat the password')
.sameAs('password', 'Passwords differ');
f.add('company', 'Company')
.required('Enter the company')
.showWhen((m) => m.customerType === 'company');
console.log(await f.save());
  • Conditions and formulas are arrows with one parameter: m => m.method === 'courier'. The server reads their text with the TypeScript parser and rejects an assignment, a closure over script variables and unknown calls.
  • An unknown method is not a script error: its chain gets ✗ with a hint at the method it may mean.
  • Edits a script did not save are saved when it finishes without an error.
  • The answer marks every edit with a ✓ or ✗ line naming the chain that made it, shows the build and names every difference of the form from the task with the chains that fix it: a field or an array of the task the form lacks, a property of a field from the spec, a formula, the steps of a wizard. The answer "Checked against the task: no differences found." means the form does everything the task asks.
  • A ready form opens the same way — with the task of the change — and changes with the same chains (f.field(name), .rename, .remove, .removeRule). The check of a change names what the task asks to change and the form does not.

The form is its code. The server merges each edit into the module files, and code written by hand stays; an edit that cannot go in next to it is named with file:line. There is no form.intent.json in the folder: the server reads the form from its code.

search only reads. Its code sees frozen data: form (fields with their rules and steps, arrays, steps, behavior, visibility, the submit button), task (the task and the parsed spec; null before the first program) and api (builder methods with the signature, doc and example). The answer is at most 6000 characters.

// the fields of the "Payment" step with their rules
return form.fields.filter((field) => field.step === 'Payment');

The tool set: REFORMER_SURFACE=tools​

Ten tools. They run in the service, and the files — the form directory, the plan_form draft, the report_issue reports — are written to disk by the @reformer/mcp client from the service's response (what stays with you). It is convenient to group the tools by the steps of working on a form.

StepTools
Figure out which APIchoose_api (requirement in your own words → operator), get_context (context for a build step)
Find reference materialget_symbol_docs, list_symbols, find_recipe, search_docs
Build the formplan_form (spec → a draft), form_build (intent → form module on disk, hand-written code stays)
Checkvalidate_form: kind = code, json-schema, behaviors, bundle, layout
Report a problemreport_issue

generate_form, which returned the form files as text, and the aliases validate_json_schema and check_behaviors were removed in 7.0 — a call answers "Unknown tool". Use form_build instead of generate_form, and validate_form with kind: "json-schema" or kind: "behaviors" instead of the aliases.

The role of each tool is described in the Overview. Below are the details of form_build, plan_form, validate_form and report_issue.

form_build​

Builds a form module on disk from the intent the agent sends as an argument. form_build compiles it, cross-checks it, type-checks the result and writes all module files itself. The answer is diagnostics only.

A built form is its code: a change sends only its records. A record replaces the one with the same key (a field or an array by name, a rule by target, a behavior by kind and target), a record with "remove": true removes it, the rest stays as the code has it. A new field with no place in the layout goes to the end of the form. The change is merged into the code: hand-written code stays.

ParameterTypeRequiredDescription
dirstringNothe form folder inside the project, form by default; required at a monorepo root
intentobjectNothe records of the form that change; a new form — all of it
showstringNo"intent" — return the form read from its code (and the hand-written code the server does not read); nothing is built
wholebooleanNotrue — intent is the whole form: records it does not name go away
grammarstringNoreturn the intent grammar instead of building: base, a section (behavior, arrays, wizard, cross, async, parts, operators, nodes), several comma-separated, or all
  • Start with the grammar: form_build {"grammar":"base"} needs neither a project nor a file; further sections on demand. A call with no form yet and no intent also returns the grammar.
  • Nothing is written while errors remain. Errors come as a list with the file and line.
  • Hand-written code in built files stays. The build merges only the change of the form next to it; what did not go in, the answer lists under Not merged: N. with file:line.
  • types.ts and api.ts are yours from day one. On the core stack index.tsx is a stub with samples (a field, visibility in JSX, bundle.submission.submit, steps): the build keeps it in step with the intent until you write your JSX markup there; from then on the file is yours and the build type-checks it. On a renderer target the build merges its assembly into index.tsx and keeps code written by hand.
  • An unknown key of a record is an error naming the nearest valid key (unknown-key). A component prop written next to the field (placeholder, min) is moved into componentProps with a note.
  • The verdict is the one of validate_form with kind: "bundle". On top of it the build type-checks the module (an error names the file to fix) and needs the environment: @reformer/core and @reformer/ui-kit installed in the project.

The module layout and the intent format are in the 06-form-directory-layout recipe of the service's reference (reformer://docs/mcp); find_recipe returns it too.

plan_form​

Drafts <dir>/form.intent.json from a markdown spec: fields with types and components, rules from the spec tables, wizard steps, arrays. The draft is written to disk (the first build turns it into code and removes it); the answer is a short summary and a list of what to finish by hand (formulas of computed fields and visibility conditions are not extracted from the text).

ParameterTypeRequiredDescription
specPathstringYesthe markdown spec, absolute or relative to the working directory
dirstringNothe form folder, as in form_build (form by default)
targetstringNothe stack from the task: core / renderer-react / renderer-json
  • An existing form.intent.json is never overwritten — a draft starts the work, it does not replace it.
  • No free-text description (description is not supported since 7.0): from a description the agent writes the intent itself, by the grammar from form_build {"grammar":"base"}.

validate_form​

Checks a form before it runs. Returns RF0xx diagnostics with the line, a "what to do" hint and the next call to make.

kindWhat it checks
codeThe form's TypeScript: unknown or wrongly imported @reformer symbols, operators outside their schema, removed API
json-schemaa renderer-json schema document
behaviorscompute cycles — from a list of { target, reads[] }
bundlethe FormIntent judged as form_build judges it: record reading, C1–C13, placement, kit components; schema is optional
layoutthe form module's file names against the canonical set (form.schema.ts, form.behavior.ts, form.validation.ts, …)

kind: 'code' finds removed API by a table of former names — the same "before → after" replacement is described on the Migrating from earlier APIs page.

report_issue​

Submits a report about an error and its solution for feedback collection.

Parameters:

ParameterTypeRequiredDescription
errorstringYesDescription of the error or problem
solutionstringYesSolution or fix
tagsstring[]NoTags for categorization and analytics
contextobjectNoAdditional context (see below)

Structure of context:

FieldTypeDescription
examplesarrayCode examples with descriptions
examples[].descriptionstringExample description
examples[].codestringExample code
relatedFilesstring[]Paths to related files
notesstringAdditional notes

Recommended tags:

FormatExampleDescription
category:<type>category:behavior, category:validationCategory: schema, validation, behavior, react, types, other
agent:<name>agent:claude, agent:cursorAI agent name
severity:<level>severity:critical, severity:minorProblem severity

Returns:

Confirmation that the report was written successfully.

How it works:

  1. The AI encounters an error while working with ReFormer
  2. The AI solves the problem
  3. The AI calls report_issue with a description of the error and the solution
  4. The report is saved locally as a separate file — <project root>/.reformer/issue_reports/<timestamp>-<slug>.json

The directory can be overridden with the REFORMER_ISSUE_REPORTS_DIR environment variable (a relative path is resolved against the server's working directory). The project root is the nearest package.json with dependencies found upward from cwd; if there is none, reports are placed directly in cwd. The server returns the exact path in its response.

Example of AI usage:

AI found an error: "Cycle detected in computeFrom"
AI identified the cause: effect depends on the target field
AI calls report_issue:
- error: "Infinite loop in computeFrom when effect depends on target"
- solution: "Use peek() instead of .value to read target without dependency"
- tags: ["category:behavior", "agent:claude", "severity:critical"]
- context:
examples:
- description: "Wrong - creates a dependency"
code: "const current = targetNode.value.value;"
- description: "Correct - no dependency"
code: "const current = targetNode.value.peek();"
relatedFiles: ["packages/reformer/src/core/behavior/behaviors/compute-from.ts"]

Storage format (JSON):

One report per file, pretty-printed with indentation:

{
"timestamp": "2026-01-15T10:30:00.000Z",
"error": "...",
"solution": "...",
"tags": ["category:behavior"],
"context": { "examples": [], "notes": "..." }
}

The file name is made of the timestamp and a short slug of the error. If two reports land in the same millisecond, a -2, -3, … suffix is added to the name — an existing file is never overwritten.

Why collect feedback?​

Error reports help to:

  • Identify common user problems
  • Improve the documentation
  • Find bugs in the library
  • Understand which patterns cause difficulties

All data is stored locally on your computer.