get_node_info
Retrieve detailed information about a specific node in Figma using its node ID, enabling precise design data access for analysis or integration.
Instructions
Get detailed information about a specific node in Figma
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodeId | Yes | The ID of the node to get information about |
Implementation Reference
- src/cursor_mcp_plugin/code.js:149-205 (handler)Core handler function that retrieves detailed information about a Figma node using the Figma API, including position, size, fills, strokes, children, and text properties.async function getNodeInfo(nodeId) { const node = await figma.getNodeByIdAsync(nodeId); if (!node) { throw new Error(`Node not found with ID: ${nodeId}`); } // Base node information const nodeInfo = { id: node.id, name: node.name, type: node.type, visible: node.visible, }; // Add position and size for SceneNode if ("x" in node && "y" in node) { nodeInfo.x = node.x; nodeInfo.y = node.y; } if ("width" in node && "height" in node) { nodeInfo.width = node.width; nodeInfo.height = node.height; } // Add fills for nodes with fills if ("fills" in node) { nodeInfo.fills = node.fills; } // Add strokes for nodes with strokes if ("strokes" in node) { nodeInfo.strokes = node.strokes; if ("strokeWeight" in node) { nodeInfo.strokeWeight = node.strokeWeight; } } // Add children for parent nodes if ("children" in node) { nodeInfo.children = node.children.map((child) => ({ id: child.id, name: child.name, type: child.type, })); } // Add text-specific properties if (node.type === "TEXT") { nodeInfo.characters = node.characters; nodeInfo.fontSize = node.fontSize; nodeInfo.fontName = node.fontName; } return nodeInfo; }
- src/talk_to_figma_mcp/server.ts:90-118 (registration)MCP tool registration for 'get_node_info', including schema validation for nodeId input and handler that proxies the command to the Figma plugin via WebSocket.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(result, null, 2) } ] }; } catch (error) { return { content: [ { type: "text", text: `Error getting node info: ${error instanceof Error ? error.message : String(error)}` } ] }; } } );
- src/cursor_mcp_plugin/code.js:68-72 (handler)Dispatch case in the Figma plugin's command handler that routes 'get_node_info' calls to the getNodeInfo function.case "get_node_info": if (!params || !params.nodeId) { throw new Error("Missing nodeId parameter"); } return await getNodeInfo(params.nodeId);
- Zod schema for input validation of the nodeId parameter in the MCP tool.{ nodeId: z.string().describe("The ID of the node to get information about")