Lupa

v0.3.4
io.github.wjkba/figma-lupa Checked 2 days ago Published 3 days ago

Read-only Figma for coding agents: exact layout, tokens mapped to your CSS, assets and a pixel diff.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

status Connection status

Which Figma files are connected through the Lupa plugin, their current page and selection.

get_outline Page outline

Lists pages and their top-level frames (ids, sizes) — a cheap map of the file for finding what to implement.

ParameterTypeDescription
depthintegerLevels below the page (default 1).
filestringWhich open Figma file (name or key) when several are connected. Default: the most recently active.
pagestringPage name or id; "*" lists every page's frames. Default: current page.

find_nodes Find layers

Search layers by name (or text content with text:true) across the file, a page, or inside a node.

ParameterTypeDescription
query *stringCase-insensitive substring.
filestringWhich open Figma file (name or key) when several are connected. Default: the most recently active.
limitinteger
pagestringPage name or id; "*" or omitted = all pages.
textbooleanMatch text content of text layers instead of layer names.
typesarrayLayer types, e.g. ["FRAME","COMPONENT","INSTANCE","TEXT"].
withinstringOnly search inside this node id.

get_design Read a design

The main tool: a compact, exact description of a frame/component (layout, sizes, colours, typography, tokens, components, overrides) for reproducing it in code. Output is breadth-first within a token budget; cut subtrees say how to fetch them.

ParameterTypeDescription
assets_dirstringAlso write the icons (SVG) and images to this folder; each layer then names its file in src: (saves a separate export_assets call).
budgetintegerApproximate output size in tokens (default 8000).
componentsstringauto (default): repeated components printed once + per-instance overrides. inline: every instance expanded. names: instances as one line (when the codebase already has them).
current_colorbooleanWith assets_dir: monochrome SVG icons use currentColor (default false).
depthintegerMax levels to read below the target (default: all).
expand_vectorsbooleanDescribe the shapes inside icons/illustrations instead of one svg line (default false).
filestringWhich open Figma file (name or key) when several are connected. Default: the most recently active.
include_hiddenbooleanInclude hidden layers (default false).
screenshotbooleanAlso return a PNG of the target (saves a separate get_screenshot call).
targetstringFigma URL, node id(s) like "12:34" (comma-separated), or omit for the current selection in Figma.

get_screenshot Screenshot

Renders the target as PNG image(s) you can look at. Wide renders are scaled to what vision can read; tall ones are split into tiles. Optionally saves the full-resolution PNG.

ParameterTypeDescription
filestringWhich open Figma file (name or key) when several are connected. Default: the most recently active.
save_tostringAlso write the PNG to this path (e.g. for visual tests).
scalenumberRender scale (default: 2, reduced to fit 1568px wide).
targetstringFigma URL, node id(s) like "12:34" (comma-separated), or omit for the current selection in Figma.

export_assets Export assets

Writes the icons (SVG) and images (original files) used inside the target to a folder, deduplicated, and lists which file belongs to which layer / src hash. as:"svg"|"png" exports the target layers themselves instead.

ParameterTypeDescription
asstringauto (default): every svg graphic + image fill inside the target.
current_colorbooleanReplace the single colour of monochrome SVG icons with currentColor (default false).
dirstringOutput folder (default "figma-assets" in the working directory).
filestringWhich open Figma file (name or key) when several are connected. Default: the most recently active.
scalenumberPNG scale for as:"png" (default 2).
targetstringFigma URL, node id(s) like "12:34" (comma-separated), or omit for the current selection in Figma.

get_tokens Design tokens

The file's local variables (all modes) and styles — as a readable list, CSS custom properties, or JSON.

ParameterTypeDescription
filestringWhich open Figma file (name or key) when several are connected. Default: the most recently active.
filterstringOnly tokens whose name contains this.
formatstringDefault list.

get_css Figma's CSS

Figma's own generated CSS (as in Dev Mode) for specific layers — a cross-check, not a layout description.

ParameterTypeDescription
filestringWhich open Figma file (name or key) when several are connected. Default: the most recently active.
targetstringFigma URL, node id(s) like "12:34" (comma-separated), or omit for the current selection in Figma.

compare_screenshot Compare with implementation

Pixel-diffs your implementation against the Figma render of the target. Pass url (+ selector) to have Lupa render your running page at the design's width, or image = a PNG screenshot. Returns the mismatch %, the differing regions mapped to Figma layers, and a design | implementation | diff image.

ParameterTypeDescription
filestringWhich open Figma file (name or key) when several are connected. Default: the most recently active.
imagestringInstead of url: path to a PNG screenshot of the implementation, cropped to the same element.
save_diffstringAlso write the comparison image to this path.
selectorstringCSS selector of the element to capture on that page (default: the full page).
targetstringFigma URL, node id(s) like "12:34" (comma-separated), or omit for the current selection in Figma.
thresholdnumberPer-pixel colour tolerance 0–1 (default 0.1).
urlstringPage with your implementation, e.g. http://localhost:5173/sheet. Rendered in headless Chromium at the design's width, 2x.
wait_forstringSelector to wait for before capturing (default: selector).