# Tools

> Draft for `/docs/tools`. Generated by hand from `src/server/mcp.ts` on 2026-11-23 (create_team and move_design added; layout tools, D-050; the polish round: strict arguments, metadata-only writes, `edits[]`, `get_artboard` include modes). Engineer note: generate this page from the tool registry at build time so it cannot drift (go-live checklist D2).

Every tool acts for one person, inside the teams that person belongs to (a service key: inside its one team). IDs are short strings. `?` marks an optional argument.

Arguments are strict: a name the tool does not take is refused with `bad_request`, naming it (`unknown`) and the names it takes (`accepted`). Results are one compact JSON text. Writes answer with metadata (id, version, sizes, `content_height`, warnings), never with the HTML you sent; read HTML or text with `get_artboard`.

**Artboard HTML** (`create_artboard`, `edit_artboard`, `set_artboard_html`): one self-contained page. Prefer HTML and CSS. Use JavaScript only for interaction inside the page; it has no network access: inline every image as a `data:` URL; Google Fonts are the only remote resource.

## Identity and teams

| Tool | Arguments | Returns |
| --- | --- | --- |
| `whoami` | none | `name`, `email`, `client`, `kind` of the connection; `server_version` (the nauvid build: when it changes, reconnect to see new tools, `/mcp` in Claude Code); `open_mentions: {count}` when mentions wait |
| `list_teams` | none | `teams[]` with `id`, `name`, `slug`, `role` |
| `create_team` | `name`, `icon_domain?` | A new team, as the web's Create team: name 1–40 characters, your person is its owner, it starts empty (no starter designs, nobody invited), at most 20 owned teams per person. `icon_domain` (a bare domain) fetches the team icon once from that website; no icon found still creates the team (`icon.set: false`). Returns `id`, `slug`, `name`, `url`. Never with a service key. Only when the person asked. |

## Designs

| Tool | Arguments | What it does |
| --- | --- | --- |
| `list_designs` | `team?`, `query?`, `pinned?` | Designs, most recently changed first (up to 200). `query` searches title and project. `open_mentions: {count}` when mentions wait. |
| `search` | `query`, `team?`, `design_id?`, `kinds?` (`design`, `artboard`, `note`, `comment`), `limit?` | Finds words in what your person can open: design titles and projects, artboard names and the visible text of each artboard's current version (not scripts, styles or attributes), notes and section titles, comments and replies (resolved too). Every word must match, the last as a prefix; accents and case do not matter; no stemming, so try other forms in further calls. Grouped by kind, best first, up to `limit` per kind (default 8, at most 25; at most 3 artboards per design), each with `excerpt` (fenced), `url`, the design and artboard it is in; a comment hit has `comment.thread_id` for `list_comments`. One-letter words are left out; the last word is a prefix from 3 letters. Old versions, images and drawings are not searched. |
| `get_design` | `design_id` | The outline and layout: artboards with `id`, `name`, box (`x`, `y`, `w`, `h`), `version`, `open_comments` and prototype `links` (when they have any); `objects`: every note, image and drawing as `{kind, id, x, y, w, h}` with `artboard_id` when attached; `bounds` of everything; `overlaps` between artboards that cover each other; `prototype_start_artboard_id`; `open_mentions: {count, here}` when mentions wait (`here`: thread ids in this design). No HTML. |
| `create_design` | `title`, `team?`, `project?` | An empty design. Returns `id` and `url`. |
| `get_design_styles` | `design_id` | The design's shared stylesheet: `css` (fenced), `version`, `artboards_using`. |
| `set_design_styles` | `design_id`, `css` or `edits`, `base_version` | Replaces the shared stylesheet (`css`, up to 256 KB, no `</style`) or changes it with `edits: [{old_text, new_text, replace_all?}]` (up to 20, matched against the stored CSS like `edit_artboard`, all or nothing). Every artboard with `<style data-nv-shared></style>` (one per artboard) is saved again with the new CSS (`restyled`, `skipped`; `deferred` past 16 MB a call or 64 MB a day, filled on their next save). The CSS is filled in on every save, so stored HTML, exports and screenshots stay self-contained; `get_artboard` shows the placeholder empty. Needs Edit. 5 calls at once, then one a minute. |
| `get_design_part` | `design_id`, `name` | One shared part: `html` (fenced, with the `data-nv-id` of each element), `version` (0 when there is none of that name yet), `artboards_using`, `parts` (the design's part names). |
| `set_design_part` | `design_id`, `name`, `html` or `edits`, `base_version` | Creates or changes a shared part (a nav, header, footer, SVG sprite: up to 64 KB, at most 8 per design, no `data-nv-part` or `data-nv-shared` inside, must stay inside its host). An artboard hosts it with one empty element of its own, `<nav data-nv-part="nav" data-active="billing"></nav>`; every save fills the host's children with the part and `get_artboard` shows the host empty (`include: "text"` shows the part's text). Every artboard that hosts it is saved again (`resaved`, `skipped` with `problems`, `deferred`), sharing `set_design_styles`' limit and byte budget. An `edit_artboard` whose `old_text` is in the part answers `edit_not_found` with `in_part`; comments on the part's elements say `anchor.in_part` in `list_comments`. |
| `rename_design` | `design_id`, `title` | New title (up to 200 characters). |
| `duplicate_design` | `design_id`, `title?` | A copy with all artboards. Comments are not copied. |
| `remix_design` | `url_or_slug`, `team_id?` | Copies a design someone published on nauvid (`https://nauvid.com/p/<slug>`, or the slug) into one of your person's teams as a new design: the published version of each artboard as version 1, the team's default access, never published itself. Only a live publication that allows remixing; anything else (not found, unpublished, taken down, Remix off) is the same `not_found`. Returns `design_id`, `url`, `team`, `artboard_count` and `remixed_from` (title and author, fenced). At most 20 remixes an hour per person (web and MCP together). The only tool that reads a publication; it never lists them. Only when the person asked. |
| `set_design_cover` | `design_id`, `artboard_id` (or `null`) | Which artboard the design's card shows on home. |
| `set_prototype_start` | `design_id`, `artboard_id` (or `null`) | The first screen of the clickable prototype ("Play prototype"). `null`: the first artboard. |
| `reorder_artboards` | `design_id`, `artboard_ids[]` | Puts the design's artboards in a new order: every artboard id exactly once, first to last. The order Play and Present step through and `get_design` lists; the layout does not move. All or nothing: an id that is not an artboard of the design, a repeat or a missing one changes nothing. Needs Edit. Returns `artboard_ids` (the order now) and `previous` (pass it back to undo). |
| `delete_design` | `design_id` | Soft delete; `purge_after` says when it is erased (30 days). Only when the person asked. |
| `restore_design` | `design_id` | Undo `delete_design`. |
| `set_design_project` | `design_id`, `project` (or `null`) | Moves a design to a project; a new name creates the project. |
| `move_design` | `design_id`, `to_team` | Moves the design, with everything in it (artboards, every version, comments and replies, mentions, notes, drawings, images, cover, prototype start, its project, pins, For you entries), to another of your person's teams, in one transaction. Needs owner or admin in the design's team and membership in the target; never with a service key. Afterwards "whole team" access means the target team, Restricted stays Restricted, people it was shared with keep their entry, and members of the old team who are not in the target lose access. Same id and url. Returns the outline in its new team plus `moved` (counts, with `artboards` = live ones and `deleted_artboards`; `shares_kept`, `shares_dropped`, `lost_access`). Only when the person asked. |

## Projects

| Tool | Arguments | What it does |
| --- | --- | --- |
| `list_projects` | `team?` | Projects by name with `design_count`. A project can be empty. |
| `create_project` | `name`, `team?` | An empty project (up to 120 characters). A name the team already has is a conflict. |
| `rename_project` | `project` (id or current name), `name`, `team?` | Renames the project; its designs move with it. Never merges into another project. |
| `delete_project` | `project` (id or current name), `designs?` (`move` or `delete`), `team?` | Deletes the project. An empty one just goes; one with designs needs `designs`: `move` keeps them in the team under no project, `delete` also deletes the ones you have Full access on (the rest are unassigned). Owner, admin or the project's creator only. Restorable for 30 days; ask the person first. |
| `restore_project` | `project_id` | Undoes `delete_project` within 30 days: same id, the designs it held that still have no project, and the ones deleted with it. A name taken meanwhile is a conflict. |

## Artboards

| Tool | Arguments | What it does |
| --- | --- | --- |
| `create_artboard` | `design_id`, `name`, `html` or `upload_id` (+ `sha256?`), `w?`, `h?`, `x?`, `y?`, `worker?` | Adds an artboard. Default size 1440 × 900. Without `x`/`y` it goes in the first free spot right of the last-created artboard on its row (80 px gap, past any artboard, note, image or drawing in the way); with `x`/`y` exactly there, and `overlaps` lists what it covers. Returns metadata only: `id`, `name`, `version` 1, `url`, `x`, `y`, `w`, `h`, `content_height`, `comments`, `link_warnings` (one per target: `{to, element_ids, pending?, message}`), `relinked`. |
| `get_artboard` | `artboard_id`, `version?`, `include?` (`html`, `text`, `meta`), `ids?`, `element_id?`, `worker?` | Current HTML (fenced), `version`, `open_comments`, `last_edit`, prototype `links`, `prototype_start`. Read before every edit. `include: "text"`: no HTML, one line per element with text of its own, `[<data-nv-id>] tag: text`; `"meta"`: neither. `element_id`: only that element's subtree, exactly as stored (valid `old_text`). `ids: false`: HTML without `data-nv-id`, `read_only` (never `old_text`). With `version`: that older version, read-only (`current_version` is the one to edit against). |
| `edit_artboard` | `artboard_id`, `base_version`, `edits[]` (`old_text`, `new_text`, `replace_all?`; 1–20), or `old_text`, `new_text`, `replace_all?`; `worker?` | Replaces exact pieces of HTML, in order, all or nothing, as one version. Each `old_text` must occur exactly once (`replace_all`: every occurrence). `old_text` may leave out the `data-nv-id` attributes (copied from the HTML you sent): it then matches with them ignored, and an element in the replaced text keeps its id when `new_text` has the same tags. A failure (`edit_not_found`, `edit_ambiguous`) names the edit's `index`; nothing is saved. `edit_not_found` adds `near`: the stored HTML where `old_text` stops matching. Returns `edits_applied`. |
| `set_artboard_html` | `artboard_id`, `html` or `upload_id` (+ `sha256?`), `base_version`, `worker?` | Replaces the whole HTML. For rewrites. With `upload_id` the HTML comes from an upload (a failed save keeps it for the retry). A document without `</html>` saves with an `html_warning`. |
| `begin_html_upload` | none | Opens an upload for large HTML (over about 20 KB): `upload_id`, `upload_url` (a secret for that one upload), `expires_at` (one hour), `max_bytes`, `part_bytes`. |
| `append_html_upload` | `upload_id`, `part`, `text` | Adds part 0, 1, 2… (up to 32 KB each, at most 128 parts) in order; the same part again with the same text is a no-op. Returns `parts`, `bytes` so far and `part_sha256` (this part). |

**Live on the canvas.** People with the design open see your pointer (your client's mark and name, and the person you work for): it glides to the elements `create_artboard`, `edit_artboard`, `set_artboard_html` and `arrange_artboards` changed, which flash briefly; `get_artboard` and `get_artboard_screenshot` put a soft ring on the artboard you read. `worker` (optional, at most 40 characters, e.g. a subagent's name) labels the pointer, so several subagents show as several pointers. Nothing of it is stored.

Every artboard write takes `base_version`. When the versions since it only re-pointed prototype links (your next screen's create resolved a name link), the write applies to the current version and the result says `rebased_from`; any other change since is a 409 `conflict`. `content_height` is where the content really ends: above `h` it is cut off, below `h` the artboard has empty space (`arrange_artboards` with `h: "fit"` fixes both).

| Tool | Arguments | What it does |
| --- | --- | --- |
| `get_artboard_screenshot` | `artboard_id`, `version?`, `scale?` (0.5, 1, 2), `top?`, `height?`, `annotations?`, `worker?` | A PNG of the artboard as it renders, plus a list of blocked remote loads. A whole artboard taller than 4096 px comes back as an overview of about 4 megapixels; `top` and `height` (CSS px) return just that part, laid out as the whole artboard: read a long page in parts of about 2000 to 4000 px. |
| `list_artboard_versions` | `artboard_id`, `limit?`, `before?` | Every saved version, newest first: number, when, who (a person; a known agent "Claude · for Ana · via Claude Code (…)"; any other client by its own name, "Build bot · for Ana"), size, `current`, `same_as`. |
| `restore_artboard_version` | `artboard_id`, `version`, `base_version` | Brings a version back as a new version (current + 1), attributed to you. 409 on a stale `base_version`; open comments re-anchor. |
| `rename_artboard` | `artboard_id`, `name` | New name (up to 200 characters). HTML and version do not change. |
| `duplicate_artboard` | `artboard_id`, `name?`, `x?`, `y?` | A copy in the same design, at version 1, placed like `create_artboard` but right of its source (`overlaps` with an explicit `x`/`y`). `name` names the copy (default "<name> copy"); name links waiting for that name resolve (`relinked`). Comments are not copied. Returns metadata like `create_artboard`. |
| `arrange_artboards` | `design_id`, `items[]` (`artboard_id`, `x?`, `y?`, `w?`, `h?`), `worker?` | Moves and resizes artboards in one step: all items or none. Needs Edit. HTML and versions stay; attached notes, images and drawings move along. Returns the boxes now, `previous` (pass it back as `items` to undo), `overlaps` it created (warnings) and `bounds`. `h: "fit"` sets the height to the measured content height, taller or shorter, at the item's `w` when it has one. When the renderer cannot measure, it uses the last measured height at that width, or leaves `h`; `fit` says per item which (`measured: now | last | none`). |
| `delete_artboard` | `artboard_id` | Soft delete, with its comment threads. Only when the person asked. |
| `set_status` | `design_id`, `text`, `worker?` | Optional. A short line (at most 80 characters, plain text) that people with the design open see next to your pointer for 60 s; empty `text` clears it, a new call replaces it. At most 3 in a row, then one every 2 s (`too_many`). Returns `status` (fenced) and `expires_at`. |
| `restore_artboard` | `artboard_id` | Undo `delete_artboard`; its comments come back. |

## Videos

A YouTube or Vimeo video on the canvas, beside the work. It loads nothing from YouTube or Vimeo until a person presses Play; it is never part of an artboard's HTML and is not shown on public pages or embeds.

| Tool | Arguments | What it does |
| --- | --- | --- |
| `list_videos` | `design_id`, `artboard_id?` | The design's videos: `id`, `provider`, `title` (fenced), `watch_url`, `start` (seconds, when the link had one), position and size, the attached artboard and who added it. |
| `add_video` | `design_id`, `url`, `artboard_id?`, `side?`, `x?`, `y?`, `w?` | Puts a YouTube or Vimeo link on the canvas (any other link is refused). With `artboard_id` it is placed beside that artboard and attached to it; or give `x`, `y`. 16:9, `w` from 160 to 3840 px. Only when your person asks. |
| `delete_video` | `video_id` | Removes a video; people get it back with Undo. Only one you were asked to remove. |

## Comments

| Tool | Arguments | What it does |
| --- | --- | --- |
| `list_comments` | `design_id?`, `artboard_id?`, `comment_id?`, `status?` (`open`, `resolved`, `all`), `mentions_me?`, `for_agent?`, `team?`, `limit?`, `cursor?` | Threads with replies, newest first, 20 per page (`limit` 1–200); pass `next_cursor` back as `cursor` for the next page (null on the last). `comment_id` (a thread's or a reply's id) reads one thread, any status. Default status `open`. The thread's `url` is its link; empty `mentions` and never-edited fields are left out. Each message has `body` once, as people read it (mentions as `@Name`; `mentions[]` has their ids), and `author`: `{kind, label, user_id, agent}`. |
| `create_comment` | `design_id`, `body`, `artboard_id?`, `element_id?`, `x?`, `y?`, `as_agent?` | Starts a thread on an element, a point or the canvas. `@Name` mentions a person or agent. The result is the thread, in `list_comments`' shape. |
| `reply_comment` | `comment_id`, `body`, `as_agent?` | Replies in a thread. |
| `resolve_comment` | `comment_id` | Marks a thread done. Only after the change and a reply. |
| `reopen_comment` | `comment_id` | Reopens a resolved thread. |
| `pending_mentions` | `limit?`, `team?`, `cwd?`, `as_agent?`, `format?` (`json`, `hook`), `event?` | Open threads where you or your person are @mentioned and not yet answered, oldest first: ids, counts and links, never text. `cwd` applies the directory's mention scope (`set_mention_scope`). `format: "hook"` is for the Claude Code plugin's prompt hook. |
| `set_mention_scope` | `cwd`, `teams?` | Limits mention reminders in one project directory to some of your person's teams (`[]` mutes, `null` or left out: every team, the default). Per person; nauvid stores a hash of the path. Reminders only: tools still reach every team. |

`whoami`, `list_designs` and `get_design` carry `open_mentions` (a count; `get_design` also `here`) when something is waiting; no other result does. See [The review loop](review-loop.md#when-you-are-mentioned).

## Large HTML

Sending 50 KB or more of HTML as one tool argument is where models cut it off or garble numbers. Above about 20 KB, use an upload instead of `html`:

1. `begin_html_upload` → `upload_id`, `upload_url`.
2. Either send the HTML in parts: `append_html_upload {upload_id, part: 0, text}`, then part 1, 2… (up to 32 KB each, joined exactly as sent); or, from a client with a shell, the whole file in one request, without it passing through the model: `curl -sS -X PUT --data-binary @page.html '<upload_url>'` (answers `{bytes, sha256}`).
3. `create_artboard` or `set_artboard_html` with `upload_id` instead of `html`, and `sha256` (`shasum -a 256 page.html`) to make sure nothing was lost: a mismatch saves nothing.

An upload belongs to the person it was opened for, expires after one hour and is used up by the save that takes it. The nauvid server never reads your disk: the file travels in your own request.

## Not available yet

- Search by meaning (semantic search); `search` matches words.
- Moving images by MCP (notes move with `update_sticky`; attached notes and images move with their artboard).
- Uploading images or other files. Embed images as `data:` URLs.
- Inviting people or managing members (create_team makes an empty team; people are invited in Settings → Members).

These are not tools today. Do not tell a person they exist.
