> For the complete documentation index, see [llms.txt](https://docs.divmagic.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.divmagic.com/mcp/tools.md).

# Tools

The five tools the DivMagic MCP server exposes to your agent

You do not call these by hand — your agent does, based on what you ask for in plain language. This page documents what each one accepts so you can see what is possible and phrase requests that reach it.

| Tool                                                  | What it does                                                           | Credits                                          |
| ----------------------------------------------------- | ---------------------------------------------------------------------- | ------------------------------------------------ |
| [`copy_component_from_url`](#copy_component_from_url) | Renders a page and returns its markup                                  | 1 per copy                                       |
| [`get_component_result`](#get_component_result)       | Picks up a copy that was still running, or reads a large one in pieces | Free                                             |
| [`list_library_components`](#list_library_components) | Lists what is in your library                                          | Free                                             |
| [`get_library_component`](#get_library_component)     | Reads one saved design                                                 | Free                                             |
| [`save_to_library`](#save_to_library)                 | Files a design into your library                                       | Free, or 1 credit when it copies the page itself |

***

## `copy_component_from_url`

Opens a real web page in a browser and converts what it renders into clean, self-contained markup.

| Parameter         | Type                                            | Default    | Description                                                |
| ----------------- | ----------------------------------------------- | ---------- | ---------------------------------------------------------- |
| `url`             | string                                          | —          | The page to copy, for example `https://stripe.com/pricing` |
| `componentFormat` | `html` \| `jsx`                                 | `html`     | Output language                                            |
| `styleFormat`     | `inline` \| `tailwind` \| `local` \| `external` | `tailwind` | How styling is emitted                                     |
| `refresh`         | boolean                                         | `false`    | Render the page again rather than reusing a stored copy    |

**Requires an active plan.** An account with no MCP credits is refused before the page is opened.

A copy usually takes 10–30 seconds. If it has not finished within **20 seconds**, you get a job id instead of markup — the work carries on in the background and [`get_component_result`](#get_component_result) picks it up.

For what the format options mean, see:

{% content-ref url="/pages/aoxcwlmI4Dcw35EW8y58" %}
[Component Format](/settings/component-format.md)
{% endcontent-ref %}

{% content-ref url="/pages/28wtnmMDfYScXAueULAF" %}
[Style Format](/settings/style-format.md)
{% endcontent-ref %}

### About `refresh`

A page copied in the last **30 days** is served from that stored copy rather than rendered again. Pass `refresh: true` when the page has changed since, or when the stored copy is visibly stale.

Both paths cost one credit. `refresh` only decides whether the time is spent re-rendering.

***

## `get_component_result`

Fetches a copy that was still running, or reads a large result a piece at a time.

| Parameter  | Type    | Description                                                                        |
| ---------- | ------- | ---------------------------------------------------------------------------------- |
| `jobId`    | string  | The id `copy_component_from_url` handed you                                        |
| `offset`   | integer | Byte offset to read from. Omit for the whole result.                               |
| `maxBytes` | integer | Bytes per piece, from 1,024 up to 262,144 (256 KB). Only meaningful with `offset`. |

While the job is still running you get:

```
Still working. Ask again in about 10 seconds.
```

Polling is free and never spends a credit.

***

## `list_library_components`

Lists what is saved in the library of the account the key belongs to — designs copied from pages with the extension, and designs filed by an agent — newest first.

Takes no parameters. Returns up to **50** entries, each with:

| Field         | Description                                      |
| ------------- | ------------------------------------------------ |
| `componentId` | The id to pass to `get_library_component`        |
| `title`       | What the component is called                     |
| `url`         | The page it came from, or `null`                 |
| `version`     | How many times it has been edited, starting at 1 |
| `createdAt`   | When it was saved                                |

***

## `get_library_component`

Returns the markup of one component from your library.

| Parameter     | Type    | Description                                                       |
| ------------- | ------- | ----------------------------------------------------------------- |
| `componentId` | string  | The id, as `list_library_components` reported it                  |
| `offset`      | integer | Byte offset to read from. Omit for the whole component.           |
| `maxBytes`    | integer | Bytes per piece, 1,024 to 262,144. Only meaningful with `offset`. |

A component belonging to a different account reads as one that does not exist.

***

## `save_to_library`

Files a design into your library, where it joins whatever was saved from the extension.

| Parameter                                 | Type   | Description                                                                                                    |
| ----------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------- |
| `title`                                   | string | What to call it, 1–200 characters                                                                              |
| `url`                                     | string | A page to copy and file in one step. The markup is not returned.                                               |
| `jobId`                                   | string | A job id from `copy_component_from_url`, to file that copy as it was rendered                                  |
| `code`                                    | string | Markup the agent wrote or repaired itself                                                                      |
| `sourceUrl`                               | string | The page it came from. Taken from the copy automatically, so only worth passing with `code`.                   |
| `refresh` `componentFormat` `styleFormat` |        | Only with `url`, and they mean exactly what they mean in [`copy_component_from_url`](#copy_component_from_url) |

Pass **exactly one** of `url`, `jobId` or `code` — never two, never none. Which one is settled by a single question: does the markup that should be filed still match what was copied?

| Pass    | When                                                                                                                                                                    | Credits    |
| ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| `url`   | Nobody needs to see the page, it is only being filed. It is copied and saved in one step, the markup never passes through the conversation, and only the id comes back. | 1 per copy |
| `jobId` | The page was already copied and the markup has not changed since. Reading or quoting it is not a change.                                                                | Free       |
| `code`  | The markup in hand differs from the copy — repaired, edited, or written by the agent.                                                                                   | Free       |

### What may be saved

The library **renders** stored markup and never runs it. Studio, the extension and the dashboard card paste the stored body straight into a page — no bundler, no JavaScript anywhere in the path.

So a save is refused if it contains any of these:

* `<script>` blocks
* `import` or `export` statements
* Function declarations
* Variable declarations
* `.map()` or any loop over data
* Props, state or hooks
* TypeScript

Repetition has to be written out: three cards are three blocks of markup, not an array and a loop.

A component may hold up to **250,000 bytes**. A larger save is refused and nothing is written.

{% hint style="info" %}
This check applies only to markup passed as `code`. A copy filed by `jobId` is DivMagic's own converter output and is never re-judged.
{% endhint %}
