get_document_info
Retrieve comprehensive details about the active Figma design document, including structure, elements, and metadata for analysis or integration.
Instructions
Get detailed information about the current Figma document
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/cursor_mcp_plugin/code.js:110-135 (handler)Core implementation of get_document_info tool. Fetches and returns detailed information about the current Figma document/page including name, ID, type, children list, and page structure.
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/talk_to_figma_mcp/server.ts:32-58 (registration)MCP tool registration for 'get_document_info'. Includes empty input schema ({}), description, and proxy handler that forwards the command to the Figma plugin via WebSocket and formats the response as MCP content.
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, null, 2) } ] }; } catch (error) { return { content: [ { type: "text", text: `Error getting document info: ${error instanceof Error ? error.message : String(error)}` } ] }; } } ); - Input schema for get_document_info tool: empty object indicating no parameters required.
"get_document_info", "Get detailed information about the current Figma document", {}, - src/cursor_mcp_plugin/code.js:64-65 (handler)Dispatch case in handleCommand function that routes 'get_document_info' command to the getDocumentInfo handler.
case "get_document_info": return await getDocumentInfo();