Controlling the App
While the desktop app is running, the CLI drives it over the same automation bridge as the MCP server. Every command on this page except headless tool call needs the running app.
Documents
Each open tab is a document with a stable ID. List them, then pass --document-id (and --page-id) to aim a command at a background tab without switching to it:
pairdraw documents list --json
pairdraw tree --document-id tab-123 --page-id 0:1Open, create, save, and close documents:
pairdraw documents open designs/landing.fig # opens in a new tab
pairdraw documents new --path designs/draft.fig # empty document, saved to the path
pairdraw documents save # the document this session targets, or the one in front
pairdraw documents save --document-id tab-123
pairdraw documents save --document-id tab-123 --path designs/copy.fig
pairdraw documents close --document-id tab-123
pairdraw documents close --document-id tab-123 --save # or --discardRelative paths resolve against the shell's working directory. These commands never open a dialog in the app, because nobody may be there to answer it. save without --document-id saves the document this CLI session is targeting, or the document in front. close without --document-id closes only a document this session opened. Closing a document with unsaved changes fails unless you pass --save or --discard, and saving a document that has never been saved needs --path. Each command prints the document and page it acted on; with --json it prints { "result", "target" }, so a script can read the new document's ID from target.documentId. Set PAIRDRAW_SESSION to keep two CLI agents apart; without it, every command shares the cli session.
To bring a tab to the front, optionally on a specific page:
pairdraw documents activate tab-123 --page-id 0:4Undo and redo
Step back through changes made through the CLI and MCP, like Edit → Undo and Edit → Redo:
pairdraw undo --document-id tab-123
pairdraw redo --document-id tab-123 --json{
"result": { "applied": true, "label": "Set opacity", "scope": "document" },
"target": { "documentId": "tab-123", "documentName": "Landing", "pageId": "0:1", "pageName": "Page 1" }
}When there is nothing to undo or redo, the command says so and result.applied is false.
The editor has one history, shared by you and every automation client, so Edit → Undo in the app steps back through any change, newest first. Automation is narrower: undo and redo only act on a step that the CLI or MCP made, and only while it is the newest one. If the newest change was made in the editor, the command fails and leaves it alone, so an agent can't revert your work. They also fail while the document is in vector edit mode, whose history belongs to the editing session.
Each CLI or MCP command that edits the document is one undo step. An eval script is recorded against its target page: if it switches figma.currentPage and edits another page, those edits are not part of the undo step.
Settings
Read and change editor settings by dotted key:
pairdraw settings get
pairdraw settings get appearance.theme
pairdraw settings set appearance.theme light
pairdraw settings set editing.snapping.pixelGrid false
pairdraw settings set chat.maxAgentSteps 100Values are read as JSON when they parse (false, 100, "auto") and as plain strings otherwise. Invalid keys and values are rejected without changing anything.
| Key | Values |
|---|---|
appearance.theme | dark, light, auto |
appearance.language | en, de, es, fr, id, it, ja, pl, ru, zh-CN |
appearance.animations | system, off |
appearance.accent | JSON object: {"kind":"preset","preset":"green"} with pairdraw (the default), blue, purple, pink, red, orange, yellow, green, graphite, or {"kind":"custom","color":"#FF6600"} |
editing.snapping.geometry | true, false |
editing.snapping.objects | true, false |
editing.snapping.pixelGrid | true, false |
rendering.canvasMode | retained, tiled (applies after a reload) |
recovery.enabled | true, false |
chat.reasoningDisplay | collapsed, while-thinking, expanded |
chat.maxAgentSteps | integer 1–1000 |
chat.changePreviewSize | off, small, medium, large |
designCheck.preset | recommended, strict, accessibility |
designCheck.disabledRules | JSON array of rule IDs, e.g. ["no-default-names"]; see pairdraw lint --list-rules |
Credentials, AI models, MCP connections, storage, and tool access are deliberately not available here: an automation client can't read secrets or grant itself access.
Calling tools
Every editor tool the MCP server exposes is also available from the CLI. List them, inspect a tool's arguments as JSON Schema, and call it with a JSON object:
pairdraw tool list
pairdraw tool describe set_fill
pairdraw tool call set_fill --args '{"id":"0:5","color":"#2563eb"}'
pairdraw tool call set_fill --document-id tab-123 --args-file fill.json
echo '{"name":"Icons"}' | pairdraw tool call create_page --args-file -Pass a file to run a tool headlessly instead. Changes to a file are kept only with --write (back to the input) or --output:
pairdraw tool call create_page design.fig --args '{"name":"Icons"}' --write
pairdraw tool call get_page_tree design.fig --jsonFor multi-step edits, eval runs a whole script against the same Figma-compatible API, and shell runs tools one line at a time.
Pass --preview-output to write a PNG of the current page after a tool changes the document. The preview is drawn by export_image, headless or in the app. --preview-scale sets its scale, from 0.1 to 4, and the longest edge stays within 1280 pixels:
pairdraw tool call create_shape design.fig --args '{"type":"RECTANGLE","x":0,"y":0,"width":120,"height":80}' \
--write --preview-output preview.pngA tool that only reads, or one that returns an error, writes no preview. If the page has nothing visible, or the renderer cannot draw it, the command warns and keeps the change.
Interactive shell
shell opens a document once and keeps it loaded while you run tools on it, one per line. Each tool sees the changes the previous ones made, and nothing is written until you call save():
pairdraw shell design.fig --preview-output preview.pngdesign.fig> create_page {"name": "Icons"}
design.fig> switch_page({"page": "Icons"})
design.fig> create_shape {"type": "ELLIPSE", "x": 0, "y": 0, "width": 48, "height": 48}
design.fig> save()
design.fig> exit()| Line | Effect |
|---|---|
<tool>, <tool> {...}, <tool>({...}) | Run a tool from tool list with a JSON object of arguments |
tools() | List the tools |
help(), help("<tool>") | Show the shell commands, or a tool's description |
save(), save("copy.fig") | Save as .fig to the input file, the --output path, or the given path |
preview(), preview("page.png") | Write a PNG of the current page now |
exit() | Leave the shell |
Tab completes tool names. A failing line prints its error and the shell carries on. Ctrl+C clears a half-typed line; on an empty line, Ctrl+C and Ctrl+D leave as exit() does. With unsaved changes, leaving asks you to save first, and a second exit(), Ctrl+C or Ctrl+D discards them. save() writes .fig only, so a .pen or .html input needs a .fig path, either --output or save("name.fig").
When standard input is not a terminal, the shell reads one line at a time from it and exits at the end of the input or at exit(). The command exits with status 1 if any line failed:
printf '%s\n' 'create_page {"name": "Icons"}' 'save()' | pairdraw shell design.fig -o out.figWithout a file, shell sends each line to the document this CLI session is targeting, or to the one --document-id names. There, save() saves that document like documents save.
AI models
models lists the AI providers the chat can use and the models each one offers, with its default model. ACP agents such as Claude Code and Codex are listed too; they run their own models.
pairdraw models
pairdraw models --provider openrouter
pairdraw models --json