variables
Extract design-token bindings (collections, modes, aliases) from a saved Figma .fig file, and optionally export one collection/mode as DTCG tokens.
Instructions
The variables a frame binds (collections, modes, aliases); without a node, every local variable. Opt-in format dtcg writes DTCG 2025.10 tokens: requires explicit collection and mode IDs plus out, takes no node, fails without publishing on any diagnostic. An alias into another collection exports its resolved value (aliasOf records the source), read in that collection's only mode or the aliasModes one. No workspace/index needed.
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": {
"file": "<file>"
},
"name": "variables"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| out | No | DTCG token file, preferably .tokens.json; required only for dtcg; create its parent directory first; never overwrites the source design | |
| file | Yes | the saved .fig: a local path (absolute recommended), or gs://bucket/object using gcloud; remote sources are unavailable with --root | |
| mode | No | exact modeId in that collection; required only for dtcg, no default | |
| node | No | the node, including full instance sublayer IDs; omit for every local variable | |
| format | No | rest (default) preserves variables JSON; dtcg exports one collection/mode | rest |
| aliasModes | No | dtcg only: {collectionId: modeId} naming the mode each aliased collection is read in; an alias into a single-mode collection needs no entry. Such aliases export resolved values with aliasOf recording the first target | |
| collection | No | exact collection ID from variables: a local one, or a library one the file has cached copies of (exported from them, marked libraryCopy); required only for dtcg |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | ||
| modeId | No | ||
| variables | No | ||
| tokenCount | No | ||
| collections | No | ||
| diagnostics | No | ||
| collectionId | No | ||
| missingVariables | No |