FormLoom

get_snippet

Glossary

A FormLoom MCP tool that returns framework-correct, copy-paste form code with a real provisioned key embedded.

Definition

The `get_snippet` MCP tool is FormLoom's core codegen primitive. Given a `framework` (e.g. 'nextjs', 'astro', 'sveltekit') and an array of `fields` (name, type, required), it returns ready-to-paste code in the correct idiom for that framework — a Server Action for Next.js, a `use:enhance` form for SvelteKit, an `.astro` component for Astro, etc. — with a real, provisioned FormLoom access key already embedded, so the form works on first run.

Why it matters for form backends

This is the tool that makes FormLoom the form backend AI coding tools can auto-wire. No other form backend's MCP server generates framework-correct client code with a live endpoint.

Example

json
// MCP tool call
{
  "name": "get_snippet",
  "arguments": {
    "framework": "nextjs",
    "fields": [
      { "name": "email", "type": "email", "required": true },
      { "name": "message", "type": "textarea", "required": true }
    ]
  }
}

FAQ

Yes — it calls `provision_endpoint` internally and embeds the minted access key in the returned code.

Related terms

Ready to put this into practice?

Add a form to your site in minutes — free access key, copy-paste snippet.

get_snippet — form backend glossary · FormLoom