get_file_info
Retrieve basic file information from Figma designs using the file URL, including metadata and structural details for design analysis and integration workflows.
Instructions
获取Figma文件的基本信息
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | Figma文件URL |
Implementation Reference
- src/index.ts:350-375 (handler)The primary handler function executing the 'get_file_info' tool. Parses the Figma URL argument, retrieves file metadata via FigmaService, computes counts for components, styles, and pages, and formats the response as MCP content.private async handleGetFileInfo(args: any) { const { url } = args; const urlInfo = this.figmaService.parseUrl(url); const file = await this.figmaService.getFile(urlInfo.fileId); return { content: [ { type: 'text', text: JSON.stringify({ success: true, data: { fileId: urlInfo.fileId, fileName: file.name, lastModified: file.lastModified, version: file.version, componentsCount: Object.keys(file.components || {}).length, stylesCount: Object.keys(file.styles || {}).length, pagesCount: file.document.children?.length || 0, }, }, null, 2), }, ], }; }
- src/index.ts:126-139 (registration)Tool registration entry in the ListTools response, defining the name 'get_file_info', its description, and input schema requiring a Figma file URL.{ name: 'get_file_info', description: '获取Figma文件的基本信息', inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'Figma文件URL', }, }, required: ['url'], }, },
- src/index.ts:129-138 (schema)Input schema definition for the 'get_file_info' tool, specifying an object with a required 'url' string property.inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'Figma文件URL', }, }, required: ['url'], },
- src/index.ts:206-207 (registration)Dispatch case in the CallToolRequestSchema handler that routes 'get_file_info' calls to the handleGetFileInfo method.case 'get_file_info': return await this.handleGetFileInfo(args);