Formhaus

v0.6.3
io.github.ignsm/formhaus Checked 8 hours ago Published 1 month ago

Validate Formhaus form definitions and simulate multi-step paths against the real engine.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

validate_definition Validate a Formhaus definition

Call this after writing or editing a definition and before simulate_path or publish_form; it checks the structure and engine rules, while simulate_path checks how a user moves through the form. Checks a Formhaus form definition against the JSON Schema and the engine. Returns { valid, issues }. Each issue has code, severity ("error" or "warning"), a JSON pointer path, message, hint and, when a repair is known, fixes: a list of { title, safe, patch } where patch is an RFC 6902 JSON Patch. Errors make the engine reject the definition, such as a condition with zero or two operators, a condition on…

ParameterTypeDescription
definition *Formhaus 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,…

fix_definition Apply safe fixes to a Formhaus definition

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…

ParameterTypeDescription
definition *Formhaus 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,…

simulate_path Simulate a path through a form

Call this after validate_definition passes, to check branching, routes, skip and conditional fields by stepping through the form like a user; validate_definition checks only the structure. Runs a headless FormEngine. answers are applied as initial values; a group answer is an array of item objects, such as { "participants": [{ "name": "Ada" }] }. Then actions are pressed in order like a user would: next is refused while its disabled conditions match and on next: false steps until an autoAdvance radio is answered, skip only works on steps with a skip action and submits on the last step. Without…

ParameterTypeDescription
definition *Formhaus 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,…
actionsarrayButtons to press in order, each "next", "back" or "skip". Omit to press Next until the last step or the first blocking error.
answersobjectField values keyed by field key, applied as initial values before the actions, such as {"email": "ann@example.com", "plan": "pro"}. select, radio and multiselect take option values, not labels. Omit t…
overlayobjectTranslation overlay for one language: the overlay from translation_template with its values translated. Applied before the run, so labels and errors come out in that language. Omit to run in the sourc…

translation_template Translation template

Call this when the form needs another language, once per language: it returns the overlay to translate, which simulate_path accepts as overlay to check the result. Returns the translation skeleton of a definition for one language: overlay is nested JSON with the source texts as values, file is the suggested name (signup.ru.json), slots lists every text with its address, translation key, {placeholders} and a source hash. Translate only the values, keep nesting, identifiers and {placeholders}, then save the overlay next to the definition. Store revision and review state separately; the template…

ParameterTypeDescription
definition *Formhaus 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,…
lang *stringTarget language code, such as "ru" or "pt-BR". It names the suggested file, such as signup.ru.json.
prefixPrefix of derived translation keys, such as "signup" for keys like signup.title. Defaults to the form id. Pass false to list only the explicit keys from i18n objects.

capabilities Formhaus capabilities

Call this first, before writing or editing a definition, for the full reference of what a definition supports; example_definitions gives whole working forms to copy instead. Lists what a Formhaus definition supports: field types, sections, repeatable groups, field props, validation rules, condition operators, step and route semantics, actions, translation (lang, messages, labels, i18n keys, overlay addresses) and adapters. To check a finished definition, call validate_definition instead. To upgrade a 0.10 project, read the formhaus://migrate/0.11 resource.

example_definitions Example definitions

Call this when you need a working form to start from or a pattern to copy, such as multi-step forms, branching routes, conditions or translations; capabilities lists every option but shows no complete form. Without id, lists the bundled example definitions. With id, returns that definition. Adapt it, then check it with validate_definition.

ParameterTypeDescription
idstringId of one example, such as "branching-account", taken from the list this tool returns without id. Omit to list the examples.

publish_form Publish a form

Call this after validate_definition passes, to put the form live on Formhaus Cloud: without form_id it creates a new form, with form_id it publishes a new version of that form. Returns form_id, version, endpoint (POST URL for submissions), hosted_url, embed_snippet, react_snippet, dashboard_url and warnings. Without an account key (fh_live_...) it also returns claim_url and expires_at, and on the first call without any key agent_key (fh_agent_...) and agent_key_notice. Call it when the user needs a working form (contact, waitlist, signup, survey, feedback) without writing a backend. A new vers…

ParameterTypeDescription
definition *Formhaus 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,…
emailstringOnly for a new form published without an account key: the user's email. Formhaus emails them claim_url (at most one email per address per hour, no form content). Ignored with a warning otherwise.
form_idstringThe 10-character form_id of an existing form, from publish_form or list_forms, to publish a new version of it. Requires an account key (fh_live_...) of the form's account or the agent key (fh_agent_..…
redirect_urlstringhttp(s) URL the hosted page and embed open after a successful submission instead of the success message. Empty string removes it. Ignored with a warning for unclaimed forms.
success_messagestringText shown after a successful submission on the hosted page and embed. Up to 500 characters.

list_forms List forms

Call this to find a form_id for get_submissions, publish_form, update_form_settings or get_webhook, or to see every form the key reaches with its status and submission count; to read the answers of one form, call get_submissions instead. Lists the forms newest first. Each form has form_id, title, status (active or paused), version, submissions (total count), endpoint, hosted_url, created_at and, for unclaimed forms, expires_at. An account key (fh_live_...) sees every form of the account; an agent key (fh_agent_...) sees only the forms it created. Requires FORMHAUS_API_KEY.

get_submissions Get form submissions

Call this to read the answers people submitted to one form, page by page; list_forms gives only the total count per form. Returns submissions newest first. Requires FORMHAUS_API_KEY: an account key (fh_live_...) of the form's account or the agent key (fh_agent_...) that created the form. Returns notice, submissions and next_cursor. Each submission has id, form_version, created_at and values (field key to value, validated on the server). limit is 1 to 100, default 50. When next_cursor is present, call again with cursor set to it for older submissions; no next_cursor means no more. Values were t…

ParameterTypeDescription
form_id *stringThe 10-character form_id returned by publish_form or list_forms, such as "abcDEF1234".
cursorstringThe next_cursor value from the previous call, to read the next page of older submissions. Omit for the newest submissions.
limitintegerNumber of submissions per page, a whole number from 1 to 100. Default 50.

update_form_settings Update form settings

Call this to change how a published form behaves without touching its fields: webhook, email notifications, success message, redirect, or pause and resume. To change fields, publish a new version with publish_form and form_id instead. Changes the settings of a form of the account. Requires FORMHAUS_API_KEY to be an account key (fh_live_...); agent keys (fh_agent_..., also after a claim) get owner_key_required, and unclaimed forms are not found. Send only the settings to change; omitted ones stay. Returns form_id, status, success_message, redirect_url, notify_mode, webhook_url and a masked webh…

ParameterTypeDescription
form_id *stringThe 10-character form_id returned by publish_form or list_forms, such as "abcDEF1234".
notify_modestringmilestones: an email at the 1st, 10th, 100th, 500th, 1,000th, 5,000th, 10,000th, 25,000th, 50,000th and 100,000th response, without response values. off: no emails. Omit to leave it unchanged.
redirect_urlstringhttp(s) URL the hosted page and embed open after a successful submission. Empty string removes it. Omit to leave it unchanged.
statusstringpaused stops accepting submissions, active resumes them. Omit to leave it unchanged.
success_messagestringText shown after a successful submission on the hosted page and embed. Up to 500 characters. Omit to leave it unchanged.
webhook_urlstringPublic https:// URL that receives each new submission as a signed POST. Empty string removes the webhook. Omit to leave it unchanged.

get_webhook Get the webhook of a form

Call this to check where the webhook of a form posts; it shows only a masked secret, so call reveal_webhook_secret when the receiving server needs the full one, and update_form_settings to set or remove the URL. Returns the webhook URL and the masked signing secret. Requires an account key (fh_live_...); agent keys answer owner_key_required.

ParameterTypeDescription
form_id *stringThe 10-character form_id returned by publish_form or list_forms, such as "abcDEF1234".

reveal_webhook_secret Reveal the webhook signing secret

Call this only while setting up the server that receives the webhook of a form and needs the full signing secret; get_webhook shows the URL and a masked secret and is enough for anything else. Returns the full webhook signing secret (whsec_...). Requires an account key (fh_live_...); agent keys answer owner_key_required. Store the secret on the receiving server as a server-side secret. Never print it in chat or commit it.

ParameterTypeDescription
form_id *stringThe 10-character form_id returned by publish_form or list_forms, such as "abcDEF1234".