Skip to main content
Glama
figma-forge-mcp

figma-forge-mcp

by TBlopT

run_code

Executes arbitrary Figma Plugin API code inside the plugin to handle tasks not covered by other tools, returning JSON results for automation and custom design operations.

Instructions

Escape hatch: run arbitrary Figma Plugin API code inside the plugin. code is the body of an async function receiving (figma, args, h); its return value (JSON) comes back. Use for anything not covered by other tools: vectors, boolean ops, component properties, export settings, etc.

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": "run_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
argsNo
codeYesBody of an async function, e.g. 'const n = figma.createStar(); return n.id;'

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.1/5.0
Behavior3/5

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

With no annotations, the description carries the full load, and it does disclose the execution contract: code runs as the body of an async function receiving (figma, args, h) and its JSON return value is passed back. That is genuinely useful context. However, for an arbitrary-code tool it says nothing about side effects on the document, sandboxing/permissions, error propagation, or timeouts — the risk profile an agent most needs.

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?

Three tight sentences, front-loaded with the 'Escape hatch' framing so the agent knows the tool's role before reading details. No filler.

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

Completeness3/5

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

No output schema exists, and the description correctly states the return value is JSON, which covers the return contract. With zero annotations and an arbitrary-execution surface, though, the definition is thin on what the tool may mutate or how failures surface — relevant given the tool's near-unlimited blast radius.

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 only 50% and the `args` property is an undescribed empty schema, so the description must compensate — and it does, by explaining that `args` is the second parameter handed to the generated async function. It also reveals an otherwise invisible `h` helper, though it never explains what `h` provides or the expected shape of `args`.

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 ('run arbitrary Figma Plugin API code inside the plugin') and frames itself as the escape hatch, which immediately distinguishes it from all the narrow, purpose-built siblings like create_rectangle and export_node_as_image.

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?

Gives an explicit usage rule — 'Use for anything not covered by other tools' — plus concrete example categories (vectors, boolean ops, component properties, export settings). It stops short of naming a specific sibling to prefer or warning about when this tool is the wrong choice (e.g., simple node creation), so 4 rather than 5.

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