figma_exec
Run JavaScript in the Figma plugin main thread to inspect and manipulate the live document, using the Figma API, and return JSON-serializable data without hitting REST API rate limits.
Instructions
Execute JavaScript inside the running Figma plugin main thread (like ae_exec / cocosmcp_exec / Blender execute_blender_code).
The code runs with access to the global figma Plugin API.
Write an async body; the final expression / return value is JSON-serialized back.
Prefer plain data (id/name/type/x/y/width/height). Avoid returning live node proxies.
Example:
return figma.currentPage.selection.map(n => ({ id: n.id, name: n.name, type: n.type }));
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_exec"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Plugin-main JavaScript body. Can use await. Return JSON-serializable data. |