Skip to main content
Glama
grab

Talk to Figma MCP

by grab

export_node_as_image

Convert Figma design nodes into images in PNG, JPG, SVG, or PDF formats. Specify the node ID and scale to export precise design elements for use in documents or presentations.

Instructions

Export a node as an image from Figma

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
formatNoExport format
nodeIdYesThe ID of the node to export
scaleNoExport scale

Implementation Reference

  • Registration of the 'export_node_as_image' tool including its input schema (nodeId, optional format and scale), description, and handler function. The handler sends the export command to the underlying Figma plugin via WebSocket (sendCommandToFigma), receives the base64 image data, and returns it as an MCP image content block.
    // Export Node as Image Tool
    server.tool(
      "export_node_as_image",
      "Export a node as an image from Figma",
      {
        nodeId: z.string().describe("The ID of the node to export"),
        format: z
          .enum(["PNG", "JPG", "SVG", "PDF"])
          .optional()
          .describe("Export format"),
        scale: z.number().positive().optional().describe("Export scale"),
      },
      async ({ nodeId, format, scale }: any) => {
        try {
          const result = await sendCommandToFigma("export_node_as_image", {
            nodeId,
            format: format || "PNG",
            scale: scale || 1,
          });
          const typedResult = result as { imageData: string; mimeType: string };
    
          return {
            content: [
              {
                type: "image",
                data: typedResult.imageData,
                mimeType: typedResult.mimeType || "image/png",
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error exporting node as image: ${error instanceof Error ? error.message : String(error)
                  }`,
              },
            ],
          };
        }
      }
    );
  • Zod input schema for the 'export_node_as_image' tool defining parameters: nodeId (required string), format (optional enum PNG/JPG/SVG/PDF), scale (optional positive number).
    {
      nodeId: z.string().describe("The ID of the node to export"),
      format: z
        .enum(["PNG", "JPG", "SVG", "PDF"])
        .optional()
        .describe("Export format"),
      scale: z.number().positive().optional().describe("Export scale"),
  • Handler function that executes the tool: proxies parameters to Figma plugin command 'export_node_as_image', handles the response (imageData base64 and mimeType), returns MCP image content or error text.
    async ({ nodeId, format, scale }: any) => {
      try {
        const result = await sendCommandToFigma("export_node_as_image", {
          nodeId,
          format: format || "PNG",
          scale: scale || 1,
        });
        const typedResult = result as { imageData: string; mimeType: string };
    
        return {
          content: [
            {
              type: "image",
              data: typedResult.imageData,
              mimeType: typedResult.mimeType || "image/png",
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error exporting node as image: ${error instanceof Error ? error.message : String(error)
                }`,
            },
          ],
        };
      }
    }
  • TypeScript type definition for CommandParams of 'export_node_as_image' matching the Zod schema, used in sendCommandToFigma.
    export_node_as_image: {
      nodeId: string;
      format?: "PNG" | "JPG" | "SVG" | "PDF";
      scale?: number;
    };
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool exports an image but doesn't describe what happens during export (e.g., file generation, download, or API response format), permissions required, rate limits, or side effects, which is insufficient for a mutation tool.

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?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's front-loaded and wastes no space, making it easy to parse quickly.

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

Completeness2/5

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

Given the tool's complexity (a mutation with 3 parameters) and lack of annotations and output schema, the description is incomplete. It doesn't explain the export result (e.g., image data, file path, or error handling), leaving critical gaps for an AI agent to use it effectively.

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 schema fully documents parameters like 'nodeId', 'format', and 'scale'. The description adds no additional meaning beyond the schema, such as explaining parameter interactions or constraints, but meets the baseline since the schema handles the heavy lifting.

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 clearly states the action ('export') and resource ('a node as an image from Figma'), making the tool's purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_node_info' or 'clone_node', which might also involve node operations but serve different purposes.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a valid node ID), exclusions, or comparisons to sibling tools like 'get_node_info' for non-export purposes, leaving usage context unclear.

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

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/grab/cursor-talk-to-figma-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server