Generate reference code for a node
figma_get_codeGenerate 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
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | Figma 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. | |
| depth | No | Max nesting depth to generate | |
| source | No | Where 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_id | No | Node id to use instead of the one in the link, e.g. "12:345", "12-345", or an instance sublayer "I12:345;67:89". | |
| framework | No | react-tailwind |