Skip to main content
Glama

view_node

Retrieve a thumbnail of a specific node within a Figma file by specifying the file key and node ID using the Figma MCP Server tool.

Instructions

Get a thumbnail for a specific node in a Figma file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_keyYesThe key of the Figma file
node_idYesThe ID of the node to view. Node ids have the format `<number>:<number>`

Implementation Reference

  • The main handler function that executes the view_node tool: fetches thumbnails for the node using getThumbnails, converts to base64, and returns an image in the tool result.
    async function doViewNode(fileKey: string, nodeId: string): Promise<CallToolResult> { const thumbnails = await getThumbnails(fileKey, [nodeId]); const nodeThumb = thumbnails[nodeId]; if (!nodeThumb) { throw new Error(`Could not get thumbnail for node ${nodeId}`); } const b64 = await imageUrlToBase64(nodeThumb); return { content: [ { type: "text", text: `Thumbnail for node ${nodeId}:`, }, { type: "image", data: b64, mimeType: "image/png", }, ], }; }
  • The Tool schema definition for view_node, specifying input parameters file_key and node_id.
    const VIEW_NODE: Tool = { name: "view_node", description: "Get a thumbnail for a specific node in a Figma file", inputSchema: { type: "object", properties: { file_key: { type: "string", description: "The key of the Figma file", }, node_id: { type: "string", description: "The ID of the node to view. Node ids have the format `<number>:<number>`", }, }, required: ["file_key", "node_id"], }, };
  • index.ts:138-140 (registration)
    Registration of the view_node tool (via VIEW_NODE constant) in the MCP server's list of tools.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ADD_FIGMA_FILE, VIEW_NODE, READ_COMMENTS, POST_COMMENT, REPLY_TO_COMMENT], }));
  • Helper utility to convert the thumbnail image URL to base64 format, called within the doViewNode handler.
    async function imageUrlToBase64(url: string) { const response = await fetch(url); const arrayBuffer = await response.arrayBuffer(); return Buffer.from(arrayBuffer).toString("base64"); }
  • index.ts:270-273 (registration)
    Dispatch logic in the CallToolRequest handler that routes 'view_node' calls to the doViewNode function.
    if (request.params.name === "view_node") { const input = request.params.arguments as { file_key: string; node_id: string }; return doViewNode(input.file_key, input.node_id); }

Other Tools

Related 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/MatthewDailey/figma-mcp'

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