Detect Unused Tokens
detect_unused_tokensScan a GitHub repository against Figma design tokens to identify unused tokens, then report which CSS, SCSS, or Tailwind variables have zero code references.
Instructions
Scan a GitHub repository for design token usage and identify unused tokens.
Extracts tokens from a Figma file, derives CSS/SCSS/Tailwind variable names, and searches the GitHub repo for references. Reports which tokens have zero references in the codebase.
Args:
figma_file_key (string): The Figma file key from the URL
github_repo (string): GitHub repository in 'owner/repo' format
collection_names (string[], optional): Filter to specific variable collections
search_patterns (string[]): Pattern types to search: 'css', 'scss', 'tailwind', 'all' (default: ['all'])
file_extensions (string[], optional): Filter to specific file extensions
Returns: JSON report with total/used/unused token counts, usage map, and list of unused tokens.
Examples:
"Find unused tokens in our repo" → detect_unused_tokens with figma_file_key + github_repo
"Check if color tokens are used" → detect_unused_tokens with collection_names: ["Colors"]
"Search only CSS files" → detect_unused_tokens with file_extensions: ["css", "scss"]
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>",
"github_repo": "<github_repo>"
},
"name": "detect_unused_tokens"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| github_repo | Yes | GitHub repository in 'owner/repo' format | |
| figma_file_key | Yes | The Figma file key (from the URL: figma.com/design/{THIS_PART}/...) | |
| file_extensions | No | Filter search to specific file extensions (e.g. ['tsx', 'css', 'scss']) | |
| search_patterns | No | Token reference patterns to search for (default: all) | |
| collection_names | No | Filter to specific variable collection names |