execute_figma_js
Run custom async JavaScript inside the Figma plugin sandbox with figma and params in scope, returning structured error details and created node IDs for safe retries.
Instructions
Execute custom async JavaScript inside the Figma Plugin sandbox with figma and params in scope. On error, returns structured { ok: false, error, safeToRetryWithoutCanvasRead, createdNodeIds } metadata.
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": "execute_figma_js"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Async function body receiving (figma, params). Return a JSON-serializable value. | |
| params | No | Optional parameters passed to the script | |
| channel | No | Optional Figma document channel, fileKey, or documentName when multiple Figma files are open |