get_node_info
Retrieve detailed information about specific design elements in Figma by providing their node ID. This tool enables users to access comprehensive data about individual components within their Figma designs.
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 implementation of get_node_info: Retrieves a Figma node by ID using figma.getNodeByIdAsync and constructs a detailed info object with properties like position, size, fills, strokes, children, and type-specific details.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/cursor_mcp_plugin/code.js:68-72 (handler)Dispatch handler in handleCommand function that validates nodeId parameter and calls the getNodeInfo implementation for the "get_node_info" command.case "get_node_info": if (!params || !params.nodeId) { throw new Error("Missing nodeId parameter"); } return await getNodeInfo(params.nodeId);
- src/talk_to_figma_mcp/server.ts:90-118 (registration)MCP tool registration for 'get_node_info' including description, input schema (nodeId: z.string()), and handler that proxies the command to the Figma plugin via sendCommandToFigma.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)}` } ] }; } } );
- Zod schema definition for the get_node_info tool input: requires nodeId as string.nodeId: z.string().describe("The ID of the node to get information about")