get_styles
Retrieve all design styles from a Figma document to access typography, colors, and effects for consistent design implementation.
Instructions
Get all styles from the current Figma document
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_styles"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/cursor_mcp_plugin/code.js:575-608 (handler)Core implementation of get_styles that fetches and formats local Figma styles (paint, text, effect, grid) using Figma Plugin APIs.
async function getStyles() { const styles = { colors: await figma.getLocalPaintStylesAsync(), texts: await figma.getLocalTextStylesAsync(), effects: await figma.getLocalEffectStylesAsync(), grids: await figma.getLocalGridStylesAsync(), }; return { colors: styles.colors.map((style) => ({ id: style.id, name: style.name, key: style.key, paint: style.paints[0], })), texts: styles.texts.map((style) => ({ id: style.id, name: style.name, key: style.key, fontSize: style.fontSize, fontName: style.fontName, })), effects: styles.effects.map((style) => ({ id: style.id, name: style.name, key: style.key, })), grids: styles.grids.map((style) => ({ id: style.id, name: style.name, key: style.key, })), }; } - src/talk_to_figma_mcp/server.ts:444-470 (registration)MCP server registration of the 'get_styles' tool, which proxies the command to the Figma plugin via WebSocket and formats the response.
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, null, 2) } ] }; } catch (error) { return { content: [ { type: "text", text: `Error getting styles: ${error instanceof Error ? error.message : String(error)}` } ] }; } } ); - src/cursor_mcp_plugin/code.js:89-90 (handler)Internal dispatch in Figma plugin's handleCommand switch statement that routes 'get_styles' command to the getStyles handler function.
case "get_styles": return await getStyles(); - Input schema for get_styles MCP tool (empty object, no parameters required).
{}, - Type definition including 'get_styles' in FigmaCommand union type for sendCommandToFigma.
| 'get_styles'