Skip to main content
Glama
arinspunk

Claude Talk to Figma MCP

by arinspunk

set_image

Set an image fill on a Figma node from base64-encoded image data. Supports PNG, JPEG, GIF, WebP formats up to ~5MB after decoding. Specify node ID, image data, and optional scale mode (FILL, FIT, CROP, TILE).

Instructions

Set an image fill on a node from base64-encoded image data. Supports PNG, JPEG, GIF, WebP. Max ~5MB after decode.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nodeIdYesThe ID of the node to apply the image fill to
imageDataYesBase64-encoded image data (PNG, JPEG, GIF, or WebP). Max ~5MB after decode.
scaleModeNoHow the image is scaled within the node (default: FILL)

Implementation Reference

  • The 'set_image' tool handler. Registers a server tool that accepts nodeId, base64 imageData, and optional scaleMode, then sends a 'set_image' command to Figma via WebSocket. Returns the node name and image hash on success, or an error message on failure.
    // Set Image Fill Tool
    server.tool(
      "set_image",
      "Set an image fill on a node from base64-encoded image data. Supports PNG, JPEG, GIF, WebP. Max ~5MB after decode.",
      {
        nodeId: z.string().describe("The ID of the node to apply the image fill to"),
        imageData: z.string().max(7_000_000).describe("Base64-encoded image data (PNG, JPEG, GIF, or WebP). Max ~5MB after decode."),
        scaleMode: z.enum(["FILL", "FIT", "CROP", "TILE"]).optional().describe("How the image is scaled within the node (default: FILL)"),
      },
      async ({ nodeId, imageData, scaleMode }) => {
        try {
          const result = await sendCommandToFigma("set_image", {
            nodeId,
            imageData,
            scaleMode: scaleMode || "FILL",
          });
          const typedResult = result as { name: string; imageHash: string };
          return {
            content: [
              {
                type: "text",
                text: `Set image fill on node "${typedResult.name}" with scale mode ${scaleMode || "FILL"} (hash: ${typedResult.imageHash})`,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error setting image fill: ${error instanceof Error ? error.message : String(error)}`,
              },
            ],
          };
        }
      }
    );
  • Input schema for the 'set_image' tool: nodeId (string), imageData (base64 string, max 7M chars), scaleMode (optional enum: FILL/FIT/CROP/TILE).
    {
      nodeId: z.string().describe("The ID of the node to apply the image fill to"),
      imageData: z.string().max(7_000_000).describe("Base64-encoded image data (PNG, JPEG, GIF, or WebP). Max ~5MB after decode."),
      scaleMode: z.enum(["FILL", "FIT", "CROP", "TILE"]).optional().describe("How the image is scaled within the node (default: FILL)"),
    },
  • Registration call: registerModificationTools(server) is called from the central registerTools function, which wires the 'set_image' tool into the MCP server.
    registerModificationTools(server);
  • The registerModificationTools function declaration which internally uses server.tool() to register 'set_image' (line 662-697).
    export function registerModificationTools(server: McpServer): void {
  • Type definition: 'set_image' is listed as a valid FigmaCommand in the union type, ensuring type safety for command dispatch.
    | "set_image"
Behavior3/5

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

Annotations are absent, so the description carries full burden. It mentions the size limit (~5MB) and supported formats, which is helpful. However, it does not disclose whether the tool is destructive (e.g., replaces existing fill), if it requires node to exist, or any authorization needs. No contradictions since no annotations.

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 two concise sentences, front-loaded with the primary action. Every word adds value, and there is no redundancy. Ideal length for a tool with three parameters.

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?

Given no output schema and no annotations, the description covers the basic input and constraints but does not explain return behavior (e.g., success/failure, what happens if node invalid) or contrast with sibling tools. It is adequate but not comprehensive for a tool that modifies a node.

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%, so baseline is 3. The description adds minor value by repeating the size limit and supported formats that are already in the schema. For scaleMode, it merely states the default (FILL) but the schema already provides the enum. No new semantic information beyond schema.

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?

The description clearly states the action (set an image fill), the resource (a node), and the method (from base64-encoded image data). It also lists supported formats and size limit, making the purpose unmistakable. Among siblings like replace_image_fill, this one is distinguished by using base64 data.

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?

No guidance is provided on when to use this tool versus similar siblings like replace_image_fill or set_image_fill. There are no prerequisites or context for appropriate usage. The description does not mention alternatives or when not to use it.

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

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/arinspunk/claude-talk-to-figma-mcp'

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