@sarjallab09/figma-intelligence 1.0.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +67 -36
- package/dist/bin/cli.js +2 -0
- package/dist/design-bridge/bridge.js +2 -0
- package/dist/figma-bridge-plugin/bridge-relay.js +2 -0
- package/dist/figma-bridge-plugin/code.js +1 -0
- package/{figma-bridge-plugin → dist/figma-bridge-plugin}/package-lock.json +0 -3
- package/dist/figma-bridge-plugin/ui.html +4970 -0
- package/dist/figma-intelligence-layer/dist/index.js +2 -0
- package/dist/scripts/clean-existing-chunks.js +2 -0
- package/dist/scripts/connect-ai-tool.js +2 -0
- package/dist/scripts/convert-hub-pdfs.js +2 -0
- package/dist/scripts/figma-mcp-status.js +2 -0
- package/dist/scripts/register-codex-mcp.js +2 -0
- package/dist/scripts/test-copilot-chat.js +2 -0
- package/package.json +11 -8
- package/bin/cli.js +0 -859
- package/design-bridge/bridge.js +0 -196
- package/design-bridge/lib/assets.js +0 -367
- package/design-bridge/lib/prompt.js +0 -85
- package/design-bridge/lib/server.js +0 -66
- package/design-bridge/lib/stitch.js +0 -37
- package/design-bridge/lib/tokens.js +0 -82
- package/design-bridge/package-lock.json +0 -579
- package/figma-bridge-plugin/README.md +0 -97
- package/figma-bridge-plugin/anthropic-chat-runner.js +0 -192
- package/figma-bridge-plugin/bridge-relay.js +0 -2363
- package/figma-bridge-plugin/chat-runner.js +0 -459
- package/figma-bridge-plugin/code.js +0 -1528
- package/figma-bridge-plugin/codex-runner.js +0 -505
- package/figma-bridge-plugin/component-schemas.js +0 -110
- package/figma-bridge-plugin/content-context.js +0 -869
- package/figma-bridge-plugin/create-button.js +0 -216
- package/figma-bridge-plugin/gemini-cli-runner.js +0 -291
- package/figma-bridge-plugin/gemini-runner.js +0 -187
- package/figma-bridge-plugin/html-to-figma.js +0 -927
- package/figma-bridge-plugin/knowledge-hub/.gitkeep +0 -0
- package/figma-bridge-plugin/knowledge-hub/uspec-references/anatomy-spec.md +0 -159
- package/figma-bridge-plugin/knowledge-hub/uspec-references/api-spec.md +0 -162
- package/figma-bridge-plugin/knowledge-hub/uspec-references/color-spec.md +0 -148
- package/figma-bridge-plugin/knowledge-hub/uspec-references/full-spec-template.md +0 -314
- package/figma-bridge-plugin/knowledge-hub/uspec-references/property-spec.md +0 -175
- package/figma-bridge-plugin/knowledge-hub/uspec-references/screen-reader-spec.md +0 -180
- package/figma-bridge-plugin/knowledge-hub/uspec-references/structure-spec.md +0 -165
- package/figma-bridge-plugin/perplexity-runner.js +0 -188
- package/figma-bridge-plugin/references/SKILL.md +0 -178
- package/figma-bridge-plugin/references/anatomy-spec.md +0 -159
- package/figma-bridge-plugin/references/api-spec.md +0 -162
- package/figma-bridge-plugin/references/color-spec.md +0 -148
- package/figma-bridge-plugin/references/full-spec-template.md +0 -314
- package/figma-bridge-plugin/references/property-spec.md +0 -175
- package/figma-bridge-plugin/references/screen-reader-spec.md +0 -180
- package/figma-bridge-plugin/references/structure-spec.md +0 -165
- package/figma-bridge-plugin/shared-prompt-config.js +0 -604
- package/figma-bridge-plugin/spec-helpers/build-table.js +0 -269
- package/figma-bridge-plugin/spec-helpers/classify-elements.js +0 -189
- package/figma-bridge-plugin/spec-helpers/index.js +0 -35
- package/figma-bridge-plugin/spec-helpers/parse-figma-link.js +0 -49
- package/figma-bridge-plugin/spec-helpers/position-markers.js +0 -158
- package/figma-bridge-plugin/stitch-auth.js +0 -322
- package/figma-bridge-plugin/stitch-runner.js +0 -1427
- package/figma-bridge-plugin/token-resolver.js +0 -107
- package/figma-bridge-plugin/ui.html +0 -4467
- package/figma-intelligence-layer/.env.example +0 -39
- package/figma-intelligence-layer/docs/local-image-generation.md +0 -60
- package/figma-intelligence-layer/examples/comfyui-workflow-template.example.json +0 -101
- package/figma-intelligence-layer/jest.config.js +0 -14
- package/figma-intelligence-layer/mcp-config.json +0 -19
- package/figma-intelligence-layer/package-lock.json +0 -5892
- package/figma-intelligence-layer/scripts/setup-comfyui-local.sh +0 -67
- package/figma-intelligence-layer/scripts/start-comfyui.sh +0 -33
- package/figma-intelligence-layer/src/index.ts +0 -2233
- package/figma-intelligence-layer/src/shared/auto-layout-validator.ts +0 -404
- package/figma-intelligence-layer/src/shared/cache.ts +0 -187
- package/figma-intelligence-layer/src/shared/color-operations.ts +0 -533
- package/figma-intelligence-layer/src/shared/color-utils.ts +0 -138
- package/figma-intelligence-layer/src/shared/component-script-builder.ts +0 -413
- package/figma-intelligence-layer/src/shared/component-templates.ts +0 -2767
- package/figma-intelligence-layer/src/shared/concept-taxonomy.ts +0 -694
- package/figma-intelligence-layer/src/shared/decision-log.ts +0 -128
- package/figma-intelligence-layer/src/shared/design-system-context.ts +0 -568
- package/figma-intelligence-layer/src/shared/design-system-intelligence.ts +0 -131
- package/figma-intelligence-layer/src/shared/design-system-matcher.ts +0 -184
- package/figma-intelligence-layer/src/shared/design-system-normalizers.ts +0 -196
- package/figma-intelligence-layer/src/shared/design-system-tokens.ts +0 -295
- package/figma-intelligence-layer/src/shared/dtcg-validator.ts +0 -530
- package/figma-intelligence-layer/src/shared/enrichment-pipeline.ts +0 -671
- package/figma-intelligence-layer/src/shared/figma-bridge.ts +0 -1408
- package/figma-intelligence-layer/src/shared/font-config.ts +0 -126
- package/figma-intelligence-layer/src/shared/icon-catalog.ts +0 -360
- package/figma-intelligence-layer/src/shared/icon-fetch.ts +0 -80
- package/figma-intelligence-layer/src/shared/prototype-script-builder.ts +0 -162
- package/figma-intelligence-layer/src/shared/response-compression.ts +0 -440
- package/figma-intelligence-layer/src/shared/semantic-token-catalog.ts +0 -324
- package/figma-intelligence-layer/src/shared/token-binder.ts +0 -505
- package/figma-intelligence-layer/src/shared/token-math.ts +0 -427
- package/figma-intelligence-layer/src/shared/token-naming.ts +0 -468
- package/figma-intelligence-layer/src/shared/token-utils.ts +0 -420
- package/figma-intelligence-layer/src/shared/types.ts +0 -346
- package/figma-intelligence-layer/src/shared/typography-presets.ts +0 -94
- package/figma-intelligence-layer/src/shared/unsplash.ts +0 -165
- package/figma-intelligence-layer/src/shared/vision-client.ts +0 -607
- package/figma-intelligence-layer/src/shared/vision-provider-anthropic.ts +0 -334
- package/figma-intelligence-layer/src/shared/vision-provider-openai.ts +0 -446
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/a11y-annotate-handler.ts +0 -782
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/a11y-annotate-renderer.ts +0 -496
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/a11y-annotation-kit.ts +0 -230
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/colorblind-sim.ts +0 -66
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/index.ts +0 -810
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/keyboard-sr-order-analyzer.ts +0 -1191
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/keyboard-sr-order-figma-page.ts +0 -1346
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/keyboard-sr-order-handler.ts +0 -148
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/vpat-figma-page.ts +0 -499
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/vpat-report.ts +0 -910
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/wcag-checker.ts +0 -989
- package/figma-intelligence-layer/src/tools/phase1-vision/a11y-audit/wcag-criteria.ts +0 -1160
- package/figma-intelligence-layer/src/tools/phase1-vision/design-from-ref/index.ts +0 -424
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/component-recognizer.ts +0 -38
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/ds-matcher.ts +0 -111
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/font-matcher.ts +0 -114
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/icon-resolver.ts +0 -103
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/index.ts +0 -1060
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/layout-segmenter.ts +0 -18
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/token-inferencer.ts +0 -39
- package/figma-intelligence-layer/src/tools/phase1-vision/screen-cloner/vision-pipeline.ts +0 -58
- package/figma-intelligence-layer/src/tools/phase1-vision/sketch-to-design/index.ts +0 -298
- package/figma-intelligence-layer/src/tools/phase1-vision/visual-audit/index.ts +0 -197
- package/figma-intelligence-layer/src/tools/phase2-accuracy/component-audit/index.ts +0 -494
- package/figma-intelligence-layer/src/tools/phase2-accuracy/intent-translator/index.ts +0 -356
- package/figma-intelligence-layer/src/tools/phase2-accuracy/layout-intelligence/container-patterns.ts +0 -123
- package/figma-intelligence-layer/src/tools/phase2-accuracy/layout-intelligence/index.ts +0 -663
- package/figma-intelligence-layer/src/tools/phase2-accuracy/lint-rules/built-in-rules.yaml +0 -56
- package/figma-intelligence-layer/src/tools/phase2-accuracy/lint-rules/index.ts +0 -614
- package/figma-intelligence-layer/src/tools/phase2-accuracy/lint-rules/rule-engine.ts +0 -113
- package/figma-intelligence-layer/src/tools/phase2-accuracy/theme-generator/color-theory.ts +0 -178
- package/figma-intelligence-layer/src/tools/phase2-accuracy/theme-generator/index.ts +0 -470
- package/figma-intelligence-layer/src/tools/phase2-accuracy/variant-expander/index.ts +0 -429
- package/figma-intelligence-layer/src/tools/phase2-accuracy/variant-expander/token-override-maps.ts +0 -226
- package/figma-intelligence-layer/src/tools/phase3-generation/ai-image-insert/index.ts +0 -535
- package/figma-intelligence-layer/src/tools/phase3-generation/component-archaeologist/index.ts +0 -660
- package/figma-intelligence-layer/src/tools/phase3-generation/component-archaeologist/pattern-fingerprints.ts +0 -209
- package/figma-intelligence-layer/src/tools/phase3-generation/composition-builder/index.ts +0 -540
- package/figma-intelligence-layer/src/tools/phase3-generation/figma-animated-build.ts +0 -391
- package/figma-intelligence-layer/src/tools/phase3-generation/page-architect/index.ts +0 -2019
- package/figma-intelligence-layer/src/tools/phase3-generation/page-architect/screen-templates.ts +0 -131
- package/figma-intelligence-layer/src/tools/phase3-generation/prototype-map/index.ts +0 -381
- package/figma-intelligence-layer/src/tools/phase3-generation/prototype-wire/index.ts +0 -565
- package/figma-intelligence-layer/src/tools/phase3-generation/swarm-build/index.ts +0 -764
- package/figma-intelligence-layer/src/tools/phase3-generation/system-drift/index.ts +0 -535
- package/figma-intelligence-layer/src/tools/phase3-generation/unsplash-search/index.ts +0 -84
- package/figma-intelligence-layer/src/tools/phase3-generation/url-to-frame/index.ts +0 -401
- package/figma-intelligence-layer/src/tools/phase4-sync/animation-specifier/code-generators/css-animations.ts +0 -68
- package/figma-intelligence-layer/src/tools/phase4-sync/animation-specifier/code-generators/framer-motion.ts +0 -78
- package/figma-intelligence-layer/src/tools/phase4-sync/animation-specifier/code-generators/swift-animations.ts +0 -93
- package/figma-intelligence-layer/src/tools/phase4-sync/animation-specifier/index.ts +0 -596
- package/figma-intelligence-layer/src/tools/phase4-sync/ci-check/index.ts +0 -462
- package/figma-intelligence-layer/src/tools/phase4-sync/export-tokens/index.ts +0 -1470
- package/figma-intelligence-layer/src/tools/phase4-sync/generate-component-code/index.ts +0 -829
- package/figma-intelligence-layer/src/tools/phase4-sync/handoff-spec/index.ts +0 -702
- package/figma-intelligence-layer/src/tools/phase4-sync/icon-library-sync/index.ts +0 -483
- package/figma-intelligence-layer/src/tools/phase4-sync/sync-from-code/index.ts +0 -501
- package/figma-intelligence-layer/src/tools/phase4-sync/sync-from-code/storybook-parser.ts +0 -106
- package/figma-intelligence-layer/src/tools/phase4-sync/watch-docs/index.ts +0 -676
- package/figma-intelligence-layer/src/tools/phase4-sync/webhook-listener/index.ts +0 -560
- package/figma-intelligence-layer/src/tools/phase5-governance/apg-doc/index.ts +0 -1043
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/component-detection.ts +0 -620
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/anatomy.ts +0 -331
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/color-tokens.ts +0 -77
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/properties.ts +0 -54
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/snapshot.ts +0 -287
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/spacing.ts +0 -71
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/states.ts +0 -43
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/extractors/typography.ts +0 -71
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/index.ts +0 -221
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/_default.ts +0 -166
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/accordion.ts +0 -232
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/alert.ts +0 -234
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/avatar-group.ts +0 -270
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/avatar.ts +0 -249
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/badge.ts +0 -231
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/banner.ts +0 -293
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/breadcrumb.ts +0 -240
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/button.ts +0 -243
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/calendar.ts +0 -307
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/card.ts +0 -143
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/checkbox.ts +0 -227
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/chip.ts +0 -233
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/combobox.ts +0 -282
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/datepicker.ts +0 -276
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/divider.ts +0 -223
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/drawer.ts +0 -255
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/dropdown-menu.ts +0 -289
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/empty-state.ts +0 -261
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/file-uploader.ts +0 -290
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/form.ts +0 -265
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/grid.ts +0 -238
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/icon.ts +0 -255
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/index.ts +0 -128
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/inline-edit.ts +0 -286
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/inline-message.ts +0 -255
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/input.ts +0 -330
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/link.ts +0 -247
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/list.ts +0 -250
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/menu.ts +0 -247
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/modal.ts +0 -144
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/navbar.ts +0 -264
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/navigation.ts +0 -251
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/number-input.ts +0 -261
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/pagination.ts +0 -248
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/popover.ts +0 -270
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/progress.ts +0 -251
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/radio.ts +0 -142
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/range-slider.ts +0 -282
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/rating.ts +0 -250
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/search.ts +0 -258
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/segmented-control.ts +0 -265
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/select.ts +0 -319
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/skeleton.ts +0 -256
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/slider.ts +0 -232
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/spinner.ts +0 -239
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/status-dot.ts +0 -252
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/stepper.ts +0 -270
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/table.ts +0 -244
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/tabs.ts +0 -143
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/tag.ts +0 -243
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/textarea.ts +0 -259
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/time-picker.ts +0 -293
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/toast.ts +0 -144
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/toggle.ts +0 -289
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/toolbar.ts +0 -267
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/tooltip.ts +0 -232
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/treeview.ts +0 -257
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/knowledge/typography.ts +0 -319
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/legacy-compat.ts +0 -121
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/anatomy-diagram.ts +0 -430
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/figma-page.ts +0 -312
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/json.ts +0 -129
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/markdown.ts +0 -78
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/renderers/visual-doc.ts +0 -2333
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/accessibility.ts +0 -100
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/anatomy.ts +0 -32
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/color-tokens.ts +0 -59
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/content-guidance.ts +0 -18
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/design-tokens.ts +0 -53
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/interaction-rules.ts +0 -19
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/overview.ts +0 -91
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/properties-api.ts +0 -71
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/qa-criteria.ts +0 -19
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/related-components.ts +0 -110
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/responsive.ts +0 -19
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/size-specs.ts +0 -67
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/spacing-structure.ts +0 -58
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/state-specs.ts +0 -79
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/states.ts +0 -50
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/type-hierarchy.ts +0 -33
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/typography.ts +0 -55
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/usage-guidelines.ts +0 -73
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/sections/variants.ts +0 -81
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec/types.ts +0 -409
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec-sheet/index.ts +0 -198
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec-sheet/renderer.ts +0 -701
- package/figma-intelligence-layer/src/tools/phase5-governance/component-spec-sheet/types.ts +0 -88
- package/figma-intelligence-layer/src/tools/phase5-governance/decision-log/index.ts +0 -135
- package/figma-intelligence-layer/src/tools/phase5-governance/design-decision-log/index.ts +0 -491
- package/figma-intelligence-layer/src/tools/phase5-governance/ds-primitives/index.ts +0 -416
- package/figma-intelligence-layer/src/tools/phase5-governance/ds-scaffolder/index.ts +0 -722
- package/figma-intelligence-layer/src/tools/phase5-governance/ds-variables/index.ts +0 -449
- package/figma-intelligence-layer/src/tools/phase5-governance/health-report/index.ts +0 -393
- package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/index.ts +0 -406
- package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/renderers/figma-page.ts +0 -292
- package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/renderers/json.ts +0 -24
- package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/renderers/markdown.ts +0 -172
- package/figma-intelligence-layer/src/tools/phase5-governance/taxonomy-docs/renderers/naming-guide.ts +0 -409
- package/figma-intelligence-layer/src/tools/phase5-governance/token-analytics/index.ts +0 -594
- package/figma-intelligence-layer/src/tools/phase5-governance/token-docs/index.ts +0 -710
- package/figma-intelligence-layer/src/tools/phase5-governance/token-migrate/index.ts +0 -458
- package/figma-intelligence-layer/src/tools/phase5-governance/token-naming/index.ts +0 -134
- package/figma-intelligence-layer/tests/apg-doc.test.ts +0 -101
- package/figma-intelligence-layer/tests/design-system-context.test.ts +0 -152
- package/figma-intelligence-layer/tests/design-system-matcher.test.ts +0 -144
- package/figma-intelligence-layer/tests/figma-bridge.test.ts +0 -83
- package/figma-intelligence-layer/tests/generate-image-and-insert.test.ts +0 -56
- package/figma-intelligence-layer/tests/screen-cloner-regression.test.ts +0 -69
- package/figma-intelligence-layer/tests/smoke.test.ts +0 -174
- package/figma-intelligence-layer/tests/spec-generator.test.ts +0 -127
- package/figma-intelligence-layer/tests/token-migrate.test.ts +0 -21
- package/figma-intelligence-layer/tests/token-naming.test.ts +0 -30
- package/figma-intelligence-layer/tsconfig.json +0 -19
- package/scripts/clean-existing-chunks.js +0 -179
- package/scripts/connect-ai-tool.js +0 -490
- package/scripts/convert-hub-pdfs.js +0 -425
- package/scripts/figma-mcp-status.js +0 -349
- package/scripts/register-codex-mcp.js +0 -96
- /package/{design-bridge → dist/design-bridge}/.env.example +0 -0
- /package/{design-bridge → dist/design-bridge}/package.json +0 -0
- /package/{figma-bridge-plugin → dist/figma-bridge-plugin}/manifest.json +0 -0
- /package/{figma-bridge-plugin → dist/figma-bridge-plugin}/package.json +0 -0
- /package/{figma-intelligence-layer → dist/figma-intelligence-layer}/package.json +0 -0
|
@@ -1,2233 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* figma-intelligence-layer — MCP Server
|
|
4
|
-
* 28 tools across 5 phases for pixel-accurate, bidirectional, context-aware AI ↔ Design collaboration.
|
|
5
|
-
*
|
|
6
|
-
* Architecture:
|
|
7
|
-
* Claude Desktop / Claude Code
|
|
8
|
-
* ↓ MCP protocol (stdio)
|
|
9
|
-
* This MCP server (figma-intelligence-layer)
|
|
10
|
-
* ↓ WebSocket
|
|
11
|
-
* Figma Desktop Bridge Plugin
|
|
12
|
-
* ↓ Plugin API
|
|
13
|
-
* Figma Electron App
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
17
|
-
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
18
|
-
import {
|
|
19
|
-
CallToolRequestSchema,
|
|
20
|
-
ListToolsRequestSchema,
|
|
21
|
-
Tool,
|
|
22
|
-
} from "@modelcontextprotocol/sdk/types.js";
|
|
23
|
-
|
|
24
|
-
// ─── Phase 1: Visual Intelligence ───────────────────────────────────────────
|
|
25
|
-
import { screenClonerHandler } from "./tools/phase1-vision/screen-cloner/index.js";
|
|
26
|
-
import { visualAuditHandler } from "./tools/phase1-vision/visual-audit/index.js";
|
|
27
|
-
import { a11yAuditHandler } from "./tools/phase1-vision/a11y-audit/index.js";
|
|
28
|
-
import { keyboardSrOrderHandler } from "./tools/phase1-vision/a11y-audit/keyboard-sr-order-handler.js";
|
|
29
|
-
import { a11yAnnotateHandler } from "./tools/phase1-vision/a11y-audit/a11y-annotate-handler.js";
|
|
30
|
-
import { sketchToDesignHandler } from "./tools/phase1-vision/sketch-to-design/index.js";
|
|
31
|
-
import { designFromRefHandler } from "./tools/phase1-vision/design-from-ref/index.js";
|
|
32
|
-
|
|
33
|
-
// ─── Phase 2: Design System Accuracy ────────────────────────────────────────
|
|
34
|
-
import { intentTranslatorHandler } from "./tools/phase2-accuracy/intent-translator/index.js";
|
|
35
|
-
import { layoutIntelligenceHandler } from "./tools/phase2-accuracy/layout-intelligence/index.js";
|
|
36
|
-
import { variantExpanderHandler } from "./tools/phase2-accuracy/variant-expander/index.js";
|
|
37
|
-
import { themeGeneratorHandler } from "./tools/phase2-accuracy/theme-generator/index.js";
|
|
38
|
-
import { lintRulesHandler } from "./tools/phase2-accuracy/lint-rules/index.js";
|
|
39
|
-
import { componentAuditHandler } from "./tools/phase2-accuracy/component-audit/index.js";
|
|
40
|
-
|
|
41
|
-
// ─── Phase 3: Generation & Scaffolding ──────────────────────────────────────
|
|
42
|
-
import { componentArchaeologistHandler } from "./tools/phase3-generation/component-archaeologist/index.js";
|
|
43
|
-
import { pageArchitectHandler } from "./tools/phase3-generation/page-architect/index.js";
|
|
44
|
-
import { generateImageAndInsertHandler } from "./tools/phase3-generation/ai-image-insert/index.js";
|
|
45
|
-
import { figmaUnsplashSearchHandler } from "./tools/phase3-generation/unsplash-search/index.js";
|
|
46
|
-
import { urlToFrameHandler } from "./tools/phase3-generation/url-to-frame/index.js";
|
|
47
|
-
import { systemDriftHandler } from "./tools/phase3-generation/system-drift/index.js";
|
|
48
|
-
import { prototypeMapHandler } from "./tools/phase3-generation/prototype-map/index.js";
|
|
49
|
-
import { prototypeScanHandler, prototypeWireHandler } from "./tools/phase3-generation/prototype-wire/index.js";
|
|
50
|
-
import { animatedBuildHandler } from "./tools/phase3-generation/figma-animated-build.js";
|
|
51
|
-
import { compositionBuilderHandler } from "./tools/phase3-generation/composition-builder/index.js";
|
|
52
|
-
import { swarmBuildHandler } from "./tools/phase3-generation/swarm-build/index.js";
|
|
53
|
-
|
|
54
|
-
// ─── Phase 4: Sync & Bidirectionality ───────────────────────────────────────
|
|
55
|
-
import { animationSpecifierHandler } from "./tools/phase4-sync/animation-specifier/index.js";
|
|
56
|
-
import { syncFromCodeHandler } from "./tools/phase4-sync/sync-from-code/index.js";
|
|
57
|
-
import { exportTokensHandler } from "./tools/phase4-sync/export-tokens/index.js";
|
|
58
|
-
import { generateComponentCodeHandler } from "./tools/phase4-sync/generate-component-code/index.js";
|
|
59
|
-
import { webhookListenerHandler } from "./tools/phase4-sync/webhook-listener/index.js";
|
|
60
|
-
import { handoffSpecHandler } from "./tools/phase4-sync/handoff-spec/index.js";
|
|
61
|
-
import { ciCheckHandler } from "./tools/phase4-sync/ci-check/index.js";
|
|
62
|
-
import { watchDocsHandler } from "./tools/phase4-sync/watch-docs/index.js";
|
|
63
|
-
import { iconLibrarySyncHandler } from "./tools/phase4-sync/icon-library-sync/index.js";
|
|
64
|
-
|
|
65
|
-
// ─── Phase 5: Memory, Governance & Health ───────────────────────────────────
|
|
66
|
-
import { dsScaffolderHandler } from "./tools/phase5-governance/ds-scaffolder/index.js";
|
|
67
|
-
import { dsVariablesHandler } from "./tools/phase5-governance/ds-variables/index.js";
|
|
68
|
-
import { decisionLogToolHandler } from "./tools/phase5-governance/decision-log/index.js";
|
|
69
|
-
import { designDecisionLogHandler } from "./tools/phase5-governance/design-decision-log/index.js";
|
|
70
|
-
import { healthReportHandler } from "./tools/phase5-governance/health-report/index.js";
|
|
71
|
-
import { componentSpecHandler } from "./tools/phase5-governance/component-spec/index.js";
|
|
72
|
-
import { componentSpecSheetHandler } from "./tools/phase5-governance/component-spec-sheet/index.js";
|
|
73
|
-
import { figmaApgDocHandler } from "./tools/phase5-governance/apg-doc/index.js";
|
|
74
|
-
import { dsPrimitivesHandler } from "./tools/phase5-governance/ds-primitives/index.js";
|
|
75
|
-
import { tokenNamingHandler } from "./tools/phase5-governance/token-naming/index.js";
|
|
76
|
-
import { tokenMigrateHandler } from "./tools/phase5-governance/token-migrate/index.js";
|
|
77
|
-
import { tokenAnalyticsHandler } from "./tools/phase5-governance/token-analytics/index.js";
|
|
78
|
-
import { tokenDocsHandler } from "./tools/phase5-governance/token-docs/index.js";
|
|
79
|
-
import { taxonomyDocsHandler } from "./tools/phase5-governance/taxonomy-docs/index.js";
|
|
80
|
-
import { validateDtcg } from "./shared/dtcg-validator.js";
|
|
81
|
-
// component-doc removed — replaced by component-spec
|
|
82
|
-
|
|
83
|
-
// ─── Bridge (for direct execute) ────────────────────────────────────────────
|
|
84
|
-
import { ensureRelayServer, getBridge } from "./shared/figma-bridge.js";
|
|
85
|
-
|
|
86
|
-
// ─── P0: Response compression ───────────────────────────────────────────────
|
|
87
|
-
import { compressResponse } from "./shared/response-compression.js";
|
|
88
|
-
|
|
89
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
90
|
-
// Tool registry — 29 tools
|
|
91
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
92
|
-
|
|
93
|
-
const TOOLS: Tool[] = [
|
|
94
|
-
// ── Phase 1 ──────────────────────────────────────────────────────────────
|
|
95
|
-
{
|
|
96
|
-
name: "figma_screen_cloner",
|
|
97
|
-
description:
|
|
98
|
-
"Takes any screenshot or image and reconstructs it as a Figma frame using your real design system — components, tokens, Auto Layout. Three modes: pixel (exact replica), system (DS-enforced), adaptive (system clone + improvement suggestions).",
|
|
99
|
-
inputSchema: {
|
|
100
|
-
type: "object",
|
|
101
|
-
properties: {
|
|
102
|
-
image: { type: "string", description: "Base64 image, data URI, URL, or file path" },
|
|
103
|
-
cloneMode: { type: "string", enum: ["pixel", "system", "adaptive"], description: "Clone fidelity mode" },
|
|
104
|
-
frameWidth: { type: "number", description: "Output frame width in px (default 1440)" },
|
|
105
|
-
targetPage: { type: "string", description: "Figma page name to place the output frame" },
|
|
106
|
-
annotateUnmatched: { type: "boolean", description: "Add sticky notes for zones with no DS match" },
|
|
107
|
-
},
|
|
108
|
-
required: ["image", "cloneMode"],
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
name: "figma_visual_audit",
|
|
113
|
-
description:
|
|
114
|
-
"Vision-based UX quality audit. Takes a screenshot or Figma node, returns severity-ranked issues (hierarchy, contrast, density, brand alignment, consistency) as Figma annotations and/or a structured report.",
|
|
115
|
-
inputSchema: {
|
|
116
|
-
type: "object",
|
|
117
|
-
properties: {
|
|
118
|
-
nodeId: { type: "string", description: "Figma node ID to audit (will be screenshotted)" },
|
|
119
|
-
imageInput: { type: "string", description: "External screenshot (base64 or URL)" },
|
|
120
|
-
auditAreas: {
|
|
121
|
-
type: "array",
|
|
122
|
-
items: { type: "string", enum: ["hierarchy", "contrast", "density", "brand", "consistency"] },
|
|
123
|
-
description: "Which audit dimensions to run",
|
|
124
|
-
},
|
|
125
|
-
outputFormat: { type: "string", enum: ["report", "annotations", "both"] },
|
|
126
|
-
},
|
|
127
|
-
required: ["auditAreas", "outputFormat"],
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
name: "figma_a11y_audit",
|
|
132
|
-
description:
|
|
133
|
-
"Comprehensive WCAG 2.2 accessibility audit producing a VPAT-style conformance report by default. Covers ALL success criteria at the requested level (A = ~30 SC, AA = ~50+ SC, AAA = ~78 SC). Each criterion gets a conformance status: Supports, Partially Supports, Does Not Support, Not Applicable, or Not Evaluated. Automated checks for contrast, target size, text spacing, non-text contrast, focus states, heading hierarchy, reading order, accessible names, and more. Manual-review criteria include actionable guidance. The result includes a formattedReport field with the full VPAT markdown table.",
|
|
134
|
-
inputSchema: {
|
|
135
|
-
type: "object",
|
|
136
|
-
properties: {
|
|
137
|
-
nodeId: { type: "string", description: "Figma node ID to audit" },
|
|
138
|
-
wcagLevel: { type: "string", enum: ["A", "AA", "AAA"], description: "WCAG conformance level. Level A checks ~30 criteria, AA checks ~50+, AAA checks all ~78." },
|
|
139
|
-
includeColorBlindSim: { type: "boolean", description: "Simulate 4 color blindness profiles (protanopia, deuteranopia, tritanopia, achromatopsia)" },
|
|
140
|
-
outputFormat: { type: "string", enum: ["inline", "report", "both"], description: "inline = Figma sticky notes, report = JSON, both = both" },
|
|
141
|
-
autoSuggestFixes: { type: "boolean", description: "Include fix suggestions in results" },
|
|
142
|
-
reportFormat: { type: "string", enum: ["issues-only", "vpat"], description: "vpat (default) returns a full VPAT-style conformance report with every SC at the requested level. issues-only returns only failing checks." },
|
|
143
|
-
},
|
|
144
|
-
required: ["nodeId", "wcagLevel", "outputFormat"],
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
name: "figma_a11y_keyboard_screenreader_order",
|
|
149
|
-
description:
|
|
150
|
-
"Generate a TEXT-BASED DOCUMENTATION PAGE (NO visual markers) with enterprise-level keyboard and screen reader order specifications. Creates a NEW Figma page containing 10 written sections: Header, Scope, Assumptions, Keyboard Tab Order table, Screen Reader Reading Order list, Interaction Announcements, Focus Management rules, Implementation Notes (ARIA table, Keyboard Behaviour, Do/Don't), Warnings, and Audit Summary. This is a reference document for developers — it does NOT place any visual numbered markers, stamps, or circle badges on the design canvas. If you need visual numbered circle markers on the design with a Tab Order Sequence chart, use figma_a11y_annotate instead.",
|
|
151
|
-
inputSchema: {
|
|
152
|
-
type: "object",
|
|
153
|
-
properties: {
|
|
154
|
-
nodeId: { type: "string", description: "Figma node ID of the frame/page to analyze" },
|
|
155
|
-
pageName: { type: "string", description: "Optional custom name for the generated annotation page" },
|
|
156
|
-
},
|
|
157
|
-
required: ["nodeId"],
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
name: "figma_a11y_annotate",
|
|
162
|
-
description:
|
|
163
|
-
"Place VISUAL numbered circle markers on a Figma design and generate a Tab Order Sequence chart. This is the tool for 'focus order annotation with markers', 'annotate focus order', 'tab order with markers', or 'add accessibility markers to my design'. Creates a NEW Figma page with: (1) a clone of the design showing numbered purple circle badges at each interactive element, (2) a Tab Order Sequence table with columns #, Element, Role, ARIA/Notes, and (3) Implementation Notes with keyboard behavior details. Supports 7 annotation types: focus-order (keyboard tab sequence), reading-order (screen reader sequence), input (form fields), landmark (ARIA landmarks), heading (heading levels H1-H6), link, button. Unlike figma_a11y_keyboard_screenreader_order which creates a text-only reference document, this tool places visual numbered markers directly on a design clone.",
|
|
164
|
-
inputSchema: {
|
|
165
|
-
type: "object",
|
|
166
|
-
properties: {
|
|
167
|
-
nodeId: { type: "string", description: "Figma node ID of the frame to annotate" },
|
|
168
|
-
annotationType: {
|
|
169
|
-
type: "string",
|
|
170
|
-
enum: ["focus-order", "reading-order", "input", "landmark", "heading", "link", "button", "all"],
|
|
171
|
-
description: "Which annotation type to render. Use 'all' for complete accessibility annotation.",
|
|
172
|
-
},
|
|
173
|
-
showDetails: { type: "boolean", description: "Whether to render details cards beside each element (default: false)" },
|
|
174
|
-
showLasso: { type: "boolean", description: "Whether to draw dotted borders around target elements (default: true)" },
|
|
175
|
-
placement: { type: "string", enum: ["left", "right", "auto"], description: "Stamp placement side relative to elements (default: left)" },
|
|
176
|
-
},
|
|
177
|
-
required: ["nodeId", "annotationType"],
|
|
178
|
-
},
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
name: "figma_sketch_to_design",
|
|
182
|
-
description:
|
|
183
|
-
"Upload a hand-drawn wireframe, whiteboard photo, or lo-fi sketch and receive a production-quality Figma frame using your design system components.",
|
|
184
|
-
inputSchema: {
|
|
185
|
-
type: "object",
|
|
186
|
-
properties: {
|
|
187
|
-
image: { type: "string", description: "Base64 sketch or whiteboard photo" },
|
|
188
|
-
productContext: { type: "string", description: "e.g. 'mobile banking app checkout flow'" },
|
|
189
|
-
strictDSOnly: { type: "boolean", description: "Error if no DS match found" },
|
|
190
|
-
frameWidth: { type: "number" },
|
|
191
|
-
annotateInterpretations: { type: "boolean" },
|
|
192
|
-
},
|
|
193
|
-
required: ["image"],
|
|
194
|
-
},
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
name: "figma_design_from_ref",
|
|
198
|
-
description:
|
|
199
|
-
"Provide reference images (competitor screenshots, mood boards) plus a prompt. Receive a new design built with YOUR design system — a re-interpretation, not a clone.",
|
|
200
|
-
inputSchema: {
|
|
201
|
-
type: "object",
|
|
202
|
-
properties: {
|
|
203
|
-
references: { type: "array", items: { type: "string" }, description: "Array of base64 images or URLs" },
|
|
204
|
-
prompt: { type: "string", description: "e.g. 'Build something like this but for our fintech brand'" },
|
|
205
|
-
extractOnly: {
|
|
206
|
-
type: "array",
|
|
207
|
-
items: { type: "string", enum: ["layout", "spacing", "color-palette", "typography"] },
|
|
208
|
-
},
|
|
209
|
-
designSystemContext: { type: "string" },
|
|
210
|
-
},
|
|
211
|
-
required: ["references", "prompt"],
|
|
212
|
-
},
|
|
213
|
-
},
|
|
214
|
-
|
|
215
|
-
// ── Phase 2 ──────────────────────────────────────────────────────────────
|
|
216
|
-
{
|
|
217
|
-
name: "figma_intent_translator",
|
|
218
|
-
description:
|
|
219
|
-
"Translates vague natural language prompts into precise, design-system-aware creation instructions. Eliminates hallucinated components and hardcoded values before any figma_execute call.",
|
|
220
|
-
inputSchema: {
|
|
221
|
-
type: "object",
|
|
222
|
-
properties: {
|
|
223
|
-
prompt: { type: "string", description: "Natural language design request" },
|
|
224
|
-
context: { type: "string", description: "Current page/frame context" },
|
|
225
|
-
strictMode: { type: "boolean", description: "Error instead of fallback if no DS match" },
|
|
226
|
-
},
|
|
227
|
-
required: ["prompt"],
|
|
228
|
-
},
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
name: "figma_layout_intelligence",
|
|
232
|
-
description:
|
|
233
|
-
"Analyze any frame and apply production-ready Auto Layout settings with design token binding in one command. Detects container type (card, form, nav, modal, list, grid, section, document page, header/section/footer/table blocks) and applies the optimal layout pattern. For document pages, automatically recurses into all nested containers, applies per-container specs, runs validation, and repairs FILL/HUG issues. Call this on every container frame created by figma_execute to ensure professional spacing and padding.",
|
|
234
|
-
inputSchema: {
|
|
235
|
-
type: "object",
|
|
236
|
-
properties: {
|
|
237
|
-
nodeId: { type: "string" },
|
|
238
|
-
applyChanges: { type: "boolean", description: "false = preview/report only" },
|
|
239
|
-
spacingTokenSet: { type: "string" },
|
|
240
|
-
responsiveHints: { type: "boolean" },
|
|
241
|
-
reportDiff: { type: "boolean" },
|
|
242
|
-
recursive: { type: "boolean", description: "Validate entire subtree for auto-layout parent-child sizing compatibility (FILL/HUG safety). Fixes invalid combinations automatically." },
|
|
243
|
-
},
|
|
244
|
-
required: ["nodeId", "applyChanges"],
|
|
245
|
-
},
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
name: "figma_variant_expander",
|
|
249
|
-
description:
|
|
250
|
-
"Turn one component state into a complete, production-ready variant matrix — all states, sizes, and themes automatically. ALWAYS use this instead of manually cloning variants with figma_execute. Workflow: create one base component frame with figma_execute, then call this tool with that nodeId and your desired dimensions.",
|
|
251
|
-
inputSchema: {
|
|
252
|
-
type: "object",
|
|
253
|
-
properties: {
|
|
254
|
-
nodeId: { type: "string" },
|
|
255
|
-
dimensions: {
|
|
256
|
-
type: "object",
|
|
257
|
-
properties: {
|
|
258
|
-
state: { type: "array", items: { type: "string" } },
|
|
259
|
-
size: { type: "array", items: { type: "string" } },
|
|
260
|
-
theme: { type: "array", items: { type: "string" } },
|
|
261
|
-
type: { type: "array", items: { type: "string" } },
|
|
262
|
-
},
|
|
263
|
-
},
|
|
264
|
-
namingConvention: { type: "string", enum: ["figma", "storybook"] },
|
|
265
|
-
autoApplyTokens: { type: "boolean" },
|
|
266
|
-
arrangeInGrid: { type: "boolean" },
|
|
267
|
-
},
|
|
268
|
-
required: ["nodeId", "dimensions", "namingConvention", "autoApplyTokens"],
|
|
269
|
-
},
|
|
270
|
-
},
|
|
271
|
-
{
|
|
272
|
-
name: "figma_theme_generator",
|
|
273
|
-
description:
|
|
274
|
-
"Generate new color modes — dark mode, high contrast, brand variants — from an existing theme while preserving semantic intent and WCAG compliance.",
|
|
275
|
-
inputSchema: {
|
|
276
|
-
type: "object",
|
|
277
|
-
properties: {
|
|
278
|
-
sourceMode: { type: "string", description: "e.g. 'Light'" },
|
|
279
|
-
newModeName: { type: "string", description: "e.g. 'Dark' or 'Brand Warm'" },
|
|
280
|
-
strategy: { type: "string", enum: ["dark", "high-contrast", "brand-shift", "custom"] },
|
|
281
|
-
brandDirection: { type: "string", description: "e.g. 'warmer and more approachable'" },
|
|
282
|
-
wcagTarget: { type: "string", enum: ["AA", "AAA"] },
|
|
283
|
-
previewBeforeApply: { type: "boolean" },
|
|
284
|
-
},
|
|
285
|
-
required: ["sourceMode", "newModeName", "strategy", "wcagTarget", "previewBeforeApply"],
|
|
286
|
-
},
|
|
287
|
-
},
|
|
288
|
-
{
|
|
289
|
-
name: "figma_lint_rules",
|
|
290
|
-
description:
|
|
291
|
-
"Define and enforce custom design system rules across an entire Figma file. Design-system ESLint — built-in rules for hardcoded colors, spacing grid violations, touch targets, and more.",
|
|
292
|
-
inputSchema: {
|
|
293
|
-
type: "object",
|
|
294
|
-
properties: {
|
|
295
|
-
action: { type: "string", enum: ["define", "run", "list", "delete"] },
|
|
296
|
-
ruleFile: { type: "string", description: "Path to YAML rule definition file" },
|
|
297
|
-
nodeId: { type: "string", description: "Scope to specific node (default: whole file)" },
|
|
298
|
-
autoFix: { type: "boolean" },
|
|
299
|
-
outputFormat: { type: "string", enum: ["inline", "report", "ci"] },
|
|
300
|
-
},
|
|
301
|
-
required: ["action", "outputFormat"],
|
|
302
|
-
},
|
|
303
|
-
},
|
|
304
|
-
{
|
|
305
|
-
name: "figma_component_audit",
|
|
306
|
-
description:
|
|
307
|
-
"Complete component usage analytics — which components are used, how often, orphaned components, detached instances, override hotspots, and duplicate patterns.",
|
|
308
|
-
inputSchema: {
|
|
309
|
-
type: "object",
|
|
310
|
-
properties: {
|
|
311
|
-
fileKey: { type: "string" },
|
|
312
|
-
includeLibraryComponents: { type: "boolean" },
|
|
313
|
-
detectOrphans: { type: "boolean" },
|
|
314
|
-
groupBy: { type: "string", enum: ["page", "component", "team"] },
|
|
315
|
-
},
|
|
316
|
-
},
|
|
317
|
-
},
|
|
318
|
-
|
|
319
|
-
// ── Phase 3 ──────────────────────────────────────────────────────────────
|
|
320
|
-
{
|
|
321
|
-
name: "figma_component_archaeologist",
|
|
322
|
-
description:
|
|
323
|
-
"Reverse-engineer undocumented, legacy, or raw Figma frames into proper design system components. Fingerprints layer structure, maps hardcoded values to tokens, and creates library components.",
|
|
324
|
-
inputSchema: {
|
|
325
|
-
type: "object",
|
|
326
|
-
properties: {
|
|
327
|
-
nodeId: { type: "string" },
|
|
328
|
-
outputAs: { type: "string", enum: ["analysis", "component", "both"] },
|
|
329
|
-
bindToExisting: { type: "boolean" },
|
|
330
|
-
createLibraryComponent: { type: "boolean" },
|
|
331
|
-
generateDocStub: { type: "boolean" },
|
|
332
|
-
},
|
|
333
|
-
required: ["nodeId", "outputAs"],
|
|
334
|
-
},
|
|
335
|
-
},
|
|
336
|
-
{
|
|
337
|
-
name: "figma_page_architect",
|
|
338
|
-
description:
|
|
339
|
-
"Generate complete, prototype-wired multi-screen flows from a plain-language product description using your real design system. Two weeks of wireframing in minutes. Shows a shimmer skeleton immediately when each frame is created, then populates with full content. Automatically scrolls the viewport to the first created screen when done. Always prefer this over piecemeal figma_execute calls for screen creation.",
|
|
340
|
-
inputSchema: {
|
|
341
|
-
type: "object",
|
|
342
|
-
properties: {
|
|
343
|
-
productContext: { type: "string", description: "e.g. 'Fintech mobile app for expense tracking'" },
|
|
344
|
-
flow: { type: "string", description: "e.g. 'Onboarding: email signup → OTP → profile → success'" },
|
|
345
|
-
platform: { type: "string", enum: ["web", "mobile", "both"] },
|
|
346
|
-
width: { type: "number" },
|
|
347
|
-
wireframeMode: { type: "boolean" },
|
|
348
|
-
includeFlowMap: { type: "boolean" },
|
|
349
|
-
contentMode: { type: "string", enum: ["placeholder", "realistic"] },
|
|
350
|
-
useStockImages: { type: "boolean", description: "Automatically pull Unsplash photos for image-heavy product flows" },
|
|
351
|
-
imageQuery: { type: "string", description: "Optional image search phrase override for stock imagery" },
|
|
352
|
-
fonts: {
|
|
353
|
-
type: "object",
|
|
354
|
-
description: "Optional font config: { heading, body, mono, ui } each with { family, styles[] }",
|
|
355
|
-
},
|
|
356
|
-
},
|
|
357
|
-
required: ["productContext", "flow", "platform", "contentMode"],
|
|
358
|
-
},
|
|
359
|
-
},
|
|
360
|
-
{
|
|
361
|
-
name: "figma_generate_image_and_insert",
|
|
362
|
-
description:
|
|
363
|
-
"Generate an AI image with Gemini and insert it into Figma. If targetNodeId is provided, fill that node when possible; otherwise create a new image-backed rectangle on the current page.",
|
|
364
|
-
inputSchema: {
|
|
365
|
-
type: "object",
|
|
366
|
-
properties: {
|
|
367
|
-
prompt: { type: "string", description: "Image generation prompt" },
|
|
368
|
-
targetNodeId: { type: "string", description: "Optional node ID to fill or place into" },
|
|
369
|
-
width: { type: "number", description: "Inserted image width in px when creating a new node" },
|
|
370
|
-
height: { type: "number", description: "Inserted image height in px when creating a new node" },
|
|
371
|
-
style: { type: "string", description: "Optional visual style guidance appended to the prompt" },
|
|
372
|
-
provider: { type: "string", enum: ["gemini", "automatic1111", "comfyui"], description: "Image provider" },
|
|
373
|
-
},
|
|
374
|
-
required: ["prompt"],
|
|
375
|
-
},
|
|
376
|
-
},
|
|
377
|
-
{
|
|
378
|
-
name: "figma_unsplash_search",
|
|
379
|
-
description:
|
|
380
|
-
"Search Unsplash for production-ready photography to use in generated Figma screens. Best for ecommerce, travel, food, wellness, lifestyle, and other image-forward interfaces.",
|
|
381
|
-
inputSchema: {
|
|
382
|
-
type: "object",
|
|
383
|
-
properties: {
|
|
384
|
-
query: { type: "string", description: "Search phrase such as 'premium skincare product' or 'hotel lobby'" },
|
|
385
|
-
count: { type: "number", description: "Number of photos to return (default 4, max 10)" },
|
|
386
|
-
page: { type: "number", description: "Search result page" },
|
|
387
|
-
orientation: { type: "string", enum: ["landscape", "portrait", "squarish"] },
|
|
388
|
-
contentFilter: { type: "string", enum: ["low", "high"], description: "Filter mature content" },
|
|
389
|
-
color: { type: "string", description: "Optional color filter such as 'black_and_white', 'blue', or 'green'" },
|
|
390
|
-
trackDownloads: { type: "boolean", description: "When true, register returned images with Unsplash download tracking" },
|
|
391
|
-
},
|
|
392
|
-
required: ["query"],
|
|
393
|
-
},
|
|
394
|
-
},
|
|
395
|
-
{
|
|
396
|
-
name: "figma_url_to_frame",
|
|
397
|
-
description:
|
|
398
|
-
"Capture any live URL and convert it into responsive Figma frames at mobile, tablet, and desktop breakpoints — built with your design system.",
|
|
399
|
-
inputSchema: {
|
|
400
|
-
type: "object",
|
|
401
|
-
properties: {
|
|
402
|
-
url: { type: "string" },
|
|
403
|
-
breakpoints: {
|
|
404
|
-
type: "array",
|
|
405
|
-
items: { type: "string", enum: ["mobile", "tablet", "desktop"] },
|
|
406
|
-
},
|
|
407
|
-
cloneMode: { type: "string", enum: ["pixel", "system", "adaptive"] },
|
|
408
|
-
addCompetitorAnnotations: { type: "boolean" },
|
|
409
|
-
dsGapReport: { type: "boolean" },
|
|
410
|
-
},
|
|
411
|
-
required: ["url", "breakpoints", "cloneMode"],
|
|
412
|
-
},
|
|
413
|
-
},
|
|
414
|
-
{
|
|
415
|
-
name: "figma_system_drift",
|
|
416
|
-
description:
|
|
417
|
-
"Compare design token snapshots across multiple Figma files and surface where teams are diverging from the canonical design system. Drift score: 0-5% healthy, 5-15% warning, 15%+ critical.",
|
|
418
|
-
inputSchema: {
|
|
419
|
-
type: "object",
|
|
420
|
-
properties: {
|
|
421
|
-
canonicalFileKey: { type: "string" },
|
|
422
|
-
targetFileKeys: { type: "array", items: { type: "string" } },
|
|
423
|
-
tokenTypes: { type: "array", items: { type: "string" } },
|
|
424
|
-
threshold: { type: "number", description: "Drift % to trigger warning (default 5%)" },
|
|
425
|
-
outputFormat: { type: "string", enum: ["report", "annotations", "pr-comment"] },
|
|
426
|
-
},
|
|
427
|
-
required: ["canonicalFileKey", "targetFileKeys", "outputFormat"],
|
|
428
|
-
},
|
|
429
|
-
},
|
|
430
|
-
{
|
|
431
|
-
name: "figma_prototype_map",
|
|
432
|
-
description:
|
|
433
|
-
"Extract all Figma prototype connections and return a navigable state machine — every screen, transition, trigger, and animation spec as JSON and/or a Mermaid diagram.",
|
|
434
|
-
inputSchema: {
|
|
435
|
-
type: "object",
|
|
436
|
-
properties: {
|
|
437
|
-
fileKey: { type: "string" },
|
|
438
|
-
startFrameId: { type: "string" },
|
|
439
|
-
includeAnimationSpecs: { type: "boolean" },
|
|
440
|
-
outputFormat: { type: "string", enum: ["json", "mermaid", "both"] },
|
|
441
|
-
},
|
|
442
|
-
required: ["outputFormat"],
|
|
443
|
-
},
|
|
444
|
-
},
|
|
445
|
-
|
|
446
|
-
{
|
|
447
|
-
name: "figma_prototype_scan",
|
|
448
|
-
description:
|
|
449
|
-
"Scan Figma frames to discover all interactive elements (buttons, links, nav items, icons) with confidence scoring. Returns an inventory of wireable elements per screen. Use BEFORE figma_prototype_wire to understand what can be connected. Supports auto-discovery of all top-level frames or targeting specific frame IDs. The AI should use the scan results plus the user's journey description to plan which elements to wire to which destinations.",
|
|
450
|
-
inputSchema: {
|
|
451
|
-
type: "object",
|
|
452
|
-
properties: {
|
|
453
|
-
frameIds: {
|
|
454
|
-
type: "array",
|
|
455
|
-
items: { type: "string" },
|
|
456
|
-
description: "Specific frame IDs to scan. Omit to auto-discover all top-level frames on the current page.",
|
|
457
|
-
},
|
|
458
|
-
journeyDescription: {
|
|
459
|
-
type: "string",
|
|
460
|
-
description: "Optional user journey text — echoed back for AI context when planning wiring.",
|
|
461
|
-
},
|
|
462
|
-
maxDepth: {
|
|
463
|
-
type: "number",
|
|
464
|
-
description: "Max node tree recursion depth (default 5, max 8).",
|
|
465
|
-
},
|
|
466
|
-
},
|
|
467
|
-
},
|
|
468
|
-
},
|
|
469
|
-
|
|
470
|
-
{
|
|
471
|
-
name: "figma_prototype_wire",
|
|
472
|
-
description:
|
|
473
|
-
"Create prototype connections between interactive elements and destination frames. Supports all Figma trigger types (ON_CLICK, ON_DRAG, ON_HOVER, AFTER_DELAY, MOUSE_ENTER, MOUSE_LEAVE) and animation types (SMART_ANIMATE, DISSOLVE, SLIDE_IN, SLIDE_OUT, PUSH, MOVE_IN, MOVE_OUT, INSTANT) with configurable duration, easing, and direction. Best used after figma_prototype_scan. Supports dry-run mode and clearing existing reactions. If only journeyDescription is provided (no connections), returns a scan for the AI to plan wiring.",
|
|
474
|
-
inputSchema: {
|
|
475
|
-
type: "object",
|
|
476
|
-
properties: {
|
|
477
|
-
connections: {
|
|
478
|
-
type: "array",
|
|
479
|
-
description: "Explicit wiring instructions. Each entry wires one interactive element to a destination frame.",
|
|
480
|
-
items: {
|
|
481
|
-
type: "object",
|
|
482
|
-
properties: {
|
|
483
|
-
fromElementId: { type: "string", description: "Node ID of the interactive element (button, link, etc.)" },
|
|
484
|
-
toFrameId: { type: "string", description: "Destination frame ID" },
|
|
485
|
-
trigger: { type: "string", enum: ["ON_CLICK", "ON_DRAG", "ON_HOVER", "AFTER_DELAY", "MOUSE_ENTER", "MOUSE_LEAVE"] },
|
|
486
|
-
animation: {
|
|
487
|
-
type: "object",
|
|
488
|
-
properties: {
|
|
489
|
-
type: { type: "string", enum: ["SMART_ANIMATE", "DISSOLVE", "SLIDE_IN", "SLIDE_OUT", "PUSH", "MOVE_IN", "MOVE_OUT", "INSTANT"] },
|
|
490
|
-
direction: { type: "string", enum: ["LEFT", "RIGHT", "TOP", "BOTTOM"] },
|
|
491
|
-
duration: { type: "number", description: "Duration in seconds (default 0.3)" },
|
|
492
|
-
easing: { type: "string", enum: ["EASE_IN", "EASE_OUT", "EASE_IN_AND_OUT", "LINEAR"] },
|
|
493
|
-
},
|
|
494
|
-
},
|
|
495
|
-
navigation: { type: "string", enum: ["NAVIGATE", "OVERLAY", "SWAP", "SCROLL_TO", "BACK", "CLOSE"] },
|
|
496
|
-
},
|
|
497
|
-
required: ["fromElementId", "toFrameId"],
|
|
498
|
-
},
|
|
499
|
-
},
|
|
500
|
-
journeyDescription: { type: "string", description: "User journey text. Without connections, triggers scan mode — returns interactive element inventory for AI to plan wiring." },
|
|
501
|
-
frameIds: { type: "array", items: { type: "string" }, description: "Frames to scan/wire (omit for auto-discover)." },
|
|
502
|
-
defaultTrigger: { type: "string", enum: ["ON_CLICK", "ON_DRAG", "ON_HOVER", "AFTER_DELAY"] },
|
|
503
|
-
defaultAnimation: {
|
|
504
|
-
type: "object",
|
|
505
|
-
properties: {
|
|
506
|
-
type: { type: "string", enum: ["SMART_ANIMATE", "DISSOLVE", "SLIDE_IN", "SLIDE_OUT", "PUSH", "MOVE_IN", "MOVE_OUT", "INSTANT"] },
|
|
507
|
-
direction: { type: "string", enum: ["LEFT", "RIGHT", "TOP", "BOTTOM"] },
|
|
508
|
-
duration: { type: "number" },
|
|
509
|
-
easing: { type: "string", enum: ["EASE_IN", "EASE_OUT", "EASE_IN_AND_OUT", "LINEAR"] },
|
|
510
|
-
},
|
|
511
|
-
},
|
|
512
|
-
clearExisting: { type: "boolean", description: "Remove existing reactions before wiring (default false)." },
|
|
513
|
-
dryRun: { type: "boolean", description: "Return plan without executing (default false)." },
|
|
514
|
-
},
|
|
515
|
-
},
|
|
516
|
-
},
|
|
517
|
-
|
|
518
|
-
{
|
|
519
|
-
name: "figma_animated_build",
|
|
520
|
-
description:
|
|
521
|
-
"Progressively builds UI elements on Figma canvas with a single cursor that tracks each creation step, showing real operation labels (e.g. '3/12 Creating: Nav Bar'). Ships with a built-in iOS screen template. Pass steps to fully customize.",
|
|
522
|
-
inputSchema: {
|
|
523
|
-
type: "object",
|
|
524
|
-
properties: {
|
|
525
|
-
steps: {
|
|
526
|
-
type: "array",
|
|
527
|
-
description: "Ordered build steps. Omit to use the default iOS screen template.",
|
|
528
|
-
items: {
|
|
529
|
-
type: "object",
|
|
530
|
-
properties: {
|
|
531
|
-
type: { type: "string", enum: ["createFrame","createRect","createText","createEllipse","pause"] },
|
|
532
|
-
x: { type: "number" },
|
|
533
|
-
y: { type: "number" },
|
|
534
|
-
text: { type: "string" },
|
|
535
|
-
name: { type: "string" },
|
|
536
|
-
w: { type: "number" },
|
|
537
|
-
h: { type: "number" },
|
|
538
|
-
color: { type: "string" },
|
|
539
|
-
radius: { type: "number" },
|
|
540
|
-
size: { type: "number" },
|
|
541
|
-
parentId: { type: "string" },
|
|
542
|
-
ms: { type: "number" },
|
|
543
|
-
},
|
|
544
|
-
required: ["type"],
|
|
545
|
-
},
|
|
546
|
-
},
|
|
547
|
-
stepDelayMs: {
|
|
548
|
-
type: "number",
|
|
549
|
-
description: "Milliseconds between steps (default 600).",
|
|
550
|
-
},
|
|
551
|
-
cursorName: {
|
|
552
|
-
type: "string",
|
|
553
|
-
description: "Name shown on cursor badge (default 'MCP Power').",
|
|
554
|
-
},
|
|
555
|
-
cursorColor: {
|
|
556
|
-
type: "string",
|
|
557
|
-
description: "Hex color for cursor (default '#6E5FD8').",
|
|
558
|
-
},
|
|
559
|
-
},
|
|
560
|
-
},
|
|
561
|
-
},
|
|
562
|
-
|
|
563
|
-
// ── Phase 4 ──────────────────────────────────────────────────────────────
|
|
564
|
-
{
|
|
565
|
-
name: "figma_animation_specifier",
|
|
566
|
-
description:
|
|
567
|
-
"Read Figma prototype transitions and output developer-ready animation code for Framer Motion, CSS, Swift, Android, or all frameworks at once.",
|
|
568
|
-
inputSchema: {
|
|
569
|
-
type: "object",
|
|
570
|
-
properties: {
|
|
571
|
-
fileKey: { type: "string" },
|
|
572
|
-
frameNodeId: { type: "string" },
|
|
573
|
-
outputFormat: {
|
|
574
|
-
type: "string",
|
|
575
|
-
enum: ["json", "framer-motion", "css", "swift", "android", "all"],
|
|
576
|
-
},
|
|
577
|
-
},
|
|
578
|
-
required: ["outputFormat"],
|
|
579
|
-
},
|
|
580
|
-
},
|
|
581
|
-
{
|
|
582
|
-
name: "figma_sync_from_code",
|
|
583
|
-
description:
|
|
584
|
-
"Reconcile Storybook component APIs against Figma component properties. Surface mismatches (missing props, value differences) and optionally sync Figma to match code.",
|
|
585
|
-
inputSchema: {
|
|
586
|
-
type: "object",
|
|
587
|
-
properties: {
|
|
588
|
-
storybookUrl: { type: "string" },
|
|
589
|
-
figmaLibraryFileKey: { type: "string" },
|
|
590
|
-
components: { type: "array", items: { type: "string" } },
|
|
591
|
-
syncDirection: { type: "string", enum: ["report", "update-figma", "update-code-stub"] },
|
|
592
|
-
},
|
|
593
|
-
required: ["storybookUrl", "figmaLibraryFileKey", "syncDirection"],
|
|
594
|
-
},
|
|
595
|
-
},
|
|
596
|
-
{
|
|
597
|
-
name: "figma_export_tokens",
|
|
598
|
-
description:
|
|
599
|
-
"Export Figma design variables/tokens to 16 code-ready formats: CSS, CSS (rem), SCSS, Less, Tailwind v3, Tailwind v4, Style Dictionary, W3C DTCG v2025.10 (full compliance with composite types, $deprecated, $type inheritance), JavaScript ES module, TypeScript module, Swift, Kotlin, Flutter/Dart, Android XML, React Native, or raw JSON. Supports mode filtering, collection filtering, alias chains, color spaces (sRGB, Display P3, Oklch), and multi-format export in a single call.",
|
|
600
|
-
inputSchema: {
|
|
601
|
-
type: "object",
|
|
602
|
-
properties: {
|
|
603
|
-
format: {
|
|
604
|
-
type: "string",
|
|
605
|
-
enum: ["css", "css-rem", "scss", "less", "tailwind", "tailwind-v4", "style-dictionary", "dtcg", "js", "ts", "swift", "kotlin", "flutter", "android-xml", "react-native", "json", "all"],
|
|
606
|
-
description: "Output format. Use 'all' to generate every format at once.",
|
|
607
|
-
},
|
|
608
|
-
collectionFilter: { type: "string", description: "Filter by collection name (substring match)" },
|
|
609
|
-
tokenTypes: {
|
|
610
|
-
type: "array",
|
|
611
|
-
items: { type: "string", enum: ["COLOR", "FLOAT", "STRING", "BOOLEAN"] },
|
|
612
|
-
description: "Filter by variable type",
|
|
613
|
-
},
|
|
614
|
-
mode: { type: "string", description: "Export a single mode only (e.g. 'Light' or 'Dark'). Omit for all modes." },
|
|
615
|
-
includeAliasChains: { type: "boolean", description: "Add comments showing semantic → primitive → raw value chains" },
|
|
616
|
-
cssSelector: { type: "string", description: "CSS selector for custom properties (default ':root')" },
|
|
617
|
-
tailwindPrefix: { type: "string", description: "Tailwind namespace prefix (default 'ds')" },
|
|
618
|
-
remBase: { type: "number", description: "Base font size for rem conversion (default 16)" },
|
|
619
|
-
colorSpace: { type: "string", enum: ["srgb", "display-p3", "oklch"], description: "Color space for DTCG output (default srgb)" },
|
|
620
|
-
deprecated: { type: "boolean", description: "Include $deprecated field in DTCG output (default true)" },
|
|
621
|
-
},
|
|
622
|
-
required: ["format"],
|
|
623
|
-
},
|
|
624
|
-
},
|
|
625
|
-
{
|
|
626
|
-
name: "figma_generate_component_code",
|
|
627
|
-
description:
|
|
628
|
-
"Generate production-ready component code from a Figma component or component set. Extracts real variant axes, states, spacing, color tokens, and typography, then outputs a typed component file + CSS Module + Storybook stories. Supports React TSX, Vue SFC, Svelte, and HTML. Falls back to built-in blueprints (52 components) when no Figma connection is available.",
|
|
629
|
-
inputSchema: {
|
|
630
|
-
type: "object",
|
|
631
|
-
properties: {
|
|
632
|
-
nodeId: { type: "string", description: "Figma node ID of the component/component set. Uses current selection if omitted." },
|
|
633
|
-
componentName: { type: "string", description: "Fallback: match a built-in blueprint by name (Button, Input, Modal, etc.)" },
|
|
634
|
-
framework: {
|
|
635
|
-
type: "string",
|
|
636
|
-
enum: ["react", "vue", "svelte", "html"],
|
|
637
|
-
description: "Target framework",
|
|
638
|
-
},
|
|
639
|
-
includeStories: { type: "boolean", description: "Generate Storybook stories file (default true)" },
|
|
640
|
-
includeStyles: { type: "boolean", description: "Generate CSS Module file (default true)" },
|
|
641
|
-
cssStrategy: {
|
|
642
|
-
type: "string",
|
|
643
|
-
enum: ["css-modules", "tailwind", "styled-components"],
|
|
644
|
-
description: "CSS approach (default css-modules)",
|
|
645
|
-
},
|
|
646
|
-
typescript: { type: "boolean", description: "Use TypeScript (default true for React/Vue)" },
|
|
647
|
-
tokenImportPath: { type: "string", description: "Import path for design tokens CSS (default '../../tokens.css')" },
|
|
648
|
-
},
|
|
649
|
-
required: ["framework"],
|
|
650
|
-
},
|
|
651
|
-
},
|
|
652
|
-
{
|
|
653
|
-
name: "figma_webhook_listener",
|
|
654
|
-
description:
|
|
655
|
-
"Subscribe to Figma file change events and trigger automated reactions: run lint on token changes, audit on component changes, health report on library publish, Slack/GitHub notifications.",
|
|
656
|
-
inputSchema: {
|
|
657
|
-
type: "object",
|
|
658
|
-
properties: {
|
|
659
|
-
action: { type: "string", enum: ["subscribe", "unsubscribe", "list", "test"] },
|
|
660
|
-
fileKey: { type: "string" },
|
|
661
|
-
events: {
|
|
662
|
-
type: "array",
|
|
663
|
-
items: { type: "string", enum: ["FILE_UPDATE", "LIBRARY_PUBLISH", "COMMENT_CREATED"] },
|
|
664
|
-
},
|
|
665
|
-
triggers: {
|
|
666
|
-
type: "object",
|
|
667
|
-
properties: {
|
|
668
|
-
onTokenChange: { type: "string" },
|
|
669
|
-
onComponentChange: { type: "string" },
|
|
670
|
-
onLibraryPublish: { type: "string" },
|
|
671
|
-
},
|
|
672
|
-
},
|
|
673
|
-
notificationChannels: {
|
|
674
|
-
type: "object",
|
|
675
|
-
properties: {
|
|
676
|
-
slack: { type: "string" },
|
|
677
|
-
github: { type: "string" },
|
|
678
|
-
email: { type: "array", items: { type: "string" } },
|
|
679
|
-
},
|
|
680
|
-
},
|
|
681
|
-
},
|
|
682
|
-
required: ["action", "fileKey"],
|
|
683
|
-
},
|
|
684
|
-
},
|
|
685
|
-
|
|
686
|
-
// ── Phase 5 ──────────────────────────────────────────────────────────────
|
|
687
|
-
{
|
|
688
|
-
name: "figma_design_system_scaffolder",
|
|
689
|
-
description:
|
|
690
|
-
"Bootstrap a complete, production-ready design system from just brand colors and product type. Generates full token system, component library, and page templates. Two weeks of work in three minutes.",
|
|
691
|
-
inputSchema: {
|
|
692
|
-
type: "object",
|
|
693
|
-
properties: {
|
|
694
|
-
brandColors: {
|
|
695
|
-
type: "object",
|
|
696
|
-
properties: {
|
|
697
|
-
primary: { type: "string", description: "e.g. '#2563EB'" },
|
|
698
|
-
secondary: { type: "string" },
|
|
699
|
-
neutral: { type: "string" },
|
|
700
|
-
accent: { type: "string" },
|
|
701
|
-
},
|
|
702
|
-
required: ["primary"],
|
|
703
|
-
},
|
|
704
|
-
productType: { type: "string", enum: ["web-app", "mobile-app", "both", "marketing"] },
|
|
705
|
-
brandName: { type: "string" },
|
|
706
|
-
includeComponents: {
|
|
707
|
-
type: "array",
|
|
708
|
-
items: { type: "string", enum: ["core", "forms", "navigation", "data", "feedback", "overlay"] },
|
|
709
|
-
},
|
|
710
|
-
generateDarkMode: { type: "boolean" },
|
|
711
|
-
dtcgExport: { type: "boolean" },
|
|
712
|
-
fonts: {
|
|
713
|
-
type: "object",
|
|
714
|
-
description: "Optional font config: { heading: { family, styles[] }, body: { family, styles[] }, mono: { family, styles[] }, ui: { family, styles[] } }",
|
|
715
|
-
properties: {
|
|
716
|
-
heading: { type: "object", properties: { family: { type: "string" }, styles: { type: "array", items: { type: "string" } } } },
|
|
717
|
-
body: { type: "object", properties: { family: { type: "string" }, styles: { type: "array", items: { type: "string" } } } },
|
|
718
|
-
mono: { type: "object", properties: { family: { type: "string" }, styles: { type: "array", items: { type: "string" } } } },
|
|
719
|
-
ui: { type: "object", properties: { family: { type: "string" }, styles: { type: "array", items: { type: "string" } } } },
|
|
720
|
-
},
|
|
721
|
-
},
|
|
722
|
-
},
|
|
723
|
-
required: ["brandColors", "productType", "brandName", "includeComponents", "generateDarkMode"],
|
|
724
|
-
},
|
|
725
|
-
},
|
|
726
|
-
{
|
|
727
|
-
name: "figma_design_system_primitives",
|
|
728
|
-
description:
|
|
729
|
-
"Diagnose Figma variable capability and create first-class design-system primitive variable collections for color, typography, spacing, radius, border, opacity, and elevation.",
|
|
730
|
-
inputSchema: {
|
|
731
|
-
type: "object",
|
|
732
|
-
properties: {
|
|
733
|
-
brandName: { type: "string", description: "Design system or brand name" },
|
|
734
|
-
primaryColor: { type: "string", description: "Primary brand hex color" },
|
|
735
|
-
secondaryColor: { type: "string", description: "Secondary brand hex color" },
|
|
736
|
-
neutralColor: { type: "string", description: "Neutral base hex color" },
|
|
737
|
-
accentColor: { type: "string", description: "Accent hex color" },
|
|
738
|
-
createSemantics: { type: "boolean", description: "Also create semantic color aliases" },
|
|
739
|
-
createDarkMode: { type: "boolean", description: "Create Light and Dark modes for color collections" },
|
|
740
|
-
fonts: {
|
|
741
|
-
type: "object",
|
|
742
|
-
description: "Optional font config override. Default: Inter for body/ui, JetBrains Mono for mono.",
|
|
743
|
-
properties: {
|
|
744
|
-
heading: { type: "object", properties: { family: { type: "string" }, styles: { type: "array", items: { type: "string" } } } },
|
|
745
|
-
body: { type: "object", properties: { family: { type: "string" }, styles: { type: "array", items: { type: "string" } } } },
|
|
746
|
-
mono: { type: "object", properties: { family: { type: "string" }, styles: { type: "array", items: { type: "string" } } } },
|
|
747
|
-
ui: { type: "object", properties: { family: { type: "string" }, styles: { type: "array", items: { type: "string" } } } },
|
|
748
|
-
},
|
|
749
|
-
},
|
|
750
|
-
},
|
|
751
|
-
required: ["brandName"],
|
|
752
|
-
},
|
|
753
|
-
},
|
|
754
|
-
{
|
|
755
|
-
name: "figma_design_system_variables",
|
|
756
|
-
description:
|
|
757
|
-
"Diagnose, scaffold, and manage design-system variable collections for primitives, semantics, and component tokens, including alias-based variable wiring.",
|
|
758
|
-
inputSchema: {
|
|
759
|
-
type: "object",
|
|
760
|
-
properties: {
|
|
761
|
-
action: {
|
|
762
|
-
type: "string",
|
|
763
|
-
enum: [
|
|
764
|
-
"diagnose",
|
|
765
|
-
"scaffold-primitives",
|
|
766
|
-
"scaffold-semantics",
|
|
767
|
-
"scaffold-components",
|
|
768
|
-
"scaffold-all",
|
|
769
|
-
"create-collections",
|
|
770
|
-
"create-variables",
|
|
771
|
-
],
|
|
772
|
-
},
|
|
773
|
-
brandName: { type: "string" },
|
|
774
|
-
primaryColor: { type: "string" },
|
|
775
|
-
secondaryColor: { type: "string" },
|
|
776
|
-
neutralColor: { type: "string" },
|
|
777
|
-
accentColor: { type: "string" },
|
|
778
|
-
createDarkMode: { type: "boolean" },
|
|
779
|
-
createSemantics: { type: "boolean" },
|
|
780
|
-
collections: { type: "array", items: { type: "object" } },
|
|
781
|
-
variables: { type: "array", items: { type: "object" } },
|
|
782
|
-
componentTemplates: { type: "array", items: { type: "object" } },
|
|
783
|
-
},
|
|
784
|
-
required: ["action"],
|
|
785
|
-
},
|
|
786
|
-
},
|
|
787
|
-
{
|
|
788
|
-
name: "figma_token_naming_convention",
|
|
789
|
-
description:
|
|
790
|
-
"Define, validate, and audit design-token naming conventions so primitive, semantic, and component token names stay accurate and consistent.",
|
|
791
|
-
inputSchema: {
|
|
792
|
-
type: "object",
|
|
793
|
-
properties: {
|
|
794
|
-
action: {
|
|
795
|
-
type: "string",
|
|
796
|
-
enum: ["define", "validate", "suggest-renames", "audit-current-file"],
|
|
797
|
-
},
|
|
798
|
-
names: {
|
|
799
|
-
type: "array",
|
|
800
|
-
items: { type: "string" },
|
|
801
|
-
description: "Token names to validate or normalize.",
|
|
802
|
-
},
|
|
803
|
-
collectionName: {
|
|
804
|
-
type: "string",
|
|
805
|
-
description: "Optional collection name to audit when using audit-current-file.",
|
|
806
|
-
},
|
|
807
|
-
},
|
|
808
|
-
required: ["action"],
|
|
809
|
-
},
|
|
810
|
-
},
|
|
811
|
-
{
|
|
812
|
-
name: "figma_decision_log",
|
|
813
|
-
description:
|
|
814
|
-
"Persistent memory layer. Log every AI design action with rationale. Query past decisions ('why was --color-primary changed?'). Export complete history. No context is ever lost between sessions.",
|
|
815
|
-
inputSchema: {
|
|
816
|
-
type: "object",
|
|
817
|
-
properties: {
|
|
818
|
-
action: { type: "string", enum: ["log", "query", "export", "clear"] },
|
|
819
|
-
entry: {
|
|
820
|
-
type: "object",
|
|
821
|
-
properties: {
|
|
822
|
-
tool: { type: "string" },
|
|
823
|
-
nodeIds: { type: "array", items: { type: "string" } },
|
|
824
|
-
rationale: { type: "string" },
|
|
825
|
-
tokens: { type: "array", items: { type: "string" } },
|
|
826
|
-
reversible: { type: "boolean" },
|
|
827
|
-
},
|
|
828
|
-
},
|
|
829
|
-
query: { type: "string" },
|
|
830
|
-
exportFormat: { type: "string", enum: ["json", "markdown"] },
|
|
831
|
-
},
|
|
832
|
-
required: ["action"],
|
|
833
|
-
},
|
|
834
|
-
},
|
|
835
|
-
{
|
|
836
|
-
name: "figma_design_decision_log",
|
|
837
|
-
description:
|
|
838
|
-
"Create a visual Design Decision Log frame in Figma documenting UX decisions for a screen. Generates a styled frame with header (status + category badges, title, description), metadata row, and numbered decision cards — each with a title, source badge, and rationale. Sources should cite UX research (NN Group, Baymard Institute, etc.).",
|
|
839
|
-
inputSchema: {
|
|
840
|
-
type: "object",
|
|
841
|
-
properties: {
|
|
842
|
-
name: { type: "string", description: "Frame title (e.g. 'E-Commerce Checkout Flow')" },
|
|
843
|
-
description: { type: "string", description: "Overview of the screen/flow and what decisions cover" },
|
|
844
|
-
status: {
|
|
845
|
-
type: "string",
|
|
846
|
-
enum: ["Approved", "Under review", "Requires revisions", "Blocked", "In progress", "Info"],
|
|
847
|
-
description: "Status badge. Defaults to 'Approved'.",
|
|
848
|
-
},
|
|
849
|
-
category: { type: "string", description: "Category badge text (e.g. 'Design Research', 'Accessibility', 'Interaction Design'). Defaults to 'Design Research'." },
|
|
850
|
-
pageName: { type: "string", description: "Page context (e.g. 'prototype example')" },
|
|
851
|
-
screenCount: { type: "number", description: "Number of screens covered" },
|
|
852
|
-
decisions: {
|
|
853
|
-
type: "array",
|
|
854
|
-
items: {
|
|
855
|
-
type: "object",
|
|
856
|
-
properties: {
|
|
857
|
-
title: { type: "string", description: "Decision title (e.g. 'Linear Checkout Flow')" },
|
|
858
|
-
rationale: { type: "string", description: "Detailed UX rationale explaining the decision" },
|
|
859
|
-
source: { type: "string", description: "Attribution (e.g. 'NN Group', 'Baymard Institute', 'UX Best Practice', 'Conversion Research')" },
|
|
860
|
-
},
|
|
861
|
-
required: ["title", "rationale", "source"],
|
|
862
|
-
},
|
|
863
|
-
description: "Array of design decisions with titles, rationale, and sources",
|
|
864
|
-
},
|
|
865
|
-
nearNodeId: { type: "string", description: "Place the frame near this node ID" },
|
|
866
|
-
},
|
|
867
|
-
required: ["name", "description", "decisions"],
|
|
868
|
-
},
|
|
869
|
-
},
|
|
870
|
-
{
|
|
871
|
-
name: "figma_health_report",
|
|
872
|
-
description:
|
|
873
|
-
"Capstone governance tool. Runs all audits in sequence and returns a composite design system health score (0-100) across 6 dimensions: token coverage, accessibility, component adoption, documentation, lint, drift.",
|
|
874
|
-
inputSchema: {
|
|
875
|
-
type: "object",
|
|
876
|
-
properties: {
|
|
877
|
-
fileKey: { type: "string" },
|
|
878
|
-
includeHistory: { type: "boolean" },
|
|
879
|
-
outputFormat: { type: "string", enum: ["report", "figma-page", "slack-digest", "all"] },
|
|
880
|
-
runAudits: {
|
|
881
|
-
type: "array",
|
|
882
|
-
items: { type: "string", enum: ["a11y", "lint", "tokens", "components", "drift", "all"] },
|
|
883
|
-
},
|
|
884
|
-
},
|
|
885
|
-
required: ["outputFormat", "runAudits"],
|
|
886
|
-
},
|
|
887
|
-
},
|
|
888
|
-
{
|
|
889
|
-
name: "figma_component_spec",
|
|
890
|
-
description:
|
|
891
|
-
"Generate full component documentation — a comprehensive multi-section reference covering overview, states, interaction rules, accessibility (WCAG), QA acceptance criteria, responsive behaviour, usage guidelines (do/don't), design tokens, typography hierarchy, content guidance, and related components. Best for when the user wants a complete written specification, developer handoff document, or full design-system documentation page. Outputs as a Figma page, markdown, JSON, or all three. Use this when the user asks for 'full docs', 'complete specification', 'documentation', 'developer handoff', 'design system page', or 'all sections'.",
|
|
892
|
-
inputSchema: {
|
|
893
|
-
type: "object",
|
|
894
|
-
properties: {
|
|
895
|
-
nodeId: { type: "string", description: "Component or ComponentSet node ID. If omitted, uses current Figma selection." },
|
|
896
|
-
outputFormat: { type: "string", enum: ["json", "markdown", "figma-page", "all"] },
|
|
897
|
-
sections: {
|
|
898
|
-
type: "array",
|
|
899
|
-
items: {
|
|
900
|
-
type: "string",
|
|
901
|
-
enum: ["overview", "anatomy", "variants", "states", "properties", "spacing", "color-tokens", "typography", "accessibility", "usage", "related"],
|
|
902
|
-
},
|
|
903
|
-
description: "Optional filter to generate only specific sections. Default: all applicable sections.",
|
|
904
|
-
},
|
|
905
|
-
pageName: { type: "string", description: "Custom page name for the generated Figma spec page." },
|
|
906
|
-
},
|
|
907
|
-
required: ["outputFormat"],
|
|
908
|
-
},
|
|
909
|
-
},
|
|
910
|
-
{
|
|
911
|
-
name: "figma_component_spec_sheet",
|
|
912
|
-
description:
|
|
913
|
-
"Generate a quick visual spec sheet directly on the Figma canvas — a single frame showing the component's anatomy, properties, and spacing at a glance. Includes: (1) Header with component name and variant string, (2) Anatomy diagram with numbered colored callout markers and a legend identifying each sub-element, (3) Properties section with live variant instance previews for every value of each property (Type, Size, State, boolean toggles) with style annotations, (4) Layout & Spacing section with colored dimension overlays. This is the DEFAULT tool when a user asks to 'show me the anatomy', 'what are the properties', 'show spacing', 'spec sheet', 'component breakdown', 'variant overview', or 'inspect this component'. Select a component before calling.",
|
|
914
|
-
inputSchema: {
|
|
915
|
-
type: "object",
|
|
916
|
-
properties: {
|
|
917
|
-
nodeId: { type: "string", description: "Component, ComponentSet, or Instance node ID. If omitted, uses current Figma selection." },
|
|
918
|
-
sections: {
|
|
919
|
-
type: "array",
|
|
920
|
-
items: { type: "string", enum: ["header", "anatomy", "properties", "spacing"] },
|
|
921
|
-
description: "Which sections to include. Default: all four.",
|
|
922
|
-
},
|
|
923
|
-
maxVariantsPerAxis: { type: "number", description: "Max variant instances to show per property axis (default: 6)." },
|
|
924
|
-
placement: { type: "string", enum: ["right", "below", "new-page"], description: "Where to place the spec sheet relative to the source component. Default: right." },
|
|
925
|
-
},
|
|
926
|
-
required: [],
|
|
927
|
-
},
|
|
928
|
-
},
|
|
929
|
-
{
|
|
930
|
-
name: "figma_apg_doc",
|
|
931
|
-
description:
|
|
932
|
-
"Generate APG-backed accessibility documentation for a selected Figma component. Maps the node to a WAI-ARIA Authoring Practices pattern, then returns native-first guidance, naming rules, roles/states, keyboard/focus specs, QA checks, and optional implementation starters.",
|
|
933
|
-
inputSchema: {
|
|
934
|
-
type: "object",
|
|
935
|
-
properties: {
|
|
936
|
-
nodeId: { type: "string", description: "Optional target node. If omitted, the current Figma selection is used." },
|
|
937
|
-
patternHint: { type: "string", description: "Optional hint such as button, tabs, dialog, combobox, or switch." },
|
|
938
|
-
framework: { type: "string", enum: ["html", "react", "vue", "angular"] },
|
|
939
|
-
outputFormat: { type: "string", enum: ["json", "report", "figma-page", "all"] },
|
|
940
|
-
includeCodeExamples: { type: "boolean", description: "Include a starter implementation snippet aligned to the chosen framework." },
|
|
941
|
-
writeToDescription: { type: "boolean", description: "Write the generated APG doc into the target node description." },
|
|
942
|
-
descriptionMode: { type: "string", enum: ["replace", "append"], description: "How to write back into the node description when writeToDescription is enabled." },
|
|
943
|
-
pageName: { type: "string", description: "Optional custom page name when rendering to Figma." },
|
|
944
|
-
},
|
|
945
|
-
required: ["outputFormat"],
|
|
946
|
-
},
|
|
947
|
-
},
|
|
948
|
-
// ── Direct Execute ───────────────────────────────────────────────────────
|
|
949
|
-
{
|
|
950
|
-
name: "figma_execute",
|
|
951
|
-
description:
|
|
952
|
-
"Execute Figma Plugin API code directly in the connected Figma file. The code runs inside the plugin sandbox with full access to the Figma Plugin API. Use `return` to return a value. All Figma API calls must use async methods (e.g. getNodeByIdAsync, findAllAsync). CRITICAL POSITIONING RULE: NEVER create root frames at (0,0) — this overlaps existing work. ALWAYS start your code with: `const _frames = figma.currentPage.children.filter(n => n.type === 'FRAME'); const _startX = _frames.length > 0 ? _frames.reduce((m,f) => Math.max(m, f.x+f.width), 0) + 200 : 0;` then set every new root frame's x = _startX. If the page has >10 frames, create a new page first: `const pg = figma.createPage(); pg.name = 'Design Name'; figma.currentPage = pg;`. Other rules: (1) Always apply Auto Layout on container frames with proper padding (16-24px) and itemSpacing (8-16px). After building, call figma_layout_intelligence for production-quality layout. (2) For multi-screen flows, prefer figma_page_architect which handles positioning and layout automatically.",
|
|
953
|
-
inputSchema: {
|
|
954
|
-
type: "object",
|
|
955
|
-
properties: {
|
|
956
|
-
code: { type: "string", description: "Figma Plugin API code to execute. Use `return` to return results." },
|
|
957
|
-
},
|
|
958
|
-
required: ["code"],
|
|
959
|
-
},
|
|
960
|
-
},
|
|
961
|
-
{
|
|
962
|
-
name: "figma_token_migrate",
|
|
963
|
-
description:
|
|
964
|
-
"Scan variables and local styles, detect naming/schema drift, propose canonical names, and optionally rename in place with variable alias compatibility.",
|
|
965
|
-
inputSchema: {
|
|
966
|
-
type: "object",
|
|
967
|
-
properties: {
|
|
968
|
-
action: { type: "string", enum: ["scan", "preview", "apply"] },
|
|
969
|
-
scope: { type: "string", enum: ["variables", "styles", "all"], description: "Which design assets to inspect." },
|
|
970
|
-
collectionName: { type: "string", description: "Optional variable collection filter." },
|
|
971
|
-
canonicalSchema: {
|
|
972
|
-
type: "string",
|
|
973
|
-
enum: ["compact", "expanded"],
|
|
974
|
-
description: "compact matches names like color/brand/500; expanded matches color/primitive/brand/500.",
|
|
975
|
-
},
|
|
976
|
-
renameInPlace: { type: "boolean", description: "When true, safe rename suggestions are applied during apply." },
|
|
977
|
-
createAliases: { type: "boolean", description: "Create variable aliases using the original names after rename." },
|
|
978
|
-
dryRun: { type: "boolean", description: "Preview apply output without writing changes." },
|
|
979
|
-
},
|
|
980
|
-
required: ["action"],
|
|
981
|
-
},
|
|
982
|
-
},
|
|
983
|
-
|
|
984
|
-
// ── Token Intelligence (New) ──────────────────────────────────────────
|
|
985
|
-
{
|
|
986
|
-
name: "figma_token_analytics",
|
|
987
|
-
description:
|
|
988
|
-
"Comprehensive design token usage analytics: usage counts per token, orphan/unused token detection, category coverage analysis, and adoption rate (% of nodes using tokens vs hardcoded values). Answers: which tokens are used, which are orphans, what's the token adoption rate?",
|
|
989
|
-
inputSchema: {
|
|
990
|
-
type: "object",
|
|
991
|
-
properties: {
|
|
992
|
-
action: {
|
|
993
|
-
type: "string",
|
|
994
|
-
enum: ["usage", "orphans", "coverage", "adoption", "full-report"],
|
|
995
|
-
description: "Analysis type. 'full-report' runs all analyses.",
|
|
996
|
-
},
|
|
997
|
-
collectionFilter: { type: "string", description: "Filter by collection name" },
|
|
998
|
-
pageFilter: { type: "string", description: "Filter to a specific page" },
|
|
999
|
-
includeHidden: { type: "boolean", description: "Include hidden nodes in analysis (default false)" },
|
|
1000
|
-
},
|
|
1001
|
-
required: ["action"],
|
|
1002
|
-
},
|
|
1003
|
-
},
|
|
1004
|
-
{
|
|
1005
|
-
name: "figma_token_docs",
|
|
1006
|
-
description:
|
|
1007
|
-
"Generate living token documentation: visual token catalog with color swatches, spacing visualizers, typography specimens, shadow previews. Outputs as Figma page, Markdown, JSON, or self-contained HTML with search/filter and dark mode toggle.",
|
|
1008
|
-
inputSchema: {
|
|
1009
|
-
type: "object",
|
|
1010
|
-
properties: {
|
|
1011
|
-
outputFormat: {
|
|
1012
|
-
type: "string",
|
|
1013
|
-
enum: ["figma", "markdown", "json", "html"],
|
|
1014
|
-
description: "Documentation output format.",
|
|
1015
|
-
},
|
|
1016
|
-
categories: {
|
|
1017
|
-
type: "array",
|
|
1018
|
-
items: { type: "string" },
|
|
1019
|
-
description: "Filter to specific categories (e.g. ['colors', 'spacing'])",
|
|
1020
|
-
},
|
|
1021
|
-
collectionFilter: { type: "string", description: "Filter by collection name" },
|
|
1022
|
-
includeVisualSwatches: { type: "boolean", description: "Render color swatches in Figma output (default true)" },
|
|
1023
|
-
includeUsageExamples: { type: "boolean", description: "Add CSS/code usage examples" },
|
|
1024
|
-
includeAliasChains: { type: "boolean", description: "Show alias resolution chains" },
|
|
1025
|
-
pageName: { type: "string", description: "Figma page name (default 'Token Documentation')" },
|
|
1026
|
-
},
|
|
1027
|
-
required: ["outputFormat"],
|
|
1028
|
-
},
|
|
1029
|
-
},
|
|
1030
|
-
{
|
|
1031
|
-
name: "figma_taxonomy_docs",
|
|
1032
|
-
description:
|
|
1033
|
-
"Generate living concept taxonomy documentation. Cross-references ~25 UI concepts (action, surface, field, feedback, etc.) with actual Figma variables to produce a naming grammar reference, per-concept token anatomy, and coverage report. Use 'naming-guide' format for a standalone reference document that teaches how to name tokens from scratch — grammar rules, allowed values per segment, worked examples, and common mistakes. Supports auto-sync: the Figma page updates automatically when tokens change.",
|
|
1034
|
-
inputSchema: {
|
|
1035
|
-
type: "object",
|
|
1036
|
-
properties: {
|
|
1037
|
-
outputFormat: {
|
|
1038
|
-
type: "string",
|
|
1039
|
-
enum: ["markdown", "json", "figma", "naming-guide"],
|
|
1040
|
-
description: "Documentation output format. 'naming-guide' produces a human-readable naming convention reference with grammar rules, allowed values, worked examples per concept, and common mistakes to avoid.",
|
|
1041
|
-
},
|
|
1042
|
-
concepts: {
|
|
1043
|
-
type: "array",
|
|
1044
|
-
items: { type: "string" },
|
|
1045
|
-
description: "Filter to specific concepts (e.g. ['action', 'surface', 'field']). Omit for all.",
|
|
1046
|
-
},
|
|
1047
|
-
includeTokenAnatomy: { type: "boolean", description: "Show per-concept token breakdowns (default true)" },
|
|
1048
|
-
showCoverage: { type: "boolean", description: "Highlight missing tokens with coverage badges (default true)" },
|
|
1049
|
-
autoSync: { type: "boolean", description: "Enable auto-sync: Figma page updates when variables change (figma format only, default false)" },
|
|
1050
|
-
pageName: { type: "string", description: "Figma page name (default 'Token Taxonomy')" },
|
|
1051
|
-
},
|
|
1052
|
-
required: ["outputFormat"],
|
|
1053
|
-
},
|
|
1054
|
-
},
|
|
1055
|
-
{
|
|
1056
|
-
name: "figma_validate_dtcg",
|
|
1057
|
-
description:
|
|
1058
|
-
"Validate design token JSON against the W3C DTCG v2025.10 specification. Checks: $type correctness, $value structure per type (composite types, color spaces, dimensions), alias resolution, circular reference detection, $deprecated usage, and $type inheritance. Returns validation issues and statistics.",
|
|
1059
|
-
inputSchema: {
|
|
1060
|
-
type: "object",
|
|
1061
|
-
properties: {
|
|
1062
|
-
tokens: {
|
|
1063
|
-
type: "object",
|
|
1064
|
-
description: "DTCG token JSON object to validate. Can also pass a string to be parsed.",
|
|
1065
|
-
},
|
|
1066
|
-
strict: { type: "boolean", description: "Strict mode: treat warnings as errors (default false)" },
|
|
1067
|
-
},
|
|
1068
|
-
required: ["tokens"],
|
|
1069
|
-
},
|
|
1070
|
-
},
|
|
1071
|
-
{
|
|
1072
|
-
name: "figma_token_math",
|
|
1073
|
-
description:
|
|
1074
|
-
"Token math and scale generation: evaluate expressions ({spacing.base} * 2), generate modular type scales (major-third, golden-ratio, etc.), create spacing scales, generate responsive clamp() tokens, convert px to rem. Powers computed/derived token relationships.",
|
|
1075
|
-
inputSchema: {
|
|
1076
|
-
type: "object",
|
|
1077
|
-
properties: {
|
|
1078
|
-
action: {
|
|
1079
|
-
type: "string",
|
|
1080
|
-
enum: ["evaluate", "modular-scale", "spacing-scale", "clamp", "px-to-rem"],
|
|
1081
|
-
description: "Operation to perform.",
|
|
1082
|
-
},
|
|
1083
|
-
expression: { type: "string", description: "Math expression with token refs: '{spacing.base} * 2'" },
|
|
1084
|
-
scaleOptions: {
|
|
1085
|
-
type: "object",
|
|
1086
|
-
properties: {
|
|
1087
|
-
base: { type: "number", description: "Base size (default 16)" },
|
|
1088
|
-
ratio: { type: "string", description: "Named ratio or number: 'major-third', 1.25" },
|
|
1089
|
-
steps: { type: "number", description: "Steps above base (default 6)" },
|
|
1090
|
-
stepsBelow: { type: "number", description: "Steps below base (default 2)" },
|
|
1091
|
-
},
|
|
1092
|
-
},
|
|
1093
|
-
spacingOptions: {
|
|
1094
|
-
type: "object",
|
|
1095
|
-
properties: {
|
|
1096
|
-
base: { type: "number", description: "Base unit (default 4)" },
|
|
1097
|
-
steps: { type: "array", items: { type: "number" }, description: "Multipliers (default [0, 0.5, 1, 1.5, 2, 3, 4, 6, 8, 12, 16])" },
|
|
1098
|
-
},
|
|
1099
|
-
},
|
|
1100
|
-
clampOptions: {
|
|
1101
|
-
type: "object",
|
|
1102
|
-
properties: {
|
|
1103
|
-
minValue: { type: "number" },
|
|
1104
|
-
maxValue: { type: "number" },
|
|
1105
|
-
minViewport: { type: "number", description: "Default 320" },
|
|
1106
|
-
maxViewport: { type: "number", description: "Default 1440" },
|
|
1107
|
-
unit: { type: "string", enum: ["px", "rem"] },
|
|
1108
|
-
},
|
|
1109
|
-
},
|
|
1110
|
-
value: { type: "number", description: "Value for px-to-rem conversion" },
|
|
1111
|
-
remBase: { type: "number", description: "Base font size for rem (default 16)" },
|
|
1112
|
-
},
|
|
1113
|
-
required: ["action"],
|
|
1114
|
-
},
|
|
1115
|
-
},
|
|
1116
|
-
{
|
|
1117
|
-
name: "figma_color_operations",
|
|
1118
|
-
description:
|
|
1119
|
-
"Color manipulation for design tokens: lighten, darken, mix, alpha, hue shift, saturate, desaturate, complement, invert. Also generates tint/shade scales (50-950), checks WCAG contrast, and suggests accessible color alternatives. Supports sRGB, Display P3, and Oklch color spaces.",
|
|
1120
|
-
inputSchema: {
|
|
1121
|
-
type: "object",
|
|
1122
|
-
properties: {
|
|
1123
|
-
action: {
|
|
1124
|
-
type: "string",
|
|
1125
|
-
enum: ["lighten", "darken", "mix", "alpha", "hue-shift", "saturate", "desaturate", "complement", "invert", "contrast-check", "suggest-accessible", "generate-scale", "tints", "shades", "format"],
|
|
1126
|
-
description: "Color operation to perform.",
|
|
1127
|
-
},
|
|
1128
|
-
color: { type: "string", description: "Hex color (#RRGGBB or #RRGGBBAA)" },
|
|
1129
|
-
color2: { type: "string", description: "Second color for mix/contrast operations" },
|
|
1130
|
-
amount: { type: "number", description: "Operation amount (0-1 for lighten/darken/alpha, degrees for hue-shift)" },
|
|
1131
|
-
steps: { type: "number", description: "Number of steps for scale generation (default 11)" },
|
|
1132
|
-
targetRatio: { type: "number", description: "Target contrast ratio for suggest-accessible (default 4.5)" },
|
|
1133
|
-
colorSpace: { type: "string", enum: ["srgb", "display-p3", "oklch"], description: "Output color space for format action" },
|
|
1134
|
-
},
|
|
1135
|
-
required: ["action", "color"],
|
|
1136
|
-
},
|
|
1137
|
-
},
|
|
1138
|
-
|
|
1139
|
-
// ── Navigation & Status ────────────────────────────────────────────────
|
|
1140
|
-
{
|
|
1141
|
-
name: "figma_get_status",
|
|
1142
|
-
description: "Check Figma connection status. Returns file name, current page, page count, and WebSocket state.",
|
|
1143
|
-
inputSchema: { type: "object", properties: {} },
|
|
1144
|
-
},
|
|
1145
|
-
{
|
|
1146
|
-
name: "figma_navigate",
|
|
1147
|
-
description: "Scroll and zoom the Figma viewport to center on a specific node.",
|
|
1148
|
-
inputSchema: {
|
|
1149
|
-
type: "object",
|
|
1150
|
-
properties: {
|
|
1151
|
-
nodeId: { type: "string", description: "The node ID to navigate to" },
|
|
1152
|
-
},
|
|
1153
|
-
required: ["nodeId"],
|
|
1154
|
-
},
|
|
1155
|
-
},
|
|
1156
|
-
{
|
|
1157
|
-
name: "figma_get_selection",
|
|
1158
|
-
description: "Get the currently selected nodes in Figma.",
|
|
1159
|
-
inputSchema: { type: "object", properties: {} },
|
|
1160
|
-
},
|
|
1161
|
-
{
|
|
1162
|
-
name: "figma_take_screenshot",
|
|
1163
|
-
description: "Capture a screenshot of a specific node or the current page as a PNG image.",
|
|
1164
|
-
inputSchema: {
|
|
1165
|
-
type: "object",
|
|
1166
|
-
properties: {
|
|
1167
|
-
nodeId: { type: "string", description: "Node ID to screenshot. If omitted, captures the current page." },
|
|
1168
|
-
scale: { type: "number", description: "Export scale (default 2)" },
|
|
1169
|
-
},
|
|
1170
|
-
},
|
|
1171
|
-
},
|
|
1172
|
-
{
|
|
1173
|
-
name: "figma_get_node",
|
|
1174
|
-
description: "Get detailed information about a specific Figma node including fills, strokes, effects, layout, and children.",
|
|
1175
|
-
inputSchema: {
|
|
1176
|
-
type: "object",
|
|
1177
|
-
properties: {
|
|
1178
|
-
nodeId: { type: "string", description: "The Figma node ID" },
|
|
1179
|
-
},
|
|
1180
|
-
required: ["nodeId"],
|
|
1181
|
-
},
|
|
1182
|
-
},
|
|
1183
|
-
|
|
1184
|
-
// ── Variable Management ────────────────────────────────────────────────
|
|
1185
|
-
{
|
|
1186
|
-
name: "figma_create_variable_collection",
|
|
1187
|
-
description: "Create a new variable collection (e.g. 'Brand Colors', 'Spacing') with an optional initial mode name.",
|
|
1188
|
-
inputSchema: {
|
|
1189
|
-
type: "object",
|
|
1190
|
-
properties: {
|
|
1191
|
-
name: { type: "string", description: "Collection name" },
|
|
1192
|
-
initialModeName: { type: "string", description: "Name for the first mode (default: 'Mode 1')" },
|
|
1193
|
-
},
|
|
1194
|
-
required: ["name"],
|
|
1195
|
-
},
|
|
1196
|
-
},
|
|
1197
|
-
{
|
|
1198
|
-
name: "figma_create_variable",
|
|
1199
|
-
description: "Create a new design variable/token in a collection. Supports COLOR, FLOAT, STRING, BOOLEAN types.",
|
|
1200
|
-
inputSchema: {
|
|
1201
|
-
type: "object",
|
|
1202
|
-
properties: {
|
|
1203
|
-
name: { type: "string", description: "Variable name (e.g. 'primary/500')" },
|
|
1204
|
-
collectionId: { type: "string", description: "Target collection ID" },
|
|
1205
|
-
resolvedType: { type: "string", enum: ["COLOR", "FLOAT", "STRING", "BOOLEAN"], description: "Variable type" },
|
|
1206
|
-
valuesByMode: { type: "object", description: "Values keyed by mode ID. For COLOR: {r, g, b, a} with 0-1 range." },
|
|
1207
|
-
description: { type: "string", description: "Optional variable description" },
|
|
1208
|
-
},
|
|
1209
|
-
required: ["name", "collectionId", "resolvedType"],
|
|
1210
|
-
},
|
|
1211
|
-
},
|
|
1212
|
-
{
|
|
1213
|
-
name: "figma_update_variable",
|
|
1214
|
-
description: "Update the value of an existing variable in a specific mode.",
|
|
1215
|
-
inputSchema: {
|
|
1216
|
-
type: "object",
|
|
1217
|
-
properties: {
|
|
1218
|
-
variableId: { type: "string", description: "Variable ID to update" },
|
|
1219
|
-
modeId: { type: "string", description: "Mode ID to set the value for" },
|
|
1220
|
-
value: { description: "New value. For COLOR: {r, g, b, a} with 0-1 range. For FLOAT: number. For STRING: string." },
|
|
1221
|
-
},
|
|
1222
|
-
required: ["variableId", "modeId", "value"],
|
|
1223
|
-
},
|
|
1224
|
-
},
|
|
1225
|
-
{
|
|
1226
|
-
name: "figma_delete_variable",
|
|
1227
|
-
description: "Delete a variable by ID.",
|
|
1228
|
-
inputSchema: {
|
|
1229
|
-
type: "object",
|
|
1230
|
-
properties: {
|
|
1231
|
-
variableId: { type: "string", description: "Variable ID to delete" },
|
|
1232
|
-
},
|
|
1233
|
-
required: ["variableId"],
|
|
1234
|
-
},
|
|
1235
|
-
},
|
|
1236
|
-
{
|
|
1237
|
-
name: "figma_rename_variable",
|
|
1238
|
-
description: "Rename a variable while preserving its values.",
|
|
1239
|
-
inputSchema: {
|
|
1240
|
-
type: "object",
|
|
1241
|
-
properties: {
|
|
1242
|
-
variableId: { type: "string", description: "Variable ID" },
|
|
1243
|
-
newName: { type: "string", description: "New name for the variable" },
|
|
1244
|
-
},
|
|
1245
|
-
required: ["variableId", "newName"],
|
|
1246
|
-
},
|
|
1247
|
-
},
|
|
1248
|
-
{
|
|
1249
|
-
name: "figma_delete_variable_collection",
|
|
1250
|
-
description: "Delete a variable collection and all its variables.",
|
|
1251
|
-
inputSchema: {
|
|
1252
|
-
type: "object",
|
|
1253
|
-
properties: {
|
|
1254
|
-
collectionId: { type: "string", description: "Collection ID to delete" },
|
|
1255
|
-
},
|
|
1256
|
-
required: ["collectionId"],
|
|
1257
|
-
},
|
|
1258
|
-
},
|
|
1259
|
-
{
|
|
1260
|
-
name: "figma_add_mode",
|
|
1261
|
-
description: "Add a new mode to a variable collection (e.g. 'Dark', 'Mobile').",
|
|
1262
|
-
inputSchema: {
|
|
1263
|
-
type: "object",
|
|
1264
|
-
properties: {
|
|
1265
|
-
collectionId: { type: "string", description: "Collection ID" },
|
|
1266
|
-
modeName: { type: "string", description: "Name for the new mode" },
|
|
1267
|
-
},
|
|
1268
|
-
required: ["collectionId", "modeName"],
|
|
1269
|
-
},
|
|
1270
|
-
},
|
|
1271
|
-
{
|
|
1272
|
-
name: "figma_rename_mode",
|
|
1273
|
-
description: "Rename an existing mode in a variable collection.",
|
|
1274
|
-
inputSchema: {
|
|
1275
|
-
type: "object",
|
|
1276
|
-
properties: {
|
|
1277
|
-
collectionId: { type: "string", description: "Collection ID" },
|
|
1278
|
-
modeId: { type: "string", description: "Mode ID to rename" },
|
|
1279
|
-
newName: { type: "string", description: "New mode name" },
|
|
1280
|
-
},
|
|
1281
|
-
required: ["collectionId", "modeId", "newName"],
|
|
1282
|
-
},
|
|
1283
|
-
},
|
|
1284
|
-
{
|
|
1285
|
-
name: "figma_batch_create_variables",
|
|
1286
|
-
description: "Create up to 100 variables in one call. 10-50x faster than individual creates.",
|
|
1287
|
-
inputSchema: {
|
|
1288
|
-
type: "object",
|
|
1289
|
-
properties: {
|
|
1290
|
-
variables: {
|
|
1291
|
-
type: "array",
|
|
1292
|
-
items: {
|
|
1293
|
-
type: "object",
|
|
1294
|
-
properties: {
|
|
1295
|
-
name: { type: "string" },
|
|
1296
|
-
collectionId: { type: "string" },
|
|
1297
|
-
resolvedType: { type: "string", enum: ["COLOR", "FLOAT", "STRING", "BOOLEAN"] },
|
|
1298
|
-
valuesByMode: { type: "object" },
|
|
1299
|
-
description: { type: "string" },
|
|
1300
|
-
},
|
|
1301
|
-
required: ["name", "collectionId", "resolvedType"],
|
|
1302
|
-
},
|
|
1303
|
-
description: "Array of variable specs to create",
|
|
1304
|
-
},
|
|
1305
|
-
},
|
|
1306
|
-
required: ["variables"],
|
|
1307
|
-
},
|
|
1308
|
-
},
|
|
1309
|
-
{
|
|
1310
|
-
name: "figma_batch_update_variables",
|
|
1311
|
-
description: "Update up to 100 variable values in one call. 10-50x faster than individual updates.",
|
|
1312
|
-
inputSchema: {
|
|
1313
|
-
type: "object",
|
|
1314
|
-
properties: {
|
|
1315
|
-
updates: {
|
|
1316
|
-
type: "array",
|
|
1317
|
-
items: {
|
|
1318
|
-
type: "object",
|
|
1319
|
-
properties: {
|
|
1320
|
-
variableId: { type: "string" },
|
|
1321
|
-
modeId: { type: "string" },
|
|
1322
|
-
value: {},
|
|
1323
|
-
},
|
|
1324
|
-
required: ["variableId", "modeId", "value"],
|
|
1325
|
-
},
|
|
1326
|
-
description: "Array of {variableId, modeId, value} updates",
|
|
1327
|
-
},
|
|
1328
|
-
},
|
|
1329
|
-
required: ["updates"],
|
|
1330
|
-
},
|
|
1331
|
-
},
|
|
1332
|
-
{
|
|
1333
|
-
name: "figma_get_variables",
|
|
1334
|
-
description: "Get all design variables/tokens organized by collection. Supports verbosity levels: 'inventory' (names only), 'summary' (with values), 'full' (everything).",
|
|
1335
|
-
inputSchema: {
|
|
1336
|
-
type: "object",
|
|
1337
|
-
properties: {
|
|
1338
|
-
collectionId: { type: "string", description: "Filter to a specific collection" },
|
|
1339
|
-
verbosity: { type: "string", enum: ["inventory", "summary", "full"], description: "Detail level (default: summary)" },
|
|
1340
|
-
},
|
|
1341
|
-
},
|
|
1342
|
-
},
|
|
1343
|
-
|
|
1344
|
-
// ── Node Operations ────────────────────────────────────────────────────
|
|
1345
|
-
{
|
|
1346
|
-
name: "figma_clone_node",
|
|
1347
|
-
description: "Clone/duplicate a node. Optionally position the clone.",
|
|
1348
|
-
inputSchema: {
|
|
1349
|
-
type: "object",
|
|
1350
|
-
properties: {
|
|
1351
|
-
nodeId: { type: "string", description: "Node ID to clone" },
|
|
1352
|
-
x: { type: "number", description: "X position for the clone" },
|
|
1353
|
-
y: { type: "number", description: "Y position for the clone" },
|
|
1354
|
-
},
|
|
1355
|
-
required: ["nodeId"],
|
|
1356
|
-
},
|
|
1357
|
-
},
|
|
1358
|
-
{
|
|
1359
|
-
name: "figma_delete_node",
|
|
1360
|
-
description: "Delete a node from the Figma file.",
|
|
1361
|
-
inputSchema: {
|
|
1362
|
-
type: "object",
|
|
1363
|
-
properties: {
|
|
1364
|
-
nodeId: { type: "string", description: "Node ID to delete" },
|
|
1365
|
-
},
|
|
1366
|
-
required: ["nodeId"],
|
|
1367
|
-
},
|
|
1368
|
-
},
|
|
1369
|
-
{
|
|
1370
|
-
name: "figma_move_node",
|
|
1371
|
-
description: "Move a node to new coordinates and/or reparent it to a different container.",
|
|
1372
|
-
inputSchema: {
|
|
1373
|
-
type: "object",
|
|
1374
|
-
properties: {
|
|
1375
|
-
nodeId: { type: "string", description: "Node ID to move" },
|
|
1376
|
-
x: { type: "number", description: "New X position" },
|
|
1377
|
-
y: { type: "number", description: "New Y position" },
|
|
1378
|
-
parentId: { type: "string", description: "New parent node ID (reparent)" },
|
|
1379
|
-
},
|
|
1380
|
-
required: ["nodeId"],
|
|
1381
|
-
},
|
|
1382
|
-
},
|
|
1383
|
-
{
|
|
1384
|
-
name: "figma_resize_node",
|
|
1385
|
-
description: "Resize a node to new dimensions.",
|
|
1386
|
-
inputSchema: {
|
|
1387
|
-
type: "object",
|
|
1388
|
-
properties: {
|
|
1389
|
-
nodeId: { type: "string", description: "Node ID to resize" },
|
|
1390
|
-
width: { type: "number", description: "New width" },
|
|
1391
|
-
height: { type: "number", description: "New height" },
|
|
1392
|
-
},
|
|
1393
|
-
required: ["nodeId", "width", "height"],
|
|
1394
|
-
},
|
|
1395
|
-
},
|
|
1396
|
-
{
|
|
1397
|
-
name: "figma_rename_node",
|
|
1398
|
-
description: "Rename a node in Figma.",
|
|
1399
|
-
inputSchema: {
|
|
1400
|
-
type: "object",
|
|
1401
|
-
properties: {
|
|
1402
|
-
nodeId: { type: "string", description: "Node ID to rename" },
|
|
1403
|
-
newName: { type: "string", description: "New name" },
|
|
1404
|
-
},
|
|
1405
|
-
required: ["nodeId", "newName"],
|
|
1406
|
-
},
|
|
1407
|
-
},
|
|
1408
|
-
{
|
|
1409
|
-
name: "figma_set_fills",
|
|
1410
|
-
description: "Set the fill paints on a node. Accepts an array of Figma Paint objects.",
|
|
1411
|
-
inputSchema: {
|
|
1412
|
-
type: "object",
|
|
1413
|
-
properties: {
|
|
1414
|
-
nodeId: { type: "string", description: "Node ID" },
|
|
1415
|
-
fills: {
|
|
1416
|
-
type: "array",
|
|
1417
|
-
items: {
|
|
1418
|
-
type: "object",
|
|
1419
|
-
properties: {
|
|
1420
|
-
type: { type: "string", enum: ["SOLID", "GRADIENT_LINEAR", "GRADIENT_RADIAL", "IMAGE"] },
|
|
1421
|
-
color: { type: "object", properties: { r: { type: "number" }, g: { type: "number" }, b: { type: "number" } } },
|
|
1422
|
-
opacity: { type: "number" },
|
|
1423
|
-
},
|
|
1424
|
-
},
|
|
1425
|
-
description: "Array of fill paints (e.g. [{type:'SOLID', color:{r:1,g:0,b:0}}])",
|
|
1426
|
-
},
|
|
1427
|
-
},
|
|
1428
|
-
required: ["nodeId", "fills"],
|
|
1429
|
-
},
|
|
1430
|
-
},
|
|
1431
|
-
{
|
|
1432
|
-
name: "figma_set_strokes",
|
|
1433
|
-
description: "Set strokes on a node. Accepts an array of Figma Paint objects and optional stroke weight.",
|
|
1434
|
-
inputSchema: {
|
|
1435
|
-
type: "object",
|
|
1436
|
-
properties: {
|
|
1437
|
-
nodeId: { type: "string", description: "Node ID" },
|
|
1438
|
-
strokes: { type: "array", description: "Array of stroke paints" },
|
|
1439
|
-
strokeWeight: { type: "number", description: "Stroke weight in pixels" },
|
|
1440
|
-
},
|
|
1441
|
-
required: ["nodeId", "strokes"],
|
|
1442
|
-
},
|
|
1443
|
-
},
|
|
1444
|
-
{
|
|
1445
|
-
name: "figma_set_text",
|
|
1446
|
-
description: "Set the text content of a text node. Automatically loads the required font.",
|
|
1447
|
-
inputSchema: {
|
|
1448
|
-
type: "object",
|
|
1449
|
-
properties: {
|
|
1450
|
-
nodeId: { type: "string", description: "Text node ID" },
|
|
1451
|
-
characters: { type: "string", description: "New text content" },
|
|
1452
|
-
fontSize: { type: "number", description: "Optional font size" },
|
|
1453
|
-
},
|
|
1454
|
-
required: ["nodeId", "characters"],
|
|
1455
|
-
},
|
|
1456
|
-
},
|
|
1457
|
-
|
|
1458
|
-
// ── Component Operations ───────────────────────────────────────────────
|
|
1459
|
-
{
|
|
1460
|
-
name: "figma_search_components",
|
|
1461
|
-
description: "Search for components and component sets in the current page by name. Returns matching components with ID, name, type, and description.",
|
|
1462
|
-
inputSchema: {
|
|
1463
|
-
type: "object",
|
|
1464
|
-
properties: {
|
|
1465
|
-
query: { type: "string", description: "Search query (matched against component names)" },
|
|
1466
|
-
limit: { type: "number", description: "Max results (default 20)" },
|
|
1467
|
-
},
|
|
1468
|
-
required: ["query"],
|
|
1469
|
-
},
|
|
1470
|
-
},
|
|
1471
|
-
{
|
|
1472
|
-
name: "figma_instantiate_component",
|
|
1473
|
-
description: "Create an instance of a component or component set variant. For component sets, specify variant properties to pick a specific variant.",
|
|
1474
|
-
inputSchema: {
|
|
1475
|
-
type: "object",
|
|
1476
|
-
properties: {
|
|
1477
|
-
nodeId: { type: "string", description: "Component or ComponentSet node ID" },
|
|
1478
|
-
variant: { type: "object", description: "Variant properties to match (e.g. {size: 'large', state: 'hover'})" },
|
|
1479
|
-
x: { type: "number", description: "X position" },
|
|
1480
|
-
y: { type: "number", description: "Y position" },
|
|
1481
|
-
parentId: { type: "string", description: "Parent node to insert into" },
|
|
1482
|
-
},
|
|
1483
|
-
required: ["nodeId"],
|
|
1484
|
-
},
|
|
1485
|
-
},
|
|
1486
|
-
{
|
|
1487
|
-
name: "figma_set_description",
|
|
1488
|
-
description: "Set the description on a component, component set, or style. Descriptions appear in Dev Mode.",
|
|
1489
|
-
inputSchema: {
|
|
1490
|
-
type: "object",
|
|
1491
|
-
properties: {
|
|
1492
|
-
nodeId: { type: "string", description: "Node ID" },
|
|
1493
|
-
description: { type: "string", description: "Description text (supports markdown)" },
|
|
1494
|
-
},
|
|
1495
|
-
required: ["nodeId", "description"],
|
|
1496
|
-
},
|
|
1497
|
-
},
|
|
1498
|
-
{
|
|
1499
|
-
name: "figma_get_styles",
|
|
1500
|
-
description: "Get all local paint, text, and effect styles from the current file.",
|
|
1501
|
-
inputSchema: { type: "object", properties: {} },
|
|
1502
|
-
},
|
|
1503
|
-
{
|
|
1504
|
-
name: "figma_create_child",
|
|
1505
|
-
description: "Create a new child node (FRAME, TEXT, RECTANGLE, ELLIPSE, LINE, COMPONENT, SECTION) inside a parent.",
|
|
1506
|
-
inputSchema: {
|
|
1507
|
-
type: "object",
|
|
1508
|
-
properties: {
|
|
1509
|
-
childType: { type: "string", enum: ["FRAME", "TEXT", "RECTANGLE", "ELLIPSE", "LINE", "COMPONENT", "SECTION"], description: "Type of node to create" },
|
|
1510
|
-
parentId: { type: "string", description: "Parent node ID (default: current page)" },
|
|
1511
|
-
name: { type: "string", description: "Node name" },
|
|
1512
|
-
width: { type: "number", description: "Width" },
|
|
1513
|
-
height: { type: "number", description: "Height" },
|
|
1514
|
-
x: { type: "number", description: "X position" },
|
|
1515
|
-
y: { type: "number", description: "Y position" },
|
|
1516
|
-
characters: { type: "string", description: "Text content (only for TEXT type)" },
|
|
1517
|
-
},
|
|
1518
|
-
required: ["childType"],
|
|
1519
|
-
},
|
|
1520
|
-
},
|
|
1521
|
-
{
|
|
1522
|
-
name: "figma_get_node_deep",
|
|
1523
|
-
description:
|
|
1524
|
-
"Get a node with full recursive child data up to maxDepth (default 10). Unlike figma_get_node which returns 1-level children, this returns the full property set for every descendant including fills, strokes, layout, typography, and variable bindings. Use for deep component analysis.",
|
|
1525
|
-
inputSchema: {
|
|
1526
|
-
type: "object",
|
|
1527
|
-
properties: {
|
|
1528
|
-
nodeId: { type: "string", description: "The Figma node ID" },
|
|
1529
|
-
maxDepth: { type: "number", description: "Max recursion depth (default 10, max 20)" },
|
|
1530
|
-
},
|
|
1531
|
-
required: ["nodeId"],
|
|
1532
|
-
},
|
|
1533
|
-
},
|
|
1534
|
-
{
|
|
1535
|
-
name: "figma_batch_get_nodes",
|
|
1536
|
-
description:
|
|
1537
|
-
"Read up to 200 nodes in a single round-trip. Returns a map of nodeId → serialized node data. 10-50x faster than calling figma_get_node individually.",
|
|
1538
|
-
inputSchema: {
|
|
1539
|
-
type: "object",
|
|
1540
|
-
properties: {
|
|
1541
|
-
nodeIds: {
|
|
1542
|
-
type: "array",
|
|
1543
|
-
items: { type: "string" },
|
|
1544
|
-
description: "Array of node IDs to read (max 200)",
|
|
1545
|
-
},
|
|
1546
|
-
includeChildren: { type: "boolean", description: "Include 1-level child summaries (default true)" },
|
|
1547
|
-
},
|
|
1548
|
-
required: ["nodeIds"],
|
|
1549
|
-
},
|
|
1550
|
-
},
|
|
1551
|
-
{
|
|
1552
|
-
name: "figma_switch_mode",
|
|
1553
|
-
description:
|
|
1554
|
-
"Switch a frame's variable mode (theme switching). All children with bound variables will resolve to the new mode's values (e.g. switch from Light to Dark). Use figma_list_modes to discover available modes first.",
|
|
1555
|
-
inputSchema: {
|
|
1556
|
-
type: "object",
|
|
1557
|
-
properties: {
|
|
1558
|
-
frameId: { type: "string", description: "Frame node ID to set the mode on" },
|
|
1559
|
-
collectionId: { type: "string", description: "Variable collection ID" },
|
|
1560
|
-
modeId: { type: "string", description: "Mode ID to activate" },
|
|
1561
|
-
},
|
|
1562
|
-
required: ["frameId", "collectionId", "modeId"],
|
|
1563
|
-
},
|
|
1564
|
-
},
|
|
1565
|
-
{
|
|
1566
|
-
name: "figma_list_modes",
|
|
1567
|
-
description:
|
|
1568
|
-
"List all modes (e.g. Light, Dark) for a variable collection. Returns mode IDs and names. Use before figma_switch_mode to discover which modes are available.",
|
|
1569
|
-
inputSchema: {
|
|
1570
|
-
type: "object",
|
|
1571
|
-
properties: {
|
|
1572
|
-
collectionId: { type: "string", description: "Variable collection ID" },
|
|
1573
|
-
},
|
|
1574
|
-
required: ["collectionId"],
|
|
1575
|
-
},
|
|
1576
|
-
},
|
|
1577
|
-
{
|
|
1578
|
-
name: "figma_bind_variables_multi_mode",
|
|
1579
|
-
description:
|
|
1580
|
-
"Bind semantic variables to node properties AND set the explicit variable mode on a container frame. Unlike basic variable binding, this ensures components actually switch between Light/Dark themes. Binds semantic alias variables (which have per-mode values) and activates a specific mode on the target frame.",
|
|
1581
|
-
inputSchema: {
|
|
1582
|
-
type: "object",
|
|
1583
|
-
properties: {
|
|
1584
|
-
bindings: {
|
|
1585
|
-
type: "array",
|
|
1586
|
-
items: {
|
|
1587
|
-
type: "object",
|
|
1588
|
-
properties: {
|
|
1589
|
-
nodeId: { type: "string", description: "Target node ID" },
|
|
1590
|
-
field: { type: "string", description: "Property to bind: fills, strokes, paddingLeft, cornerRadius, etc." },
|
|
1591
|
-
variableId: { type: "string", description: "Semantic variable ID (must have mode values)" },
|
|
1592
|
-
fillIndex: { type: "number", description: "Paint array index for fills/strokes (default 0)" },
|
|
1593
|
-
},
|
|
1594
|
-
required: ["nodeId", "field", "variableId"],
|
|
1595
|
-
},
|
|
1596
|
-
},
|
|
1597
|
-
targetFrameId: { type: "string", description: "Container frame to set the explicit mode on" },
|
|
1598
|
-
collectionId: { type: "string", description: "Variable collection ID" },
|
|
1599
|
-
activeModeId: { type: "string", description: "Mode ID to activate (e.g. Dark mode ID)" },
|
|
1600
|
-
},
|
|
1601
|
-
required: ["bindings", "targetFrameId", "collectionId", "activeModeId"],
|
|
1602
|
-
},
|
|
1603
|
-
},
|
|
1604
|
-
{
|
|
1605
|
-
name: "figma_get_pages",
|
|
1606
|
-
description: "List all pages in the current Figma file.",
|
|
1607
|
-
inputSchema: { type: "object", properties: {} },
|
|
1608
|
-
},
|
|
1609
|
-
{
|
|
1610
|
-
name: "figma_create_page",
|
|
1611
|
-
description: "Create a new page in the Figma file.",
|
|
1612
|
-
inputSchema: {
|
|
1613
|
-
type: "object",
|
|
1614
|
-
properties: {
|
|
1615
|
-
name: { type: "string", description: "Page name" },
|
|
1616
|
-
},
|
|
1617
|
-
required: ["name"],
|
|
1618
|
-
},
|
|
1619
|
-
},
|
|
1620
|
-
|
|
1621
|
-
// ── Tier 2: Competitive tools ─────────────────────────────────────────────
|
|
1622
|
-
{
|
|
1623
|
-
name: "figma_handoff_spec",
|
|
1624
|
-
description:
|
|
1625
|
-
"Generate a developer-ready handoff specification for any component or frame. Produces measurements (width, height, padding, gap), token names mapped to every property, copy-paste CSS/SCSS snippets, redline annotations, asset export lists, and responsive notes. Outputs JSON, Markdown, or an annotated Figma page with visual redlines.",
|
|
1626
|
-
inputSchema: {
|
|
1627
|
-
type: "object",
|
|
1628
|
-
properties: {
|
|
1629
|
-
nodeId: { type: "string", description: "Figma node ID of the component/frame to spec" },
|
|
1630
|
-
outputFormat: { type: "string", enum: ["json", "markdown", "figma-page", "all"], description: "Output format" },
|
|
1631
|
-
includeCss: { type: "boolean", description: "Include copy-paste CSS snippets (default true)" },
|
|
1632
|
-
includeAssets: { type: "boolean", description: "Include asset export list (default true)" },
|
|
1633
|
-
cssUnit: { type: "string", enum: ["px", "rem"], description: "CSS unit preference (default px)" },
|
|
1634
|
-
remBase: { type: "number", description: "Base size for rem conversion (default 16)" },
|
|
1635
|
-
maxDepth: { type: "number", description: "Max depth for element scanning (default 6)" },
|
|
1636
|
-
},
|
|
1637
|
-
required: ["nodeId", "outputFormat"],
|
|
1638
|
-
},
|
|
1639
|
-
},
|
|
1640
|
-
{
|
|
1641
|
-
name: "figma_ci_check",
|
|
1642
|
-
description:
|
|
1643
|
-
"CI/CD integration for design system governance. Runs lint-rules + health-report and produces CI-friendly output: GitHub Actions annotations (::error, ::warning), SARIF for Code Scanning, PR comment markdown, and threshold gates. Can also generate a ready-to-use GitHub Action YAML workflow file.",
|
|
1644
|
-
inputSchema: {
|
|
1645
|
-
type: "object",
|
|
1646
|
-
properties: {
|
|
1647
|
-
checks: {
|
|
1648
|
-
type: "array",
|
|
1649
|
-
items: { type: "string", enum: ["lint", "health", "tokens", "all"] },
|
|
1650
|
-
description: "Which checks to run",
|
|
1651
|
-
},
|
|
1652
|
-
outputFormat: { type: "string", enum: ["github-actions", "sarif", "pr-comment", "json", "all"], description: "Output format" },
|
|
1653
|
-
healthThreshold: { type: "number", description: "Minimum health score to pass (0-100, default 70)" },
|
|
1654
|
-
maxLintErrors: { type: "number", description: "Maximum allowed errors (default 0)" },
|
|
1655
|
-
maxLintWarnings: { type: "number", description: "Maximum allowed warnings (default unlimited)" },
|
|
1656
|
-
nodeId: { type: "string", description: "Scope to specific node (default: current page)" },
|
|
1657
|
-
generateWorkflow: { type: "boolean", description: "Generate a GitHub Action YAML workflow file" },
|
|
1658
|
-
},
|
|
1659
|
-
required: ["checks", "outputFormat"],
|
|
1660
|
-
},
|
|
1661
|
-
},
|
|
1662
|
-
{
|
|
1663
|
-
name: "figma_watch_docs",
|
|
1664
|
-
description:
|
|
1665
|
-
"Auto-updating documentation system. Monitors components for changes, detects documentation drift, auto-regenerates specs when stale, and produces changelogs. Actions: 'check' (compare current vs snapshot, find stale docs), 'regenerate' (force-rebuild specs), 'changelog' (generate human-readable change log), 'freshness' (report doc freshness scores), 'register-webhook' (configure automated updates).",
|
|
1666
|
-
inputSchema: {
|
|
1667
|
-
type: "object",
|
|
1668
|
-
properties: {
|
|
1669
|
-
action: { type: "string", enum: ["check", "regenerate", "changelog", "freshness", "register-webhook"], description: "Action to perform" },
|
|
1670
|
-
nodeIds: { type: "array", items: { type: "string" }, description: "Component node IDs to watch (omit for all on current page)" },
|
|
1671
|
-
snapshotDir: { type: "string", description: "Path to store spec snapshots for comparison" },
|
|
1672
|
-
autoRegenerate: { type: "boolean", description: "Auto-regenerate specs that are stale (for check action)" },
|
|
1673
|
-
specFormat: { type: "string", enum: ["json", "markdown", "figma-page", "all"], description: "Output format for regenerated specs" },
|
|
1674
|
-
fileKey: { type: "string", description: "Figma file key (for webhook registration)" },
|
|
1675
|
-
},
|
|
1676
|
-
required: ["action"],
|
|
1677
|
-
},
|
|
1678
|
-
},
|
|
1679
|
-
{
|
|
1680
|
-
name: "figma_icon_library_sync",
|
|
1681
|
-
description:
|
|
1682
|
-
"Bidirectional icon library synchronization between Figma and code. Export: Figma icon components → SVG files + React/Vue/Svelte icon components with typed catalog. Diff: Compare Figma icon set against existing icons and report added/removed/modified. Catalog: Generate a typed icon catalog with categories.",
|
|
1683
|
-
inputSchema: {
|
|
1684
|
-
type: "object",
|
|
1685
|
-
properties: {
|
|
1686
|
-
action: { type: "string", enum: ["export", "diff", "catalog"], description: "Sync action" },
|
|
1687
|
-
sourceNodeId: { type: "string", description: "Figma page/frame containing icons (default: auto-detect)" },
|
|
1688
|
-
namePrefix: { type: "string", description: "Icon name prefix filter (e.g. 'icon/' or 'Icon/')" },
|
|
1689
|
-
framework: { type: "string", enum: ["react", "vue", "svelte", "svg-only"], description: "Output framework (default react)" },
|
|
1690
|
-
generateCatalog: { type: "boolean", description: "Generate TypeScript icon catalog (default true)" },
|
|
1691
|
-
exportSize: { type: "number", description: "Export size in px (default 24)" },
|
|
1692
|
-
includeSizeVariants: { type: "boolean", description: "Include size variants (16, 20, 24, 32)" },
|
|
1693
|
-
existingIcons: { type: "array", items: { type: "string" }, description: "Existing icon names for diff comparison" },
|
|
1694
|
-
},
|
|
1695
|
-
required: ["action"],
|
|
1696
|
-
},
|
|
1697
|
-
},
|
|
1698
|
-
{
|
|
1699
|
-
name: "figma_composition_builder",
|
|
1700
|
-
description:
|
|
1701
|
-
"Build composed multi-component patterns from natural language or explicit component lists. Examples: 'login form' → Modal + Inputs + Button, 'search with filters' → Search + Select + Button, 'card with actions' → Card + Image + Buttons. Supports 12 pre-built recipes plus custom compositions. Outputs a properly laid-out Figma frame with Auto Layout and token bindings.",
|
|
1702
|
-
inputSchema: {
|
|
1703
|
-
type: "object",
|
|
1704
|
-
properties: {
|
|
1705
|
-
pattern: { type: "string", description: "Natural language pattern description (e.g. 'login form', 'nav bar', 'settings panel')" },
|
|
1706
|
-
components: {
|
|
1707
|
-
type: "array",
|
|
1708
|
-
items: {
|
|
1709
|
-
type: "object",
|
|
1710
|
-
properties: {
|
|
1711
|
-
name: { type: "string", description: "Component name from blueprint catalog" },
|
|
1712
|
-
props: { type: "object", description: "Variant properties to apply" },
|
|
1713
|
-
count: { type: "number", description: "How many instances (default 1)" },
|
|
1714
|
-
},
|
|
1715
|
-
required: ["name"],
|
|
1716
|
-
},
|
|
1717
|
-
description: "Explicit component list (overrides pattern matching)",
|
|
1718
|
-
},
|
|
1719
|
-
frameWidth: { type: "number", description: "Container width in px (default 400)" },
|
|
1720
|
-
layoutDirection: { type: "string", enum: ["VERTICAL", "HORIZONTAL"], description: "Layout direction (auto-detected if omitted)" },
|
|
1721
|
-
spacing: { type: "number", description: "Gap between components in px (default 16)" },
|
|
1722
|
-
padding: { type: "number", description: "Container padding in px (default 24)" },
|
|
1723
|
-
includeBackground: { type: "boolean", description: "Add a white background fill" },
|
|
1724
|
-
targetPage: { type: "string", description: "Figma page name to place the composition" },
|
|
1725
|
-
},
|
|
1726
|
-
required: ["pattern"],
|
|
1727
|
-
},
|
|
1728
|
-
},
|
|
1729
|
-
{
|
|
1730
|
-
name: "figma_swarm_build",
|
|
1731
|
-
description:
|
|
1732
|
-
"Multi-agent orchestrated page builder. Decomposes a high-level brief (e.g. 'SaaS landing page with hero, features, pricing, and footer') into spatial zones, assigns each to a named AI agent (Layouter, Styler, Copywriter, Matcher), runs all preparation in TRUE PARALLEL, then builds with multiple visible cursors and inter-agent chat notes. 3-5x faster than sequential tool-by-tool building. Each agent has a unique colored cursor that moves to its work area. Agent chat bubbles appear as sticky notes showing collaboration.",
|
|
1733
|
-
inputSchema: {
|
|
1734
|
-
type: "object",
|
|
1735
|
-
properties: {
|
|
1736
|
-
brief: {
|
|
1737
|
-
type: "string",
|
|
1738
|
-
description: "High-level page description (e.g. 'SaaS landing page with hero, features, pricing, testimonials, and footer')",
|
|
1739
|
-
},
|
|
1740
|
-
platform: {
|
|
1741
|
-
type: "string",
|
|
1742
|
-
enum: ["web", "mobile"],
|
|
1743
|
-
description: "Target platform (default: web). Sets frame width automatically.",
|
|
1744
|
-
},
|
|
1745
|
-
width: {
|
|
1746
|
-
type: "number",
|
|
1747
|
-
description: "Override frame width in px (default: 1440 for web, 390 for mobile)",
|
|
1748
|
-
},
|
|
1749
|
-
showAgentChat: {
|
|
1750
|
-
type: "boolean",
|
|
1751
|
-
description: "Show agent collaboration chat notes on canvas (default: true)",
|
|
1752
|
-
},
|
|
1753
|
-
fonts: {
|
|
1754
|
-
type: "object",
|
|
1755
|
-
description: "Optional font configuration override",
|
|
1756
|
-
properties: {
|
|
1757
|
-
heading: { type: "string" },
|
|
1758
|
-
body: { type: "string" },
|
|
1759
|
-
ui: { type: "string" },
|
|
1760
|
-
},
|
|
1761
|
-
},
|
|
1762
|
-
},
|
|
1763
|
-
required: ["brief"],
|
|
1764
|
-
},
|
|
1765
|
-
},
|
|
1766
|
-
];
|
|
1767
|
-
|
|
1768
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
1769
|
-
// Tool handler dispatch
|
|
1770
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
1771
|
-
|
|
1772
|
-
type AnyArgs = Record<string, unknown>;
|
|
1773
|
-
|
|
1774
|
-
async function dispatch(name: string, args: AnyArgs): Promise<unknown> {
|
|
1775
|
-
// Log every tool call for debugging
|
|
1776
|
-
const fs = await import("fs");
|
|
1777
|
-
fs.appendFileSync("/tmp/figma-tool-calls.log", `[${new Date().toISOString()}] TOOL CALLED: ${name} | args: ${JSON.stringify(args).slice(0, 500)}\n`);
|
|
1778
|
-
switch (name) {
|
|
1779
|
-
// Phase 1
|
|
1780
|
-
case "figma_screen_cloner": return screenClonerHandler(args as never);
|
|
1781
|
-
case "figma_visual_audit": return visualAuditHandler(args as never);
|
|
1782
|
-
case "figma_a11y_audit": {
|
|
1783
|
-
const a11yResult = await a11yAuditHandler(args as never);
|
|
1784
|
-
// In VPAT mode, return the formatted markdown report directly as a string
|
|
1785
|
-
// so the LLM presents the full VPAT table rather than summarising raw JSON.
|
|
1786
|
-
if (a11yResult.vpatReport) {
|
|
1787
|
-
return a11yResult.vpatReport.formattedReport;
|
|
1788
|
-
}
|
|
1789
|
-
return a11yResult;
|
|
1790
|
-
}
|
|
1791
|
-
case "figma_a11y_keyboard_screenreader_order": return keyboardSrOrderHandler(args as never);
|
|
1792
|
-
case "figma_a11y_annotate": return a11yAnnotateHandler(args as never);
|
|
1793
|
-
case "figma_sketch_to_design": return sketchToDesignHandler(args as never);
|
|
1794
|
-
case "figma_design_from_ref": return designFromRefHandler(args as never);
|
|
1795
|
-
// Phase 2
|
|
1796
|
-
case "figma_intent_translator": return intentTranslatorHandler(args as never);
|
|
1797
|
-
case "figma_layout_intelligence": return layoutIntelligenceHandler(args as never);
|
|
1798
|
-
case "figma_variant_expander": return variantExpanderHandler(args as never);
|
|
1799
|
-
case "figma_theme_generator": return themeGeneratorHandler(args as never);
|
|
1800
|
-
case "figma_lint_rules": return lintRulesHandler(args as never);
|
|
1801
|
-
case "figma_component_audit": return componentAuditHandler(args as never);
|
|
1802
|
-
// Phase 3
|
|
1803
|
-
case "figma_component_archaeologist": return componentArchaeologistHandler(args as never);
|
|
1804
|
-
case "figma_page_architect": return pageArchitectHandler(args as never);
|
|
1805
|
-
case "figma_generate_image_and_insert": return generateImageAndInsertHandler(args as never);
|
|
1806
|
-
case "figma_unsplash_search": return figmaUnsplashSearchHandler(args as never);
|
|
1807
|
-
case "figma_url_to_frame": return urlToFrameHandler(args as never);
|
|
1808
|
-
case "figma_system_drift": return systemDriftHandler(args as never);
|
|
1809
|
-
case "figma_prototype_map": return prototypeMapHandler(args as never);
|
|
1810
|
-
case "figma_prototype_scan": return prototypeScanHandler(args as never);
|
|
1811
|
-
case "figma_prototype_wire": return prototypeWireHandler(args as never);
|
|
1812
|
-
case "figma_animated_build": return animatedBuildHandler(args as never);
|
|
1813
|
-
// Phase 4
|
|
1814
|
-
case "figma_animation_specifier": return animationSpecifierHandler(args as never);
|
|
1815
|
-
case "figma_sync_from_code": return syncFromCodeHandler(args as never);
|
|
1816
|
-
case "figma_export_tokens": return exportTokensHandler(args as never);
|
|
1817
|
-
case "figma_generate_component_code": return generateComponentCodeHandler(args as never);
|
|
1818
|
-
case "figma_webhook_listener": return webhookListenerHandler(args as never);
|
|
1819
|
-
case "figma_handoff_spec": return handoffSpecHandler(args as never);
|
|
1820
|
-
case "figma_ci_check": return ciCheckHandler(args as never);
|
|
1821
|
-
case "figma_watch_docs": return watchDocsHandler(args as never);
|
|
1822
|
-
case "figma_icon_library_sync": return iconLibrarySyncHandler(args as never);
|
|
1823
|
-
// Phase 3 (Tier 2)
|
|
1824
|
-
case "figma_composition_builder": return compositionBuilderHandler(args as never);
|
|
1825
|
-
case "figma_swarm_build": return swarmBuildHandler(args as never);
|
|
1826
|
-
// Phase 5
|
|
1827
|
-
case "figma_design_system_scaffolder": return dsScaffolderHandler(args as never);
|
|
1828
|
-
case "figma_design_system_primitives": return dsPrimitivesHandler(args as never);
|
|
1829
|
-
case "figma_design_system_variables": return dsVariablesHandler(args as never);
|
|
1830
|
-
case "figma_token_naming_convention": return tokenNamingHandler(args as never);
|
|
1831
|
-
case "figma_token_migrate": return tokenMigrateHandler(args as never);
|
|
1832
|
-
case "figma_token_analytics": return tokenAnalyticsHandler(args as never);
|
|
1833
|
-
case "figma_token_docs": return tokenDocsHandler(args as never);
|
|
1834
|
-
case "figma_taxonomy_docs": return taxonomyDocsHandler(args as never);
|
|
1835
|
-
case "figma_validate_dtcg": {
|
|
1836
|
-
const dtcgArgs = args as { tokens: Record<string, unknown>; strict?: boolean };
|
|
1837
|
-
const result = validateDtcg(dtcgArgs.tokens);
|
|
1838
|
-
if (dtcgArgs.strict) {
|
|
1839
|
-
result.valid = result.issues.every(i => i.severity !== "error" && i.severity !== "warning");
|
|
1840
|
-
}
|
|
1841
|
-
return result;
|
|
1842
|
-
}
|
|
1843
|
-
case "figma_token_math": {
|
|
1844
|
-
const { evaluateExpression, generateModularScale, generateSpacingScale, generateClamp, pxToRem, SCALE_RATIOS } = await import("./shared/token-math.js");
|
|
1845
|
-
const mathArgs = args as { action: string; expression?: string; scaleOptions?: Record<string, unknown>; spacingOptions?: Record<string, unknown>; clampOptions?: Record<string, unknown>; value?: number; remBase?: number };
|
|
1846
|
-
switch (mathArgs.action) {
|
|
1847
|
-
case "evaluate": {
|
|
1848
|
-
if (!mathArgs.expression) throw new Error("expression is required");
|
|
1849
|
-
const bridge = await getBridge();
|
|
1850
|
-
const rawVars = (await bridge.getVariables(undefined, "full")) as unknown as { collections: Array<{ variables: Array<{ name: string; resolvedType: string; valuesByMode: Record<string, unknown> }> }> };
|
|
1851
|
-
const tokenMap = new Map<string, number>();
|
|
1852
|
-
for (const coll of rawVars?.collections ?? []) {
|
|
1853
|
-
for (const v of coll.variables) {
|
|
1854
|
-
if (v.resolvedType === "FLOAT") {
|
|
1855
|
-
const val = Object.values(v.valuesByMode)[0];
|
|
1856
|
-
if (typeof val === "number") tokenMap.set(v.name.replace(/\//g, "."), val);
|
|
1857
|
-
}
|
|
1858
|
-
}
|
|
1859
|
-
}
|
|
1860
|
-
const resolver = (path: string) => tokenMap.get(path);
|
|
1861
|
-
return { expression: mathArgs.expression, result: evaluateExpression(mathArgs.expression, resolver) };
|
|
1862
|
-
}
|
|
1863
|
-
case "modular-scale": {
|
|
1864
|
-
const opts = mathArgs.scaleOptions ?? {};
|
|
1865
|
-
const ratioStr = String(opts.ratio ?? "major-third");
|
|
1866
|
-
const ratio = SCALE_RATIOS[ratioStr] ?? (parseFloat(ratioStr) || 1.25);
|
|
1867
|
-
return generateModularScale({ base: Number(opts.base) || 16, ratio, steps: Number(opts.steps) || 6, stepsBelow: Number(opts.stepsBelow) || 2 });
|
|
1868
|
-
}
|
|
1869
|
-
case "spacing-scale": {
|
|
1870
|
-
const opts = mathArgs.spacingOptions ?? {};
|
|
1871
|
-
return generateSpacingScale({ base: Number(opts.base) || 4, steps: (opts.steps as number[]) ?? [0, 0.5, 1, 1.5, 2, 3, 4, 6, 8, 12, 16] });
|
|
1872
|
-
}
|
|
1873
|
-
case "clamp": {
|
|
1874
|
-
const opts = mathArgs.clampOptions ?? {} as Record<string, unknown>;
|
|
1875
|
-
return { clamp: generateClamp({ minValue: Number(opts.minValue) || 16, maxValue: Number(opts.maxValue) || 24, minViewport: Number(opts.minViewport) || 320, maxViewport: Number(opts.maxViewport) || 1440, unit: (opts.unit as "px" | "rem") ?? "rem" }) };
|
|
1876
|
-
}
|
|
1877
|
-
case "px-to-rem":
|
|
1878
|
-
return { px: mathArgs.value, rem: pxToRem(mathArgs.value ?? 16, mathArgs.remBase) };
|
|
1879
|
-
default:
|
|
1880
|
-
throw new Error(`Unknown token_math action: ${mathArgs.action}`);
|
|
1881
|
-
}
|
|
1882
|
-
}
|
|
1883
|
-
case "figma_color_operations": {
|
|
1884
|
-
const colorOps = await import("./shared/color-operations.js");
|
|
1885
|
-
const colorArgs = args as { action: string; color: string; color2?: string; amount?: number; steps?: number; targetRatio?: number; colorSpace?: "srgb" | "display-p3" | "oklch" };
|
|
1886
|
-
switch (colorArgs.action) {
|
|
1887
|
-
case "lighten": return { result: colorOps.lighten(colorArgs.color, colorArgs.amount ?? 0.1) };
|
|
1888
|
-
case "darken": return { result: colorOps.darken(colorArgs.color, colorArgs.amount ?? 0.1) };
|
|
1889
|
-
case "mix": return { result: colorOps.mix(colorArgs.color, colorArgs.color2 ?? "#FFFFFF", colorArgs.amount ?? 0.5) };
|
|
1890
|
-
case "alpha": return { result: colorOps.setAlpha(colorArgs.color, colorArgs.amount ?? 0.5) };
|
|
1891
|
-
case "hue-shift": return { result: colorOps.adjustHue(colorArgs.color, colorArgs.amount ?? 30) };
|
|
1892
|
-
case "saturate": return { result: colorOps.saturate(colorArgs.color, colorArgs.amount ?? 0.1) };
|
|
1893
|
-
case "desaturate": return { result: colorOps.desaturate(colorArgs.color, colorArgs.amount ?? 0.1) };
|
|
1894
|
-
case "complement": return { result: colorOps.complement(colorArgs.color) };
|
|
1895
|
-
case "invert": return { result: colorOps.invert(colorArgs.color) };
|
|
1896
|
-
case "contrast-check": return { ratio: colorOps.contrastRatio(colorArgs.color, colorArgs.color2 ?? "#FFFFFF"), meetsAA: colorOps.meetsWcagAA(colorArgs.color, colorArgs.color2 ?? "#FFFFFF"), meetsAAA: colorOps.meetsWcagAAA(colorArgs.color, colorArgs.color2 ?? "#FFFFFF") };
|
|
1897
|
-
case "suggest-accessible": return { result: colorOps.suggestAccessibleColor(colorArgs.color, colorArgs.color2 ?? "#000000", colorArgs.targetRatio ?? 4.5) };
|
|
1898
|
-
case "generate-scale": return { scale: colorOps.generateTintShadeScale(colorArgs.color, colorArgs.steps ?? 11) };
|
|
1899
|
-
case "tints": return { tints: colorOps.generateTints(colorArgs.color, colorArgs.steps ?? 10) };
|
|
1900
|
-
case "shades": return { shades: colorOps.generateShades(colorArgs.color, colorArgs.steps ?? 10) };
|
|
1901
|
-
case "format": return { formatted: colorOps.formatCssColor(colorArgs.color, colorArgs.colorSpace ?? "srgb") };
|
|
1902
|
-
default: throw new Error(`Unknown color_operations action: ${colorArgs.action}`);
|
|
1903
|
-
}
|
|
1904
|
-
}
|
|
1905
|
-
case "figma_decision_log": return decisionLogToolHandler(args as never);
|
|
1906
|
-
case "figma_design_decision_log": return designDecisionLogHandler(args as never);
|
|
1907
|
-
case "figma_health_report": return healthReportHandler(args as never);
|
|
1908
|
-
case "figma_component_spec": return componentSpecHandler(args as never);
|
|
1909
|
-
case "figma_component_spec_sheet": return componentSpecSheetHandler(args as never);
|
|
1910
|
-
case "figma_apg_doc": return figmaApgDocHandler(args as never);
|
|
1911
|
-
// Direct execute
|
|
1912
|
-
case "figma_execute": {
|
|
1913
|
-
const code = (args as { code: string }).code;
|
|
1914
|
-
// Soft guardrail: warn if figma_execute is being used to create spec pages
|
|
1915
|
-
const codeLC = code.toLowerCase();
|
|
1916
|
-
if (codeLC.includes("createpage") && /spec|specification|component\s*doc/i.test(code)) {
|
|
1917
|
-
return {
|
|
1918
|
-
warning: "Use figma_component_spec or figma_component_spec_sheet instead of manually creating spec pages with figma_execute. The spec tools handle page creation, deduplication, and rendering automatically.",
|
|
1919
|
-
blocked: true,
|
|
1920
|
-
};
|
|
1921
|
-
}
|
|
1922
|
-
const bridge = await getBridge();
|
|
1923
|
-
const execResult = await bridge.execute(code);
|
|
1924
|
-
if (!execResult.success) throw new Error(execResult.error);
|
|
1925
|
-
return execResult.result;
|
|
1926
|
-
}
|
|
1927
|
-
|
|
1928
|
-
// ── Navigation & Status ──────────────────────────────────────────────
|
|
1929
|
-
case "figma_get_status": {
|
|
1930
|
-
const bridge = await getBridge();
|
|
1931
|
-
return bridge.getStatus();
|
|
1932
|
-
}
|
|
1933
|
-
case "figma_navigate": {
|
|
1934
|
-
const bridge = await getBridge();
|
|
1935
|
-
return bridge.navigate((args as { nodeId: string }).nodeId);
|
|
1936
|
-
}
|
|
1937
|
-
case "figma_get_selection": {
|
|
1938
|
-
const bridge = await getBridge();
|
|
1939
|
-
return bridge.getSelection();
|
|
1940
|
-
}
|
|
1941
|
-
case "figma_take_screenshot": {
|
|
1942
|
-
const bridge = await getBridge();
|
|
1943
|
-
const a = args as { nodeId?: string; scale?: number };
|
|
1944
|
-
let dataUri: string;
|
|
1945
|
-
if (a.nodeId) {
|
|
1946
|
-
dataUri = await bridge.takeScreenshot(a.nodeId);
|
|
1947
|
-
} else {
|
|
1948
|
-
const status = await bridge.getStatus() as { currentPage?: { id: string } };
|
|
1949
|
-
if (!status.currentPage?.id) {
|
|
1950
|
-
throw new Error("No nodeId provided and could not determine current page");
|
|
1951
|
-
}
|
|
1952
|
-
dataUri = await bridge.takeScreenshot(status.currentPage.id);
|
|
1953
|
-
}
|
|
1954
|
-
// Return as MCP image content block (not raw text)
|
|
1955
|
-
const base64 = dataUri.replace(/^data:image\/png;base64,/, "");
|
|
1956
|
-
return {
|
|
1957
|
-
__images: [{ data: base64, mimeType: "image/png" }],
|
|
1958
|
-
message: `Screenshot captured${a.nodeId ? ` for node ${a.nodeId}` : " of current page"}.`,
|
|
1959
|
-
};
|
|
1960
|
-
}
|
|
1961
|
-
case "figma_get_node": {
|
|
1962
|
-
const bridge = await getBridge();
|
|
1963
|
-
// P0+P1: Return enriched node data with resolved styles via cache
|
|
1964
|
-
return bridge.getNodeEnriched((args as { nodeId: string }).nodeId);
|
|
1965
|
-
}
|
|
1966
|
-
|
|
1967
|
-
// ── Variable Management ──────────────────────────────────────────────
|
|
1968
|
-
case "figma_create_variable_collection": {
|
|
1969
|
-
const bridge = await getBridge();
|
|
1970
|
-
const a = args as { name: string; initialModeName?: string };
|
|
1971
|
-
return bridge.createVariableCollection(a.name, a.initialModeName);
|
|
1972
|
-
}
|
|
1973
|
-
case "figma_create_variable": {
|
|
1974
|
-
const bridge = await getBridge();
|
|
1975
|
-
const a = args as { name: string; collectionId: string; resolvedType: string; valuesByMode?: Record<string, unknown>; description?: string };
|
|
1976
|
-
return bridge.createVariable(a.name, a.collectionId, a.resolvedType, a.valuesByMode, a.description);
|
|
1977
|
-
}
|
|
1978
|
-
case "figma_update_variable": {
|
|
1979
|
-
const bridge = await getBridge();
|
|
1980
|
-
const a = args as { variableId: string; modeId: string; value: unknown };
|
|
1981
|
-
return bridge.updateVariable(a.variableId, a.modeId, a.value);
|
|
1982
|
-
}
|
|
1983
|
-
case "figma_delete_variable": {
|
|
1984
|
-
const bridge = await getBridge();
|
|
1985
|
-
return bridge.deleteVariable((args as { variableId: string }).variableId);
|
|
1986
|
-
}
|
|
1987
|
-
case "figma_rename_variable": {
|
|
1988
|
-
const bridge = await getBridge();
|
|
1989
|
-
const a = args as { variableId: string; newName: string };
|
|
1990
|
-
return bridge.renameVariable(a.variableId, a.newName);
|
|
1991
|
-
}
|
|
1992
|
-
case "figma_delete_variable_collection": {
|
|
1993
|
-
const bridge = await getBridge();
|
|
1994
|
-
return bridge.deleteVariableCollection((args as { collectionId: string }).collectionId);
|
|
1995
|
-
}
|
|
1996
|
-
case "figma_add_mode": {
|
|
1997
|
-
const bridge = await getBridge();
|
|
1998
|
-
const a = args as { collectionId: string; modeName: string };
|
|
1999
|
-
return bridge.addMode(a.collectionId, a.modeName);
|
|
2000
|
-
}
|
|
2001
|
-
case "figma_rename_mode": {
|
|
2002
|
-
const bridge = await getBridge();
|
|
2003
|
-
const a = args as { collectionId: string; modeId: string; newName: string };
|
|
2004
|
-
return bridge.renameMode(a.collectionId, a.modeId, a.newName);
|
|
2005
|
-
}
|
|
2006
|
-
case "figma_batch_create_variables": {
|
|
2007
|
-
const bridge = await getBridge();
|
|
2008
|
-
const a = args as { variables: Array<{ name: string; collectionId: string; resolvedType: string; valuesByMode?: Record<string, unknown>; description?: string }> };
|
|
2009
|
-
return bridge.batchCreateVariables(a.variables);
|
|
2010
|
-
}
|
|
2011
|
-
case "figma_batch_update_variables": {
|
|
2012
|
-
const bridge = await getBridge();
|
|
2013
|
-
const a = args as { updates: Array<{ variableId: string; modeId: string; value: unknown }> };
|
|
2014
|
-
return bridge.batchUpdateVariables(a.updates);
|
|
2015
|
-
}
|
|
2016
|
-
case "figma_get_variables": {
|
|
2017
|
-
const bridge = await getBridge();
|
|
2018
|
-
const a = args as { collectionId?: string; verbosity?: string };
|
|
2019
|
-
return bridge.getVariables(a.collectionId, a.verbosity);
|
|
2020
|
-
}
|
|
2021
|
-
|
|
2022
|
-
// ── Node Operations ──────────────────────────────────────────────────
|
|
2023
|
-
case "figma_clone_node": {
|
|
2024
|
-
const bridge = await getBridge();
|
|
2025
|
-
const a = args as { nodeId: string; x?: number; y?: number };
|
|
2026
|
-
return bridge.cloneNode(a.nodeId, a.x, a.y);
|
|
2027
|
-
}
|
|
2028
|
-
case "figma_delete_node": {
|
|
2029
|
-
const bridge = await getBridge();
|
|
2030
|
-
return bridge.deleteNode((args as { nodeId: string }).nodeId);
|
|
2031
|
-
}
|
|
2032
|
-
case "figma_move_node": {
|
|
2033
|
-
const bridge = await getBridge();
|
|
2034
|
-
const a = args as { nodeId: string; x?: number; y?: number; parentId?: string };
|
|
2035
|
-
return bridge.moveNode(a.nodeId, a.x, a.y, a.parentId);
|
|
2036
|
-
}
|
|
2037
|
-
case "figma_resize_node": {
|
|
2038
|
-
const bridge = await getBridge();
|
|
2039
|
-
const a = args as { nodeId: string; width: number; height: number };
|
|
2040
|
-
return bridge.resizeNode(a.nodeId, a.width, a.height);
|
|
2041
|
-
}
|
|
2042
|
-
case "figma_rename_node": {
|
|
2043
|
-
const bridge = await getBridge();
|
|
2044
|
-
const a = args as { nodeId: string; newName: string };
|
|
2045
|
-
return bridge.renameNode(a.nodeId, a.newName);
|
|
2046
|
-
}
|
|
2047
|
-
case "figma_set_fills": {
|
|
2048
|
-
const bridge = await getBridge();
|
|
2049
|
-
const a = args as { nodeId: string; fills: unknown[] };
|
|
2050
|
-
return bridge.setFills(a.nodeId, a.fills);
|
|
2051
|
-
}
|
|
2052
|
-
case "figma_set_strokes": {
|
|
2053
|
-
const bridge = await getBridge();
|
|
2054
|
-
const a = args as { nodeId: string; strokes: unknown[]; strokeWeight?: number };
|
|
2055
|
-
return bridge.setStrokes(a.nodeId, a.strokes, a.strokeWeight);
|
|
2056
|
-
}
|
|
2057
|
-
case "figma_set_text": {
|
|
2058
|
-
const bridge = await getBridge();
|
|
2059
|
-
const a = args as { nodeId: string; characters: string; fontSize?: number };
|
|
2060
|
-
return bridge.setText(a.nodeId, a.characters, a.fontSize);
|
|
2061
|
-
}
|
|
2062
|
-
|
|
2063
|
-
// ── Component Operations ─────────────────────────────────────────────
|
|
2064
|
-
case "figma_search_components": {
|
|
2065
|
-
const bridge = await getBridge();
|
|
2066
|
-
const a = args as { query: string; limit?: number };
|
|
2067
|
-
return bridge.searchComponents(a.query, a.limit);
|
|
2068
|
-
}
|
|
2069
|
-
case "figma_instantiate_component": {
|
|
2070
|
-
const bridge = await getBridge();
|
|
2071
|
-
const a = args as { nodeId: string; variant?: Record<string, string>; x?: number; y?: number; parentId?: string };
|
|
2072
|
-
return bridge.instantiateComponent(a.nodeId, a.variant, a.x, a.y, a.parentId);
|
|
2073
|
-
}
|
|
2074
|
-
case "figma_set_description": {
|
|
2075
|
-
const bridge = await getBridge();
|
|
2076
|
-
const a = args as { nodeId: string; description: string };
|
|
2077
|
-
return bridge.setDescription(a.nodeId, a.description);
|
|
2078
|
-
}
|
|
2079
|
-
case "figma_get_styles": {
|
|
2080
|
-
const bridge = await getBridge();
|
|
2081
|
-
return bridge.getStyles();
|
|
2082
|
-
}
|
|
2083
|
-
case "figma_create_child": {
|
|
2084
|
-
const bridge = await getBridge();
|
|
2085
|
-
const a = args as { childType: string; parentId?: string; name?: string; width?: number; height?: number; x?: number; y?: number; characters?: string };
|
|
2086
|
-
return bridge.createChild(a.childType, a.parentId, a.name, a.width, a.height, a.x, a.y, a.characters);
|
|
2087
|
-
}
|
|
2088
|
-
case "figma_get_node_deep": {
|
|
2089
|
-
const bridge = await getBridge();
|
|
2090
|
-
const a = args as { nodeId: string; maxDepth?: number };
|
|
2091
|
-
return bridge.getNodeDeep(a.nodeId, a.maxDepth);
|
|
2092
|
-
}
|
|
2093
|
-
case "figma_batch_get_nodes": {
|
|
2094
|
-
const bridge = await getBridge();
|
|
2095
|
-
const a = args as { nodeIds: string[]; includeChildren?: boolean };
|
|
2096
|
-
return bridge.batchGetNodes(a.nodeIds, a.includeChildren);
|
|
2097
|
-
}
|
|
2098
|
-
case "figma_switch_mode": {
|
|
2099
|
-
const bridge = await getBridge();
|
|
2100
|
-
const a = args as { frameId: string; collectionId: string; modeId: string };
|
|
2101
|
-
return bridge.switchMode(a.frameId, a.collectionId, a.modeId);
|
|
2102
|
-
}
|
|
2103
|
-
case "figma_list_modes": {
|
|
2104
|
-
const bridge = await getBridge();
|
|
2105
|
-
const a = args as { collectionId: string };
|
|
2106
|
-
return bridge.listModes(a.collectionId);
|
|
2107
|
-
}
|
|
2108
|
-
case "figma_bind_variables_multi_mode": {
|
|
2109
|
-
const bridge = await getBridge();
|
|
2110
|
-
const a = args as {
|
|
2111
|
-
bindings: Array<{ nodeId: string; field: string; variableId: string; fillIndex?: number }>;
|
|
2112
|
-
targetFrameId: string;
|
|
2113
|
-
collectionId: string;
|
|
2114
|
-
activeModeId: string;
|
|
2115
|
-
};
|
|
2116
|
-
return bridge.bindVariablesMultiMode(a.bindings, a.targetFrameId, a.collectionId, a.activeModeId);
|
|
2117
|
-
}
|
|
2118
|
-
case "figma_get_pages": {
|
|
2119
|
-
const bridge = await getBridge();
|
|
2120
|
-
return bridge.getAllPages();
|
|
2121
|
-
}
|
|
2122
|
-
case "figma_create_page": {
|
|
2123
|
-
const bridge = await getBridge();
|
|
2124
|
-
return bridge.createPage((args as { name: string }).name);
|
|
2125
|
-
}
|
|
2126
|
-
|
|
2127
|
-
default:
|
|
2128
|
-
throw new Error(`Unknown tool: ${name}`);
|
|
2129
|
-
}
|
|
2130
|
-
}
|
|
2131
|
-
|
|
2132
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
2133
|
-
// MCP Server setup
|
|
2134
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
2135
|
-
|
|
2136
|
-
export function createMcpServer() {
|
|
2137
|
-
const server = new Server(
|
|
2138
|
-
{
|
|
2139
|
-
name: "figma-intelligence-layer",
|
|
2140
|
-
version: "1.0.0",
|
|
2141
|
-
},
|
|
2142
|
-
{
|
|
2143
|
-
capabilities: { tools: {} },
|
|
2144
|
-
}
|
|
2145
|
-
);
|
|
2146
|
-
|
|
2147
|
-
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
2148
|
-
tools: TOOLS,
|
|
2149
|
-
}));
|
|
2150
|
-
|
|
2151
|
-
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
2152
|
-
const { name, arguments: args } = request.params;
|
|
2153
|
-
|
|
2154
|
-
try {
|
|
2155
|
-
const result = await dispatch(name, (args ?? {}) as AnyArgs);
|
|
2156
|
-
const content: Array<{ type: string; text?: string; data?: string; mimeType?: string }> = [];
|
|
2157
|
-
|
|
2158
|
-
// Support tools returning images for the AI client to analyze
|
|
2159
|
-
if (result && typeof result === "object" && !Array.isArray(result)) {
|
|
2160
|
-
const obj = result as Record<string, unknown>;
|
|
2161
|
-
if (Array.isArray(obj.__images)) {
|
|
2162
|
-
for (const img of obj.__images as Array<{ data: string; mimeType: string }>) {
|
|
2163
|
-
content.push({ type: "image", data: img.data, mimeType: img.mimeType });
|
|
2164
|
-
}
|
|
2165
|
-
delete obj.__images;
|
|
2166
|
-
}
|
|
2167
|
-
}
|
|
2168
|
-
|
|
2169
|
-
// P0: Adaptive response compression — prevent context window overflow
|
|
2170
|
-
if (typeof result === "string") {
|
|
2171
|
-
content.push({ type: "text", text: result });
|
|
2172
|
-
} else {
|
|
2173
|
-
const compressed = compressResponse(result);
|
|
2174
|
-
if (compressed.tier === "full") {
|
|
2175
|
-
content.push({ type: "text", text: JSON.stringify(result, null, 2) });
|
|
2176
|
-
} else {
|
|
2177
|
-
// Include compression metadata so the AI knows data was truncated
|
|
2178
|
-
const envelope = {
|
|
2179
|
-
_compressed: {
|
|
2180
|
-
tier: compressed.tier,
|
|
2181
|
-
originalSizeKB: Math.round(compressed.originalSizeBytes / 1024),
|
|
2182
|
-
compressedSizeKB: Math.round(compressed.compressedSizeBytes / 1024),
|
|
2183
|
-
note: `Response was compressed from ${Math.round(compressed.originalSizeBytes / 1024)}KB to ${Math.round(compressed.compressedSizeBytes / 1024)}KB (tier: ${compressed.tier}). Use more specific queries or nodeIds to get full data.`,
|
|
2184
|
-
},
|
|
2185
|
-
data: compressed.data,
|
|
2186
|
-
};
|
|
2187
|
-
content.push({ type: "text", text: JSON.stringify(envelope, null, 2) });
|
|
2188
|
-
}
|
|
2189
|
-
}
|
|
2190
|
-
|
|
2191
|
-
return { content };
|
|
2192
|
-
} catch (error) {
|
|
2193
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
2194
|
-
return {
|
|
2195
|
-
content: [{ type: "text", text: `Error in ${name}: ${message}` }],
|
|
2196
|
-
isError: true,
|
|
2197
|
-
};
|
|
2198
|
-
}
|
|
2199
|
-
});
|
|
2200
|
-
|
|
2201
|
-
return server;
|
|
2202
|
-
}
|
|
2203
|
-
|
|
2204
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
2205
|
-
// Start
|
|
2206
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
2207
|
-
|
|
2208
|
-
async function main() {
|
|
2209
|
-
// Connect MCP transport FIRST so Claude Code gets the handshake immediately
|
|
2210
|
-
// (relay/bridge startup must not delay the MCP initialize response)
|
|
2211
|
-
const server = createMcpServer();
|
|
2212
|
-
const transport = new StdioServerTransport();
|
|
2213
|
-
await server.connect(transport);
|
|
2214
|
-
process.stderr.write(
|
|
2215
|
-
`figma-intelligence-layer MCP server running (${TOOLS.length} tools across 5 phases)\n`
|
|
2216
|
-
);
|
|
2217
|
-
|
|
2218
|
-
// THEN connect to the bridge relay (non-blocking, fire-and-forget)
|
|
2219
|
-
ensureRelayServer().catch((err) => {
|
|
2220
|
-
process.stderr.write(`Relay server warning: ${err.message}\n`);
|
|
2221
|
-
});
|
|
2222
|
-
|
|
2223
|
-
// Connect the bridge eagerly so the relay immediately sees an MCP socket
|
|
2224
|
-
// and reports "Connected" instead of "Relay only" in the plugin UI.
|
|
2225
|
-
getBridge().catch(() => {});
|
|
2226
|
-
}
|
|
2227
|
-
|
|
2228
|
-
if (require.main === module) {
|
|
2229
|
-
main().catch((err) => {
|
|
2230
|
-
process.stderr.write(`Fatal: ${err.message}\n`);
|
|
2231
|
-
process.exit(1);
|
|
2232
|
-
});
|
|
2233
|
-
}
|