Skip to main content
Glama

Verify Code

verify_code
Idempotent

Check Flutter, SwiftUI, React, or HTML code against a Figma design by rendering it and comparing pixels; returns compiler/runtime errors and a diff image.

Instructions

Check Flutter, SwiftUI or React + Tailwind code against the design and compare the render with Figma's own 2x render of the node: Flutter code is analyzed and rendered with flutter test; SwiftUI code is compiled and rendered in the booted iOS simulator (Xcode needed); React and HTML render in headless Chrome with Tailwind. Returns compiler or analyzer errors, runtime errors (Flutter: overflows, missing assets; React: broken images), the share of differing pixels and a diff image (the design in grey, differing pixels in red). The framework comes from framework, else from the file's language, else from the client and the project like get_design_context.

React and HTML: without file it checks the code get_design_context generates and compares every layer's box too. With file (a .jsx or .tsx under a folder with package.json, or an .html page) it renders that file's default export or page: it must be self-contained apart from React and image imports; images load from the project's public folder. Pass css for the stylesheet with its tokens. React and Tailwind load from a CDN and the fonts from the system or Google Fonts. Needs Chrome and the puppeteer-core package.

Flutter and SwiftUI: with file, it checks that widget or view inside its own project: a Flutter widget with the project's packages and assets, inside a MaterialApp, scaled by flutter_screenutil to the frame size when the project uses it; a SwiftUI view compiled with the project's DesignSystem.swift and asset catalogs, so it must build without the rest of the project. The widget or view needs an init without arguments. Without file, it checks the reference code get_design_context generates and compares every layer's box with the design. Use it after implementing a frame, and fix what it reports. Text in fonts it cannot find is drawn in a fallback font, and emoji have no colour font in the Flutter test, so text after them shifts. The design's status bar and home indicator belong to the phone and are left out of the SwiftUI comparison. A run takes from 20 seconds to a few minutes.

Every result has a coverage block: what the run checked, and for each interactive element (from its role and the states its Figma component defines) the states, keyboard and screen-reader behaviour it did not check, plus screen-wide items (dark mode, other widths and text sizes, right-to-left). React and HTML runs also press Tab through the page: the Tab order, missing focus indicators, controls Enter or Space does not activate, missing accessible names and clickable elements the keyboard cannot reach. Hand the not-checked list back with the implementation.

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": "verify_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
cssNoReact: a CSS file to load with the component, e.g. its global stylesheet with the design tokens.
fileNoFlutter: the .dart file with the widget, under the project's lib/. SwiftUI: the .swift file with the view. React: the .jsx/.tsx component file. HTML: the .html page. Absolute, or relative to the project.
fontsNoFolders with font files (default: the project's assets/fonts and the system fonts).
deviceNoSwiftUI: the simulator to render in, by udid or name (default: a booted iPhone 17 Pro, another booted iPhone, else an iPhone Pro it boots). Renders are 2x and light mode on any device.
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.
widgetNoThe widget class or SwiftUI view struct in `file` (default: its first one).
fileKeyNoThe key of the Figma file. Accepted for compatibility; the file open in Figma Desktop is always used.
flutterNoFlutter: path of the flutter tool, when it is not on PATH.
interactNoSwiftUI, generated code: after rendering, tap every button of the screen and report what each did (redrew the screen, asked its owner through the Action enum, did nothing visible, or hung).
tailwindNoReact: the Tailwind major version (default: the project's, else 4).
viewportNoFlutter: lay the code out on a screen of this size, e.g. "360x780", and report runtime errors (overflows) and layers pushed off screen instead of comparing.
frameworkNoWhat to check (default: from the file's extension, else as get_design_context picks: the client, then the project).
dynamicTypeNoSwiftUI: render at this text size to check the layout under Dynamic Type (default large; the pixel comparison stays with the design at the default size).
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).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed11 schema fields changedv1.8.1
    • 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 / device
      Added value: +{
      +  "description": "SwiftUI: the simulator to render in, by udid or name (default: a booted iPhone 17 Pro, another booted iPhone, else an iPhone Pro it boots). Renders are 2x and light mode on any device.",
      +  "type": "string"
      +}
    • addedInput schema / properties / dynamicType
      Added value: +{
      +  "description": "SwiftUI: render at this text size to check the layout under Dynamic Type (default large; the pixel comparison stays with the design at the default size).",
      +  "enum": [
      +    "xSmall",
      +    "small",
      +    "medium",
      +    "large",
      +    "xLarge",
      +    "xxLarge",
      +    "xxxLarge",
      +    "accessibility1",
      +    "accessibility2",
      +    "accessibility3",
      +    "accessibility4",
      +    "accessibility5"
      +  ],
      +  "type": "string"
      +}
    • changedInput schema / properties / file / description
      Previous value: -"Flutter: the .dart file with the widget, under the project's lib/. React: the .jsx/.tsx component file. Absolute, or relative to the project."New value: +"Flutter: the .dart file with the widget, under the project's lib/. SwiftUI: the .swift file with the view. React: the .jsx/.tsx component file. HTML: the .html page. Absolute, or relative to the project."
    • changedInput schema / properties / flutter / description
      Previous value: -"Path of the flutter tool, when it is not on PATH."New value: +"Flutter: path of the flutter tool, when it is not on PATH."
    • changedInput schema / properties / framework / description
      Previous value: -"flutter or react (default: from the file, else as get_design_context picks: the client, then the project)."New value: +"What to check (default: from the file's extension, else as get_design_context picks: the client, then the project)."
    • changedInput schema / properties / framework / enum
      Previous value: -[
      -  "flutter",
      -  "react",
      -  "html"
      -]New value: +[
      +  "flutter",
      +  "swiftui",
      +  "react",
      +  "html"
      +]
    • addedInput schema / properties / interact
      Added value: +{
      +  "description": "SwiftUI, generated code: after rendering, tap every button of the screen and report what each did (redrew the screen, asked its owner through the Action enum, did nothing visible, or hung).",
      +  "type": "boolean"
      +}
    • changedInput schema / properties / viewport / description
      Previous value: -"Lay the code out on a screen of this size, e.g. \"360x780\", and report runtime errors (overflows) and layers pushed off screen instead of comparing."New value: +"Flutter: lay the code out on a screen of this size, e.g. \"360x780\", and report runtime errors (overflows) and layers pushed off screen instead of comparing."
    • changedInput schema / properties / widget / description
      Previous value: -"Flutter: the widget class in `file` (default: its first widget class)."New value: +"The widget class or SwiftUI view struct in `file` (default: its first one)."
  2. Changed7 schema fields changed
    • addedInput schema / properties / clientFrameworks
      Added value: +{
      +  "description": "Comma separated frameworks of the client, e.g. \"flutter\" (picks the framework).",
      +  "type": "string"
      +}
    • addedInput schema / properties / clientLanguages
      Added value: +{
      +  "description": "Comma separated languages of the client, e.g. \"dart\" (picks the framework).",
      +  "type": "string"
      +}
    • addedInput schema / properties / css
      Added value: +{
      +  "description": "React: a CSS file to load with the component, e.g. its global stylesheet with the design tokens.",
      +  "type": "string"
      +}
    • changedInput schema / properties / file / description
      Previous value: -"The .dart file with the widget, under the project's lib/ (absolute, or relative to the project)."New value: +"Flutter: the .dart file with the widget, under the project's lib/. React: the .jsx/.tsx component file. Absolute, or relative to the project."
    • addedInput schema / properties / framework
      Added value: +{
      +  "description": "flutter or react (default: from the file, else as get_design_context picks: the client, then the project).",
      +  "enum": [
      +    "flutter",
      +    "react",
      +    "html"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / tailwind
      Added value: +{
      +  "anyOf": [
      +    {
      +      "const": 3,
      +      "type": "number"
      +    },
      +    {
      +      "const": 4,
      +      "type": "number"
      +    }
      +  ],
      +  "description": "React: the Tailwind major version (default: the project's, else 4)."
      +}
    • changedInput schema / properties / widget / description
      Previous value: -"The widget class in `file` (default: its first widget class)."New value: +"Flutter: the widget class in `file` (default: its first widget class)."
  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?

Goes well beyond the annotations, disclosing runtime prerequisites (Xcode, Chrome, puppeteer-core), run duration (20 seconds to a few minutes), rendering caveats (fallback fonts, emoji shifting text, status bar excluded from SwiftUI comparison), and the coverage block contents. This is exactly the behavioral context an agent needs before invoking a long-running render tool.

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 core purpose and return values, then organized by framework. It is long and dense, with some repetition of the 'without file' behavior across paragraphs, but the length is largely justified by 15 parameters and four frameworks.

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 complex, multi-framework tool with no output schema, the description still explains return values (compiler/analyzer errors, runtime errors, pixel-diff share, diff image, coverage block) and per-framework prerequisites. An agent has enough to call it correctly and interpret results.

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 adds cross-parameter resolution logic the schema cannot express: framework is derived from `framework`, else the file's language, else the client and project. It also explains per-framework meaning of `file`, `viewport`, and `interact` beyond their schema text.

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 and resource: checks Flutter/SwiftUI/React+Tailwind code against the design and compares the render with Figma's 2x render. It names the concrete mechanisms (flutter test, iOS simulator, headless Chrome) and clearly distinguishes itself from get_design_context, which it references as the code generator.

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?

Explicitly says 'Use it after implementing a frame, and fix what it reports' and 'Hand the not-checked list back with the implementation', giving clear when-to-use context. It also routes to get_design_context for reference code. It stops short of stating when not to use it or naming a competing sibling for verification, so not a full 5.

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