Skip to main content
Glama

set_instance_overrides

Apply copied component overrides to selected instances in Figma, swapping them to match the source component's properties.

Instructions

Apply previously copied overrides to selected component instances. Target instances will be swapped to the source component and all copied override properties will be applied.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceInstanceIdYesID of the source component instance
targetNodeIdsYesArray of target instance IDs. Currently selected instances will be used.

Implementation Reference

  • Registration of the 'set_instance_overrides' MCP tool, including schema, description, and handler function.
    server.tool( "set_instance_overrides", "Apply previously copied overrides to selected component instances. Target instances will be swapped to the source component and all copied override properties will be applied.", { sourceInstanceId: z.string().describe("ID of the source component instance"), targetNodeIds: z.array(z.string()).describe("Array of target instance IDs. Currently selected instances will be used.") }, async ({ sourceInstanceId, targetNodeIds }) => { try { const result = await sendCommandToFigma("set_instance_overrides", { sourceInstanceId: sourceInstanceId, targetNodeIds: targetNodeIds || [] }); const typedResult = result as setInstanceOverridesResult; if (typedResult.success) { const successCount = typedResult.results?.filter(r => r.success).length || 0; return { content: [ { type: "text", text: `Successfully applied ${typedResult.totalCount || 0} overrides to ${successCount} instances.` } ] }; } else { return { content: [ { type: "text", text: `Failed to set instance overrides: ${typedResult.message}` } ] }; } } catch (error) { return { content: [ { type: "text", text: `Error setting instance overrides: ${error instanceof Error ? error.message : String(error)}` } ] }; } } );
  • The handler function that executes the set_instance_overrides tool logic by forwarding the command to the Figma plugin via sendCommandToFigma and processing the result.
    async ({ sourceInstanceId, targetNodeIds }) => { try { const result = await sendCommandToFigma("set_instance_overrides", { sourceInstanceId: sourceInstanceId, targetNodeIds: targetNodeIds || [] }); const typedResult = result as setInstanceOverridesResult; if (typedResult.success) { const successCount = typedResult.results?.filter(r => r.success).length || 0; return { content: [ { type: "text", text: `Successfully applied ${typedResult.totalCount || 0} overrides to ${successCount} instances.` } ] }; } else { return { content: [ { type: "text", text: `Failed to set instance overrides: ${typedResult.message}` } ] }; } } catch (error) { return { content: [ { type: "text", text: `Error setting instance overrides: ${error instanceof Error ? error.message : String(error)}` } ] }; } }
  • Zod input schema for the set_instance_overrides tool defining parameters sourceInstanceId and targetNodeIds.
    { sourceInstanceId: z.string().describe("ID of the source component instance"), targetNodeIds: z.array(z.string()).describe("Array of target instance IDs. Currently selected instances will be used.") },
  • TypeScript interface defining the expected result structure from the Figma plugin for set_instance_overrides.
    interface setInstanceOverridesResult { success: boolean; message: string; totalCount?: number; results?: Array<{ success: boolean; instanceId: string; instanceName: string; appliedCount?: number; message?: string; }>; }

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