set_stroke_style_id
Apply a specific stroke style to a Figma design element using its style ID to maintain visual consistency across your project.
Instructions
Apply a stroke style to a node in Figma. Use get_styles to find available stroke style IDs.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodeId | Yes | The ID of the node to modify | |
| strokeStyleId | Yes | The ID of the stroke style to apply |
Implementation Reference
- src/talk_to_figma_mcp/tools/modification-tools.ts:557-589 (registration)Full registration of the MCP tool 'set_stroke_style_id' including description, Zod input schema, and async handler function that forwards the command to Figma via sendCommandToFigma.server.tool( "set_stroke_style_id", "Apply a stroke style to a node in Figma. Use get_styles to find available stroke style IDs.", { nodeId: z.string().describe("The ID of the node to modify"), strokeStyleId: z.string().describe("The ID of the stroke style to apply") }, async ({ nodeId, strokeStyleId }) => { try { const result = await sendCommandToFigma("set_stroke_style_id", { nodeId, strokeStyleId }); const typedResult = result as { name: string }; return { content: [ { type: "text", text: `Successfully applied stroke style to node "${typedResult.name}"` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error setting stroke style: ${error instanceof Error ? error.message : String(error)}` } ] }; } }
- The handler function executes the tool logic by sending the 'set_stroke_style_id' command to Figma and returning success/error messages.async ({ nodeId, strokeStyleId }) => { try { const result = await sendCommandToFigma("set_stroke_style_id", { nodeId, strokeStyleId }); const typedResult = result as { name: string }; return { content: [ { type: "text", text: `Successfully applied stroke style to node "${typedResult.name}"` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error setting stroke style: ${error instanceof Error ? error.message : String(error)}` } ] }; } }
- Zod schema for input validation: requires nodeId (string) and strokeStyleId (string).{ nodeId: z.string().describe("The ID of the node to modify"), strokeStyleId: z.string().describe("The ID of the stroke style to apply") },