Sync Tokens to Code
sync_tokens_to_codeGenerate 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
| Name | Required | Description | Default |
|---|---|---|---|
| platforms | Yes | Target platforms to generate token files for | |
| output_dir | No | Output directory path for generated files (default: 'tokens') | tokens |
| figma_file_key | Yes | The Figma file key (from the URL: figma.com/design/{THIS_PART}/...) | |
| collection_names | No | Optional list of variable collection names to include |