Skip to main content
Glama

Sync Tokens to Code

sync_tokens_to_code
Read-onlyIdempotent

Generate platform-specific design token files (CSS, SCSS, Tailwind, Swift, Kotlin, JSON) from Figma variables, returning file contents for review before committing or opening a PR.

Instructions

Generate platform-specific design token files from Figma variables.

Extracts tokens from Figma, transforms them through Style Dictionary into platform-specific code (CSS custom properties, SCSS variables, Tailwind config, Swift UIColor, Kotlin Compose, or JSON).

This tool does NOT commit files — it returns the generated file contents for review. Use generate_sync_pr to commit and create a PR.

Args:

  • figma_file_key (string): The Figma file key

  • platforms (string[]): Target platforms — one or more of: 'css', 'scss', 'tailwind', 'swift', 'kotlin', 'json'

  • collection_names (string[], optional): Filter to specific collections

  • output_dir (string, optional): Output directory path (default: 'tokens')

Returns: JSON with generated files (path + content) and a summary of what was generated per platform.

Examples:

  • "Generate CSS and SCSS tokens from Figma" → sync_tokens_to_code with platforms: ["css", "scss"]

  • "Create mobile tokens" → sync_tokens_to_code with platforms: ["swift", "kotlin"]

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "figma_file_key": "<figma_file_key>",
      "platforms": "<platforms>"
    },
    "name": "sync_tokens_to_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
platformsYesTarget platforms to generate token files for
output_dirNoOutput directory path for generated files (default: 'tokens')tokens
figma_file_keyYesThe Figma file key (from the URL: figma.com/design/{THIS_PART}/...)
collection_namesNoOptional list of variable collection names to include

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.1

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false, and the description is consistent with them while adding real context: the transformation pipeline, the fact that nothing is committed, and that the result is file contents returned for review. What it does not cover is authentication or prerequisite setup (e.g., a Figma access token or permissions on the file), which is the one behavioral gap for an openWorld tool.

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 purpose, then the exclusion, then Args/Returns/Examples — a clean hierarchy that an agent can scan. There is mild redundancy in restating all four parameters and their defaults when the schema already documents them at 100% coverage, but the examples justify the length.

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?

For a read-only generation tool with no output schema, the description supplies the return shape (JSON with generated files' path and content, plus a per-platform summary) and the key negative behavior (no commit). Nothing an agent needs to invoke it correctly or set expectations about the response is missing.

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 description coverage is 100%, so the baseline is 3, but the description earns an increment by enumerating the platform identifiers and pairing them with natural-language examples that show how a user request maps onto the platforms array. It adds little for figma_file_key and collection_names beyond what the schema already says, so it is not a 5.

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 opening sentence gives a specific verb and resource (generate design token files from Figma variables) and immediately scopes the mechanism (Style Dictionary transforms to CSS, SCSS, Tailwind, Swift, Kotlin, or JSON). It also explicitly distinguishes itself from the sibling that performs the commit step, so an agent can separate it from generate_sync_pr without opening either schema.

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 states the boundary explicitly: 'This tool does NOT commit files — it returns the generated file contents for review. Use generate_sync_pr to commit and create a PR.' It then reinforces routing with two intent-to-call examples ('Generate CSS and SCSS tokens' → platforms [css, scss]). Both when-to-use and when-to-use-something-else are covered.

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