feat: fetch multiple Figma nodes in one get_figma_data call - #404
Open
GLips wants to merge 4 commits into
Open
Conversation
Normalize both API response shapes into a common slice list so parseAPIResponse aggregates roots/components/styles declaratively, and make the metrics pass (countNamedStyles, detectVariables) skip null node entries so a partial miss (some ids resolve, some don't) no longer crashes with a TypeError after simplify. Also surface skipped ids via Logger, tighten the nodeId regex grammar, and add cross-node dedup + partial-miss regression tests.
A multi-node fetch where some ids resolve and others don't previously only logged the gap server-side, so the LLM could act on an incomplete design as if it were complete. Carry missingNodeIds onto SimplifiedDesign (present only when non-empty, so the common case costs no tokens) and render a MISSING_NODES line in the tree format; YAML/JSON pick it up via metadata.
GLips
force-pushed
the
advisor/003-multi-node-fetch
branch
from
June 24, 2026 17:23
c2968c0 to
5637d60
Compare
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.
What this enables
get_figma_datacan now fetch several top-level nodes in a single call by passing comma-separated ids (nodeId: "1:2,3:4"). Previously, assembling a multi-frame design meant one tool call per node — more round-trips, more latency, more tokens spent re-sending the file context each time. The LLM driving the tool can now grab every frame it needs at once.Two audiences benefit:
MISSING_NODESmarker so the model knows it's working from an incomplete design instead of silently assuming it got everything.parseAPIResponseis no longer a two-branch mutation bag — both API response shapes (full-file and by-nodes) normalize into a common slice list and aggregate declaratively. This PR also lands the FigmaService characterization tests that lock down the request/error path the feature exercises.Why now
The Figma REST API's
nodes?ids=endpoint has always accepted a comma-separated list, but the parser only ever read the first node and dropped the rest. The same line also crashed with a rawTypeErrorwhen the API returned an emptynodesobject — bypassing the friendly not-found guidance one line below it. This is a captured, grounded request (docs/ideas/multi-node-fetch.md), and the fix for "only reads the first node" is the same edit that removes the crash.What reviewers should know
main.getRawNodeis deliberately untouched — it already passes the ids string straight through to the API, so no change was needed at the request layer.globalVars/traversalState), so a style or subtree shared between two separately-requested nodes is counted across both and elevated once — the same machinery that already deduped across a full file's top-level frames. Tests cover the shared-hoist, single-use-inline, and cross-root-template cases.not_founderror. The skipped ids are logged server-side and surfaced to the caller.missingNodeIds/MISSING_NODESfield, anddownload_figma_imageskeeps its own single-node regex (it takes an array, not a comma scalar).Reviewed for correctness across two independent passes (incl. a cross-model audit); full suite, type-check, and lint green.