set_fill_style_id
Apply a fill style to a Figma design element using its style ID to maintain visual consistency across your project.
Instructions
Apply a fill style to a node in Figma. Use get_styles to find available fill style IDs.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodeId | Yes | The ID of the node to modify | |
| fillStyleId | Yes | The ID of the fill style to apply |
Implementation Reference
- src/talk_to_figma_mcp/tools/modification-tools.ts:521-554 (registration)Full MCP tool registration for 'set_fill_style_id': includes schema validation with Zod for nodeId and fillStyleId parameters, and handler function that sends the command to Figma via websocket utility and formats response.server.tool( "set_fill_style_id", "Apply a fill style to a node in Figma. Use get_styles to find available fill style IDs.", { nodeId: z.string().describe("The ID of the node to modify"), fillStyleId: z.string().describe("The ID of the fill style to apply") }, async ({ nodeId, fillStyleId }) => { try { const result = await sendCommandToFigma("set_fill_style_id", { nodeId, fillStyleId }); const typedResult = result as { name: string }; return { content: [ { type: "text", text: `Successfully applied fill style to node "${typedResult.name}"` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error setting fill style: ${error instanceof Error ? error.message : String(error)}` } ] }; } } );
- The handler executes by calling sendCommandToFigma with the parameters and returns a formatted text response based on the result.async ({ nodeId, fillStyleId }) => { try { const result = await sendCommandToFigma("set_fill_style_id", { nodeId, fillStyleId }); const typedResult = result as { name: string }; return { content: [ { type: "text", text: `Successfully applied fill style to node "${typedResult.name}"` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error setting fill style: ${error instanceof Error ? error.message : String(error)}` } ] }; } }
- Zod schema defining required string inputs: nodeId and fillStyleId.nodeId: z.string().describe("The ID of the node to modify"), fillStyleId: z.string().describe("The ID of the fill style to apply") },
- src/talk_to_figma_mcp/tools/index.ts:15-15 (registration)Top-level call to registerModificationTools which includes the set_fill_style_id tool.registerModificationTools(server);