figma_run
Execute JavaScript through the Figma Plugin API in an open design file to read or modify layers, pages, and styles, returning returned values, printed output, or errors.
Instructions
Run JavaScript in the open Figma file through the Plugin API, as the body of an async function with figma in scope (top-level await works). print(...) and console.log(...) are collected. Returns the value of a return statement, the printed lines, or the error with its stack. The plugin uses dynamic-page access: use figma.getNodeByIdAsync, figma.setCurrentPageAsync and page.loadAsync() before reading another page. A layer whose fonts are missing cannot be moved into another parent or re-stacked (appendChild, insertChild), only moved by x and y.
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_run"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| timeout_s | No | default 120 |