Skip to main content
Glama

Generate Coded Components

generate_coded_components
Read-onlyIdempotent

Generate framework-specific components from Figma designs by extracting layout, styles, and design tokens into React, Tailwind, React Native, or HTML/CSS code.

Instructions

Generate production-ready, pixel-perfect coded components from Figma.

Extracts layout, colors, typography, spacing, effects from Figma node trees, resolves variable bindings to design tokens, diffs variants for state/dimensional overrides, detects nested components, and emits framework-specific code.

Args:

  • figma_file_key (string): The Figma file key

  • component_names (string[], optional): Specific components (default: all)

  • framework ('react-tailwind' | 'react-css' | 'react-native' | 'html-css'): Target framework

  • output_dir (string): Output directory (default: 'src/components')

  • state_prop_names (string[]): Variant props that become CSS pseudo-classes

  • include_storybook (boolean): Generate Storybook files (default: false)

Returns: JSON with generated component files, props, dependencies, and summary.

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>",
      "framework": "<framework>"
    },
    "name": "generate_coded_components"
  }
}

Input Schema

NameRequiredDescriptionDefault
frameworkYesTarget framework for code generation
output_dirNoOutput directory for generated components (default: 'src/components')src/components
figma_file_keyYesThe Figma file key (from the URL: figma.com/design/{THIS_PART}/...)
component_namesNoSpecific component names to generate (default: all)
state_prop_namesNoVariant prop names that map to CSS pseudo-classes (default: ['State', 'Status', 'Interaction'])
include_storybookNoGenerate Storybook story files (default: false)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.1

TDQS

A3.5/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true and openWorldHint=true, so the safety profile is largely covered, and the description adds real process detail (variable-binding resolution to design tokens, variant diffing for state/dimensional overrides, nested-component detection). The significant gap is that it never resolves whether output_dir means files are actually written to disk, which is exactly the behavior an agent needs to know given readOnlyHint=true.

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 the purpose, followed by a compact pipeline summary and organized Args/Returns sections, so an agent can skim it quickly. It loses a point for the Args block, which duplicates schema content that is already fully documented and could have been replaced with behavioral notes.

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?

With no output schema, the description does supply a return summary ('JSON with generated component files, props, dependencies, and summary'), and it covers all six parameters. What it omits — file-write vs. in-response semantics, overwrite behavior, and failure modes — matters for a tool that emits code into a target directory.

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 explains every parameter including the framework enum and the state_prop_names default. The 'Args' block mostly restates the schema; the one genuinely useful addition is that state_prop_names maps to CSS pseudo-classes, but that phrasing is already present in the schema description.

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 opening sentence names a specific verb and artifact ('Generate ... coded components from Figma'), and the pipeline sentence pins down the source of truth (Figma node trees) and the output (framework-specific code). This implicitly separates it from extraction siblings like extract_styles or extract_tokens, but no sibling is named or contrasted explicitly, so it stops short of a 5.

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?

Usage is implied rather than stated: you supply a Figma file key plus a framework and get components back, with component_names defaulting to 'all'. There is no when-to-use vs. when-not guidance, no mention of prerequisites (Figma auth/access), no statement about whether existing files in output_dir are overwritten, and no pointer to alternative tools such as extract_tokens or implement_design.

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