export
Export design elements or canvases as PNG, SVG, PDF, HTML, React, MP4, or MOV files, returning inline data or writing to a specified path for handoff and publishing.
Instructions
Export elements in the specified format and return the data. Raster formats (png, jpeg, webp) return an inline image. SVG returns raw SVG markup as text. HTML returns an HTML/CSS snippet as text. PDF returns base64-encoded data as text. Video formats (mp4, mov) write a file (large binary is never inlined) and return its path; use duration (seconds, max 30) and fps to control length. MOV supports a transparent background; MP4 does not. With motion (mp4/mov) it renders a FILM, Motion/<film>.bm beside the canvas or at the project root: STATE frames tweened by element name, per-frame blueprint patch lines for the procedural rest (knowledge motion/core and motion/grammar, runner tool/motion/render.mjs). "replay" (animated reveal) needs an interactive recording session and is not available headlessly: it returns a clear error. When outputPath is provided, writes to that file path instead and returns a confirmation. In the web editor there is no local filesystem: outputPath is not available (omit it and the data returns inline), and video export (mp4/mov) is not available at all (use png/jpeg/webp/svg/pdf/html, or export from the desktop app). (External MCP clients: call init first for usage docs. Hosted-CLI and sub-agents have docs pre-loaded.)
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "export"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fps | No | Video frames per second (default 30, clamped 1-60). Only used for mp4/mov. | |
| ids | No | Element IDs (or #refs) to export. REQUIRED, except with `motion` (a film names its own canvases) or `pages`. `elementIds` is accepted as an alias. | |
| pages | No | pdf: one page per item, in order: an element id or #ref (the element, a frame exactly its frame) or a canvas path (the whole canvas), on any canvas. Replaces `ids`; the format defaults to pdf. | |
| scale | No | Scale factor for raster export. Defaults to 2.0. Ignored for svg/pdf. Mutually exclusive with width/height. | |
| union | No | png/jpeg/webp: inline elements far apart on the canvas (their union mostly empty space) come back as one close-up per element; true keeps one image of the whole union. | |
| width | No | Target pixel width for raster export. If only width is provided, height is computed to maintain aspect ratio. Mutually exclusive with scale. Ignored for svg/pdf. | |
| format | No | Export format: "png" (default), "jpeg", "webp", "svg", "pdf", "html" (snippet), "htmlDoc" (self-contained document), "htmlFlex" (snippet using semantic flexbox for auto-layout), "react" (JSX snippet pasteable into a .tsx file), or "mp4"/"mov" (video: writes a file, returns its path). | |
| height | No | Target pixel height for raster export. If only height is provided, width is computed to maintain aspect ratio. Mutually exclusive with scale. Ignored for svg/pdf. | |
| motion | No | mp4/mov only: render a FILM through the engine evaluator (knowledge `motion/core`). Pass the film's name, "Launch" (or "Motion/Launch.bm"): `Motion/<film>.bm` in the folder of canvasId or at the project root, written by an edit whose ```bm fence opens with file("Motion/<film>.bm"). Or an object {film: "<name>" | bm: "<text>", patches: [[t, [lines]], ...], tracks: ["<track line>", ...] (a compiled track program the engine evaluates at any t), frames: [a, b], motionBlur: 1..8, frameHashes: true, dumpFrames: {dir, frames}}. A film's states live on the canvases its canvases[...] line names. `fps` defaults to the film's header. | |
| fitMode | No | How to fit content when both width and height are specified: "fit" (letterbox, default), "fill" (crop), "stretch" (ignore aspect ratio). | |
| project | No | Optional: run THIS call against a project other than the session's bound one: a name or key from list_projects (or an unambiguous name/handle substring), or the absolute path of a project folder (one holding .bl files, or an empty one), which opens in the background and is added to list_projects. Unknown/ambiguous is refused with candidates. | |
| canvasId | No | Canvas ID to export from. REQUIRED, except with `pages` (each item names its canvas) and when every id or #ref lives on one canvas (that canvas is read). | |
| duration | No | Video duration in seconds (default 3, max 30). Only used for mp4/mov. | |
| sessionId | No | Session ID for per-session visual feedback. Optional. | |
| background | No | Background type: "clear" for transparent, "window" for window color. Defaults to "clear". Ignored for svg/pdf. | |
| htmlImages | No | HTML/React only. Pictures are resampled to the size they are drawn at (1x and 2x, an image-set) and deduped. "files" (the default with outputPath) writes them under images/ beside the markup; "inline" embeds data URIs (always the case without outputPath). | |
| outputPath | No | File path to write the exported data to. When provided, writes the file and returns a confirmation instead of inline data. A relative path is written under the project's Exports/ folder; a path ending in / names a folder. Works with all formats. | |
| jpegQuality | No | JPEG quality 0-100. Defaults to 90. Only used when format is "jpeg". | |
| webpQuality | No | WebP quality 0-100. Defaults to 90. Only used when format is "webp" and webpLossless is false. | |
| videoQuality | No | mp4/mov: "low", "medium" or "high" (default high), the encoder bits per pixel per frame 0.04, 0.08 or 0.16 (VideoBitrate: 5, 10 or 20 Mbps at 1080p60, bounded 1 to 120 Mbps): a 29 s 1440x1440x60 clip asks about 20 Mbps at high, about 72 MB, half at medium, a quarter at low. The answer names the applied bitrate. | |
| webpLossless | No | When true, uses WebP lossless encoding (quality is ignored). Defaults to false. Only used when format is "webp". | |
| videoMaxBytes | No | mp4/mov: a size target in bytes (a 16 MB cap is 16000000). The encoder takes the bitrate that fits it over the clip when that is under the quality's ask, so one export lands under it, no second pass. Subtract the audio you will mux yourself. The answer names the applied bitrate and notes an overshoot. | |
| htmlKeepInvisible | No | HTML/React only, for films: an element at opacity 0 is kept as markup at opacity 0 (it fades or cuts in later) instead of being dropped. Default false. |