get_instance_overrides
Extract override properties from a component instance in Figma to apply and align them across other instances, ensuring consistent design implementation.
Instructions
Get all override properties from a selected component instance. These overrides can be applied to other instances, which will swap them to match the source component.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/talk_to_figma_mcp/server.ts:1243-1277 (registration)Registration of the get_instance_overrides MCP tool, including input schema, description, and inline handler function that proxies to Figma plugin.server.tool( "get_instance_overrides", "Get all override properties from a selected component instance. These overrides can be applied to other instances, which will swap them to match the source component.", { nodeId: z.string().optional().describe("Optional ID of the component instance to get overrides from. If not provided, currently selected instance will be used."), }, async ({ nodeId }) => { try { const result = await sendCommandToFigma("get_instance_overrides", { instanceNodeId: nodeId || null }); const typedResult = result as getInstanceOverridesResult; return { content: [ { type: "text", text: typedResult.success ? `Successfully got instance overrides: ${typedResult.message}` : `Failed to get instance overrides: ${typedResult.message}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error copying instance overrides: ${error instanceof Error ? error.message : String(error)}` } ] }; } } );
- Handler function executes the tool logic by sending 'get_instance_overrides' command to the Figma plugin via WebSocket and formats the response as MCP content.async ({ nodeId }) => { try { const result = await sendCommandToFigma("get_instance_overrides", { instanceNodeId: nodeId || null }); const typedResult = result as getInstanceOverridesResult; return { content: [ { type: "text", text: typedResult.success ? `Successfully got instance overrides: ${typedResult.message}` : `Failed to get instance overrides: ${typedResult.message}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error copying instance overrides: ${error instanceof Error ? error.message : String(error)}` } ] }; } }
- TypeScript interface defining the structure of the result returned by the Figma plugin for get_instance_overrides command.interface getInstanceOverridesResult { success: boolean; message: string; sourceInstanceId: string; mainComponentId: string; overridesCount: number; }
- Zod schema for input parameters to the tool (optional nodeId).{ nodeId: z.string().optional().describe("Optional ID of the component instance to get overrides from. If not provided, currently selected instance will be used."), },
- Supporting TypeScript interface for ComponentOverride, likely used in processing override data from Figma.interface ComponentOverride { id: string; overriddenFields: string[]; }