build_tree
Create an entire Figma node tree (frames, rectangles, text) under a parent in one atomic call; if any step fails, all created nodes are rolled back.
Instructions
Build a whole tree of nodes (frames, rectangles, texts) in ONE call, under a given parent. All or nothing: if any step fails, everything created by this call is deleted. Returns the created IDs. Data only, no code. tree is one node object: { type: "FRAME"|"RECTANGLE"|"TEXT", name?, x?, y?, width?, height?, fill?{r,g,b,a? in 0..1}, stroke?, strokeWeight?, cornerRadius?, layoutSizingHorizontal?/layoutSizingVertical? ("FIXED"|"HUG"|"FILL"), bindings?[{property:"FILL"|"STROKE"|"CORNER_RADIUS"|"PADDING"|"PADDING_TOP"|"PADDING_BOTTOM"|"PADDING_LEFT"|"PADDING_RIGHT"|"ITEM_SPACING"|"WIDTH"|"HEIGHT", variable:}], explicitModes?[{collection, mode}], strokeAlign? ("INSIDE"|"OUTSIDE"|"CENTER"), cornerRadii? {topLeft,topRight,bottomRight,bottomLeft}, noFill? (remove all fills), layoutPositioning? ("ABSOLUTE" inside an auto-layout parent, with x, y, width, height, constraintH/constraintV "MIN"|"MAX"|"CENTER"|"STRETCH"|"SCALE"); binding properties also CORNER_TOP_LEFT, CORNER_TOP_RIGHT, CORNER_BOTTOM_LEFT, CORNER_BOTTOM_RIGHT }. Also on any node: props {same keys as set_node_properties}, fieldBindings [{field, variable}] (same fields as bind_variable_field), effects [same shape as set_effects]. Types ELLIPSE (like RECTANGLE) and INSTANCE (componentId of a local COMPONENT, properties {name: value} as in set_instance_properties). FRAME also takes asComponent (true: turn the built frame into a COMPONENT once its children exist; the returned id is the component's). FRAME also takes layoutMode ("NONE"|"HORIZONTAL"|"VERTICAL"), layoutWrap, paddingTop/Right/Bottom/Left, itemSpacing, primaryAxisAlignItems, counterAxisAlignItems and children[] (same node shape, max depth 12, max 500 nodes in total). TEXT takes text (required), fontSize, fontWeight (100..900), textStyle (text style name or ID). Colors set on an element should be bound to variables with bindings rather than left as raw RGB. A property you do not give keeps Figma's own default (no invented padding, spacing, alignment, font size or color). A frame with auto layout and an explicit width or height keeps that size fixed.
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": {
"tree": "<tree>"
},
"name": "build_tree"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tree | Yes | The root node of the tree to build (see the tool description for the shape) | |
| parentId | No | ID of the parent node (frame or section). Defaults to the current page. |