Skip to main content
Glama
paragdesai1

Cursor Talk to Figma MCP

by paragdesai1

get_node_info

Retrieve detailed information about specific Figma design elements to analyze properties, dimensions, and relationships within your design files.

Instructions

Get detailed information about a specific node in Figma

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nodeIdYesThe ID of the node to get information about

Implementation Reference

  • Registration of the 'get_node_info' MCP tool, including input schema (nodeId: string), description, and inline handler function that sends the command to the Figma plugin via sendCommandToFigma and processes the result using filterFigmaNode before returning as text content.
    server.tool(
      "get_node_info",
      "Get detailed information about a specific node in Figma",
      {
        nodeId: z.string().describe("The ID of the node to get information about"),
      },
      async ({ nodeId }) => {
        try {
          const result = await sendCommandToFigma("get_node_info", { nodeId });
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(filterFigmaNode(result))
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error getting node info: ${error instanceof Error ? error.message : String(error)
                  }`,
              },
            ],
          };
        }
      }
    );
  • The handler function (inline in registration) executes the tool logic: forwards nodeId to Figma plugin's get_node_info command, filters the node data, and returns JSON stringified text response or error.
    server.tool(
      "get_node_info",
      "Get detailed information about a specific node in Figma",
      {
        nodeId: z.string().describe("The ID of the node to get information about"),
      },
      async ({ nodeId }) => {
        try {
          const result = await sendCommandToFigma("get_node_info", { nodeId });
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(filterFigmaNode(result))
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error getting node info: ${error instanceof Error ? error.message : String(error)
                  }`,
              },
            ],
          };
        }
      }
    );
  • Input schema for get_node_info tool using Zod: requires 'nodeId' as string with description.
    {
      nodeId: z.string().describe("The ID of the node to get information about"),
    },
  • Helper function filterFigmaNode recursively processes Figma node data: skips VECTOR nodes, extracts relevant properties (id, name, type, fills, strokes, etc.), converts RGBA colors to hex using rgbaToHex, removes boundVariables/imageRef, handles children recursively.
    function filterFigmaNode(node: any) {
      // Skip VECTOR type nodes
      if (node.type === "VECTOR") {
        return null;
      }
    
      const filtered: any = {
        id: node.id,
        name: node.name,
        type: node.type,
      };
    
      if (node.fills && node.fills.length > 0) {
        filtered.fills = node.fills.map((fill: any) => {
          const processedFill = { ...fill };
    
          // Remove boundVariables and imageRef
          delete processedFill.boundVariables;
          delete processedFill.imageRef;
    
          // Process gradientStops if present
          if (processedFill.gradientStops) {
            processedFill.gradientStops = processedFill.gradientStops.map((stop: any) => {
              const processedStop = { ...stop };
              // Convert color to hex if present
              if (processedStop.color) {
                processedStop.color = rgbaToHex(processedStop.color);
              }
              // Remove boundVariables
              delete processedStop.boundVariables;
              return processedStop;
            });
          }
    
          // Convert solid fill colors to hex
          if (processedFill.color) {
            processedFill.color = rgbaToHex(processedFill.color);
          }
    
          return processedFill;
        });
      }
    
      if (node.strokes && node.strokes.length > 0) {
        filtered.strokes = node.strokes.map((stroke: any) => {
          const processedStroke = { ...stroke };
          // Remove boundVariables
          delete processedStroke.boundVariables;
          // Convert color to hex if present
          if (processedStroke.color) {
            processedStroke.color = rgbaToHex(processedStroke.color);
          }
          return processedStroke;
        });
      }
    
      if (node.cornerRadius !== undefined) {
        filtered.cornerRadius = node.cornerRadius;
      }
    
      if (node.absoluteBoundingBox) {
        filtered.absoluteBoundingBox = node.absoluteBoundingBox;
      }
    
      if (node.characters) {
        filtered.characters = node.characters;
      }
    
      if (node.style) {
        filtered.style = {
          fontFamily: node.style.fontFamily,
          fontStyle: node.style.fontStyle,
          fontWeight: node.style.fontWeight,
          fontSize: node.style.fontSize,
          textAlignHorizontal: node.style.textAlignHorizontal,
          letterSpacing: node.style.letterSpacing,
          lineHeightPx: node.style.lineHeightPx
        };
      }
    
      if (node.children) {
        filtered.children = node.children
          .map((child: any) => filterFigmaNode(child))
          .filter((child: any) => child !== null); // Remove null children (VECTOR nodes)
      }
    
      return filtered;
    }
  • Helper function rgbaToHex converts Figma RGBA color objects (r,g,b,a 0-1) to hex string format, omitting alpha if fully opaque.
    function rgbaToHex(color: any): string {
      // skip if color is already hex
      if (color.startsWith('#')) {
        return color;
      }
    
      const r = Math.round(color.r * 255);
      const g = Math.round(color.g * 255);
      const b = Math.round(color.b * 255);
      const a = Math.round(color.a * 255);
    
      return `#${r.toString(16).padStart(2, '0')}${g.toString(16).padStart(2, '0')}${b.toString(16).padStart(2, '0')}${a === 255 ? '' : a.toString(16).padStart(2, '0')}`;
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. While 'Get' implies a read operation, it doesn't specify whether this requires authentication, rate limits, what happens with invalid node IDs, or the format/scope of 'detailed information' returned. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

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 appropriately sized for a simple lookup tool and front-loads the essential information.

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?

For a single-parameter read operation with no output schema, the description is minimally complete but lacks important context. It doesn't explain what constitutes 'detailed information' in the return value, doesn't address error conditions, and doesn't differentiate from similar sibling tools. The absence of annotations means the description should do more to compensate.

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%, with the single parameter 'nodeId' clearly documented in the schema. The description doesn't add any parameter-specific information beyond what's in the schema, so it meets the baseline for adequate but unenriched parameter documentation.

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 verb 'Get' and the resource 'detailed information about a specific node in Figma', making the purpose understandable. However, it doesn't differentiate from sibling tools like 'get_nodes_info' (plural) or 'get_document_info', which could cause confusion about when to use this singular node lookup versus batch operations.

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. With siblings like 'get_nodes_info' (plural) and 'get_document_info', there's no indication whether this is for single-node queries, whether it's more efficient for individual lookups, or any prerequisites for node ID availability.

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/paragdesai1/parag-Figma-MCP'

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