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
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/talk_to_figma_mcp/server.ts:67-94 (registration)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) }`, }, ], }; } } );
- src/cursor_mcp_plugin/code.js:186-211 (handler)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, }, ], }; }
- src/cursor_mcp_plugin/code.js:107-109 (handler)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":