run_code
Executes arbitrary Figma Plugin API code inside the plugin to handle tasks not covered by other tools, returning JSON results for automation and custom design operations.
Instructions
Escape hatch: run arbitrary Figma Plugin API code inside the plugin. code is the body of an async function receiving (figma, args, h); its return value (JSON) comes back. Use for anything not covered by other tools: vectors, boolean ops, component properties, export settings, etc.
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": "run_code"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| args | No | ||
| code | Yes | Body of an async function, e.g. 'const n = figma.createStar(); return n.id;' |