Skip to main content
Glama

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

Implementation Reference

  • 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")
    },
  • Top-level call to registerModificationTools which includes the set_fill_style_id tool.
    registerModificationTools(server);

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