> ## Documentation Index
> Fetch the complete documentation index at: https://formpaste.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# get_snippet

> MCP tool - fetch a wired form snippet for a framework, with or without a real access key.

<Info>**Free** - like the rest of the MCP server, `get_snippet` is not plan-gated.</Info>

Returns the same bare, wired snippet shown on a form's Setup tab in the dashboard, for
any of the six supported frameworks. Useful on its own when an agent already has a form
(and its `formId`) and just needs the code again - e.g. to wire a second page, or after
[`create_form`](/docs/agents/create-form)'s snippet was discarded.

## Input schema

| Field       | Type                                                            | Required | Notes                                                                                                         |
| ----------- | --------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------- |
| `framework` | `"html" \| "react" \| "nextjs" \| "astro" \| "vue" \| "svelte"` | yes      | Which framework's snippet to render.                                                                          |
| `formId`    | `string`                                                        | no       | An existing form's id (`frm_…`), owner-scoped. If omitted (or not yours), the snippet uses a placeholder key. |

## Example call

```json theme={null}
{
  "name": "get_snippet",
  "arguments": {
    "framework": "astro",
    "formId": "frm_..."
  }
}
```

## Returned shape

```json theme={null}
{
  "framework": "astro",
  "snippet": "---\n// src/components/ContactForm.astro - a no-JS form that posts to Formpaste.\n---\n<form action=\"https://api.formpaste.com/submit\" method=\"POST\">\n  <input type=\"hidden\" name=\"access_key\" value=\"fp_...\" />\n  ...\n</form>"
}
```

| Field       | Type     | Meaning                                                                                                                                                                                                                        |
| ----------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `framework` | `string` | Echoes the requested framework.                                                                                                                                                                                                |
| `snippet`   | `string` | A complete, bare form for that framework - email field, message field, submit handling, and success/error state. Not a styled component; see [Copy-paste components](/docs/features/copy-paste-components) for that separate track. |

## With vs. without `formId`

* **With `formId`**, and the form belongs to your account - the snippet's
  `access_key` is the form's real key, ready to paste and use immediately.
* **Without `formId`**, or with an id that isn't yours - the snippet uses
  `YOUR_ACCESS_KEY` as a placeholder. Owner-scoping means you can't fetch another
  account's key this way; a non-owned `formId` behaves exactly like omitting it.

Every snippet posts to `https://api.formpaste.com/submit` (the real, single submit
endpoint - never a per-form URL like `/f/{form_id}`).

## Errors

An unsupported `framework` value returns:

```
invalid_framework: valid values are html, react, nextjs, astro, vue, svelte
```

An invalid or revoked token returns the same auth error as every MCP tool - see
[MCP server](/docs/agents/mcp-server#auth).

<CardGroup cols={2}>
  <Card title="create_form" icon="wand-magic-sparkles" href="/docs/agents/create-form">
    Create a form and get its first snippet in one call.
  </Card>

  <Card title="Framework snippets" icon="brackets-curly" href="/docs/framework-snippets">
    The same six snippets, browsable outside of MCP.
  </Card>
</CardGroup>
