Layerbridge
v0.3.0Read, edit and export the Figma file open in a local plugin.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
get_local_components
List the file's own components and component sets with id, key, description, page and property definitions. Scans every page unless pageId is given.
| Parameter | Type | Description |
|---|---|---|
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
includeVariants | boolean | Also list each variant inside a set (default false) |
pageId | string | Only this page (faster on big files) |
create_component
Turn an existing layer into a main component.
| Parameter | Type | Description |
|---|---|---|
nodeId * | string | Figma node ID, e.g. '4029:12345' |
description | string | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
name | string |
combine_as_variants
Combine two or more components into a component set (variants).
| Parameter | Type | Description |
|---|---|---|
nodeIds * | array | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
name | string | |
parentId | Figma node ID, e.g. '4029:12345' |
create_instance
Place an instance of a local component (componentId) or a published library component (componentKey).
| Parameter | Type | Description |
|---|---|---|
componentId | string | Figma node ID, e.g. '4029:12345' |
componentKey | string | Key of a published library component |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
parentId | Figma node ID, e.g. '4029:12345' | |
x | number | |
y | number |
swap_component
Swap an instance to another component, keeping overrides where Figma can.
| Parameter | Type | Description |
|---|---|---|
nodeId * | string | Figma node ID, e.g. '4029:12345' |
componentId | Figma node ID, e.g. '4029:12345' | |
componentKey | string | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
detach_instance
Detach instances into plain frames.
| Parameter | Type | Description |
|---|---|---|
nodeIds * | array | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
set_instance_properties
Set an instance's component properties (variant values, boolean toggles, text, instance swaps). Keys can be plain names ('Label') or Figma's suffixed keys ('Label#12:0').
| Parameter | Type | Description |
|---|---|---|
nodeId * | string | Figma node ID, e.g. '4029:12345' |
properties * | object | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
add_component_property
Add a component property to a component or component set.
| Parameter | Type | Description |
|---|---|---|
defaultValue * | string | boolean | |
name * | string | |
nodeId * | string | Figma node ID, e.g. '4029:12345' |
propertyType * | string | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
create_paint_style
Create a local colour style from one hex colour or a stack of solid paints.
| Parameter | Type | Description |
|---|---|---|
name * | string | |
description | string | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
hex | string | |
opacity | number | |
paints | array |
create_text_style
Create a local text style. The font must be available to Figma.
| Parameter | Type | Description |
|---|---|---|
fontFamily * | string | |
fontSize * | number | |
name * | string | |
description | string | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
fontStyle | string | e.g. Regular, Medium, Bold (default Regular) |
letterSpacing | number | Pixels |
lineHeight | number | Pixels |
create_effect_style
Create a local effect style (shadows / blurs). Shadow colours may be hex.
| Parameter | Type | Description |
|---|---|---|
effects * | array | |
name * | string | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
create_grid_style
Create a local layout-grid style using Figma's LayoutGrid objects.
| Parameter | Type | Description |
|---|---|---|
layoutGrids * | array | |
name * | string | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
update_style
Update a local style's name, description, colour, type settings, effects or grids.
| Parameter | Type | Description |
|---|---|---|
styleId * | string | |
description | string | |
effects | array | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
fontFamily | string | |
fontSize | number | |
fontStyle | string | |
hex | string | |
layoutGrids | array | |
letterSpacing | number | |
lineHeight | number | |
name | string | |
opacity | number |
delete_style
Delete a local style. Requires confirm: true.
| Parameter | Type | Description |
|---|---|---|
confirm * | boolean | Must be true — this cannot be undone from here |
styleId * | string | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
apply_style
Apply a style to a layer as its fill, stroke, text, effect or grid style.
| Parameter | Type | Description |
|---|---|---|
nodeId * | string | Figma node ID, e.g. '4029:12345' |
styleId * | string | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
target | string |
create_variable_collection
Create a local variable collection.
| Parameter | Type | Description |
|---|---|---|
name * | string | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
add_variable_mode
Add a mode (e.g. Dark) to a variable collection.
| Parameter | Type | Description |
|---|---|---|
collectionId * | string | |
name * | string | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
rename_variable_mode
Rename a mode in a variable collection.
| Parameter | Type | Description |
|---|---|---|
collectionId * | string | |
modeId * | string | |
name * | string | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
create_variable
Create a variable in a collection, optionally with values per mode. Values: hex for COLOR, number for FLOAT, boolean, string, or { alias: variableId }. Modes may be named by id or name.
| Parameter | Type | Description |
|---|---|---|
collectionId * | string | |
name * | string | |
variableType * | string | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
values | object |
set_variable_value
Set a variable's value for one mode (mode id or name).
| Parameter | Type | Description |
|---|---|---|
modeId * | string | |
variableId * | string | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
value |
delete_variable
Delete a variable. Requires confirm: true.
| Parameter | Type | Description |
|---|---|---|
confirm * | boolean | Must be true — this cannot be undone from here |
variableId * | string | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
delete_variable_collection
Delete a variable collection and everything in it. Requires confirm: true.
| Parameter | Type | Description |
|---|---|---|
collectionId * | string | |
confirm * | boolean | Must be true — this cannot be undone from here |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
bind_variable
Bind a variable to a layer property (width, height, itemSpacing, paddingLeft, cornerRadius, opacity, visible, characters…) or to a fill/stroke colour (field 'fill' or 'stroke'). Omit variableId to unbind.
| Parameter | Type | Description |
|---|---|---|
field * | string | |
nodeId * | string | Figma node ID, e.g. '4029:12345' |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
paintIndex | integer | |
variableId | string |
get_reactions
Read a layer's prototype interactions (triggers and actions).
| Parameter | Type | Description |
|---|---|---|
nodeId * | string | Figma node ID, e.g. '4029:12345' |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
set_reactions
Replace or append a layer's prototype interactions, using Figma's Reaction objects.
| Parameter | Type | Description |
|---|---|---|
nodeId * | string | Figma node ID, e.g. '4029:12345' |
reactions * | array | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
mode | string |
remove_reactions
Remove all of a layer's interactions, or the one at index.
| Parameter | Type | Description |
|---|---|---|
nodeId * | string | Figma node ID, e.g. '4029:12345' |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
index | integer |
get_annotations
Read Dev Mode annotations in a subtree (default: current page), with the file's annotation categories.
| Parameter | Type | Description |
|---|---|---|
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
nodeId | string | Figma node ID, e.g. '4029:12345' |
set_annotations
Replace or append a layer's annotations ({ label | labelMarkdown, properties?, categoryId? }). Works in Dev Mode too.
| Parameter | Type | Description |
|---|---|---|
annotations * | array | |
nodeId * | string | Figma node ID, e.g. '4029:12345' |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
mode | string |
get_fonts
Fonts used in a subtree (default: current page) with how many text layers use each; optionally the fonts available to Figma.
| Parameter | Type | Description |
|---|---|---|
family | string | Filter available fonts by family |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
includeAvailable | boolean | |
nodeId | string | Figma node ID, e.g. '4029:12345' |
create_section
Create a section, either at a given box or wrapped around existing layers (nodeIds).
| Parameter | Type | Description |
|---|---|---|
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
height | number | |
name | string | |
nodeIds | array | |
padding | number | |
width | number | |
x | number | |
y | number |
set_constraints
Set a layer's resizing constraints.
| Parameter | Type | Description |
|---|---|---|
nodeId * | string | Figma node ID, e.g. '4029:12345' |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
horizontal | string | |
vertical | string |
reorder_nodes
Move layers in their parent's stacking order.
| Parameter | Type | Description |
|---|---|---|
nodeIds * | array | |
position * | string | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
index | integer |
lock_nodes
Lock or unlock layers.
| Parameter | Type | Description |
|---|---|---|
nodeIds * | array | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
locked | boolean | Default true |
batch_rename_nodes
Rename many layers: regex find/replace, or a template with {name} {index} {type}. Target explicit nodeIds or every layer under rootId.
| Parameter | Type | Description |
|---|---|---|
caseSensitive | boolean | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
find | string | |
nodeIds | array | |
replace | string | |
rootId | Figma node ID, e.g. '4029:12345' | |
startIndex | integer | |
template | string |
find_replace_text
Find and replace text in every text layer of a subtree (default: current page). dryRun previews.
| Parameter | Type | Description |
|---|---|---|
find * | string | |
caseSensitive | boolean | |
dryRun | boolean | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
regex | boolean | |
replace | string | |
rootId | string | Figma node ID, e.g. '4029:12345' |
rename_page
Rename a page.
| Parameter | Type | Description |
|---|---|---|
name * | string | |
pageId * | string | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
delete_page
Delete a page and everything on it. Requires confirm: true.
| Parameter | Type | Description |
|---|---|---|
confirm * | boolean | Must be true — this cannot be undone from here |
pageId * | string | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
get_viewport
The canvas viewport: centre, zoom and visible bounds.
| Parameter | Type | Description |
|---|---|---|
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
create_from_svg
Create editable vector layers from an SVG string.
| Parameter | Type | Description |
|---|---|---|
svg * | string | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
name | string | |
parentId | string | Figma node ID, e.g. '4029:12345' |
x | number | |
y | number |
save_version
Save a named version to the file's version history. Figma notes very recent edits may not be included.
| Parameter | Type | Description |
|---|---|---|
title * | string | |
description | string | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
notify
Show a toast message inside Figma.
| Parameter | Type | Description |
|---|---|---|
message * | string | |
error | boolean | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
timeoutMs | number |
get_rest_json
A layer in the REST API's JSON shape (exportAsync JSON_REST_V1), without using the REST API.
| Parameter | Type | Description |
|---|---|---|
nodeId * | string | Figma node ID, e.g. '4029:12345' |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
get_selection_colors
The colours and colour styles used in the current selection.
| Parameter | Type | Description |
|---|---|---|
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
get_dev_resources
Dev resources (links) attached to a layer, optionally its children too.
| Parameter | Type | Description |
|---|---|---|
nodeId * | string | Figma node ID, e.g. '4029:12345' |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
includeChildren | boolean |
add_dev_resource
Attach a dev resource link to a layer. Works in Dev Mode.
| Parameter | Type | Description |
|---|---|---|
nodeId * | string | Figma node ID, e.g. '4029:12345' |
url * | string | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
name | string |
delete_dev_resource
Remove a dev resource link from a layer.
| Parameter | Type | Description |
|---|---|---|
nodeId * | string | Figma node ID, e.g. '4029:12345' |
url * | string | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
get_board
FigJam: read a board as compact JSON — stickies (text, colour, author, position), shapes with text, connectors (what they join, label, line type), sections with their children, tables (cell text), code blocks, text and stamps, plus a count of every layer type. Only works when the plugin runs in a FigJam file.
| Parameter | Type | Description |
|---|---|---|
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
maxItems | integer | Stop listing after this many items (default 500); counts still cover everything |
pageId | string | A page other than the current one |
create_sticky
FigJam: add a sticky note.
| Parameter | Type | Description |
|---|---|---|
text * | string | |
color | string | A FigJam colour name such as yellow, green or lightGray (get_board lists the ones in use), or a hex colour |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
parentId | string | A section to put it in |
wide | boolean | A wide sticky instead of a square one |
x | number | Left edge, in the parent's coordinates. Without x, y or parentId the item is centred in view. |
y | number | Top edge, in the parent's coordinates |
create_shape_with_text
FigJam: add a shape with text in it, e.g. a flowchart box or decision diamond.
| Parameter | Type | Description |
|---|---|---|
shapeType * | string | |
text * | string | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
fill | string | A FigJam colour name such as yellow, green or lightGray (get_board lists the ones in use), or a hex colour |
height | number | |
parentId | string | A section to put it in |
width | number | |
x | number | Left edge, in the parent's coordinates. Without x, y or parentId the item is centred in view. |
y | number | Top edge, in the parent's coordinates |
create_connector
FigJam: connect two items (stickies, shapes, sections…) with a connector line that follows them when they move.
| Parameter | Type | Description |
|---|---|---|
endNodeId * | ||
startNodeId * | string | Figma node ID, e.g. '4029:12345' |
endCap | string | Default is FigJam's arrow |
endMagnet | string | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
label | string | |
lineType | string | |
startCap | string | Default NONE |
startMagnet | string | Which side it attaches to (default AUTO) |
create_table
FigJam: add a table, optionally filled with text row by row.
| Parameter | Type | Description |
|---|---|---|
columns * | integer | |
rows * | integer | |
cells | array | Text per row; missing cells stay empty |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
x | number | Left edge, in the parent's coordinates. Without x, y or parentId the item is centred in view. |
y | number | Top edge, in the parent's coordinates |
create_code_block
FigJam: add a code block with syntax highlighting.
| Parameter | Type | Description |
|---|---|---|
code * | string | |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
language | string | |
x | number | Left edge, in the parent's coordinates. Without x, y or parentId the item is centred in view. |
y | number | Top edge, in the parent's coordinates |
generate_diagram
FigJam: draw a Mermaid flowchart as real FigJam shapes, connectors and sections, laid out automatically. Supports flowchart/graph with TD, TB, BT, LR or RL; node shapes [rect], (round), {diamond}, ((circle)), ([stadium]), [(database)], {{hexagon}}, [[subroutine]], [/parallelogram/]; edges -->, ---, -.->, ==> with |label| or -- label -->; subgraphs become sections; %% comments. Styling (classDef, style, click) is skipped and reported in warnings. Returns the id of every shape, connector and section, keyed by Mermaid id. Up to 300 nodes.
| Parameter | Type | Description |
|---|---|---|
mermaid * | string | Mermaid source, starting with e.g. "flowchart LR" |
direction | string | Overrides the direction in the Mermaid header |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
x | number | Left edge of the diagram (default: centred in view) |
y | number | Top edge of the diagram |
get_slides
Figma Slides: the deck as rows of slides with id, name, whether it is skipped, its transition and the first few text layers of each. Only works when the plugin runs in a Slides file. Edit a slide's content with the usual tools (create_text, create_frame, set_text_content, …) using the slide id as parentId.
| Parameter | Type | Description |
|---|---|---|
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
textNodesPerSlide | integer | Text layers summarised per slide (default 5, 0 for none) |
create_slide
Figma Slides: add a slide, at the end of the deck or at a row and position. Use a row one past the last to start a new row.
| Parameter | Type | Description |
|---|---|---|
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
index | integer | Position within the row; needs row |
name | string | Layer name. Figma Slides renames slides to their position number when the deck changes, so it rarely lasts; identify slides by id |
row | integer |
reorder_slides
Figma Slides: rearrange the deck. Pass every slide id exactly once, grouped into rows in the new order.
| Parameter | Type | Description |
|---|---|---|
grid * | array | Slide ids per row, e.g. [['1:2','1:3'],['1:4']] |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
delete_slide
Figma Slides: delete a slide and everything on it.
| Parameter | Type | Description |
|---|---|---|
confirm * | boolean | Must be true — this cannot be undone from here |
slideId * | string | The slide's node id, from get_slides |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
set_slide_transition
Figma Slides: set the transition that plays when this slide appears. Values left out keep the slide's current ones.
| Parameter | Type | Description |
|---|---|---|
slideId * | string | The slide's node id, from get_slides |
style * | string | |
curve | string | |
delay | number | With trigger AFTER_DELAY |
duration | number | Length of the transition, as Figma's SlideTransition.duration |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
trigger | string |
focus_slide
Figma Slides: make a slide the focused one, as when it is opened in single-slide view.
| Parameter | Type | Description |
|---|---|---|
slideId * | string | The slide's node id, from get_slides |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
list_files
List all currently connected Figma files. Returns fileKey and fileName for each. Use the fileKey to target a specific file in other tools.
get_document
Get the current Figma page document tree. When multiple files are connected, specify fileKey.
| Parameter | Type | Description |
|---|---|---|
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
get_selection
Get the currently selected nodes in Figma. When multiple files are connected, specify fileKey.
| Parameter | Type | Description |
|---|---|---|
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
get_node
Get a specific Figma node by ID. Accepts top-level IDs like '4029:12345' and instance-child IDs like 'I12740:17806;12740:17793'. Never use hyphens. When multiple files are connected, specify fileKey.
| Parameter | Type | Description |
|---|---|---|
nodeId * | string | The node ID to fetch. Accepts top-level IDs like '4029:12345' and instance-child IDs like 'I12740:17806;12740:17793'. |
depth | integer | Levels of children to include (default all) |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
includeHidden | boolean | Include children the design hides (visible: false). Default false. |
get_styles
Get all local styles in the document. When multiple files are connected, specify fileKey.
| Parameter | Type | Description |
|---|---|---|
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
get_metadata
Get metadata about the current Figma document including file name, pages, and current page info. When multiple files are connected, specify fileKey.
| Parameter | Type | Description |
|---|---|---|
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
get_design_context
Get the design context for the current selection or page. Returns a summarized tree structure optimized for understanding the current design context. When multiple files are connected, specify fileKey.
| Parameter | Type | Description |
|---|---|---|
depth | number | How many levels deep to traverse the node tree (default 2) |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
get_variable_defs
Get all local variable definitions including variable collections, modes, and variable values. Variables are Figma's system for design tokens (colors, numbers, strings, booleans). When multiple files are connected, specify fileKey.
| Parameter | Type | Description |
|---|---|---|
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
get_screenshot
Export a screenshot of the selected nodes or specific nodes by ID. Returns base64-encoded image data. When multiple files are connected, specify fileKey.
| Parameter | Type | Description |
|---|---|---|
allowHidden | boolean | Export even when the node or an ancestor is hidden (default false — hidden nodes are reported instead, since they render nothing) |
clip | boolean | When true, export using Figma's absolute node bounds (REST use_absolute_bounds / plugin useAbsoluteBounds) so PNGs are clipped to the node's logical bounds |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
format | string | Export format: PNG (default) or SVG or JPG or PDF |
nodeIds | array | Optional list of node IDs to export. Accepts top-level IDs like '4029:12345' and instance-child IDs like 'I12740:17806;12740:17793'. Never use hyphens. If empty, exports the current selection. |
scale | number | Export scale for raster formats (default 2) |
svgIdAttribute | boolean | SVG only: write layer names as id attributes (Figma default false) |
svgOutlineText | boolean | SVG only: outline text as paths (Figma default true). False keeps <text> elements. |
svgSimplifyStroke | boolean | SVG only: simplify inside/outside strokes (Figma default true) |
timeoutMs | number | Milliseconds one export may take before it is reported as stuck (default 30000). A stuck export almost always means Figma's window is minimized or covered. |
set_node_visibility
Show or hide specific Figma nodes. Returns previous visibility for each node so you can restore them after. Useful for isolating a single layer before exporting: hide all siblings, export the frame, then restore visibility.
| Parameter | Type | Description |
|---|---|---|
items * | array | List of nodes with their target visibility |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
set_text_content
Update the contents of a single text node. The plugin loads the node's fonts before applying the new text. Accepts either text or characters. When multiple files are connected, specify fileKey.
| Parameter | Type | Description |
|---|---|---|
nodeId * | string | The text node ID to update |
characters | string | Alias for text, matching create_text. Supply one of the two. |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
text | string | The new text content. Required unless characters is given. |
set_text_properties
Patch common text properties such as font family/style, size, alignment, auto-resize, line height, letter spacing, fill color, and bounds. When multiple files are connected, specify fileKey.
| Parameter | Type | Description |
|---|---|---|
nodeId * | string | The text node ID to update |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
fillHex | string | Optional text fill color as hex |
fillOpacity | number | Optional text fill opacity from 0 to 1 |
fontFamily | string | Optional font family |
fontSize | number | Optional font size |
fontStyle | string | Optional font style |
height | number | Optional height |
letterSpacingPx | number | Optional letter spacing in pixels |
lineHeightPx | number | Optional line height in pixels |
textAlignHorizontal | string | Optional horizontal alignment |
textAlignVertical | string | Optional vertical alignment |
textAutoResize | string | Optional text auto-resize mode |
width | number | Optional width |
x | number | Optional x position |
y | number | Optional y position |
set_node_properties
Patch common node properties such as name, position, size, visibility, opacity, and corner radius. Only supported properties for the target node type may be changed. Use set_solid_fill or set_gradient_fill to change paints. When multiple files are connected, specify fileKey.
| Parameter | Type | Description |
|---|---|---|
nodeId * | string | The node ID to update |
cornerRadius | number | Optional corner radius |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
height | number | Optional height |
name | string | Optional new node name |
opacity | number | Optional opacity from 0 to 1 |
rotation | number | Optional rotation in degrees |
visible | boolean | Optional visibility |
width | number | Optional width |
x | number | Optional x position |
y | number | Optional y position |
set_solid_fill
Replace a node's fill (or stroke) with a single solid paint. Provide a hex color and optional paint opacity — fillHex/fillOpacity are accepted as aliases. Use set_gradient_fill for gradient paints.
| Parameter | Type | Description |
|---|---|---|
nodeId * | string | The node ID to update |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
fillHex | string | Alias for hex, matching the create_* tools. Supply one of the two. |
fillOpacity | number | Alias for opacity, matching the create_* tools |
hex | string | Solid color as hex (e.g. '#FFAA00'). Required unless fillHex is given. |
opacity | number | Optional paint opacity from 0 to 1 (default 1) |
target | string | Apply to fills or strokes (default fill) |
set_gradient_fill
Replace a node's fill (or stroke) with a gradient paint. Provide ordered stops (position 0..1, hex color, optional alpha) and an optional 2x3 gradientTransform matching Figma's gradientTransform format. Useful for setting linear/radial/angular/diamond gradients programmatically.
| Parameter | Type | Description |
|---|---|---|
gradientStops * | array | Ordered list of gradient color stops (at least 2) |
nodeId * | string | The node ID to update |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
gradientTransform | array | 2x3 affine matrix [[a,b,tx],[c,d,ty]] mapping the unit gradient onto the shape (Figma's gradientTransform). Defaults to identity (horizontal left→right). |
gradientType | string | Gradient family (default LINEAR) |
opacity | number | Overall paint opacity (default 1) |
target | string | Apply to fills or strokes (default fill) |
set_effects
Replace a node's effects list (drop/inner shadows, layer/background blurs). Pass an empty array to clear all effects. Each entry mirrors the shape returned by get_node's `effects` field.
| Parameter | Type | Description |
|---|---|---|
effects * | array | Full replacement list of effects. Pass [] to clear all effects. Each entry is a drop/inner shadow or a layer/background blur. |
nodeId * | string | The node ID to update |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
set_stroke_properties
Patch stroke geometry properties: weight, align, dash pattern, cap, join. Use set_solid_fill/set_gradient_fill with target='stroke' to set the paint itself.
| Parameter | Type | Description |
|---|---|---|
nodeId * | string | The node ID to update |
dashPattern | array | Dash pattern as [dash, gap, dash, gap, ...] in pixels. Pass [] for a solid stroke. |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
strokeAlign | string | How the stroke is positioned relative to the geometry edge |
strokeCap | string | End-cap style (only meaningful on open paths/lines) |
strokeJoin | string | Corner join style |
strokeWeight | number | Stroke thickness in pixels |
set_auto_layout
Configure auto-layout on a frame: direction, gap, padding, alignment, sizing modes, wrap. Set layoutMode='NONE' to disable auto-layout on the frame.
| Parameter | Type | Description |
|---|---|---|
nodeId * | string | The node ID to update (must be a frame) |
counterAxisAlignItems | string | Alignment along the counter axis |
counterAxisSizingMode | string | AUTO = hug contents along counter axis |
counterAxisSpacing | number | Gap between wrapped rows/columns (only when layoutWrap=WRAP) |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
itemSpacing | number | Gap between children along the primary axis (pixels) |
layoutMode | string | Auto-layout direction. 'NONE' disables auto-layout. |
layoutWrap | string | Allow children to wrap onto multiple rows/columns |
paddingBottom | number | |
paddingLeft | number | |
paddingRight | number | |
paddingTop | number | |
primaryAxisAlignItems | string | Alignment along the primary axis |
primaryAxisSizingMode | string | AUTO = hug contents along primary axis |
create_page
Create a new page in the Figma document, optionally naming it and switching the editor to it. Returns the new page's ID, which can be passed as parentId to create_frame / create_text / create_shape / create_image to author content on that page. When multiple files are connected, specify fileKey.
| Parameter | Type | Description |
|---|---|---|
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
name | string | Optional page name (defaults to Figma's 'Page N') |
setAsCurrent | boolean | When true, switch the editor to the new page after creating it (default false) |
create_frame
Create a new frame, optionally inside a specified parent. You can set name, size, position, and a solid fill. When multiple files are connected, specify fileKey.
| Parameter | Type | Description |
|---|---|---|
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
fillHex | string | Optional solid fill color as hex |
fillOpacity | number | Optional solid fill opacity from 0 to 1 |
height | number | Frame height |
name | string | Optional frame name |
parentId | string | Optional parent node ID to append the frame into |
width | number | Frame width |
x | number | Optional x position |
y | number | Optional y position |
create_text
Create a new text node, optionally inside a specified parent. You can set its content, font, size, alignment, color, position, and bounds. When multiple files are connected, specify fileKey.
| Parameter | Type | Description |
|---|---|---|
characters | string | Initial text content |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
fillHex | string | Optional text fill color as hex |
fillOpacity | number | Optional text fill opacity from 0 to 1 |
fontFamily | string | Font family, defaults to Inter |
fontSize | number | Optional font size |
fontStyle | string | Font style, defaults to Regular |
height | number | Optional height |
name | string | Optional text node name |
parentId | string | Optional parent node ID to append the text into |
textAlignHorizontal | string | Optional horizontal alignment |
textAutoResize | string | Optional text auto-resize mode |
width | number | Optional width |
x | number | Optional x position |
y | number | Optional y position |
create_shape
Create a rectangle, ellipse, or line, optionally inside a specified parent. You can set its size, position, rotation, fill, and stroke. When multiple files are connected, specify fileKey.
| Parameter | Type | Description |
|---|---|---|
shapeType * | string | Shape type to create |
cornerRadius | number | Optional corner radius for supported shapes |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
fillHex | string | Optional fill color as hex |
fillOpacity | number | Optional fill opacity from 0 to 1 |
height | number | Optional height |
name | string | Optional shape name |
parentId | string | Optional parent node ID to append the shape into |
rotation | number | Optional rotation in degrees |
strokeHex | string | Optional stroke color as hex |
strokeOpacity | number | Optional stroke opacity from 0 to 1 |
strokeWeight | number | Optional stroke weight |
width | number | Optional width |
x | number | Optional x position |
y | number | Optional y position |
create_image
Create an image-backed rectangle from a local file path, remote URL, or data URI. You can set its parent, position, size, corner radius, and fit mode. When multiple files are connected, specify fileKey.
| Parameter | Type | Description |
|---|---|---|
source * | string | Image source. Accepts a local file path (absolute or relative to the MCP server cwd), an http/https URL, or a data URI. |
cornerRadius | number | Optional corner radius |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
height | number | Optional height |
name | string | Optional image node name |
parentId | string | Optional parent node ID to append the image into |
scaleMode | string | How the image should fit its bounds: FILL (default) or FIT |
width | number | Optional width |
x | number | Optional x position |
y | number | Optional y position |
import_html_layers
Import a DOM serialization (JSON produced by html-figma's browser htmlToFigma()) as editable Figma layers inside a new wrapper frame — frames, text, rectangles, and SVG vectors in one call. Source must be a JSON file path inside the MCP server working directory. Optionally append the wrapper into an existing frame/section via parentId. Requires the plugin to be open in the design editor. When multiple files are connected, specify fileKey.
| Parameter | Type | Description |
|---|---|---|
source * | string | Path to a JSON file containing an html-figma htmlToFigma() layer tree, relative to the MCP server cwd (absolute paths must stay inside it). |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
name | string | Optional name for the wrapper frame (default: 'imported layers') |
parentId | string | Optional parent node ID (frame/section) to append the wrapper frame into. x/y become relative to that parent. |
x | number | Optional x position of the wrapper frame |
y | number | Optional y position of the wrapper frame |
duplicate_nodes
Duplicate one or more nodes in place. The duplicates remain under the same parent as the originals. When multiple files are connected, specify fileKey.
| Parameter | Type | Description |
|---|---|---|
nodeIds * | array | List of node IDs to duplicate |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
reparent_nodes
Move one or more nodes into a different parent container. When multiple files are connected, specify fileKey.
| Parameter | Type | Description |
|---|---|---|
nodeIds * | array | List of node IDs to move |
parentId * | string | Destination parent node ID |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
group_nodes
Wrap a list of nodes in a new group. Nodes must share a common parent (or supply parentId explicitly). Returns the new group's node ID.
| Parameter | Type | Description |
|---|---|---|
nodeIds * | array | Node IDs to group. Must share a common parent. |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
name | string | Optional name for the new group |
parentId | string | Optional explicit parent for the new group. Defaults to the shared parent of the input nodes. |
ungroup_node
Ungroup a group or frame — its children move up to its parent and the wrapper is removed. Returns the IDs of the orphaned children in their new parent.
| Parameter | Type | Description |
|---|---|---|
nodeId * | string | Group or frame to ungroup. Children move up to its parent and the wrapper is removed. |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
set_selection
Set the current page selection to a list of node IDs. Pass an empty array to clear the selection. Works in both design editor and Dev Mode.
| Parameter | Type | Description |
|---|---|---|
nodeIds * | array | Node IDs to select. Pass [] to clear the selection. |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
scroll_and_zoom_into_view
Scroll and zoom the Figma viewport so the given nodes are framed in view. Works in both design editor and Dev Mode.
| Parameter | Type | Description |
|---|---|---|
nodeIds * | array | Node IDs to frame in the viewport |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
delete_nodes
Delete one or more nodes. This is destructive and requires confirm: true. Page and document nodes cannot be deleted through this tool. When multiple files are connected, specify fileKey.
| Parameter | Type | Description |
|---|---|---|
confirm * | boolean | Must be true to confirm deletion |
nodeIds * | array | List of node IDs to delete |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
get_motion_styles
List all available animation presets in Figma (Motion API beta). When multiple files are connected, specify fileKey.
| Parameter | Type | Description |
|---|---|---|
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
get_node_motion
Read a node's current animationStyles, animations, manualKeyframeTracks, and timelines (Motion API beta). When multiple files are connected, specify fileKey.
| Parameter | Type | Description |
|---|---|---|
nodeId * | string | The node ID to fetch motion properties for |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
apply_animation_style
Apply a preset animation style to a node (Motion API beta). When multiple files are connected, specify fileKey.
| Parameter | Type | Description |
|---|---|---|
nodeId * | string | The node ID to apply the style to |
styleId * | string | The ID of the animation style to apply |
animationStyleData | object | Optional values used to configure the applied animation style (e.g. duration, timelineOffset, axis, direction) |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
remove_animation_style
Remove an applied animation style from a node (Motion API beta). If no animationStyleId is provided, removes all styles. When multiple files are connected, specify fileKey.
| Parameter | Type | Description |
|---|---|---|
nodeId * | string | The node ID to remove the style from |
animationStyleId | string | The ID of the animation style to remove. If omitted, all animation styles are removed. |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
apply_manual_keyframe_track
Applies or replaces the manual Motion keyframe track for a property, paint, or effect field on a node. When multiple files are connected, specify fileKey.
| Parameter | Type | Description |
|---|---|---|
field * | object | The property, paint, or effect field to animate. Example: { type: 'PROPERTY', name: 'TRANSLATION_X' } |
nodeId * | string | The node ID to apply the track to |
track * | object | The manual keyframe track to write. Contains keyframes, baseValue, etc. |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
remove_manual_keyframe_track
Removes the manual Motion keyframe track for a property, paint, or effect field on a node. When multiple files are connected, specify fileKey.
| Parameter | Type | Description |
|---|---|---|
field * | object | The property, paint, or effect field to remove. Example: { type: 'PROPERTY', name: 'TRANSLATION_X' } |
nodeId * | string | The node ID to remove the track from |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
set_timeline_duration
Sets the duration (in seconds) for a timeline. When multiple files are connected, specify fileKey.
| Parameter | Type | Description |
|---|---|---|
duration * | number | The new timeline duration in seconds (must be greater than zero) |
nodeId * | string | The node ID whose timeline duration will be changed |
timelineId * | string | A timeline id read from the node's timelines array |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
save_screenshots
Export nodes and save them straight to disk, one node at a time (PNG/SVG/JPG/PDF). Returns metadata only. Hidden nodes and existing files are reported rather than failing the batch; the run stops early if Figma's exports stall. When multiple files are connected, specify fileKey.
| Parameter | Type | Description |
|---|---|---|
items * | array | List of screenshot save operations to execute in batch |
allowHidden | boolean | Export even when the node or an ancestor is hidden (default false — hidden nodes are reported instead, since they render nothing) |
clip | boolean | Default clipping behavior for saved screenshots. When true, PNGs are clipped to the node's logical bounds using Figma's absolute node bounds. |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
format | string | Default export format: PNG (default) or SVG or JPG or PDF |
overwrite | boolean | Replace files that already exist (default false — existing files are reported, not touched) |
scale | number | Default export scale for raster formats (default 2) |
svgIdAttribute | boolean | SVG only: write layer names as id attributes (Figma default false) |
svgOutlineText | boolean | SVG only: outline text as paths (Figma default true). False keeps <text> elements. |
svgSimplifyStroke | boolean | SVG only: simplify inside/outside strokes (Figma default true) |
timeoutMs | number | Milliseconds one export may take before it is reported as stuck (default 30000). A stuck export almost always means Figma's window is minimized or covered. |
export_assets
Export every matching layer in a frame to a folder, e.g. all icon instances as SVG, exactly as Figma draws them on that screen, overrides included. Scans rootId with the filter (types, namePattern, size, stopAtMatch, default true) or takes explicit nodeIds; skips hidden layers; writes identical exports once; writes manifest.json with each node's bounds relative to rootId and its file. Stops early and says why if exports stall.
| Parameter | Type | Description |
|---|---|---|
outputDir * | string | Directory to write into, relative to the MCP server's working directory (or inside FIGMA_BRIDGE_OUTPUT_ROOTS) |
clip | boolean | Use the node's logical bounds instead of its render bounds |
dedupe | boolean | When two nodes export byte-identical files (ignoring generated SVG ids), write the file once and point the second at it in the manifest (default true) |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
fileName | string | File name template without extension. Tokens: {name} {id} {index} {type} {x} {y} (x/y relative to rootId). Default '{name}__{id}' |
format | string | Default SVG |
includeHidden | boolean | Also match layers the design hides (default false; they render nothing) |
limit | integer | Maximum nodes to export (default 500) |
manifest | boolean | Write manifest.json listing every node, its bounds and its file (default true) |
maxDepth | integer | Do not descend deeper than this |
maxSize | number | Match only nodes whose larger side is at most this many px |
minSize | number | Match only nodes whose larger side is at least this many px |
namePattern | string | Case-insensitive regular expression the layer name must match |
nodeIds | array | Export exactly these nodes instead of scanning (rootId still sets relative positions) |
overwrite | boolean | Replace files that already exist (default false — existing files are reported, not touched) |
rootId | string | Scan this node's subtree with the filter below and export every match |
scale | number | Raster scale (default 2) |
stopAtMatch | boolean | Do not look inside a node that matched — so an icon instance is returned whole, not also as its inner vectors |
svgIdAttribute | boolean | SVG only: write layer names as id attributes (Figma default false) |
svgOutlineText | boolean | SVG only: outline text as paths (Figma default true). False keeps <text> elements. |
svgSimplifyStroke | boolean | SVG only: simplify inside/outside strokes (Figma default true) |
timeoutMs | number | Milliseconds one export may take before it is reported as stuck (default 30000). A stuck export almost always means Figma's window is minimized or covered. |
types | array | Node types to match, e.g. ['INSTANCE','VECTOR','BOOLEAN_OPERATION','TEXT','FRAME'] |
export_tokens
Export the file's local variables (every mode) and colour/text/effect styles as W3C design-tokens JSON, CSS custom properties, or both, written to disk.
| Parameter | Type | Description |
|---|---|---|
outputPath * | string | File to write (e.g. tokens.json or tokens.css); with format 'both' the extension is replaced |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
format | string | W3C design-tokens JSON (default), CSS custom properties, or both |
overwrite | boolean | Replace files that already exist (default false — existing files are reported, not touched) |
export_frames_to_pdf
Export frames as one multi-page PDF, one page per frame in the order given, written to disk.
| Parameter | Type | Description |
|---|---|---|
nodeIds * | array | Frames in page order |
outputPath * | string | PDF file to write |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
overwrite | boolean | Replace files that already exist (default false — existing files are reported, not touched) |
timeoutMs | number | Milliseconds one export may take before it is reported as stuck (default 30000). A stuck export almost always means Figma's window is minimized or covered. |
title | string | PDF document title |
export_image_fills
Save the original images behind image fills in a subtree — the uploaded bitmaps, not a render — plus images.json listing which layers use each.
| Parameter | Type | Description |
|---|---|---|
nodeId * | string | Layer whose subtree's image fills are saved |
outputDir * | string | Directory to write the original images into |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
overwrite | boolean | Replace files that already exist (default false — existing files are reported, not touched) |
import_tokens
Import design tokens into the file's local variables: W3C DTCG JSON (including export_tokens output), CSS custom properties (:root is the default mode; [data-theme="x"], .dark and @media (prefers-color-scheme: dark) are other modes) or Tailwind v4 @theme blocks. Matches existing variables by collection and name, creates what is missing, updates what changed, and sets aliases last. Previews by default — pass dryRun: false to apply. Never deletes; variables the import leaves out are listed as missing.
| Parameter | Type | Description |
|---|---|---|
collection | string | Put every token in this collection. Without it, DTCG uses each top-level group as the collection and CSS names are matched to existing variables, falling back to "Tokens". |
content | string | The tokens themselves, instead of a file |
deleteMissing | boolean | Not implemented: missing variables are only reported, never deleted |
dryRun | boolean | Default true: report the plan without changing the file |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
format | string | Default auto: JSON is DTCG, anything else CSS (which includes @theme blocks). tailwind reads only @theme blocks. |
modeMapping | object | Rename source modes to Figma mode names, e.g. { "dark": "Dark", ":root": "Light" } |
source | string | Path to a .json or .css file, relative to the server's working directory |
compare_to_image
Compare a Figma node with the built page or component: exports the node as PNG, compares it with a local screenshot (image) or a screenshot Playwright takes of a local URL, and writes design, actual and diff PNGs. Returns the mismatch percentage and the largest mismatching regions in design coordinates, each with the layers most likely responsible. url needs the optional Playwright install.
| Parameter | Type | Description |
|---|---|---|
nodeId * | string | Figma node ID, e.g. '4029:12345' |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
fit | string | When sizes differ: crop compares the overlapping top-left area (default); resize scales the image to the design's size first |
image | string | Path to a PNG (or JPG, with the optional jpeg-js) of the built UI, inside the allowed folders |
maxRegions | integer | How many regions to return (default 5) |
outputDir | string | Where to write the PNGs (default figma-compare), inside the allowed folders |
scale | number | Pixels per design unit for both images (default 1). Use 2 for a retina screenshot. |
selector | string | With url: screenshot only the first element matching this CSS selector |
threshold | number | pixelmatch colour threshold, 0–1 (default 0.1; lower is stricter) |
url | string | A localhost or file URL to screenshot instead (needs Playwright) |
viewport | object | With url: window size in CSS pixels (default: the node's size) |
import_url
Render a localhost or file URL in Playwright and import the page (or one element, via selector) as editable Figma layers — frames, text, images and SVGs — through import_html_layers. Needs the optional Playwright install.
| Parameter | Type | Description |
|---|---|---|
url * | string | A localhost or file URL (other hosts need FIGMA_BRIDGE_ALLOW_REMOTE_URLS=1) |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
name | string | Name of the wrapper frame (default: the URL's host and path) |
parentId | string | Frame or section to put the wrapper in |
selector | string | CSS selector of the element to import (default body) |
viewport | object | Browser window size in CSS pixels (default 1440×900) |
x | number | |
y | number |
get_code_context
Design-to-code context for one layer, read in a single walk. format "json" (default) returns a compact tree — each layer's flex/grid layout (mode, gap, padding, justify/align, fixed/hug/fill sizing, absolute position with constraints), a ref into a deduped styles table (fills, strokes, radius, effects, opacity) and textStyles table, text with mixed-style segments, component instances with variant and property values, icons collapsed to { type: ICON, assetHint }, image fills as imageRef — plus tokens used and assets to export. Every variable-bound value carries the variable name, its CSS cu…
| Parameter | Type | Description |
|---|---|---|
nodeId * | string | Figma node ID, e.g. '4029:12345' |
expandInstances | boolean | Read inside component instances instead of treating each as a component placeholder (default false; the requested layer is always read) |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
format | string | "json" (default), "jsx-tailwind" or "html-css" |
includeHidden | boolean | Include layers turned off in the design (default false) |
inlineSvgMaxBytes | integer | Inline each icon's SVG when it is at most this many bytes (default 0: never; up to 60 icons) |
maxDepth | integer | Levels of children to read; deeper layers are summarised with a childCount. Default: no limit |
maxNodes | integer | Stop after this many layers (default 3000) |
run_script
Run JavaScript inside the Figma plugin with `figma` (the Plugin API) in scope, as the body of an async function: use await, and return a JSON-serialisable value. Returns { result, logs (console.log/info/warn/error/debug during the run), durationMs }; nodes in the result become {id, name, type}, cycles are cut and results over ~200KB are truncated. The script can change or delete anything in the file. In Dev Mode only reading works. A timed-out script cannot be stopped and may keep running. Off unless the server runs with FIGMA_BRIDGE_ALLOW_SCRIPTS=1.
| Parameter | Type | Description |
|---|---|---|
code * | string | Body of an async function, e.g. "const n = await figma.getNodeByIdAsync('1:2'); return n.name" |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
timeoutMs | integer | Default 10000, max 60000 |
generate_component_docs
Document a component or component set (an instance documents its main component): name, description, documentation links, property definitions with types, defaults and variant options, the variants, every variable (with its CSS custom property) and style used inside it, and optionally how many instances the file has. Returns markdown (default) or JSON; outputPath also writes it to a file, writeToCanvas also places a documentation frame beside the component (needs the design editor).
| Parameter | Type | Description |
|---|---|---|
nodeId * | string | Figma node ID, e.g. '4029:12345' |
countInstances | boolean | Count instances across the file (can be slow on big files; default false) |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
format | string | "markdown" (default) or "json" |
outputPath | string | Also write the result here (inside the allowed output folders) |
overwrite | boolean | Replace an existing file at outputPath (default false) |
writeToCanvas | boolean | Also create a documentation frame next to the component (default false) |
check_accessibility
Check a frame for WCAG 2.2 accessibility problems: text contrast (1.4.3 AA / 1.4.6 AAA), target size (2.5.8, or 2.5.5 at 44px) and very small text. Contrast is computed from the layers behind each text; when the background is an image, gradient, blur or blend it renders the containing layer as a PNG and samples the pixels behind the text, reporting the worst background colour (method: sampled). Returns a 0-100 score and issues sorted by severity, each with the node, colours, ratio, required ratio, informational APCA Lc, and the nearest colour variable or style that would pass. Optional: write…
| Parameter | Type | Description |
|---|---|---|
nodeId * | string | Figma node ID, e.g. '4029:12345' |
annotate | boolean | Add a Figma annotation to each failing layer (changes the file; design editor only) |
checks | array | Which checks to run (default all three) |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
level | string | WCAG level (default AA) |
maxExports | integer | Most layers to render for pixel sampling (default 25) |
maxIssues | integer | Most issues in the reply (default 200; files list all) |
minFontSize | number | Warn below this font size in px (default 12) |
minTarget | number | Minimum target size in px (default 24 for AA per WCAG 2.5.8; 44 for AAA 2.5.5 and Apple's HIG) |
outputDir | string | Write accessibility-<node>.json and .md here (inside the allowed output folders) |
lint_design_system
Lint a frame against the file's design system. Rules: unbound-color (solid fill/stroke with no variable or style; suggests the matching local colour variable in the layer's mode, respecting variable scopes, or paint style — exact first, else nearest by CIEDE2000 within maxDeltaE), unbound-spacing and unbound-radius (auto-layout gap/padding and corner radius not bound to a number variable; suggests one), text-without-style (suggests the nearest text style in the same family), detached-instance, off-scale-spacing / off-scale-radius (against spacingScale/radiusScale, or a scale inferred from th…
| Parameter | Type | Description |
|---|---|---|
nodeId * | string | Figma node ID, e.g. '4029:12345' |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
includeInstanceChildren | boolean | Also look inside instances (default false: their insides come from the main component, so lint that instead) |
limit | integer | Most layers with findings to collect (default 5000) |
maxDeltaE | number | Colour distance (CIEDE2000) for suggestions (default 5; fixes use 2) |
maxIssues | integer | Most issues in the reply (default 300) |
radiusScale | array | Allowed corner radii in px |
respectScopes | boolean | Only suggest variables whose scopes allow the property (default true) |
rules | array | Rules to run (default all) |
spacingScale | array | Allowed spacing values in px |
fix_design_system
Apply lint_design_system's suggestions: bind solid fills/strokes to matching colour variables (or a paint style when the layer has one paint), bind auto-layout spacing/padding and corner radius to number variables with exactly the same value, and give unstyled text a text style whose font, size, line height and letter spacing match. Only binds when the variable resolves, in that layer's mode, to the same value (colours within maxDeltaE, default 2); re-checks each layer before changing it and reverts if Figma changed the result. dryRun defaults to true and returns the plan without changing anyt…
| Parameter | Type | Description |
|---|---|---|
nodeId * | string | Figma node ID, e.g. '4029:12345' |
dryRun | boolean | Default true: plan only. Pass false to change the file. |
fileKey | string | The fileKey of the Figma file. Required when several files are connected; see list_files. |
includeInstanceChildren | boolean | Also look inside instances (default false: their insides come from the main component, so lint that instead) |
limit | integer | Most layers with findings to collect (default 5000) |
maxDeltaE | number | Largest colour change allowed when binding (CIEDE2000, default 2; 0 = exact only) |
maxItems | integer | Most changes/skips listed in the reply (default 300) |
respectScopes | boolean | Only bind variables whose scopes allow the property (default true) |
rules | array | Which fixes (default all four) |
health
Diagnose the bridge: server version and role, connected files, and a live test export from the plugin. Use it when calls time out: it tells a dead plugin apart from one node that will not export.
| Parameter | Type | Description |
|---|---|---|
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
nodeId | string | Node to test-export (default: the first visible layer on the current page) |
get_pages
List the file's pages and which one Figma currently shows. When multiple files are connected, specify fileKey.
| Parameter | Type | Description |
|---|---|---|
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
get_nodes
Fetch several nodes in one call. Each result carries its tree (optionally depth-limited), absolute bounds, auto-layout sizing, instance component properties and mixed-text segments. A node that fails is reported in place instead of failing the call. includeHidden keeps layers the design turns off.
| Parameter | Type | Description |
|---|---|---|
nodeIds * | array | Node IDs to fetch |
depth | integer | Levels of children to include (default all) |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
includeHidden | boolean | Include children the design hides (visible: false). Default false. |
scan_nodes
Search a node's subtree and return a flat list of matches: id, name, type, visibility, layer path, absolute bounds, bounds relative to the root, text and font for TEXT, component name for INSTANCE. Filter by types, namePattern, textPattern, size, maxDepth; stopAtMatch keeps an icon instance whole. Hidden layers are skipped unless visibleOnly is false.
| Parameter | Type | Description |
|---|---|---|
rootId * | string | Node whose subtree is searched |
fileKey | string | The fileKey of the Figma file to query. Required when multiple files are connected. Use list_files to see connected files. |
limit | integer | Maximum matches returned (default 2000) |
maxDepth | integer | Do not descend deeper than this |
maxSize | number | Match only nodes whose larger side is at most this many px |
minSize | number | Match only nodes whose larger side is at least this many px |
namePattern | string | Case-insensitive regular expression the layer name must match |
stopAtMatch | boolean | Do not look inside a node that matched — so an icon instance is returned whole, not also as its inner vectors |
textPattern | string | Case-insensitive regular expression a TEXT node's characters must match |
types | array | Node types to match, e.g. ['INSTANCE','VECTOR','BOOLEAN_OPERATION','TEXT','FRAME'] |
visibleOnly | boolean | Skip hidden layers and everything inside them (default true) |