figma_tokens
Export, diff, or import Figma file variables as design-token JSON, with dry-run planning and guarded writes to keep design tokens in sync.
Instructions
Export, diff or sync the file's local variables as a design-token document. "export" writes figma-tokens/v1 with every collection, mode, value, description and alias; "diff" compares a document with the live file; "import" (dry run by default) creates missing collections, modes and variables, updates values/descriptions, and verifies every mode after writing. A plain DTCG tree is accepted on import with collection/mode (default Tokens / Mode 1); supported types are color, number, dimension (px is dropped into a unitless FLOAT), string, boolean, fontFamily and fontWeight. Unsupported DTCG types block the import instead of being dropped. Import is one undo transaction and requires the fingerprint from a dry run plus the planId; a changed file or changed live variables is refused before writing. A remote/library alias carries remote:true and its live variable id; only an unchanged binding is preserved, never rebound by name. prune is off by default and, when enabled, deletes only variables in the named collections and only with allowDestructive:true; aliases pointing at a pruned variable block the plan. Modes that the document does not name are preserved for existing variables and filled from the default managed mode for new variables, with that fact in the plan.
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": {
"path": "<path>"
},
"name": "figma_tokens"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | Plain DTCG import: destination mode name (default Mode 1) | |
| path | Yes | export: destination JSON; diff/import: the token document to read | |
| prune | No | Import: delete variables absent from the document in the named collections. Off by default. | |
| action | No | export: write the live variables to path | diff: compare path with live | import: dry run or apply path | export |
| dryRun | No | Import: TRUE (default) plans and fingerprints; FALSE applies. | |
| planId | No | Import apply: the planId returned by the dry run; required when dryRun:false. | |
| fileKey | No | Which connected Figma file to use: its fileKey (figma_whoami) or, when omitted, the only connected file. Required once more than one file is connected; figma_ping lists them. | |
| collection | No | Plain DTCG import: destination collection name (default Tokens) | |
| maxChanges | No | Maximum changes listed in the reply; counts stay complete and truncation is reported. | |
| allowDestructive | No | Import + prune: confirms variable deletion. Node bindings to deleted variables will break. | |
| expectedFingerprint | No | Import apply: the fingerprint returned by the dry run; required when dryRun:false. |