feat: add set_fills tool for multi-fill stack support - #173
Open
Ananchai-m wants to merge 1 commit into
Open
Conversation
set_fill_color only accepts a single SOLID color and replaces the entire fills array — multi-fill stacks (base color + semi-transparent overlay, two stacked gradients, etc.) couldn't be set via MCP. Add set_fills tool accepting an array of paint specs. Each entry takes type (SOLID / GRADIENT_LINEAR), color (or gradientStops for gradients), opacity, blend mode, and visibility. Order is bottom-up: index 0 is the bottom-most layer, last entry renders on top — matches Figma's own fills array semantics. Plugin handler builds the paint objects, validates required fields per type, and assigns to node.fills. Server exposes the tool with a zod schema mirroring the runtime validation. Useful for testing converters / pipelines that handle multi-fill specifically (e.g. nested-Frame native rendering instead of PNG rasterisation).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
set_fill_coloronly accepts a single SOLID color and replaces the entire fills array — multi-fill stacks (base color + semi-transparent overlay, two stacked gradients, etc.) couldn't be set via MCP. This blocked testing converters / pipelines that handle multi-fill specifically.Changes
Adds a
set_fillstool accepting an array of paint specs:Each entry takes
type(SOLID / GRADIENT_LINEAR),color(orgradientStopsfor gradients),opacity,blendMode, andvisible. Order is bottom-up: index 0 is the bottom-most layer, last entry renders on top — matches Figma's ownfillsarray semantics.Plugin handler builds the paint objects, validates required fields per type, and assigns to
node.fills. Server exposes the tool with a zod schema mirroring the runtime validation.Tests
Manually verified locally — calling
set_fillson a Figma rectangle produces the expected stacked appearance, matches what the user would get from manually pressing+in Figma's Fill panel.Files changed
src/talk_to_figma_mcp/server.ts— tool definition + zod schema + CommandParams entrysrc/cursor_mcp_plugin/code.js—setFills()handler + dispatch case