set_variable
Create or update a variable in a Figma variable collection, automatically creating the collection if it doesn't exist.
Instructions
Create or update a variable in a Figma variable collection. Creates the collection if collectionName is provided and it doesn't exist.
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": {
"name": "<name>",
"resolvedType": "<resolvedType>"
},
"name": "set_variable"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collectionId | No | ID of an existing variable collection | |
| collectionName | No | Name for a new collection (used if collectionId not provided) | |
| name | Yes | Variable name | |
| resolvedType | Yes | Variable type | |
| value | No | Variable value. COLOR: {r,g,b,a} (0-1). FLOAT: number. STRING: string. BOOLEAN: boolean. | |
| modeId | No | Mode ID to set the value for (uses default mode if omitted) |