Skip to main content
Glama

get_node_info

Retrieve detailed information about a specific Figma node, enabling users to access design data programmatically for analysis or automation tasks within the Cursor Talk to Figma MCP server.

Instructions

Get detailed information about a specific node in Figma

Input Schema

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": {}, "type": "object" }

Implementation Reference

  • Registration of the MCP 'get_node_info' tool, including inline input schema (nodeId: string), description, and handler function. The handler proxies the request to the Figma plugin via sendCommandToFigma and filters the result using filterFigmaNode before returning as JSON text.
    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 for 'get_node_info' tool: takes nodeId, sends 'get_node_info' command to Figma plugin, filters the node result with filterFigmaNode, returns as JSON-formatted text content block, handles errors.
    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) }`, }, ], }; } }
  • Zod input schema for 'get_node_info' tool: requires 'nodeId' as string.
    { nodeId: z.string().describe("The ID of the node to get information about"), },
  • filterFigmaNode: Recursive helper to process Figma node data for the tool response. Converts RGBA colors to HEX using rgbaToHex, removes boundVariables/imageRef, skips VECTOR nodes, includes relevant props (fills, strokes, boundingBox, style, characters), recurses on children.
    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; }
  • rgbaToHex: Utility helper used by filterFigmaNode to convert Figma RGBA colors (0-1 floats) to HEX strings, 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')}`; }

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/andreycretsu/cursor-talk-to-figma-mcp-main'

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