Skip to main content
Glama

Publish an interactive artifact

publish_artifact
Destructive

Publish a self-contained interactive HTML page, React artifact or Cursor canvas into a Folio wiki, where it joins the page tree; send an id to replace an existing artifact's content.

Instructions

Publishes an interactive page (kind "artifact") into Folio: a Claude artifact, a Cursor canvas or any self-contained HTML page. It is shown in a sandboxed iframe and is in the tree, search, trash and Git like any page. Without id it creates a new artifact under parentPath of space; with id it replaces that artifact's content (id, path, properties and title/icon are kept unless sent).

How to send it: ONE self-contained HTML document in html (the entry page). It must run with no build step and no server: inline your CSS, JS and DATA (no fetch of your own APIs — the frame's CSP blocks other hosts). Scripts, styles and fonts may load only from cdnjs.cloudflare.com, cdn.jsdelivr.net, unpkg.com, cdn.tailwindcss.com, code.jquery.com, esm.sh (and Google Fonts).

A React artifact or a Cursor canvas (.canvas.tsx): build a standalone page that loads React from the CDN — e.g. + react-dom + @babel/standalone with holding the component, or importing from https://esm.sh/react@18 — map imports of libraries (recharts, lucide-react, d3, three…) to CDN/esm.sh URLs, replace cursor/canvas or shadcn components with plain HTML/CSS, and mount the component. Put the original JSX/TSX in sourceCode (kept as the source file; type react or canvas-tsx).

State: window.storage (the Claude artifact API: get/set/delete/list, async, string values, shared = seen by every reader) and localStorage both work and persist per reader; window.claude.complete does not (it rejects). Declare capabilities (claude, network, connectors) if the page needs more than storage — Folio shows a "works partially" note.

Also accepted instead of html: text with type svg / markdown / mermaid (Folio wraps it into a page), files (extra files next to the entry, utf8 or base64, referenced by relative path), url (a direct https link to an .html/.zip/.svg/.md file; claude.ai and Cursor share links are refused — send the HTML instead), embedCode (a Claude "Get embed code" ). Set sourceUrl to the original link (e.g. the claude.ai share URL) and origin (claude / cursor / other) when you know them. properties become page properties. Requires an editor role and a write-scoped token.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "space": "<space>"
    },
    "name": "publish_artifact"
  }
}

Input Schema

NameRequiredDescriptionDefault
idNoReplace this artifact (its page id); omit to create a new one
urlNoImport from a direct https link to an .html / .zip / .svg / .md file instead of html
htmlNoThe entry page: one complete, self-contained HTML document
iconNoEmoji icon
textNoRaw svg / markdown / mermaid text (with type svg / markdown / mermaid) instead of html
typeNoWhat the source was: html (default), react, svg, markdown, mermaid, canvas-tsx, embed
entryNoEntry file inside the artifact when it is not index.html
filesNoExtra files of the artifact, referenced from the entry by relative path
spaceYesSpace slug
titleNoPage title (new artifact: default the HTML <title>)
originNoWhere it came from: claude, cursor, url, upload or other
embedCodeNoA Claude embed code (<iframe src=...>) — creates an embed artifact
sourceUrlNoLink to the original (e.g. the claude.ai share URL) — stored, never fetched
parentPathNoNew artifact only: folder from the space root ("" = root), e.g. "reports"
propertiesNoPage properties (status, owner, tags, …)
sourceCodeNoThe original JSX/TSX (or other source) of a React artifact / Cursor canvas, kept verbatim
capabilitiesNoWhat the page needs from its host besides storage: claude, network, connectors
sourceFileNameNoFile name for sourceCode (default source.jsx, or source.canvas.tsx for type canvas-tsx)

Output Schema

NameRequiredDescriptionDefault
idYesPage id of the artifact
urlYesLink to the page in Folio
pathYesPath of the artifact folder (<slug>.artifact) relative to the space root
spaceYes
titleYesPage title
createdYesTrue when a new artifact was created, false when an existing one was replaced
warningsYesNon-fatal notes (e.g. a capability Folio does not provide)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.5/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Goes well past annotations: explains that replace-mode keeps id/path/properties/title/icon, discloses the sandboxed iframe and CSP host allowlist, that `window.claude.complete` rejects while `window.storage`/localStorage persist per reader, and that a capability gap produces a 'works partially' note. The destructiveHint=true annotation is corroborated by the stated content-replacement semantics.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with purpose and the create-vs-replace rule, then organized into how-to-send, React specifics, state, alternatives and permissions. It is long, and the inline CDN list plus example <script> tags are dense, but nearly every line carries constraint information an agent cannot get from the schema.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For an 18-parameter, nested-schema mutation tool this is close to complete: input forms, CSP restrictions, runtime API availability, auth requirements, and refusal rules are all covered, and an output schema means return values need not be described.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3; the description still adds cross-parameter meaning the schema does not, such as `parentPath` applying only to new artifacts, `sourceCode` being preserved as the source file with type react/canvas-tsx, `sourceUrl` being stored but never fetched, and `capabilities` having a visible UI consequence. Remaining parameters are left to their schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Publishes an interactive page (kind "artifact") into Folio') and names the accepted input flavours (artifact, Cursor canvas, self-contained HTML). It also spells out the two operating modes (create without `id`, replace with `id`), which lets an agent distinguish this from generic `create_page`. It never names a sibling tool, so differentiation is by description rather than by explicit routing.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly covers when to omit vs. supply `id`, when to use `text`/`files`/`url`/`embedCode` instead of `html`, and states exclusions plainly ('claude.ai and Cursor share links are refused — send the HTML instead'). Requires-when clauses (editor role, write-scoped token) are given up front.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.