get_styles
Retrieve all styles from a Figma document to integrate design elements programmatically, enabling seamless workflow automation within the Talk to Figma MCP server.
Instructions
Get all styles from the current Figma document
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/talk_to_figma_mcp/server.ts:942-969 (registration)Registration of the 'get_styles' MCP tool, including the input schema (empty object) and the inline handler function that forwards the 'get_styles' command to the Figma plugin and returns the result as JSON text content.server.tool( "get_styles", "Get all styles from the current Figma document", {}, async () => { try { const result = await sendCommandToFigma("get_styles"); return { content: [ { type: "text", text: JSON.stringify(result) } ] }; } catch (error) { return { content: [ { type: "text", text: `Error getting styles: ${error instanceof Error ? error.message : String(error) }`, }, ], }; } } );
- src/talk_to_figma_mcp/server.ts:946-968 (handler)The handler function that executes the tool logic: sends 'get_styles' command to Figma via sendCommandToFigma helper and formats the response as MCP content.async () => { try { const result = await sendCommandToFigma("get_styles"); return { content: [ { type: "text", text: JSON.stringify(result) } ] }; } catch (error) { return { content: [ { type: "text", text: `Error getting styles: ${error instanceof Error ? error.message : String(error) }`, }, ], }; } }
- Empty input schema for the get_styles tool (no parameters required).{},