set_effects
Apply visual effects like shadows and blurs to Figma design elements. Modify drop shadows, inner shadows, layer blur, and background blur properties for nodes.
Instructions
Set the visual effects of a node in Figma
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodeId | Yes | The ID of the node to modify | |
| effects | Yes | Array of effects to apply |
Implementation Reference
- The asynchronous handler function for the 'set_effects' MCP tool. It sends the nodeId and effects array to Figma using sendCommandToFigma and returns a success message with the node name or an error message.async ({ nodeId, effects }) => { try { const result = await sendCommandToFigma("set_effects", { nodeId, effects }); const typedResult = result as { name: string, effects: any[] }; return { content: [ { type: "text", text: `Successfully applied ${effects.length} effect(s) to node "${typedResult.name}"` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error setting effects: ${error instanceof Error ? error.message : String(error)}` } ] }; } }
- Zod schema defining the input parameters for the set_effects tool: nodeId (string) and effects (array of effect objects with type, optional color, offset, radius, spread, visible, blendMode).{ nodeId: z.string().describe("The ID of the node to modify"), effects: z.array( z.object({ type: z.enum(["DROP_SHADOW", "INNER_SHADOW", "LAYER_BLUR", "BACKGROUND_BLUR"]).describe("Effect type"), color: z.object({ r: z.number().min(0).max(1).describe("Red (0-1)"), g: z.number().min(0).max(1).describe("Green (0-1)"), b: z.number().min(0).max(1).describe("Blue (0-1)"), a: z.number().min(0).max(1).describe("Alpha (0-1)") }).optional().describe("Effect color (for shadows)"), offset: z.object({ x: z.number().describe("X offset"), y: z.number().describe("Y offset") }).optional().describe("Offset (for shadows)"), radius: z.number().optional().describe("Effect radius"), spread: z.number().optional().describe("Shadow spread (for shadows)"), visible: z.boolean().optional().describe("Whether the effect is visible"), blendMode: z.string().optional().describe("Blend mode") }) ).describe("Array of effects to apply") },
- src/talk_to_figma_mcp/tools/modification-tools.ts:316-369 (registration)MCP server.tool registration call for 'set_effects', including description, input schema, and handler function.server.tool( "set_effects", "Set the visual effects of a node in Figma", { nodeId: z.string().describe("The ID of the node to modify"), effects: z.array( z.object({ type: z.enum(["DROP_SHADOW", "INNER_SHADOW", "LAYER_BLUR", "BACKGROUND_BLUR"]).describe("Effect type"), color: z.object({ r: z.number().min(0).max(1).describe("Red (0-1)"), g: z.number().min(0).max(1).describe("Green (0-1)"), b: z.number().min(0).max(1).describe("Blue (0-1)"), a: z.number().min(0).max(1).describe("Alpha (0-1)") }).optional().describe("Effect color (for shadows)"), offset: z.object({ x: z.number().describe("X offset"), y: z.number().describe("Y offset") }).optional().describe("Offset (for shadows)"), radius: z.number().optional().describe("Effect radius"), spread: z.number().optional().describe("Shadow spread (for shadows)"), visible: z.boolean().optional().describe("Whether the effect is visible"), blendMode: z.string().optional().describe("Blend mode") }) ).describe("Array of effects to apply") }, async ({ nodeId, effects }) => { try { const result = await sendCommandToFigma("set_effects", { nodeId, effects }); const typedResult = result as { name: string, effects: any[] }; return { content: [ { type: "text", text: `Successfully applied ${effects.length} effect(s) to node "${typedResult.name}"` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error setting effects: ${error instanceof Error ? error.message : String(error)}` } ] }; } } );
- src/talk_to_figma_mcp/tools/index.ts:16-16 (registration)Invocation of registerModificationTools function, which registers the set_effects tool among others, within the main registerTools aggregator.registerModificationTools(server);
- Inclusion of 'set_effects' in the FigmaCommand type union, used for typing commands sent to Figma.| "set_effects"