Skip to main content
Glama

component_map

Read-only

Reuse existing local code components by mapping Figma instances to them, with override support and stale mapping detection.

Instructions

Map the Figma component instances in a selection/subtree to existing local code components, so they can be reused instead of regenerated. Joins the grounded Figma component names (and their variant axes) against an AST scan of the project; an explicit docs/figma-component-map.md row (FigmaName | code/path) overrides the fuzzy match — this file is the durable record a verified mapping is written back to, so the next run reuses it instead of re-guessing. A row whose target no longer resolves (deleted/renamed) is reported in staleOverrides and degrades to the fuzzy result rather than a phantom import. Each distinct component is mapped once with all its instance ids. A mapped candidate also reports matchedProps (Figma axes the component already has) and unmatchedProps (axes it lacks → component-extension TODOs). Returns { mappings (candidate + confidence + status high/medium/low/unmapped), unmapped, staleOverrides, profile }.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nodeIdNoRoot node id; omit to use the selection or current page
rootDirNoProject root to scan; defaults to the server cwd
thresholdNoConfidence at/above which a match counts as a reliable reuse (default 0.7)
Behavior5/5

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

The description goes far beyond the readOnlyHint annotation, detailing the AST scan, the override mechanism with docs/figma-component-map.md, handling of staleOverrides degrading to fuzzy results, mapping each component once, and reporting matchedProps/unmatchedProps. This extensive disclosure gives the agent a deep understanding of the tool's behavior without contradicting annotations.

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 relatively long but every sentence contributes substantive detail about the tool's logic, edge cases, and outputs. There is minor repetition of the 'reuse' theme, but overall it is structured and information-dense without unnecessary fluff.

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 and the absence of an output schema, the description provides a comprehensive overview including the return structure ('{ mappings ... unmapped, staleOverrides, profile }'), the override mechanism, and how stale entries are handled. It is sufficiently complete for an agent to select and invoke the tool correctly, though more detail on the 'candidate' fields could be added.

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?

The input schema covers 100% of the parameters (nodeId, rootDir, threshold) with descriptive text. The tool description does not add significant parameter-level detail; it focuses on high-level behavior. Since schema coverage is complete, the baseline of 3 applies.

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 description clearly states the tool's function: 'Map the Figma component instances in a selection/subtree to existing local code components, so they can be reused instead of regenerated.' This provides a specific verb (map), resource (Figma component instances to code components), and purpose. It also distinguishes itself from sibling tools like scan_components or get_local_components by focusing on mapping/reuse.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives clear context for when to use the tool: when you need to map Figma components to existing local code components for reuse. It implies the scenario ('so they can be reused instead of regenerated') but does not explicitly mention when NOT to use it or provide alternative tool names. Thus it meets the 'clear context, no exclusions' bar.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/awdr74100/figwright'

If you have feedback or need assistance with the MCP directory API, please join our Discord server