feat(icon.ts simplify-node-response.ts): optimize icon handling with direct MCP response integration#154
feat(icon.ts simplify-node-response.ts): optimize icon handling with direct MCP response integration#154miraclehen wants to merge 5 commits intoGLips:mainfrom
Conversation
…irect MCP response integration
… feat/icon-handing # Conflicts: # src/services/figma.ts # src/utils/common.ts
|
Was able to take a look at the code and take it for a spin too. This is awesome—I really like a lot of the stuff in here. I love the logic in The deterministic naming seems super useful too—especially if we could do it solely based on the Figma file metadata (i.e. before downloading the file itself). That way we could check the filesystem first to see if a file exists before we kick off the download. One issue—I'm not sure PNG images are supported and downloaded anymore in this version? We'll need to maintain support for that. There are two other things I'm a bit concerned about at a higher, more architectural level. Would to chat through more. 1. Combining image downloads with data requestI'm not sure about combining the image downloads with the initial Figma data request. The reasons I can immediately think of are twofold. Potential Issue: LatencyIncreases latency of the initial call to get Figma data. If you're iterating on a design and calling the same frame, or following up on an initial design with a focus on a child frame the LLM didn't get quite right, downloading images would slow that iteration down. I kinda like the Unix-philosophy of one-job-per-tool for the MCP, but I do also see the benefit of combining the two functions into a single function where it's not the LLM's direct responsibility to ask for image downloads. I could go either way here honestly. Curious to hear your thoughts. Potential Issue: CMS-backed ProjectsSome developers might be working in CMS-backed systems, where images are pulled dynamically and Figma images only serve as placeholders. Combining the two features means developers can't include "ignore the images in the file, and instead pull from our CMS this way: ..." in their prompt. Addressing this first concernWe might be able to address both issues by including a arguments for the That would probably work, but we also just added some SVG options to the 2. Including SVG strings in responseThis one I feel more strongly about than the first. Including the full SVG strings for icons in the The technique of downloading them to a local tmp directory is pretty clever, but I'm just concerned about blowing up LLM's context windows. Also if I'm not mistaken, an LLM would need to create the SVG files on its own from the passed in data via subsequent tool calls. Addressing this second concernI feel like downloading SVGs as files is a better solution there, since SVGs can be stored and served as files, and we already run locally on developers' computers, so have access to read/write files without LLMs driving everything. Looking forward to hearing your thoughts on the above and working to get this merged. Thanks for another great contribution! |
Overview
This pull request optimizes the icon handling process in the frontend project by transitioning from LLM-based icon recognition and individual downloads to directly utilizing the Figma MCP server response. During local development, an LLM prompt manages icon file checks, creation, and correct referencing. I suggest adding prompt documentation and Figma icon naming guidelines in the README to ensure the Figma MCP server operates as expected.
Changes Made
Prompt
These were the reference prompts I used while working on this PR:
Constraints:
For example, if the icon field is arrow_right_aba990.svg, the usage should be:
Documentation Update Suggestion:
Suggested adding a section in the README with LLM prompt guidelines and Figma icon naming recommendations to guide users interacting with the Figma MCP server during local development, ensuring the server operates as expected and standardizing icon naming.
README Update (Suggested)
To ensure users can effectively interact with the Figma MCP server, I suggest adding the following guidelines to the Readme files.
Suggested Prompt:
Suggested Figma Guidelines
This is a bold change, but local testing shows promising results, and I’d greatly appreciate feedback from the maintainers to ensure it aligns with the project’s goals. 😊