figma_build
Creates or updates a declarative, keyed UI tree in one transaction after validating the spec, returning a dry-run plan so re-sent builds patch existing nodes instead of duplicating them.
Instructions
Create or update a declarative, keyed UI tree in ONE transaction. The spec is validated and resolved (fonts, styles, local variables, components) before anything is written; every node gets a stable key in pluginData, so re-sending the same buildId updates instead of duplicating. dryRun defaults to TRUE and returns a real plan plus a scope fingerprint. Pass dryRun:false with that fingerprint to apply. An existing root with the same buildId is patched in place; prune:true makes the tree exact by deleting keyed children the spec no longer contains. An SVG leaf is created as a frame; re-sending it updates that frame in place, and a changed svg source replaces its interior while keeping the id and key. A BOOLEAN_OPERATION is created from at least two operands in spec order (first operand is the subtract/intersect base) and can change its operation in place; its size is derived from the operands and is ignored. A PATTERN paint resolves its file-local source node id before writing and is refused when that node is missing. A SHADER paint must resolve to an available fill shader; an unimported shader is imported inside the write transaction. Refuses type changes, ambiguous component names, unknown keys, position inside auto-layout, component swaps, and unsupported node types.
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": {
"root": "<root>"
},
"name": "figma_build"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | upsert: create or update by buildId; create: refuse if it exists | upsert |
| root | Yes | The tree. FRAME, COMPONENT and BOOLEAN_OPERATION may have children; an INSTANCE uses properties/overrides. | |
| prune | No | Delete keyed children not present in the spec, at every level. Protected nodes are skipped and reported. | |
| dryRun | No | TRUE (default): plan and validate only. FALSE: apply in one undo transaction. | |
| planId | No | The planId returned by figma_build; if supplied on apply, a different spec is refused before it is sent. | |
| buildId | No | Stable build scope. Defaults to root.key. Re-send the same id to update the same root. | |
| fileKey | No | Which connected Figma file to use: its fileKey (figma_whoami) or, when omitted, the only connected file. Required once more than one file is connected; figma_ping lists them. | |
| parentId | No | Container for a new root; defaults to the current page | |
| expectedFingerprint | No | Scope fingerprint from a previous dry run. Apply refuses if the document has moved since. |