Skip to main content
Glama

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
NameRequiredDescriptionDefault
nodeIdYesThe ID of the node to modify
strokeStyleIdYesThe ID of the stroke style to apply

Implementation Reference

  • 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")
    },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/agenisea/cc-fig-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server