Skip to main content
Glama

token_map

Read-only

Maps Figma variables and paint styles to project design tokens, so generated code uses defined tokens instead of hard-coded values. Handles ambiguous matches and multi-mode themes.

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?

Beyond the readOnlyHint annotation, the description richly discloses behaviors: ambiguity handling with candidate.ambiguousWith, framework built-in detection, multi-mode collection handling with themedCollections, map-file overrides, staleOverrides, and the return structure. It also notes a limitation (Tailwind v3 JS configs not yet parsed), which is excellent transparency.

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

Conciseness3/5

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

The description is a dense single paragraph with many nested clauses and parentheticals. While every sentence adds substantive information, the lack of structure (e.g., bullets, sections) and its length make it harder to parse quickly. It is thorough but not concise; a more structured format would improve it.

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 is highly complete. It explains edge cases (ambiguity, framework built-ins, multi-mode collections), override mechanisms, stale overrides, and the return object structure. This is more than sufficient for an agent to understand and invoke the tool correctly.

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

Parameters4/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. The description adds value by explaining that tokenSource can be pointed to a CSS file when Tailwind v3 JS configs are not parsed, and that rootDir defaults to the server cwd (also in schema). This extra practical guidance pushes it above baseline.

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's purpose: mapping Figma variables and shared paint styles to project design tokens so generated code references tokens instead of hard-coded values. It uses a specific verb ('Map') and a specific resource ('the document's Figma variables...and shared paint styles...to the project's design tokens'), and it distinguishes itself from sibling tools like component_map or icon_map by targeting token mapping specifically.

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?

The description provides clear context for when the tool is used (mapping tokens for code generation) and includes practical guidance like using tokenSource to override detection when Tailwind v3 JS configs are not parsed. However, it does not explicitly mention alternatives or when not to use the tool, so it falls short of a 5.

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