Skip to main content
Glama
Figma Canvas MCP

Figma Canvas MCP

by AmroJSawan

figma_execute

Execute custom JavaScript in Figma's plugin context to handle complex canvas operations not covered by other tools; requires Canvas Bridge and can modify your document.

Instructions

Execute arbitrary JavaScript in Figma's plugin context with full access to the figma API. Use for complex operations not covered by other tools. Requires Canvas Bridge plugin. CAUTION: Can modify your document.

COMPONENT INSTANCES: For instances (node.type === 'INSTANCE'), use figma_set_instance_properties — direct text editing FAILS SILENTLY. Check instance.componentProperties for available props (may have #nodeId suffixes).

RESULT ANALYSIS: Check resultAnalysis.warning for silent failures (empty arrays, null returns).

VALIDATION: After creating/modifying visuals: screenshot with figma_capture_screenshot, check alignment/spacing/proportions, iterate up to 3x.

PLACEMENT: Always create components inside a Section or Frame, never on blank canvas. Use parent.insertChild(0, bg) for z-ordering backgrounds behind content.

HOUSEKEEPING (MANDATORY): Before creating: screenshot the target page to see existing content and find clear space. When creating: place inside a named Section, positioned BELOW or AWAY from existing content. Never overlap. After creating: screenshot to verify clean placement and no overlaps. On failure/retry: DELETE any partial artifacts (empty frames, orphaned layers, blank pages) before retrying. Use node.remove() to clean up. Pages: NEVER create a new page if one with that name already exists — use the existing one. If you created a blank page during a failed attempt, delete it. Layers: If your code creates helper frames, placeholder nodes, or intermediate layers that aren't part of the final result, remove them.

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_execute"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesJavaScript code to execute. Has access to the 'figma' global object. Example: 'const rect = figma.createRectangle(); rect.resize(100, 100); return { id: rect.id };'
timeoutNoExecution timeout in milliseconds (default: 5000, max: 30000)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.17.3

TDQS

A4.3/5.0
Behavior4/5

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

No annotations exist, and the description carries the burden well: it warns "CAUTION: Can modify your document," discloses silent-failure modes and the resultAnalysis.warning check, states plugin/auth prerequisites, and documents mandatory cleanup of partial artifacts. What it does not cover explicitly is how the sandbox behaves on timeout (partial mutations?) or whether execution is undoable, which for arbitrary mutating code is the remaining gap.

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 purpose and caution, then organized under bold headings by concern, which makes it scannable despite its length. It is longer than typical (~250 words) and the housekeeping block repeats the screenshot-verify loop and cleanup advice across several bullets, some of which could be consolidated.

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?

No output schema exists, yet the description compensates by telling the agent to inspect resultAnalysis.warning, and it covers the full create-verify-cleanup lifecycle for a tool that can mutate a document. Missing only edge-case behavior around timeouts mid-execution and whether mutations are reversible.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% and the schema already documents both `code` (with an example) and `timeout` (default/max). The description adds no syntax or scoping detail about `code` beyond what the schema says, so it sits at the baseline rather than adding meaning.

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 ("Execute arbitrary JavaScript in Figma's plugin context with full access to the figma API") and immediately scopes it against siblings: "Use for complex operations not covered by other tools." An agent can tell this is the general-purpose escape hatch rather than a targeted tool.

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

Usage Guidelines5/5

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

Explicit when-to-use rule (complex operations not covered elsewhere) plus named routing for two concrete cases: instances go to figma_set_instance_properties, verification goes to figma_capture_screenshot. It also names a prerequisite (Canvas Bridge plugin) and a hard exclusion (direct text editing on INSTANCE nodes fails silently).

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

Deploy Server

Other Tools