Create nodes
create_nodesCreates one or more Figma node trees in a single undo step and returns their new IDs, so you can build nested frames, text, components, and images in one call.
Instructions
Create one or more node trees in one call (one undo step). Returns the new ids. NODE SPEC: {type, ...PROPS, children?: [NODE SPEC]}. type: FRAME (default) | RECTANGLE | ELLIPSE | LINE | POLYGON | STAR | TEXT | COMPONENT | SECTION | GROUP (needs children) | SVG (svg: "<svg…>" or svgPath) | IMAGE (rectangle with an image fill: imagePath | imageUrl | imageBase64, scaleMode; natural size when width/height omitted) | INSTANCE (componentId of a COMPONENT/COMPONENT_SET, or componentKey of a library component) | PAGE (top level only). Nested frames get no fill unless fills are given (top-level frames: white). Auto-layout frames hug their content on axes without width/height; plain frames without size grow to fit their children. TEXT: width without height → fixed width, wrapping. Top-level nodes without x/y are placed to the right of existing content. Example: {"type":"FRAME","name":"Card","layoutMode":"VERTICAL","padding":24,"itemSpacing":12,"cornerRadius":16,"fills":["#FFFFFF"],"effects":[{"type":"DROP_SHADOW","color":"#0000001A","offset":{"x":0,"y":4},"radius":16}],"children":[{"type":"TEXT","characters":"Title","fontFamily":"Inter","fontWeight":700,"fontSize":24},{"type":"TEXT","characters":"Body","fontSize":14,"fills":["#666666"],"layoutSizingHorizontal":"FILL"}]}
PROPS (all optional):
Geometry: name, x, y, width, height, rotation, opacity, visible, locked, constraints, blendMode.
fills / strokes: array of "#RRGGBB" | "#RRGGBBAA" | "rgba(r,g,b,a)" | {type:"SOLID", color, opacity?, variable?} | {type:"GRADIENT_LINEAR"|"GRADIENT_RADIAL"|"GRADIENT_ANGULAR"|"GRADIENT_DIAMOND", stops:[{color, position}] or ["#hex", ...], angle? (linear only, degrees: 0 = left→right, 90 = top→bottom)} | {type:"IMAGE", imagePath (local file) | imageUrl | imageBase64, scaleMode?: "FILL"|"FIT"|"CROP"|"TILE"}. [] removes all. Shorthand: fill / stroke = single paint.
strokeWeight, strokeAlign ("INSIDE"|"OUTSIDE"|"CENTER"), dashPattern, cornerRadius (number or [tl,tr,br,bl]).
effects: [{type:"DROP_SHADOW"|"INNER_SHADOW", color, offset:{x,y}, radius, spread?} | {type:"LAYER_BLUR"|"BACKGROUND_BLUR", radius}].
Auto layout (FRAME/COMPONENT): layoutMode ("HORIZONTAL"|"VERTICAL"|"GRID"|"NONE"), itemSpacing, padding (number | [vertical, horizontal] | [top,right,bottom,left] | {top,right,bottom,left}), primaryAxisAlignItems ("MIN"|"CENTER"|"MAX"|"SPACE_BETWEEN"), counterAxisAlignItems ("MIN"|"CENTER"|"MAX"|"BASELINE"), layoutWrap ("WRAP"|"NO_WRAP"), counterAxisSpacing, clipsContent.
Inside an auto-layout parent: layoutSizingHorizontal / layoutSizingVertical ("FIXED"|"HUG"|"FILL"), layoutPositioning ("ABSOLUTE"), layoutGrow.
TEXT: characters, fontFamily, fontStyle ("Bold", "Medium Italic"…), fontWeight (100-900), fontSize, lineHeight (px | "150%" | "auto"), letterSpacing (px | "2%"), textAlignHorizontal ("LEFT"|"CENTER"|"RIGHT"|"JUSTIFIED"), textAlignVertical, textAutoResize ("WIDTH_AND_HEIGHT"|"HEIGHT"|"NONE"|"TRUNCATE"), textCase, textDecoration, paragraphSpacing, hyperlink (url). Fonts are loaded automatically. Partial styling: rangeStyles [{text: "substring" | start, end, fontFamily?, fontStyle?, fontWeight?, fontSize?, fills?, textDecoration?, textCase?, letterSpacing?, lineHeight?, hyperlink?, textStyleId?, fillStyleId?}] (applied after characters).
Styles: fillStyleId / strokeStyleId / effectStyleId / textStyleId / gridStyleId — style id or exact local style name.
Variables: boundVariables {field: variableId | variable name | null}, fields e.g. fills, strokes, width, height, itemSpacing, paddingLeft, cornerRadius, opacity, characters.
INSTANCE: componentProperties {propName: value} (names without the #id suffix are fine), swapComponentId.
Any other writable Plugin API property is assigned as-is; problems are reported in "warnings" instead of failing the whole call.
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": {
"nodes": "<nodes>"
},
"name": "create_nodes"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodes | Yes | NODE SPECs | |
| select | No | Select the created top-level nodes and zoom to them | |
| parentId | No | Parent (frame, group, section, component, page). Default: current page |