get_styles
Retrieve all design styles from a Figma document to access color palettes, typography, and other visual elements 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/talk_to_figma_mcp/server.ts:912-939 (handler)The handler function for the 'get_styles' MCP tool. It sends a 'get_styles' command to the Figma plugin via WebSocket and returns the JSON-stringified result as text content, or an error message if failed. This is the core execution logic of the tool.
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:912-939 (registration)Registration of the 'get_styles' tool using McpServer.tool() with name, description, empty input schema ({}), and inline handler function.
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) }`, }, ], }; } } ); - Empty input schema for the get_styles tool (no parameters required).
async () => {