get_styles
Retrieve all style definitions from a Figma document to inspect text, color, and effect styles for design consistency and reuse.
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
- The handler implementation for the MCP 'get_styles' tool. It forwards the command to the Figma plugin via websocket and returns the styles as JSON text.
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/tools/index.ts:13-13 (registration)Registration of document tools (including get_styles) by calling registerDocumentTools on the MCP server.
registerDocumentTools(server); - src/talk_to_figma_mcp/server.ts:34-34 (registration)Top-level registration of all tools (including get_styles) on the MCP server instance.
registerTools(server); - Type definition for FigmaCommand union that includes 'get_styles' as a valid command type sent to the Figma plugin.
export type FigmaCommand = | "get_document_info" | "get_selection" | "get_node_info" | "create_rectangle" | "create_frame" | "create_text" | "create_ellipse" | "create_polygon" | "create_star" | "create_vector" | "create_line" | "set_fill_color" | "set_stroke_color" | "move_node" | "resize_node" | "delete_node" | "get_styles" | "get_local_components" | "get_team_components" | "create_component_instance" | "export_node_as_image" | "join" | "set_corner_radius" | "clone_node" | "set_text_content" | "scan_text_nodes" | "set_multiple_text_contents" | "set_auto_layout" | "set_font_name" | "set_font_size" | "set_font_weight" | "set_letter_spacing" | "set_line_height" | "set_paragraph_spacing" | "set_text_case" | "set_text_decoration" | "get_styled_text_segments" | "load_font_async" | "get_remote_components" | "set_effects" | "set_effect_style_id" | "group_nodes" | "ungroup_nodes" | "flatten_node" | "insert_child";