Skip to main content
Glama

Get Design Context

get_design_context
Read-only

Retrieves design context for a Figma node and generates reference code, assets, a screenshot, and variables for design-to-code workflows, adapting to React, HTML, Flutter, or SwiftUI projects.

Instructions

Get design context for a Figma node — the primary tool for design-to-code workflows. Returns reference code (Flutter widgets for Flutter projects, SwiftUI views for Swift packages and Xcode projects, HTML + Tailwind for static sites, React + Tailwind otherwise), the assets it uses, a screenshot and the variables in the node. SwiftUI code comes with a Structure block naming what each part is (tab bar, segmented control, chips, carousel, grid, buttons, fields) and the pattern used for it. The code must be adapted to the target project. Use the nodeId parameter to specify a node id; from a URL like https://figma.com/design/:fileKey/:fileName?node-id=1-2 the node id is 1:2. With no nodeId the current selection in Figma is used. Large nodes return metadata instead of code unless forceCode is set.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "get_design_context"
  }
}

Input Schema

NameRequiredDescriptionDefault
pageNoReact and HTML: draw the node as a web page that fills the viewport, never narrower than the design, with full-width sections stretching (default: frames 768 or more wide).
nodeIdNoThe ID of the node, eg. "123:456" or "123-456" (instance ids like "I1:2;3:4" work too). Omit it to use the current selection in Figma.
screenNoDraw the node as a phone screen that fills the screen and scrolls when tall (default: portrait frames 300-480 wide).
fileKeyNoThe key of the Figma file. Accepted for compatibility; the file open in Figma Desktop is always used.
assetsDirNoFolder of the asset files in the code. Flutter default: the svg/png/images folders of the project's pubspec.yaml, else assets/figma. SwiftUI: the asset catalog to add image sets to (default: the project's *.xcassets, else Assets.xcassets). React default: public/figma (static/figma for SvelteKit), loaded by URL (/figma/name.svg). HTML default: assets/figma, relative to the page.
forceCodeNoAlways return code, even for very large nodes.
frameworkNoCode to generate: react, html, flutter or swiftui. Default: from clientFrameworks / clientLanguages, else FIGMA_LOCAL_MCP_FRAMEWORK, else flutter when the project has a pubspec.yaml, swiftui when it has a Package.swift, .xcodeproj or .xcworkspace, html for a static site (index.html without package.json), else react.
screenUtilNoFlutter: write lengths with flutter_screenutil (.w, .h, .r, .sp) so the layout scales from the design size (default: when the project's pubspec.yaml depends on flutter_screenutil).
skillNamesNoAccepted for compatibility (logging only).
clientLanguagesNoComma separated languages of the client, e.g. "dart" or "swift" (picks the framework).
clientFrameworksNoComma separated frameworks of the client, e.g. "flutter" or "swiftui" (picks the framework).
exactLineHeightsNoSwiftUI: set Figma's default line heights too, which Figma rounds to whole points, so text matches the design to the pixel (default: true). false leaves default-height text at the face's own line height (within half a point per line) and the code shorter.
excludeScreenshotNoLeave the screenshot out of the response.
disableCodeConnectNoDraw mapped components from their layers instead of naming the code component.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv1.8.1
    • changedInput schema / properties / assetsDir / description
      Previous value: -"Folder of the asset files in the code. Flutter default: the svg/png/images folders of the project's pubspec.yaml, else assets/figma. React default: public/figma (static/figma for SvelteKit), loaded by URL (/figma/name.svg). HTML default: assets/figma, relative to the page."New value: +"Folder of the asset files in the code. Flutter default: the svg/png/images folders of the project's pubspec.yaml, else assets/figma. SwiftUI: the asset catalog to add image sets to (default: the project's *.xcassets, else Assets.xcassets). React default: public/figma (static/figma for SvelteKit), loaded by URL (/figma/name.svg). HTML default: assets/figma, relative to the page."
    • changedInput schema / properties / clientFrameworks / description
      Previous value: -"Comma separated frameworks of the client, e.g. \"flutter\" (picks the framework)."New value: +"Comma separated frameworks of the client, e.g. \"flutter\" or \"swiftui\" (picks the framework)."
    • changedInput schema / properties / clientLanguages / description
      Previous value: -"Comma separated languages of the client, e.g. \"dart\" (picks the framework)."New value: +"Comma separated languages of the client, e.g. \"dart\" or \"swift\" (picks the framework)."
    • addedInput schema / properties / exactLineHeights
      Added value: +{
      +  "description": "SwiftUI: set Figma's default line heights too, which Figma rounds to whole points, so text matches the design to the pixel (default: true). false leaves default-height text at the face's own line height (within half a point per line) and the code shorter.",
      +  "type": "boolean"
      +}
    • changedInput schema / properties / framework / description
      Previous value: -"Code to generate: react, html or flutter. Default: from clientFrameworks / clientLanguages, else FIGMA_LOCAL_MCP_FRAMEWORK, else flutter when the project has a pubspec.yaml, html for a static site (index.html without package.json), else react."New value: +"Code to generate: react, html, flutter or swiftui. Default: from clientFrameworks / clientLanguages, else FIGMA_LOCAL_MCP_FRAMEWORK, else flutter when the project has a pubspec.yaml, swiftui when it has a Package.swift, .xcodeproj or .xcworkspace, html for a static site (index.html without package.json), else react."
    • changedInput schema / properties / framework / enum
      Previous value: -[
      -  "react",
      -  "html",
      -  "flutter"
      -]New value: +[
      +  "react",
      +  "html",
      +  "flutter",
      +  "swiftui"
      +]
  2. Changed5 schema fields changed
    • changedInput schema / properties / assetsDir / description
      Previous value: -"Flutter: folder of the asset paths in the code (default: the svg/png/images folders of the project's pubspec.yaml, else assets/figma)."New value: +"Folder of the asset files in the code. Flutter default: the svg/png/images folders of the project's pubspec.yaml, else assets/figma. React default: public/figma (static/figma for SvelteKit), loaded by URL (/figma/name.svg). HTML default: assets/figma, relative to the page."
    • changedInput schema / properties / framework / description
      Previous value: -"Code to generate: flutter or react. Default: from clientFrameworks / clientLanguages, else FIGMA_LOCAL_MCP_FRAMEWORK, else flutter when the project has a pubspec.yaml, else react."New value: +"Code to generate: react, html or flutter. Default: from clientFrameworks / clientLanguages, else FIGMA_LOCAL_MCP_FRAMEWORK, else flutter when the project has a pubspec.yaml, html for a static site (index.html without package.json), else react."
    • changedInput schema / properties / framework / enum
      Previous value: -[
      -  "react",
      -  "flutter"
      -]New value: +[
      +  "react",
      +  "html",
      +  "flutter"
      +]
    • addedInput schema / properties / page
      Added value: +{
      +  "description": "React and HTML: draw the node as a web page that fills the viewport, never narrower than the design, with full-width sections stretching (default: frames 768 or more wide).",
      +  "type": "boolean"
      +}
    • changedInput schema / properties / screen / description
      Previous value: -"Flutter: draw the node as a phone screen that fills the screen and scrolls when tall (default: portrait frames 300-480 wide)."New value: +"Draw the node as a phone screen that fills the screen and scrolls when tall (default: portrait frames 300-480 wide)."
  3. First observedv1.5.1

TDQS

A4.6/5.0
Behavior5/5

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

Adds substantial behavior beyond the readOnly/openWorld annotations: the exact reference-code output per framework, that code must be adapted to the target project, that a screenshot and assets are included, and that large nodes silently return metadata unless forceCode is set — a critical surprise the agent would otherwise miss.

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?

Dense but front-loaded: identity and output shape come first, then nodeId usage, then the large-node caveat. The framework parenthetical enumeration is long but carries real information; little is wasted, though it could be broken into shorter clauses.

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

Completeness5/5

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

For a 14-parameter, zero-required tool with no output schema, the description covers what is returned (code, assets, screenshot, variables), framework-specific return variation, defaults, and the large-node degradation — enough for an agent to call it correctly without further context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description earns more by explaining the URL-to-nodeId conversion, the current-selection default, and the forceCode escape hatch for large nodes. The remaining 14 parameters (page, screen, screenUtil, exactLineHeights, etc.) are left entirely to the schema.

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?

States a specific verb+resource (get design context for a Figma node) and positions itself as the primary design-to-code tool, listing concrete outputs (Flutter/SwiftUI/HTML/React code, assets, screenshot, variables) that let an agent distinguish it from siblings like get_screenshot or get_metadata.

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?

Gives clear when-to-use framing ('primary tool for design-to-code workflows') and explains how to derive nodeId from a Figma URL and that omitting it uses the current selection. It lacks explicit when-not-to-use guidance or named alternatives for cases like raw metadata or a plain screenshot.

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