Skip to main content
Glama
paragdesai1

Cursor Talk to Figma MCP

by paragdesai1

get_document_info

Retrieve detailed information about the current Figma document to understand its structure and contents for design analysis.

Instructions

Get detailed information about the current Figma document

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Registration of the MCP tool 'get_document_info' including its empty input schema, description, and handler function that proxies the request to the Figma plugin via sendCommandToFigma and formats the response.
    server.tool( "get_document_info", "Get detailed information about the current Figma document", {}, async () => { try { const result = await sendCommandToFigma("get_document_info"); return { content: [ { type: "text", text: JSON.stringify(result) } ] }; } catch (error) { return { content: [ { type: "text", text: `Error getting document info: ${error instanceof Error ? error.message : String(error) }`, }, ], }; } } );
  • The Figma plugin implementation of getDocumentInfo which returns structured information about the current page and its children. This is called by the MCP server handler.
    async function getDocumentInfo() { await figma.currentPage.loadAsync(); const page = figma.currentPage; return { name: page.name, id: page.id, type: page.type, children: page.children.map((node) => ({ id: node.id, name: node.name, type: node.type, })), currentPage: { id: page.id, name: page.name, childCount: page.children.length, }, pages: [ { id: page.id, name: page.name, childCount: page.children.length, }, ], }; }
  • Dispatch handler in Figma plugin code that routes 'get_document_info' command to the getDocumentInfo function.
    case "get_document_info": return await getDocumentInfo(); case "get_selection":

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