figma_get_variables
Extract Figma design tokens, variables, color and spacing values, and code exports for CSS, Tailwind, TypeScript, or Sass, including Light/Dark modes and filtered collections.
Instructions
Extract design tokens and variables from a Figma file with code export support (CSS, Tailwind, TypeScript, Sass). Use when user asks for: design system tokens, variables, color/spacing values, theme data, or code exports. Handles multi-mode variables (Light/Dark themes). NOT for component metadata (use figma_get_component). Supports filtering by collection/mode/name and verbosity control to prevent token exhaustion. Enterprise plan required for Variables API; automatically falls back to Styles API or console-based extraction if unavailable. TIP: For full design system extraction (tokens + components + styles combined), prefer figma_get_design_system_kit instead — it returns everything in one optimized call.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "figma_get_variables"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | Filter variables by mode name or ID. Only returns variables that have values for this mode. Only applies when format='filtered'. Example: 'Light' or 'Dark' | |
| page | No | Page number for paginated results (1-based). Use when response is too large (>1MB). Each page returns up to 50 variables. | |
| enrich | No | Set to true when user asks for: CSS/Sass/Tailwind exports, code examples, design tokens, usage information, dependencies, or any export format. Adds resolved values, dependency graphs, and usage analysis. Default: false | |
| format | No | Response format: 'summary' (~2K tokens with overview and names only), 'filtered' (apply collection/name/mode filters), 'full' (complete dataset from cache or fetch). Summary is recommended for initial exploration. Full format returns all data but may be auto-summarized if >25K tokens. Default: full | full |
| fileUrl | No | Figma file URL (e.g., https://figma.com/design/abc123). Auto-detected from WebSocket Desktop Bridge connection. Only required if not connected. | |
| pageSize | No | Number of variables per page (1-100). Default: 50. Smaller values reduce response size. | |
| verbosity | No | Controls payload size: 'inventory' (names/IDs only, ~95% smaller, use with filtered), 'summary' (names/values only, ~80% smaller), 'standard' (essential properties, ~45% smaller), 'full' (everything). Default: standard | standard |
| collection | No | Filter variables by collection name or ID. Case-insensitive substring match. Only applies when format='filtered'. Example: 'Primitives' or 'VariableCollectionId:123' | |
| namePattern | No | Filter variables by name using regex pattern or substring. Case-insensitive. Only applies when format='filtered'. Example: 'color/brand' or '^typography' | |
| refreshCache | No | Force refresh cache by fetching fresh data from Figma. Use when data may have changed since last fetch. Default: false (use cached data if available and fresh) | |
| include_usage | No | Include usage in styles and components (requires enrich=true) | |
| returnAsLinks | No | Return variables as resource_link references instead of full data. Drastically reduces payload size (100+ variables = ~20KB vs >1MB). Use with figma_get_variable_by_id to fetch specific variables. Recommended for large variable sets. Default: false | |
| export_formats | No | Which code formats to generate examples for. Use when user mentions specific formats like 'CSS', 'Tailwind', 'SCSS', 'TypeScript', etc. Automatically enables enrichment. | |
| resolveAliases | No | Automatically resolve variable aliases to their final values (hex colors, numbers, etc.). When true, each variable will include a 'resolvedValuesByMode' field with the actual values instead of just alias references. Useful for getting color hex values without manual resolution. Default: false. | |
| include_exports | No | Include export format examples (requires enrich=true) | |
| includePublished | No | Include published variables from libraries | |
| parseFromConsole | No | Parse variables from console logs after user has executed the snippet. This is STEP 2 of the two-call workflow. Set to true ONLY after: (1) you received a console snippet from the first call, (2) instructed the user to run it in Figma's PLUGIN console (Plugins → Development → Open Console or existing plugin), (3) user confirmed they ran the snippet and saw '✅ Variables data captured!' message. Default: false. Never set to true on the first call. | |
| useConsoleFallback | No | Enable automatic fallback to console-based extraction when REST API returns 403 (Figma Enterprise plan required). When enabled, provides a JavaScript snippet that users run in Figma's plugin console. This is STEP 1 of a two-call workflow. After receiving the snippet, instruct the user to run it, then call this tool again with parseFromConsole=true. Default: true. Set to false only to disable the fallback entirely. | |
| include_dependencies | No | Include variable dependency graph (requires enrich=true) |