Skip to main content
Glama

use_figma

Run JavaScript against the Figma plugin API to create or edit designs in the file open in Figma Desktop, returning node details and console output.

Instructions

Create or edit designs in the file open in Figma Desktop by running JavaScript against the Figma plugin API. code is the body of an async function with figma in scope: use await, and return a value (nodes come back as {id, name, type, x, y, width, height}); console.log output is returned too. The whole run is one undo step. If the script throws, the changes it made before the error stay.

Rules of the plugin API here:

  • The file uses dynamic page loading: use figma.getNodeByIdAsync, figma.setCurrentPageAsync, await page.loadAsync() before reading another page, getMainComponentAsync, and the *Async style/variable getters.

  • Load every font before setting text or text properties: await figma.loadFontAsync({ family: "Inter", style: "Regular" }). Check figma.listAvailableFontsAsync() when unsure a font exists.

  • Colours are 0-1 RGB: fills = [{ type: "SOLID", color: { r: 1, g: 0.4, b: 0 } }]. Paint arrays are immutable: assign a new array.

  • Prefer auto layout: layoutMode, itemSpacing, padding*, primaryAxisAlignItems, counterAxisAlignItems; set layoutSizingHorizontal/Vertical ("FILL", "HUG", "FIXED") only after the node is appended to an auto-layout parent.

  • New nodes land on the current page: place top-level frames clear of existing ones, and append children with parent.appendChild(node).

  • Reuse what the file has: find its components, styles and variables with search_design_system first, and set bound variables with figma.variables.setBoundVariableForPaint.

  • Images from the web: const img = await figma.createImageAsync(url), then fills = [{ type: "IMAGE", imageHash: img.hash, scaleMode: "FILL" }]. fetch(url) works too (e.g. an SVG for figma.createNodeFromSvg). Local files go in with place_image.

  • figma.currentPage.selection = [node] and figma.viewport.scrollAndZoomIntoView([node]) show the result.

Build a screen in a few calls (structure, then sections), return the ids, and check each step with get_screenshot.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesBody of an async function run with `figma` in scope.
fileKeyNoThe key of the Figma file. Accepted for compatibility; the file open in Figma Desktop is always used.
timeoutMsNoHow long to wait for the script, in ms (default 60000).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.5.1

TDQS

A4.6/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so richly: it discloses undo semantics ("one undo step"), partial-failure behavior (changes before a throw persist), class-scoping of `code`, what is returned (nodes as {id, name, type, x, y, width, height} plus console.log), and many API constraints. These are exactly the side-effect and failure traits an agent needs before executing arbitrary code.

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?

Long, but front-loaded with purpose and structured as a scannable rules list where each bullet is directly actionable for writing plugin-API code. Some API detail (colour format, auto-layout properties) is verbose, but for a code-execution tool the density is largely justified and nothing reads as filler.

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 no-annotation, no-output-schema code-execution tool, the description supplies what an agent needs to call it correctly: input contract, return shape, error behaviour, environment constraints, and a workflow loop with sibling tools. Nothing essential for correct invocation is missing.

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. The description adds meaning beyond the schema for `code` by specifying it is the body of an async function with `figma` in scope, that await should be used, and what a returned value looks like, which shapes how the agent authors the parameter. It adds little for fileKey/timeoutMs, but those are already fully documented in 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 pair and resource ("Create or edit designs in the file open in Figma Desktop") plus the mechanism (running JavaScript against the Figma plugin API). This is clearly distinguishable from siblings like get_screenshot, place_image, or search_design_system, which are read/lookup tools.

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?

Routes the agent to siblings explicitly: use search_design_system first to reuse components/styles/variables, place_image for local files, and get_screenshot to check each step. It also frames the workflow ("Build a screen in a few calls... return the ids"). It lacks an explicit when-not-to-use statement, but the conditional routing is clear and actionable.

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