build_tree
Build entire Figma node trees in a single call from structured specs, including auto-layout, fills, text, effects, and instances, to avoid creating nodes one by one.
Instructions
Build a complete node tree in ONE call. Far faster and more precise than creating nodes one by one. Node spec: { type: FRAME|COMPONENT|TEXT|RECT|ELLIPSE|LINE|INSTANCE|SVG, name, x, y, w, h, children: [...] }
Auto-layout: layout: { mode: HORIZONTAL|VERTICAL, gap, pad: n|[v,h]|[t,r,b,l], primary: MIN|CENTER|MAX|SPACE_BETWEEN, counter, wrap, crossGap }
Sizing: sizeH / sizeV: FIXED|HUG|FILL, grow, minW, maxW, minH, maxH, absolute (absolute position inside auto-layout)
Paint: fills: ["#hex" | {color, opacity} | {type: GRADIENT_LINEAR, angle, stops:[{pos,color,opacity}]} | {type: GRADIENT_RADIAL, cx, cy, rx, ry, stops}], fillStyle: "Style/Name", fillVar: "variable/name"
Strokes: strokes, strokeWeight, strokeAlign: INSIDE|CENTER|OUTSIDE, dash: [4,2]; radius: n|[tl,tr,br,bl] (corner smoothing 60% by default), smoothing
Effects: effects: [{type: DROP_SHADOW|INNER_SHADOW, color, opacity, x, y, blur, spread} | {type: LAYER_BLUR|BACKGROUND_BLUR, radius}], effectStyle
Text: text: { chars, style: "Text/Style" OR font: "Any Family", weight: "Regular|Medium|SemiBold|Bold|Light", size, lineHeight (px number or "120%"), letterSpacing (%), textCase, align, decoration, color, ranges: [{match, color, font, weight, underline}] }, autoResize
Other: opacity, blend, rotation, clip, mask, constraints, grids: [{pattern: COLUMNS|ROWS|GRID, count, gutter, offset, alignment, size, color, opacity}], exports: [{format, scale}], description (components)
INSTANCE: { type: INSTANCE, componentId }. SVG: { type: SVG, svg: "<svg…>", svgColor } The root is built hidden and shown when finished. Returns root id, size and (with returnIds) a name→id map.
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": "build_tree"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tree | No | Root node spec (see description) | |
| pageId | No | Page id to build on (switches to it) | |
| parentId | No | Parent node id (frame/section/component) | |
| returnIds | No | Return a map of layer name → node id |