Run Figma Plugin API code
figma_executeExecute JavaScript in the Figma plugin to handle bulk edits, build complex layouts, and read plugin-only data when standard tools cannot cover the task.
Instructions
Runs JavaScript inside the Figma plugin with the full Plugin API, for anything the other tools don't cover (bulk edits, complex layouts, reading plugin-only data). The code is the body of an async function with figma, params and helpers ({getNode, toPaints, parseColor, applyProps, summary}) in scope; return a JSON-serializable value. Load fonts before editing text: await figma.loadFontAsync({family:"Inter",style:"Regular"}).
Example: const f = figma.createFrame(); f.layoutMode = "VERTICAL"; f.itemSpacing = 8; return helpers.summary(f);
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": {
"code": "<code>"
},
"name": "figma_execute"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | Figma link (or file key) of the file to edit. Needed only when the plugin is open in more than one file. | |
| code | Yes | ||
| params | No | ||
| timeout_ms | No |