get_file_info
Retrieve basic information from Figma files by providing the file URL. This tool extracts essential data about Figma designs for analysis and integration purposes.
Instructions
获取Figma文件的基本信息
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | Figma文件URL |
Implementation Reference
- src/index.ts:350-375 (handler)The main handler function for the 'get_file_info' tool. It parses the Figma URL, fetches the file data using FigmaService, extracts basic file information (name, version, counts of components, styles, pages), and returns a JSON response.
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:129-138 (schema)Input schema definition for the 'get_file_info' tool, specifying the required 'url' parameter as a string.
inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'Figma文件URL', }, }, required: ['url'], }, - src/index.ts:206-207 (registration)Registration of the 'get_file_info' tool handler in the CallToolRequestSchema switch statement.
case 'get_file_info': return await this.handleGetFileInfo(args); - src/index.ts:126-139 (registration)Tool metadata registration in the ListToolsRequestSchema response, including name, description, and input schema.
{ name: 'get_file_info', description: '获取Figma文件的基本信息', inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'Figma文件URL', }, }, required: ['url'], }, },