Skip to main content
Glama

create_component_instance

Generate a reusable component instance in Figma, enabling automated design updates and modifications via natural language commands.

Instructions

Create an instance of a component in Figma

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Registration of the 'create_component_instance' MCP tool using server.tool(), including schema definition and handler function.
    server.tool( "create_component_instance", "Create an instance of a component in Figma", { componentKey: z.string().describe("Key of the component to instantiate"), x: z.number().describe("X position"), y: z.number().describe("Y position"), }, async ({ componentKey, x, y }) => { try { const result = await sendCommandToFigma("create_component_instance", { componentKey, x, y, }); const typedResult = result as any; return { content: [ { type: "text", text: JSON.stringify(typedResult), } ] } } catch (error) { return { content: [ { type: "text", text: `Error creating component instance: ${error instanceof Error ? error.message : String(error) }`, }, ], }; } } );
  • The asynchronous handler function that implements the tool logic: sends 'create_component_instance' command with parameters to Figma plugin, processes result or error, and returns formatted content.
    async ({ componentKey, x, y }) => { try { const result = await sendCommandToFigma("create_component_instance", { componentKey, x, y, }); const typedResult = result as any; return { content: [ { type: "text", text: JSON.stringify(typedResult), } ] } } catch (error) { return { content: [ { type: "text", text: `Error creating component instance: ${error instanceof Error ? error.message : String(error) }`, }, ], }; } }
  • Zod schema for input validation: requires componentKey (string), x (number), y (number).
    { componentKey: z.string().describe("Key of the component to instantiate"), x: z.number().describe("X position"), y: z.number().describe("Y position"), },
  • TypeScript type definition for CommandParams of create_component_instance in the FigmaCommand union type.
    get_team_components: Record<string, never>; create_component_instance: { componentKey: string; x: number; y: number;

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/andreycretsu/cursor-talk-to-figma-mcp-main'

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