Skip to main content
Glama
figma-mcp-v2

figma-mcp-v2

by LukasAnda

Generate reference code for a node

figma_get_code
Read-onlyIdempotent

Generate starting implementation code from a Figma frame or component layout into React + Tailwind, React + CSS, or HTML + CSS, converting auto layout into flexbox or grid.

Instructions

Generates a starting implementation of a frame/component from its Figma layout: React + Tailwind (arbitrary values), React + CSS, or HTML + CSS. Auto layout becomes flexbox/grid, sizing becomes fixed/flex/stretch, icons become (download them with figma_download_assets). Adapt the output to the project's existing components and design tokens rather than pasting it verbatim; figma_get_design lists the tokens and component instances.

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": {
      "url": "<url>"
    },
    "name": "figma_get_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
urlYesFigma link, e.g. https://www.figma.com/design/<fileKey>/<name>?node-id=12-345 (right-click a layer > Copy link to selection). A bare file key also works.
depthNoMax nesting depth to generate
sourceNoWhere to read from. auto (default): Figma's viewer protocol (no token, no Dev Mode), then the REST API if FIGMA_TOKEN is set, then the plugin. web/rest/plugin force one.auto
node_idNoNode id to use instead of the one in the link, e.g. "12:345", "12-345", or an instance sublayer "I12:345;67:89".
frameworkNoreact-tailwind

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.1

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already establish read-only, idempotent, no-destruct behavior, so the bar is lower, and the description still adds real substance: the layout-to-code mapping (auto layout to flexbox/grid, sizing to fixed/flex/stretch) and the caveat that icons come out as img tags pointing at SVG files that must be downloaded separately. It does not spell out the shape of the returned payload or whether a failing source fallback is surfaced, which keeps it off a 5.

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?

Three tight sentences, front-loaded with what is generated and in which flavors, then the caveats and adaptation advice. No filler, though the last sentence packs two sibling references into one clause, which is slightly dense.

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

Completeness4/5

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

With no output schema, the description carries some of that burden and does so by describing the emitted code shape and icon handling; annotations cover the safety profile. The main residual gap is the exact return payload (e.g., code string plus asset references) and any depth-related output limits.

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

Parameters3/5

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

Schema coverage is 80%, so the schema already documents url, depth, source, node_id, and framework thoroughly. The description reinforces meaning by naming the three framework targets in prose, but adds no new detail on depth, node_id sublayer syntax, or source fallback beyond what the schema states, so the baseline 3 applies.

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?

States a specific verb and resource ('Generates a starting implementation of a frame/component from its Figma layout') and enumerates the three output targets, so an agent knows exactly what comes back. It also names the sibling boundaries: figma_download_assets for icon files and figma_get_design for tokens/component instances.

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?

Gives clear operating context: this is a starting point to be adapted to existing components and design tokens, not pasted verbatim, and it routes asset fetching and token discovery to the right siblings. It stops short of an explicit exclusion such as 'do not use this when you only need the layout tree — use figma_get_design'.

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