Skip to main content
Glama

Extract Design Tokens

extract_tokens

Extract design tokens (colors, fonts, spacing, radii, shadows) from a design image or spec and export them as CSS variables, Tailwind config, W3C JSON, or Figma Tokens Studio JSON.

Instructions

Extract design tokens (colors, fonts, spacing, radii, shadows) from a design and export them as CSS variables, a Tailwind config, W3C design tokens JSON, or Figma (Tokens Studio) JSON.

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": "extract_tokens"
  }
}

Input Schema

NameRequiredDescriptionDefault
specNoJSON spec from analyze_design
imageNoLocal file path or http(s) URL of the design image
formatNoExport format. 'figma' = Tokens Studio JSON, 'json' = W3C design tokenscss

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

B3.2/5.0
Behavior2/5

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

No annotations are supplied, so the description carries the full behavioral burden and mostly repeats the name. It does not say whether export means returning text or writing files to disk, whether spec or image (or both) is required given zero required parameters, what happens on invalid input, or how large designs are handled.

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?

A single front-loaded sentence that leads with the verb and resource, then enumerates scope and output modes. The parenthetical lists are dense but every item is informative; nothing is wasted, though the sentence becomes long.

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

Completeness3/5

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

With no output schema and no annotations, the description should do more than name output formats. It never explains what the return value looks like (generated file paths vs token content), nor how the two optional inputs (spec, image) interact, which is the key ambiguity for an agent with zero required parameters.

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 three parameters are already documented, including the format enum with the 'figma' and 'json' clarifications. The description largely restates the format enum values, adding a small amount of mapping context but nothing about the spec/image relationship.

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?

States a specific verb (extract) and resource (design tokens) and enumerates the token categories and four export formats, which makes the tool's function unambiguous. It does not distinguish itself from siblings like extract_css_tokens or generate_motion_tokens, so an agent cannot tell from the description alone which extraction tool applies.

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?

Implies usage by saying tokens come 'from a design,' and the format list helps with choosing an output mode. There is no explicit when-to-use/when-not guidance, no mention of the analyze_design prerequisite, and no routing away from the closely named extract_css_tokens sibling.

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