get_file_styles
Retrieve style definitions from Figma files to access color palettes, typography settings, and design tokens for consistent implementation.
Instructions
Get styles from a file
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fileKey | Yes | The key of the file to get styles from |
Implementation Reference
- src/handlers/projects.ts:64-68 (handler)The core handler function implementing the get_file_styles tool. It extracts the fileKey from args and makes an API request to Figma's /files/{fileKey}/styles endpoint.async getFileStyles(args: GetFileStylesArgs) { const { fileKey } = args; return this.api.makeRequest(`/files/${fileKey}/styles`); }
- src/types/projects.ts:32-34 (schema)TypeScript interface defining the input arguments for the get_file_styles tool: requires a fileKey string.export interface GetFileStylesArgs { fileKey: string; }
- src/index.ts:433-446 (registration)MCP tool registration including name, description, and input schema matching GetFileStylesArgs.{ name: 'get_file_styles', description: 'Get styles from a file', inputSchema: { type: 'object', properties: { fileKey: { type: 'string', description: 'The key of the file to get styles from' } }, required: ['fileKey'] }, },
- src/index.ts:602-608 (handler)Dispatch handler in the main CallToolRequestHandler switch statement that validates args and delegates to projectsHandler.getFileStyles.case 'get_file_styles': { const args = this.validateArgs<GetFileStylesArgs>(request.params.arguments, ['fileKey']); const result = await this.projectsHandler.getFileStyles(args); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }