get_file_data
Retrieve and manage Figma file data efficiently using chunking and pagination. Filter by node types, control response size, and optimize memory usage for large-scale Figma projects.
Instructions
Get Figma file data with chunking and pagination
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cursor | No | Pagination cursor for continuing from a previous request | |
| depth | No | Maximum depth to traverse in the node tree | |
| excludeProps | No | Properties to exclude from node data | |
| file_key | Yes | Figma file key | |
| maxMemoryMB | No | Maximum memory usage in MB | |
| maxResponseSize | No | Maximum response size in MB (defaults to 50) | |
| nodeTypes | No | Filter nodes by type | |
| pageSize | No | Number of nodes per page | |
| summarizeNodes | No | Return only essential node properties to reduce response size |
Implementation Reference
- src/index.ts:302-345 (handler)Executes the get_file_data tool: validates arguments, calls ChunkedFigmaClient.getFileInfoChunked with chunking parameters, and returns paginated node data as JSON.case 'get_file_data': { const args = request.params.arguments as unknown as GetFileDataArgs; if (!args.file_key) { throw new McpError(ErrorCode.InvalidParams, 'file_key is required'); } console.debug('[MCP Debug] Fetching file data with chunking', { fileKey: args.file_key, pageSize: args.pageSize, maxMemoryMB: args.maxMemoryMB, nodeTypes: args.nodeTypes, maxResponseSize: args.maxResponseSize, excludeProps: args.excludeProps, summarizeNodes: args.summarizeNodes }); const result = await this.figmaClient.getFileInfoChunked( args.file_key, args.cursor, args.depth, { pageSize: args.pageSize, maxMemoryMB: args.maxMemoryMB, nodeTypes: args.nodeTypes, maxResponseSize: args.maxResponseSize, excludeProps: args.excludeProps, summarizeNodes: args.summarizeNodes } ); return { content: [ { type: 'text', text: JSON.stringify({ nodes: result.nodes, memoryUsage: result.memoryUsage, nextCursor: result.nextCursor, hasMore: result.hasMore }, null, 2) } ] }; }
- src/index.ts:77-146 (registration)Registers the get_file_data tool in the list_tools handler, defining its name, description, and JSON input schema for MCP protocol.{ name: 'get_file_data', description: 'Get Figma file data with chunking and pagination', inputSchema: { type: 'object', properties: { file_key: { type: 'string', description: 'Figma file key' }, pageSize: { type: 'number', description: 'Number of nodes per page', minimum: 1, maximum: 1000 }, maxMemoryMB: { type: 'number', description: 'Maximum memory usage in MB', minimum: 128, maximum: 2048 }, nodeTypes: { type: 'array', items: { type: 'string', enum: [ 'FRAME', 'GROUP', 'VECTOR', 'BOOLEAN_OPERATION', 'STAR', 'LINE', 'TEXT', 'COMPONENT', 'INSTANCE' ] }, description: 'Filter nodes by type' }, cursor: { type: 'string', description: 'Pagination cursor for continuing from a previous request' }, depth: { type: 'number', description: 'Maximum depth to traverse in the node tree', minimum: 1 }, maxResponseSize: { type: 'number', description: 'Maximum response size in MB (defaults to 50)', minimum: 1, maximum: 100 }, excludeProps: { type: 'array', items: { type: 'string' }, description: 'Properties to exclude from node data' }, summarizeNodes: { type: 'boolean', description: 'Return only essential node properties to reduce response size' } }, required: ['file_key'] } },
- src/index.ts:27-37 (schema)TypeScript interface defining the typed arguments for the get_file_data handler.interface GetFileDataArgs { file_key: string; pageSize?: number; maxMemoryMB?: number; nodeTypes?: string[]; cursor?: string; depth?: number; maxResponseSize?: number; excludeProps?: string[]; summarizeNodes?: boolean; }