Get Design Context
get_design_contextRetrieves 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
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | 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). | |
| nodeId | No | The 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. | |
| screen | No | Draw the node as a phone screen that fills the screen and scrolls when tall (default: portrait frames 300-480 wide). | |
| fileKey | No | The key of the Figma file. Accepted for compatibility; the file open in Figma Desktop is always used. | |
| assetsDir | No | 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. | |
| forceCode | No | Always return code, even for very large nodes. | |
| framework | No | 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. | |
| screenUtil | No | Flutter: 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). | |
| skillNames | No | Accepted for compatibility (logging only). | |
| clientLanguages | No | Comma separated languages of the client, e.g. "dart" or "swift" (picks the framework). | |
| clientFrameworks | No | Comma separated frameworks of the client, e.g. "flutter" or "swiftui" (picks the framework). | |
| exactLineHeights | No | 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. | |
| excludeScreenshot | No | Leave the screenshot out of the response. | |
| disableCodeConnect | No | Draw mapped components from their layers instead of naming the code component. |