Skip to main content
Glama

variables

Destructive

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

NameRequiredDescriptionDefault
outNoDTCG token file, preferably .tokens.json; required only for dtcg; create its parent directory first; never overwrites the source design
fileYesthe saved .fig: a local path (absolute recommended), or gs://bucket/object using gcloud; remote sources are unavailable with --root
modeNoexact modeId in that collection; required only for dtcg, no default
nodeNothe node, including full instance sublayer IDs; omit for every local variable
formatNorest (default) preserves variables JSON; dtcg exports one collection/moderest
aliasModesNodtcg 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
collectionNoexact 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

NameRequiredDescriptionDefault
pathNo
modeIdNo
variablesNo
tokenCountNo
collectionsNo
diagnosticsNo
collectionIdNo
missingVariablesNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv0.11.3
    • addedInput schema / properties / aliasModes
      Added value: +{
      +  "additionalProperties": {
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  "description": "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",
      +  "propertyNames": {
      +    "minLength": 1
      +  },
      +  "type": "object"
      +}
    • addedInput schema / properties / collection
      Added value: +{
      +  "description": "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",
      +  "minLength": 1,
      +  "type": "string"
      +}
    • addedInput schema / properties / format
      Added value: +{
      +  "default": "rest",
      +  "description": "rest (default) preserves variables JSON; dtcg exports one collection/mode",
      +  "enum": [
      +    "rest",
      +    "dtcg"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / mode
      Added value: +{
      +  "description": "exact modeId in that collection; required only for dtcg, no default",
      +  "minLength": 1,
      +  "type": "string"
      +}
    • addedInput schema / properties / out
      Added value: +{
      +  "description": "DTCG token file, preferably .tokens.json; required only for dtcg; create its parent directory first; never overwrites the source design",
      +  "minLength": 1,
      +  "type": "string"
      +}
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "oneOf": [
      +    {
      +      "required": [
      +        "variables",
      +        "collections",
      +        "missingVariables"
      +      ]
      +    },
      +    {
      +      "required": [
      +        "path",
      +        "collectionId",
      +        "modeId",
      +        "tokenCount",
      +        "diagnostics"
      +      ]
      +    }
      +  ],
      +  "properties": {
      +    "collectionId": {
      +      "type": "string"
      +    },
      +    "collections": {
      +      "type": "array"
      +    },
      +    "diagnostics": {
      +      "type": "array"
      +    },
      +    "missingVariables": {
      +      "type": "array"
      +    },
      +    "modeId": {
      +      "type": "string"
      +    },
      +    "path": {
      +      "type": "string"
      +    },
      +    "tokenCount": {
      +      "type": "integer"
      +    },
      +    "variables": {
      +      "type": "array"
      +    }
      +  },
      +  "type": "object"
      +}
  2. Changed1 schema field changedv0.9.3
    • changedInput schema / additionalProperties
      Previous value: -trueNew value: +false
  3. Changed4 schema fields changedv0.7.2
    • addedInput schema / additionalProperties
      Added value: +true
    • changedInput schema / properties / file / description
      Previous value: -"the .fig file (File > Save local copy): an absolute path, or gs://bucket/object"New value: +"the saved .fig: a local path (absolute recommended), or gs://bucket/object using gcloud; remote sources are unavailable with --root"
    • addedInput schema / properties / file / minLength
      Added value: +1
    • changedInput schema / properties / node / description
      Previous value: -"the frame; omit for every local variable"New value: +"the node, including full instance sublayer IDs; omit for every local variable"
  4. First observed

TDQS

A3.5/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare destructiveHint=true and openWorldHint=false; the description adds genuinely new behavior — DTCG output semantics, the all-or-nothing 'fails without publishing on any diagnostic' rule, and that aliases export resolved values with aliasOf recording the source. It does not explain what the destructiveHint covers or what happens to an existing file at `out` beyond 'never overwrites the source design', so the safety story is only half told.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Every clause carries information and the core scope statement is front-loaded before the dtcg caveats. The semicolon-chained, telegraphic phrasing makes it slower to parse than it needs to be, but there is no filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With an output schema, full annotation coverage, and 100% schema description coverage, the description carries only what structured fields cannot: alias resolution rules, mode requirements, and failure semantics. What remains missing is how the two paths relate — whether the default rest output also requires `out`, and whether a node is required when format=rest.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3 and the schema already documents every parameter including the dtcg-only constraints. The description adds a little cross-parameter meaning (alias into a single-mode collection needs no aliasModes entry; aliasOf records the first target), but that content is largely duplicated in the schema descriptions rather than extending them.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The resource is stated precisely: variables bound by a frame (with collections, modes, aliases) or, absent a node, every local variable, plus an opt-in DTCG token export mode. That is specific enough to distinguish it from a generic reader. It never names a sibling tool (inspect, nodes, export), so the boundary with adjacent tools is left to inference, which caps it at 4.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives real selection conditions for the dtcg path (requires explicit collection and mode IDs plus out, takes no node, fails without publishing on any diagnostic) and notes 'No workspace/index needed'. But there is no explicit when-to-use versus the other 19 siblings — nothing says when to reach for variables instead of inspect, nodes, or export.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.