Skip to main content
Glama

token_map

Read-only

Map Figma variables and paint styles to project design tokens from CSS or Tailwind config, enabling code generation that uses existing tokens instead of hard-coded values.

Instructions

Map the document's Figma variables — and its shared paint styles (single solid color styles, the design-token mechanism of pre-variables files; such rows carry source: 'style') — to the project's design tokens, so generated code references existing tokens instead of hard-coded values. Joins the grounded Figma names + values against tokens parsed from the project CSS (Tailwind v4 @theme or :root custom properties); the match is name-based with an exact color value-match as confirmation. When several project tokens share the exact same color value and the name cannot pick one, the mapping is capped below 'high' and candidate.ambiguousWith lists the other same-value tokens — verify that pick semantically instead of trusting it blindly. On a Tailwind project a variable that hits a framework built-in scale (spacing/N, line-height/N, weight/*) is reported as status 'framework-builtin' with { builtin: { scale, step } } rather than unmapped — it has no @theme token but the utility (p-4 / gap-4, leading-7, font-bold) is still usable. A variable in a multi-mode collection whose value differs per mode (a Light/Dark theme) carries figmaModes (mode name → value per theme; figmaValue is only the default mode), and the result lists themedCollections — keep such tokens theme-aware (a token that itself switches per theme, or the non-default values wired through the project's dark-mode mechanism), never just the default-mode literal. tokenSource overrides the detected styling config; rootDir defaults to the server cwd. Tailwind v3 JS configs are not yet parsed (pass tokenSource to a CSS file). An explicit docs/figma-token-map.md row (FigmaName | ref) overrides the fuzzy join with matchedBy ["map-file"] — this file is the durable record a verified token mapping is written back to, so the next run reuses it instead of re-guessing an ambiguous or value-only match. A row whose ref no longer resolves to a project token is reported in staleOverrides and degrades to the normal join. Returns { mappings (candidate + confidence + status + matchedBy + builtin), unmapped, staleOverrides, tokenSource, profile }.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rootDirNoProject root; defaults to the server cwd
thresholdNoConfidence at/above which a match counts as reliable (default 0.7)
tokenSourceNoPath (relative to rootDir) to a CSS file holding the tokens; overrides detection
Behavior5/5

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

The description thoroughly discloses behavioral traits: name-based matching with exact color value confirmation, confidence thresholds, handling of ambiguous matches via candidate.ambiguousWith, framework built-in detection, theme-aware mappings for multi-mode collections, and handling of stale overrides. This goes well beyond the annotations which only indicate read-only behavior.

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?

The description is comprehensive but somewhat long; however, it is well-structured with clear sections for each major behavior. While every sentence adds value, it could be slightly more concise without losing information.

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

Completeness5/5

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

Given the tool's complexity and the absence of an output schema, the description covers all necessary context: input parameters, matching logic, output structure (mappings, unmapped, staleOverrides, etc.), and numerous edge cases. It is sufficiently complete for an agent to invoke the tool correctly.

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?

The input schema has 100% description coverage, so the description adds minimal new meaning beyond default values and usage context. The schema already explains rootDir, threshold, and tokenSource with descriptions, making the description's extra details (like default thresholds) helpful but not essential.

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?

The description clearly states the tool maps Figma variables and paint styles to project design tokens, enabling code generation that references existing tokens. It is specific and distinguishes itself from sibling tools like icon_map or component_map by focusing on token mapping.

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

Usage Guidelines5/5

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

The description provides extensive guidance on when to use the tool (to generate token-aware code) and covers numerous edge cases: ambiguous matches, framework built-ins, multi-mode collections, tokenSource overrides, and stale overrides. It implicitly indicates when not to use by describing scenarios where the mapping may be uncertain.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/awdr74100/figwright'

If you have feedback or need assistance with the MCP directory API, please join our Discord server