Skip to main content
Glama

Detect Unused Tokens

detect_unused_tokens
Read-onlyIdempotent

Scan 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

NameRequiredDescriptionDefault
github_repoYesGitHub repository in 'owner/repo' format
figma_file_keyYesThe Figma file key (from the URL: figma.com/design/{THIS_PART}/...)
file_extensionsNoFilter search to specific file extensions (e.g. ['tsx', 'css', 'scss'])
search_patternsNoToken reference patterns to search for (default: all)
collection_namesNoFilter to specific variable collection names

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.1

TDQS

A3.7/5.0
Behavior4/5

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

The description adds meaningful behavioral context beyond the annotations by explaining that it extracts tokens from Figma, derives CSS/SCSS/Tailwind names, searches GitHub references, and reports zero-reference tokens. It still does not mention authentication, rate limits, private repository handling, or other operational constraints.

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?

The description is structured and front-loaded with the core purpose, followed by process, arguments, return value, and examples. It is slightly redundant because the Args section repeats schema metadata that is already fully documented.

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

Completeness4/5

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

Given the tool’s complexity, no output schema, and rich annotations, the description is mostly complete: it explains the multi-system workflow and summarizes the returned report. The main missing contextual details are external access prerequisites and limitations around Figma or GitHub permissions.

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 description coverage is 100%, so the schema already defines all five parameters. The description largely repeats the same parameter meanings and defaults, adding only small usage context through examples rather than new semantic detail.

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?

The description clearly states the specific action: scan a GitHub repository for design token usage and identify unused tokens, including the supporting Figma extraction step. It does not explicitly differentiate itself from sibling tools such as extract_tokens, so it is clear but not fully sibling-aware.

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?

The examples show common invocation patterns, such as finding unused tokens, checking color tokens, and limiting to CSS/SCSS files. However, there is no explicit guidance on when to use this tool versus alternatives, nor any stated exclusions or prerequisites.

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