Skip to main content
Glama
southleft

figma-console-mcp

by southleft

figma_ds_extract_tokens

Extract design tokens from analyzed codebases into canonical DTCG JSON plus CSS, Tailwind, SCSS or TypeScript outputs by mining declared styles and recurring raw values.

Instructions

Extract design tokens from analyzed codebases into canonical DTCG JSON (plus optional CSS variables / Tailwind / SCSS / TypeScript projections). Mines declared styling intent first — :root and @theme custom properties (light+dark → multi-mode tokens), SCSS variables, tailwind.config theme values, shadcn HSL triples — then promotes recurring raw values (hex colors, spacing/radius/font sizes) above a frequency threshold. Every token carries provenance (source file:line, confidence, frequency) in $extensions. Names are structural as-mined; do a semantic-naming review pass with the user afterwards. The DTCG output is directly importable into Figma variables with figma_import_tokens (top-level groups become collections). Requires figma_ds_analyze to have run for the same outDir. Local Mode only.

Input Schema

NameRequiredDescriptionDefault
writeNoWrite token files to <outDir>/tokens/ (default true). False returns the DTCG document inline instead (dry run).
outDirNoThe outDir used in figma_ds_analyze (reads .extraction/analysis.json from it). Default: '<first target of the analysis run>/design-system' — pass explicitly when in doubt.
formatsNoToken file formats to write under <outDir>/tokens/. 'dtcg' (canonical) is always written. Match the app's styling method — e.g. add 'tailwind-v4' for a Tailwind app, 'scss' for SCSS.
targetsNoOverride: scan these app roots instead of the analysis manifest's targets (rarely needed).
dtcgDialectNoDTCG dialect: 'legacy' hex-string colors (max compatibility) or '2025' DTCG 2025.10 object colors/dimensions.legacy
minFrequencyNoHow often a raw (undeclared) value must recur to be promoted to a token (default 4). Values below the threshold are listed in the report for review.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.46.0

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it discloses the mining strategy (declared intent first, then frequency-based promotion), provenance in $extensions, structural naming and the need for semantic review, and the Local Mode restriction. It does not fully describe file-writing side effects or overwrite behavior, but the behavioral context is substantially richer than typical.

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?

Front-loaded with the core purpose, then logical progression through process, output, naming caveat, import path, and constraints. It is dense but every sentence contributes; a minor trim could improve it, but it is well structured and not padded.

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?

For a complex six-parameter tool with no output schema, the description covers the input prerequisite, extraction logic, output formats, provenance, naming limitation, downstream import, and mode restriction. It could state what the report contains or how file writes behave, but overall it is complete enough for correct invocation.

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 description coverage is 100%, so the schema already documents all six parameters in detail. The description reinforces the frequency threshold concept and mentions formats and outDir context, but adds little beyond what the schema provides. Baseline 3 is appropriate.

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

Purpose5/5

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

States a specific verb and resource: extract design tokens from analyzed codebases into canonical DTCG JSON, with optional projections. It clearly distinguishes this from sibling tools like figma_export_tokens and figma_get_token_values by emphasizing codebase mining, declared styling intent, and DTCG output.

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

Usage Guidelines4/5

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

Explicitly states the prerequisite that figma_ds_analyze must have run for the same outDir, and notes Local Mode only. It also points to figma_import_tokens as the downstream consumer. However, it does not contrast with alternatives such as figma_export_tokens or figma_setup_design_tokens, so a small gap remains.

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

Deploy Server

Other Tools