Skip to main content
Glama
figma-mcp-v2

figma-mcp-v2

by LukasAnda

Build a layout tree

figma_build_layout

Builds a complete nested Figma layer tree—screens, auto-layout stacks, text, shapes, components, and instances—in one call, returning node IDs, warnings, and an optional PNG preview.

Instructions

Builds a whole nested layer tree in one call: screens, auto-layout stacks, text, shapes, SVG icons, components, variants and instances. Prefer this over many figma_create_node calls. Returns ids (by "ref"), warnings for anything Figma rejected, and optionally a PNG of the result to check it.

Node spec (all fields optional except where noted):

  • type: frame (default) | text (default when "text" is set) | rect | ellipse | line | svg (needs "svg") | instance | component | componentSet (children become variants, named "Prop=Value")

  • name, ref (id handle for later nodes and the result), children: [...]

  • Layout: layout "row"|"column"|"none", gap (number or "auto" = space-between), padding (n | [y,x] | [t,r,b,l]), align (main axis: start|center|end|between), cross (start|center|end|baseline), wrap

  • Size: width/height = number | "fill" | "hug" (auto-layout frames hug by default), minWidth, maxWidth, grow

  • Position: x, y (in non-auto-layout parents), position "absolute" inside auto layout

  • Look: fill, stroke, strokeWidth (n or {top,right,bottom,left}), strokeAlign inside|center|outside, dash, radius (n | [tl,tr,br,bl]), smoothing (0-1), opacity, clip, shadow {x,y,blur,spread,color,inset} or [..], blur, backgroundBlur, visible, rotation. Colors: "#RRGGBB(AA)" or "rgba()".

  • Text: text, font "Family/Style" (e.g. "Inter/Semi Bold"; styles matched loosely), weight 400-900, size, lineHeight (px | "140%" | "auto"), letterSpacing (px | "-2%"), color, textAlign, decoration underline|strikethrough, textCase, maxLines, ranges [{start,end,color,weight,size,decoration}]. width "fill" or a number makes it wrap.

  • svg: svgColor recolors all its paths.

  • Tokens: bind {fill|color|stroke|gap|padding|paddingX|paddingY|radius|width|height|opacity|: "variable name"}, textStyle / fillStyle / effectStyle: "style name"

  • Components: componentProps [{name, type TEXT|BOOLEAN|INSTANCE_SWAP, default, layer: "layer name"}] wires a property to a layer; description

  • Instances: componentRef (a ref built earlier in this call) | componentId | componentKey, variant {Prop: "Value"}, properties {Name: value}, overrides {"Layer name": "new text" | {text, color, fill, visible, ...}}

  • props: raw Plugin API properties applied last.

  • Pinning: anchor {left, right, top, bottom, centerX, above: "sibling name"} positions the node against its parent's edges after the whole tree is laid out (absolute inside auto layout, constraints set), e.g. a floating button {right: 16, bottom: 16, above: "Navigation bar"} or a sheet {left: 0, bottom: 0}.

  • Handoff: annotation "text" | {label, category, color, properties: ["padding","itemSpacing",...]} | [..] adds native Figma annotations (shown in Dev Mode); devStatus "READY_FOR_DEV" | "COMPLETED" | {type, description} on top-level frames or sections.

  • Presentation: type "section" (children positioned by x/y; the section fits around them with "padding", default 120; "fill" for its background). type "arrow" {from, to (refs or ids), fromSide?, toSide?: "top", color, strokeWidth, dash, gap} draws an orthogonal connector with an arrowhead once everything is placed, for flows between screens.

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": "figma_build_layout"
  }
}

Input Schema

NameRequiredDescriptionDefault
xNoLeft of the first top-level node; by default it goes right of existing content
yNo
gapNoHorizontal gap between top-level nodes (default 120)
urlNoFigma link (or file key) of the file to edit. Needed only when the plugin is open in more than one file.
treeYesRoot node spec, or an array of them (e.g. several screens placed side by side).
page_idNoSwitch to this page first (parent defaults to it)
parent_idNoParent frame/group/page id; defaults to the current page
collectionNoVariable collection that "bind" names resolve in when several collections share names (e.g. light and dark). "name@Collection" in a bind overrides it.
screenshotNoReturn a PNG of the built roots to check the result
outline_depthNoDepth of the returned layer outline
screenshot_scaleNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.1

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare the mutation profile (readOnlyHint=false, idempotentHint=false, destructiveHint=false), so the description's job is to add context beyond that. It does: it discloses the return contract (ids keyed by "ref", warnings for anything Figma rejected, optional PNG), which implies partial application rather than atomic failure — useful for a batch builder. It never states that repeated calls will duplicate content, which is the main behavioral risk implied by idempotentHint=false.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose and the sibling preference are front-loaded in the first two sentences, then the DSL reference is grouped into labeled bullets (Layout, Size, Position, Look, Text, Tokens, Components, Instances, Pinning, Handoff, Presentation), which makes a long description scannable. It is dense rather than padded, though a few entries (e.g. the smoothing range, dash) are marginal for an agent choosing or invoking the tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For an 11-parameter tree-builder with no output schema, the description covers both halves of the contract: the full nested node grammar and what comes back (ref-keyed ids, rejection warnings, screenshot). Placement semantics for the root (`x`, `y`, `gap`, `parent_id`, `page_id`, `collection` interplay with `bind`) are addressed sufficiently that an agent can construct a correct call without guessing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 82%, so the top-level parameters are already documented, but the required `tree` parameter is a bare untyped object with additionalProperties — the schema conveys essentially nothing about its shape. The description supplies the entire node-spec grammar (type options, layout, size, position, look, text, tokens, components, instances, pinning, handoff, presentation), which is meaning that exists nowhere else.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The first sentence names a specific verb and resource ("Builds a whole nested layer tree in one call") and enumerates exactly what kinds of layers can be produced (screens, auto-layout stacks, text, shapes, SVG, components, variants, instances). It also names the sibling it replaces, so an agent can distinguish it from figma_create_node without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

"Prefer this over many figma_create_node calls" gives an explicit routing rule with a named alternative, which is stronger than most definitions. It stops short of saying when a single figma_create_node call is still appropriate (or when to use figma_create_from_svg / figma_create_instance instead), so the exclusion side is only implied.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.