Skip to main content
Glama
figma-bridge

figma-bridge

by Seuketchi

figma_run

Execute JavaScript through the Figma Plugin API in an open design file to read or modify layers, pages, and styles, returning returned values, printed output, or errors.

Instructions

Run JavaScript in the open Figma file through the Plugin API, as the body of an async function with figma in scope (top-level await works). print(...) and console.log(...) are collected. Returns the value of a return statement, the printed lines, or the error with its stack. The plugin uses dynamic-page access: use figma.getNodeByIdAsync, figma.setCurrentPageAsync and page.loadAsync() before reading another page. A layer whose fonts are missing cannot be moved into another parent or re-stacked (appendChild, insertChild), only moved by x and y.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "code": "<code>"
    },
    "name": "figma_run"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYes
timeout_sNodefault 120

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.9/5.0
Behavior4/5

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

With no annotations, the description carries the full load and does well: it discloses that print and console.log output is collected, that the return value or error-with-stack comes back, and it flags two non-obvious quirks (dynamic-page access requirements, and that layers with missing fonts cannot be re-parented, only moved by x/y). It stops short of saying whether executed code mutates and persists in the file or what the timeout does on expiry.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Four tightly packed sentences, front-loaded with the core action and then the behavioral caveats. Dense but every clause carries information the agent needs; no filler or repetition.

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

Completeness4/5

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

This is an arbitrary-code-execution tool with no output schema and no annotations, so the description must explain returns and environment — and it largely does, covering return values, printed output, errors, page-navigation corollaries, and a font-related limitation. Missing: whether the code's changes persist to the document, and what happens when timeout_s expires.

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 50% (code undocumented, timeout_s documented as default 120), so the description must compensate and does: it explains that `code` is the body of an async function with `figma` in scope, that top-level await is allowed, and how output and return values are captured. The timeout_s parameter is left entirely to the schema, which is a minor gap given the default is stated there.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a precise verb and resource: run JavaScript in the open Figma file via the Plugin API. It states the execution context (async function body, `figma` in scope) so an agent knows exactly what is being invoked. It does not compare itself to siblings such as figma_run_file, which is the only thing separating it from a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives substantial how-to guidance (top-level await works, use figma.getNodeByIdAsync / setCurrentPageAsync / page.loadAsync before reading another page), which implicitly tells the agent how to write valid code. However, it never says when to choose this tool over figma_read or figma_run_file, nor any when-not conditions. Usage context is implied rather than stated.

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