list_files
Retrieve and organize files within a Figma project or team using accurate file listing, ensuring efficient management of design assets.
Instructions
List files in a project or team
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | No | Project ID to list files from | |
| team_id | No | Team ID to list files from |
Implementation Reference
- src/index.ts:347-354 (handler)MCP server handler for the 'list_files' tool. It extracts arguments, calls the Figma client's listFiles method, and returns the result as JSON text content.case 'list_files': { const args = request.params.arguments as unknown as ListFilesArgs; console.debug('[MCP Debug] Listing files', args); const data = await this.figmaClient.listFiles(args); return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }], }; }
- src/index.ts:14-17 (schema)TypeScript interface defining the input schema for list_files arguments (project_id and team_id optional). Matches the JSON inputSchema in tool registration.interface ListFilesArgs { project_id?: string; team_id?: string; }
- src/index.ts:147-163 (registration)Tool registration in the ListToolsRequestHandler response. Defines name, description, and JSON inputSchema for the list_files tool.{ name: 'list_files', description: 'List files in a project or team', inputSchema: { type: 'object', properties: { project_id: { type: 'string', description: 'Project ID to list files from' }, team_id: { type: 'string', description: 'Team ID to list files from' } } } },
- src/client.ts:282-291 (helper)Implementation of listFiles method in ChunkedFigmaClient class. Performs the actual HTTP GET request to Figma's /files endpoint with optional project_id or team_id parameters.async listFiles(params: { project_id?: string; team_id?: string }) { try { console.debug('[MCP Debug] Listing files with params:', params); const response = await this.client.get('/files', { params }); return response.data; } catch (error) { console.error('[MCP Error] Failed to list files:', error); throw error; } }