Skip to main content
Glama
southleft

figma-console-mcp

by southleft

figma_execute

Runs arbitrary JavaScript inside Figma’s plugin context with full Figma API access to handle complex design operations not covered by other tools.

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 Desktop 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.

MULTI-FILE (Local Mode only): Pass fileKey to run this in a specific connected file without switching the active file/target lock (see figma_list_open_files). To run the same code across several connected files at once, use figma_execute_across_files instead. Cloud Mode pairs with a single plugin instance and rejects fileKey.

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 };'
fileKeyNoLocal Mode only. Run against this specific connected file instead of the active file. Does not change the active file or target lock. Get connected fileKeys from figma_list_open_files. Rejected in Cloud Mode, which pairs with a single plugin instance.
timeoutNoExecution timeout in milliseconds (default: 5000, max: 300000)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.46.0

TDQS

A4.5/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: it warns 'CAUTION: Can modify your document', states the Desktop Bridge plugin prerequisite, discloses silent-failure modes (empty arrays, null returns, text edits on instances), points at resultAnalysis.warning, and mandates cleanup of partial artifacts via node.remove() on retry. These are exactly the non-obvious traits an agent needs before invoking 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.

Conciseness3/5

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

Purpose and the primary alternative are front-loaded correctly, but the body is a long manual with four bolded sections, and the HOUSEBRIDGE/housekeeping block repeats the screenshot-before/after/on-retry instruction three times. Most sentences are actionable, yet the same guidance could be delivered in roughly half the space.

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 an arbitrary-code-execution tool with no output schema, the description covers prerequisites, mutation risk, silent-failure detection, validation loop, placement conventions, and cleanup obligations. Nothing an agent needs to call this safely and correctly is missing.

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 description coverage is 100%, so the baseline is 3. The MULTI-FILE paragraph restates the fileKey semantics already present in the schema (Local Mode only, does not change target lock, rejected in Cloud Mode) and says nothing about timeout beyond what the schema documents, so it adds routing value rather than new parameter 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 precise verb and resource: execute arbitrary JavaScript in Figma's plugin context with figma API access. It explicitly scopes itself as the fallback for 'complex operations not covered by other tools', which lets an agent distinguish it from the many narrow sibling tools (figma_resize_node, figma_set_text, etc.) without opening a schema.

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?

Names concrete alternatives and the conditions that select them: figma_set_instance_properties for INSTANCE nodes (with the warning that direct text editing fails silently), figma_capture_screenshot for validation, figma_list_open_files for fileKeys, and figma_execute_across_files for multi-file runs. It also states the exclusion that Cloud Mode rejects fileKey.

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