@ufira/vibma 0.3.2 → 1.0.0-rc2
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 +3 -1
- package/dist/mcp.cjs +2461 -1159
- package/dist/mcp.js +2463 -1161
- package/dist/tools/endpoint.cjs +10 -1
- package/dist/tools/endpoint.js +10 -1
- package/dist/tools/generated/guards.cjs +789 -0
- package/dist/tools/generated/guards.d.cts +92 -0
- package/dist/tools/generated/guards.d.ts +92 -0
- package/dist/tools/generated/guards.js +721 -0
- package/dist/tools/registry.cjs +949 -2
- package/dist/tools/registry.js +951 -2
- package/dist/tools/schemas.cjs +43 -6
- package/dist/tools/schemas.d.cts +38 -6
- package/dist/tools/schemas.d.ts +38 -6
- package/dist/tools/schemas.js +38 -6
- package/dist/tools/types.d.cts +5 -1
- package/dist/tools/types.d.ts +5 -1
- package/package.json +8 -2
- package/dist/mcp.cjs.map +0 -1
- package/dist/mcp.js.map +0 -1
- package/dist/tools/endpoint.cjs.map +0 -1
- package/dist/tools/endpoint.js.map +0 -1
- package/dist/tools/registry.cjs.map +0 -1
- package/dist/tools/registry.js.map +0 -1
- package/dist/tools/schemas.cjs.map +0 -1
- package/dist/tools/schemas.js.map +0 -1
- package/dist/tools/types.cjs.map +0 -1
- package/dist/tools/types.js.map +0 -1
- package/dist/utils/coercion.cjs.map +0 -1
- package/dist/utils/coercion.js.map +0 -1
- package/dist/utils/color.cjs.map +0 -1
- package/dist/utils/color.js.map +0 -1
- package/dist/utils/wcag.cjs.map +0 -1
- package/dist/utils/wcag.js.map +0 -1
package/dist/mcp.cjs
CHANGED
|
@@ -25,13 +25,18 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
25
|
// src/mcp.ts
|
|
26
26
|
var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
27
27
|
var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
28
|
-
var import_zod18 = require("zod");
|
|
29
28
|
var import_ws = __toESM(require("ws"), 1);
|
|
30
29
|
var import_uuid = require("uuid");
|
|
31
30
|
var import_fs = require("fs");
|
|
32
31
|
var import_path = require("path");
|
|
33
32
|
var import_url = require("url");
|
|
34
33
|
|
|
34
|
+
// src/tools/mcp-registry.ts
|
|
35
|
+
var import_zod5 = require("zod");
|
|
36
|
+
|
|
37
|
+
// src/tools/registry.ts
|
|
38
|
+
var import_zod = require("zod");
|
|
39
|
+
|
|
35
40
|
// src/tools/types.ts
|
|
36
41
|
var MAX_RESPONSE_CHARS = 5e4;
|
|
37
42
|
function mcpJson(data) {
|
|
@@ -55,81 +60,975 @@ function mcpError(prefix, error) {
|
|
|
55
60
|
return { content: [{ type: "text", text: `${prefix}: ${msg}` }] };
|
|
56
61
|
}
|
|
57
62
|
|
|
63
|
+
// src/tools/generated/help.ts
|
|
64
|
+
var helpDirectory = `# Available Endpoints
|
|
65
|
+
|
|
66
|
+
[design-system]
|
|
67
|
+
components Create and manage reusable components and variant sets.
|
|
68
|
+
fonts Search available fonts in Figma.
|
|
69
|
+
instances Create and manage component instances.
|
|
70
|
+
styles CRUD for local paint, text, effect, and grid styles.
|
|
71
|
+
variable_collections CRUD for variable collections \u2014 the document-level API for design tokens.
|
|
72
|
+
variables Search and update design variables within a collection.
|
|
73
|
+
|
|
74
|
+
[connection]
|
|
75
|
+
connection Manage the Figma plugin connection.
|
|
76
|
+
|
|
77
|
+
[document]
|
|
78
|
+
document Navigate and manage Figma pages (canvases) in the document.
|
|
79
|
+
version_history Save named versions to the Figma file's version history.
|
|
80
|
+
|
|
81
|
+
[creation]
|
|
82
|
+
frames Create and manage frames, shapes, auto-layout containers, sections, and SVG nodes.
|
|
83
|
+
text Create and manage text nodes.
|
|
84
|
+
|
|
85
|
+
[quality]
|
|
86
|
+
lint Run design quality and accessibility checks.
|
|
87
|
+
|
|
88
|
+
[interaction]
|
|
89
|
+
prototyping Manage prototype interactions, reactions, and navigation flows.
|
|
90
|
+
|
|
91
|
+
[node-inspection]
|
|
92
|
+
selection Read and set the current Figma selection.
|
|
93
|
+
|
|
94
|
+
Topics:
|
|
95
|
+
missing_tools Why create or edit tools are missing and how to fix it
|
|
96
|
+
|
|
97
|
+
Use help(topic: "<endpoint>") for endpoint details.
|
|
98
|
+
Use help(topic: "<endpoint>.<method>") for method details.`;
|
|
99
|
+
var helpEndpoints = {
|
|
100
|
+
"components": {
|
|
101
|
+
"summary": '# components\nCreate and manage reusable components and variant sets.\n\nMethods:\n clone Duplicate nodes [create]\n audit Run lint on a node \u2014 returns severity-ranked findings [read]\n reparent Move nodes into a new parent [edit]\n list List local component names (variant sets as single entries) [read]\n get Get component detail \u2014 property definitions + ID for instances.create [read]\n create Create components [create]\n update Add, edit, or delete component properties [edit]\n delete Delete components or component sets [edit]\n\n// depth: omit \u2192 id+name stubs | 0 \u2192 props + child stubs | N \u2192 recurse N | -1 \u2192 full tree\n// fields: whitelist e.g. ["fills","opacity"] \u2014 id, name, type always included. Pass ["*"] for all.\n// layoutSizingHorizontal/Vertical: FIXED | HUG | FILL \u2014 how the node sizes within auto-layout.\n// Colors: fillVariableName/strokeVariableName bind by name \u2014 preferred over raw color values.\n// Note: node-based endpoints (frames, text, instances, components) use `results` as the list key.\n// Standalone endpoints (styles, variables, variable_collections) use `items`. Components.list uses `items` (catalog view).\n// ---\n// visible: false hides the node. Omitted from response when true (the default).\n// locked: true prevents editing in Figma UI. Omitted when false (the default).\n// rotation: degrees (0-360). Omitted when 0.\n// blendMode: layer blend mode. Omitted when PASS_THROUGH (the default).\n// layoutPositioning: ABSOLUTE = floating inside auto-layout parent. Omitted when AUTO (the default).\n// minWidth/maxWidth/minHeight/maxHeight: responsive constraints for auto-layout children.\n// constraints: position behavior in non-auto-layout parents. Ignored inside auto-layout frames.\n// bindings: bind design variables to node properties. field uses slash path: "fills/0/color" (first fill), "strokes/0/color", "opacity", "width", "height", "cornerRadius", "paddingLeft", "itemSpacing".\n// explicitMode: pin a variable mode on this node. Use { collectionName, modeName } (preferred) or { collectionId, modeId }.\n// properties: escape hatch \u2014 set any Figma node property directly. Use only when no dedicated field exists.\ninterface Node {\n id: string; name: string; type: string;\n visible?: boolean; // omitted when true\n locked?: boolean; // omitted when false\n opacity?: number; // omitted when 1\n rotation?: number; // omitted when 0\n blendMode?: string; // omitted when PASS_THROUGH\n layoutPositioning?: "AUTO" | "ABSOLUTE";\n layoutSizingHorizontal?: "FIXED" | "HUG" | "FILL";\n layoutSizingVertical?: "FIXED" | "HUG" | "FILL";\n minWidth?: number; maxWidth?: number; minHeight?: number; maxHeight?: number;\n absoluteBoundingBox: { x: number; y: number; width: number; height: number };\n fills?: Paint[]; // solid: {type: "SOLID", color: {r, g, b, a}}\n strokes?: Paint[];\n effects?: Effect[]; // DROP_SHADOW | INNER_SHADOW | LAYER_BLUR | BACKGROUND_BLUR\n children?: NodeStub[]; // stubs: {id, name, type} \u2014 use depth to expand\n}\n// PatchItem uses flat params matching create shape \u2014 no nested sub-objects.\n// Fill/stroke/corner/layout/text params are identical to frames.create and text.create.\n// Unknown keys produce a warning, preventing silent failures.\n// Components are reusable design elements. Instances stay linked to the component and inherit changes.\n// Workflow: create component (with properties) \u2192 add children \u2192 create instances via instances.create.\n// ---\n// A component set (variant set) groups related components as variants (e.g. Button/Primary, Button/Secondary).\n// Property types: BOOLEAN (toggle visibility), TEXT (editable text), INSTANCE_SWAP (swap child instance), VARIANT (variant picker).\n// exposeText: when creating from_node, text children become editable TEXT properties on the component.\n// Auto-bind: TEXT properties auto-bind to text children with matching names (case-insensitive).\n// Example: properties:[{propertyName:"Label", type:"TEXT", defaultValue:"Click"}] binds to a child text node named "Label".\n// text.create accepts componentPropertyName to bind on creation \u2014 walks up ancestors to find the nearest component.\n// For nested text (text inside frames inside a component), componentPropertyName resolves via ancestor walk. Alternatively, pass componentId explicitly.\n// For existing nodes with many text children, prefer components(method:"create", type:"from_node", exposeText:true) \u2014 it auto-discovers, creates TEXT properties, and binds all text nodes in one operation.\n// Property keys: read returns clean names ("Label"), write requires the #suffix ("Label#1:0"). Call components.get(id) to discover exact keys before edit/delete.\n// ComponentItem accepts the same params as FrameItem (layout, fill, stroke, sizing, min/max).\n// A component IS a frame \u2014 create it directly with all layout properties, then add children.\n// SIZING: Components with text need a width constraint \u2014 set width + layoutSizingHorizontal:"FIXED".\n// Without it, text won\'t wrap and the component grows unboundedly.\n// HUG on both axes is only correct for intrinsically-sized elements (buttons, badges, icons).\n// action: "add" (default) \u2014 requires type + defaultValue. "edit" \u2014 pass defaultValue to change value, name to rename property. "delete" \u2014 just propertyName#suffix.\n// action: "rename_variant" \u2014 renames a variant option VALUE (not the property). Pass defaultValue=current option name, name=new option name.\n// For VARIANT properties: "edit" with defaultValue reorders children to set the default variant.\n\nUse components(method: "help", topic: "<method>") for method details.',
|
|
102
|
+
"methods": {
|
|
103
|
+
"clone": "# components.clone\nDuplicate nodes\n\nParams:\n id (string, required) \u2014 Node ID\n parentId (string, optional) \u2014 Parent node ID. Omit to place on current page.\n x (number, optional) \u2014 X position (default: 0)\n y (number, optional) \u2014 Y position (default: 0)\n depth (number, optional) \u2014 Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.",
|
|
104
|
+
"audit": '# components.audit\nRun lint on a node \u2014 returns severity-ranked findings\n\nParams:\n id (string, required) \u2014 Node ID to audit\n rules (string[], optional) \u2014 Rules to check. Default: ["all"]. Categories: "component", "composition", "token", "naming", "wcag".\n maxDepth (number, optional) \u2014 Max tree depth (default: 10)\n maxFindings (number, optional) \u2014 Max findings (default: 50)',
|
|
105
|
+
"reparent": "# components.reparent\nMove nodes into a new parent\n\nParams:\n items (array, required) \u2014 Array of {id, parentId, index?}\n id (string, required)\n parentId (string, required)\n index (number, optional)",
|
|
106
|
+
"list": "# components.list\nList local component names (variant sets as single entries)\n\nParams:\n query (string, optional) \u2014 Name search query (case-insensitive substring match)\n offset (number, optional) \u2014 Skip N items for pagination (default 0)\n limit (number, optional) \u2014 Max items per page (default 100)",
|
|
107
|
+
"get": "# components.get\nGet component detail \u2014 property definitions + ID for instances.create\n\nParams:\n id (string, optional) \u2014 Component or component set ID\n names (string[], optional) \u2014 Batch lookup by name (case-insensitive). Either id or names is required.",
|
|
108
|
+
"create": `# components.create
|
|
109
|
+
Create components
|
|
110
|
+
|
|
111
|
+
Example: components(method:"create", type:"component", items:[{name:"Card", layoutMode:"VERTICAL", padding:"16", itemSpacing:"8", fillVariableName:"bg/surface", children:[{type:"text", text:"Title", componentPropertyName:"Title"}, {type:"text", text:"Description", fontSize:14, componentPropertyName:"Description"}], properties:[{propertyName:"Show Icon", type:"BOOLEAN", defaultValue:true}]}])
|
|
112
|
+
|
|
113
|
+
Discriminant: type (component | from_node | variant_set)
|
|
114
|
+
|
|
115
|
+
## component \u2014 Create component with full frame properties (layout, fill, stroke, sizing). A component IS a frame \u2014 build directly, no need to create a frame first.
|
|
116
|
+
name (string, required) \u2014 Component name
|
|
117
|
+
parentId (string, optional) \u2014 Parent node ID. Omit to place on current page.
|
|
118
|
+
x (number, optional) \u2014 X position (default: 0)
|
|
119
|
+
y (number, optional) \u2014 Y position (default: 0)
|
|
120
|
+
width (number, optional) \u2014 Width in px (omit to shrink-to-content via HUG)
|
|
121
|
+
height (number, optional) \u2014 Height in px (omit to shrink-to-content via HUG)
|
|
122
|
+
rotation (number, optional) \u2014 Rotation in degrees (0-360)
|
|
123
|
+
opacity (string, optional) \u2014 Opacity (0-1) or variable name
|
|
124
|
+
visible (boolean, optional) \u2014 Show/hide (default true)
|
|
125
|
+
locked (boolean, optional) \u2014 Lock/unlock (default false)
|
|
126
|
+
blendMode (PASS_THROUGH | NORMAL | DARKEN | MULTIPLY | LINEAR_BURN | COLOR_BURN | LIGHTEN | SCREEN | LINEAR_DODGE | COLOR_DODGE | OVERLAY | SOFT_LIGHT | HARD_LIGHT | DIFFERENCE | EXCLUSION | HUE | SATURATION | COLOR | LUMINOSITY, optional)
|
|
127
|
+
layoutPositioning (AUTO | ABSOLUTE, optional) \u2014 ABSOLUTE = floating inside auto-layout parent
|
|
128
|
+
fills (array, optional) \u2014 Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills.
|
|
129
|
+
fillColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)
|
|
130
|
+
fillStyleName (string, optional) \u2014 Paint style name for fill
|
|
131
|
+
fillVariableName (string, optional) \u2014 Color variable by name e.g. 'bg/primary'
|
|
132
|
+
strokes (array, optional) \u2014 Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes.
|
|
133
|
+
strokeColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)
|
|
134
|
+
strokeStyleName (string, optional) \u2014 Paint style name for stroke
|
|
135
|
+
strokeVariableName (string, optional) \u2014 Color variable by name for stroke
|
|
136
|
+
strokeWeight (string, optional) \u2014 All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight.
|
|
137
|
+
strokeTopWeight (string, optional)
|
|
138
|
+
strokeBottomWeight (string, optional)
|
|
139
|
+
strokeLeftWeight (string, optional)
|
|
140
|
+
strokeRightWeight (string, optional)
|
|
141
|
+
strokeAlign (INSIDE | OUTSIDE | CENTER, optional) \u2014 Stroke position (default: INSIDE)
|
|
142
|
+
strokesIncludedInLayout (boolean, optional) \u2014 Include stroke width in layout measurements (default: false)
|
|
143
|
+
cornerRadius (string, optional) \u2014 All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.
|
|
144
|
+
topLeftRadius (string, optional)
|
|
145
|
+
topRightRadius (string, optional)
|
|
146
|
+
bottomRightRadius (string, optional)
|
|
147
|
+
bottomLeftRadius (string, optional)
|
|
148
|
+
effectStyleName (string, optional) \u2014 Effect style name (e.g. 'Shadow/Card') for shadows, blurs
|
|
149
|
+
layoutMode (NONE | HORIZONTAL | VERTICAL, optional) \u2014 Layout direction (default: auto \u2014 NONE when width+height set, otherwise inferred from layout props)
|
|
150
|
+
layoutWrap (NO_WRAP | WRAP, optional)
|
|
151
|
+
padding (string, optional) \u2014 All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft.
|
|
152
|
+
paddingTop (string, optional)
|
|
153
|
+
paddingRight (string, optional)
|
|
154
|
+
paddingBottom (string, optional)
|
|
155
|
+
paddingLeft (string, optional)
|
|
156
|
+
primaryAxisAlignItems (MIN | MAX | CENTER | SPACE_BETWEEN, optional)
|
|
157
|
+
counterAxisAlignItems (MIN | MAX | CENTER | BASELINE, optional)
|
|
158
|
+
layoutSizingHorizontal (FIXED | HUG | FILL, optional)
|
|
159
|
+
layoutSizingVertical (FIXED | HUG | FILL, optional)
|
|
160
|
+
itemSpacing (string, optional) \u2014 Spacing between children (number or variable name string, default: 0)
|
|
161
|
+
counterAxisSpacing (string, optional) \u2014 Gap between wrapped rows (requires layoutWrap: WRAP)
|
|
162
|
+
minWidth (number, optional) \u2014 Min width for responsive auto-layout
|
|
163
|
+
maxWidth (number, optional) \u2014 Max width for responsive auto-layout
|
|
164
|
+
minHeight (number, optional) \u2014 Min height for responsive auto-layout
|
|
165
|
+
maxHeight (number, optional) \u2014 Max height for responsive auto-layout
|
|
166
|
+
overflowDirection (NONE | HORIZONTAL | VERTICAL | BOTH, optional) \u2014 Scroll overflow in prototype (default: NONE)
|
|
167
|
+
description (string, optional) \u2014 Component description (shown in Figma's component panel)
|
|
168
|
+
children (array, optional) \u2014 Inline child nodes. Text: {type:"text", text, componentPropertyName?, fontFamily?, fontSize?, fontColor?}. Frame: {type:"frame", name?, layoutMode?, fillColor?, children?}. Instance: {type:"instance", componentId, componentPropertyName?, variantProperties?, properties?}. Component: {type:"component", name, children?}. componentPropertyName auto-creates and binds a TEXT (text) or INSTANCE_SWAP (instance) property.
|
|
169
|
+
properties (array, optional) \u2014 Component properties to define at creation: [{propertyName, type, defaultValue}]. TEXT properties for inline children with componentPropertyName are created automatically.
|
|
170
|
+
propertyName (string, required) \u2014 Property name
|
|
171
|
+
type (BOOLEAN | TEXT | INSTANCE_SWAP, required) \u2014 Property type
|
|
172
|
+
defaultValue (string_or_boolean, required) \u2014 Default value
|
|
173
|
+
preferredValues (array, optional) \u2014 Preferred values for INSTANCE_SWAP
|
|
174
|
+
|
|
175
|
+
## from_node \u2014 Convert existing nodes to components. Text children auto-exposed as editable properties (exposeText: true).
|
|
176
|
+
nodeId (string, required) \u2014 Node ID to convert
|
|
177
|
+
exposeText (boolean, optional) \u2014 Auto-expose text as editable properties (default: true)
|
|
178
|
+
|
|
179
|
+
## variant_set \u2014 Combine components into a variant set. The resulting set is a frame \u2014 accepts all frame properties for layout/styling.
|
|
180
|
+
name (string, optional) \u2014 Node name
|
|
181
|
+
parentId (string, optional) \u2014 Parent node ID. Omit to place on current page.
|
|
182
|
+
x (number, optional) \u2014 X position (default: 0)
|
|
183
|
+
y (number, optional) \u2014 Y position (default: 0)
|
|
184
|
+
width (number, optional) \u2014 Width in px (omit to shrink-to-content via HUG)
|
|
185
|
+
height (number, optional) \u2014 Height in px (omit to shrink-to-content via HUG)
|
|
186
|
+
rotation (number, optional) \u2014 Rotation in degrees (0-360)
|
|
187
|
+
opacity (string, optional) \u2014 Opacity (0-1) or variable name
|
|
188
|
+
visible (boolean, optional) \u2014 Show/hide (default true)
|
|
189
|
+
locked (boolean, optional) \u2014 Lock/unlock (default false)
|
|
190
|
+
blendMode (PASS_THROUGH | NORMAL | DARKEN | MULTIPLY | LINEAR_BURN | COLOR_BURN | LIGHTEN | SCREEN | LINEAR_DODGE | COLOR_DODGE | OVERLAY | SOFT_LIGHT | HARD_LIGHT | DIFFERENCE | EXCLUSION | HUE | SATURATION | COLOR | LUMINOSITY, optional)
|
|
191
|
+
layoutPositioning (AUTO | ABSOLUTE, optional) \u2014 ABSOLUTE = floating inside auto-layout parent
|
|
192
|
+
fills (array, optional) \u2014 Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills.
|
|
193
|
+
fillColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)
|
|
194
|
+
fillStyleName (string, optional) \u2014 Paint style name for fill
|
|
195
|
+
fillVariableName (string, optional) \u2014 Color variable by name e.g. 'bg/primary'
|
|
196
|
+
strokes (array, optional) \u2014 Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes.
|
|
197
|
+
strokeColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)
|
|
198
|
+
strokeStyleName (string, optional) \u2014 Paint style name for stroke
|
|
199
|
+
strokeVariableName (string, optional) \u2014 Color variable by name for stroke
|
|
200
|
+
strokeWeight (string, optional) \u2014 All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight.
|
|
201
|
+
strokeTopWeight (string, optional)
|
|
202
|
+
strokeBottomWeight (string, optional)
|
|
203
|
+
strokeLeftWeight (string, optional)
|
|
204
|
+
strokeRightWeight (string, optional)
|
|
205
|
+
strokeAlign (INSIDE | OUTSIDE | CENTER, optional) \u2014 Stroke position (default: INSIDE)
|
|
206
|
+
strokesIncludedInLayout (boolean, optional) \u2014 Include stroke width in layout measurements (default: false)
|
|
207
|
+
cornerRadius (string, optional) \u2014 All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.
|
|
208
|
+
topLeftRadius (string, optional)
|
|
209
|
+
topRightRadius (string, optional)
|
|
210
|
+
bottomRightRadius (string, optional)
|
|
211
|
+
bottomLeftRadius (string, optional)
|
|
212
|
+
effectStyleName (string, optional) \u2014 Effect style name (e.g. 'Shadow/Card') for shadows, blurs
|
|
213
|
+
layoutMode (NONE | HORIZONTAL | VERTICAL, optional) \u2014 Layout direction (default: auto \u2014 NONE when width+height set, otherwise inferred from layout props)
|
|
214
|
+
layoutWrap (NO_WRAP | WRAP, optional)
|
|
215
|
+
padding (string, optional) \u2014 All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft.
|
|
216
|
+
paddingTop (string, optional)
|
|
217
|
+
paddingRight (string, optional)
|
|
218
|
+
paddingBottom (string, optional)
|
|
219
|
+
paddingLeft (string, optional)
|
|
220
|
+
primaryAxisAlignItems (MIN | MAX | CENTER | SPACE_BETWEEN, optional)
|
|
221
|
+
counterAxisAlignItems (MIN | MAX | CENTER | BASELINE, optional)
|
|
222
|
+
layoutSizingHorizontal (FIXED | HUG | FILL, optional)
|
|
223
|
+
layoutSizingVertical (FIXED | HUG | FILL, optional)
|
|
224
|
+
itemSpacing (string, optional) \u2014 Spacing between children (number or variable name string, default: 0)
|
|
225
|
+
counterAxisSpacing (string, optional) \u2014 Gap between wrapped rows (requires layoutWrap: WRAP)
|
|
226
|
+
minWidth (number, optional) \u2014 Min width for responsive auto-layout
|
|
227
|
+
maxWidth (number, optional) \u2014 Max width for responsive auto-layout
|
|
228
|
+
minHeight (number, optional) \u2014 Min height for responsive auto-layout
|
|
229
|
+
maxHeight (number, optional) \u2014 Max height for responsive auto-layout
|
|
230
|
+
overflowDirection (NONE | HORIZONTAL | VERTICAL | BOTH, optional) \u2014 Scroll overflow in prototype (default: NONE)
|
|
231
|
+
componentIds (string[], optional) \u2014 Existing component IDs to combine (min 2). Alternative to children.
|
|
232
|
+
variantPropertyName (string, optional) \u2014 Rename the auto-generated variant property (default: 'Property 1')
|
|
233
|
+
children (array, optional) \u2014 Inline variant components. Each must be {type:"component", name, children?, ...frame_params}. All variants must share the same child structure. Alternative to componentIds \u2014 do not combine both.`,
|
|
234
|
+
"update": '# components.update\nAdd, edit, or delete component properties\n\nExample: components(method:"update", items:[{id:"1:23", propertyName:"Label", action:"edit", defaultValue:"Click Me"}])\n\nParams:\n items (UpdatePropertyItem[], required) \u2014 Array of {id, propertyName, action?, type?, defaultValue?, name?, preferredValues?}\n id (string, required) \u2014 Component or component set ID\n propertyName (string, required) \u2014 Property name with #suffix for edit/delete (e.g. "Label#1:0"). Call components.get to find exact keys. For add, plain name works.\n action (add | edit | delete | rename_variant, optional) \u2014 "add" (default): requires type + defaultValue. "edit": pass defaultValue to change default, name to rename property. "delete": just propertyName. "rename_variant": pass defaultValue=current option name, name=new option name.\n type (BOOLEAN | TEXT | INSTANCE_SWAP | VARIANT, optional) \u2014 Property type (required for add)\n defaultValue (string_or_boolean, optional) \u2014 Default value (add/edit). For rename_variant: the CURRENT option name to rename\n name (string, optional) \u2014 New name \u2014 for edit: renames the property itself, for rename_variant: the new option value name\n preferredValues (array, optional) \u2014 Preferred values for INSTANCE_SWAP\n depth (number, optional) \u2014 Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.',
|
|
235
|
+
"delete": "# components.delete\nDelete components or component sets\n\nParams:\n id (string, required) \u2014 Component or component set ID"
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
"connection": {
|
|
239
|
+
"summary": '# connection\nManage the Figma plugin connection.\n\nMethods:\n create Join a relay channel (required first step before any other tool) [read]\n get Verify end-to-end connection to Figma [read]\n list Inspect which clients (MCP, plugin) are connected to each channel [read]\n delete Disconnect all clients (MCP server and Figma plugin) from a channel and reset its state [edit]\n\n// Connection manages the WebSocket link between the MCP server and the Figma plugin.\n// Channels are named rooms \u2014 both the MCP server and Figma plugin must join the same channel to communicate.\n// Workflow: connection(method:"create") to join a channel \u2192 connection(method:"get") to verify Figma plugin is connected.\n// If get times out (5s), the Figma plugin is not running or not on the same channel.\n// list shows all active channels and their connected clients. delete factory-resets a channel.\n\nUse connection(method: "help", topic: "<method>") for method details.',
|
|
240
|
+
"methods": {
|
|
241
|
+
"create": "# connection.create\nJoin a relay channel (required first step before any other tool)\n\nParams:\n channel (string, optional) \u2014 The channel name displayed in the Figma plugin panel. Defaults to 'vibma' if omitted.",
|
|
242
|
+
"get": "# connection.get\nVerify end-to-end connection to Figma\n\nNo params.",
|
|
243
|
+
"list": "# connection.list\nInspect which clients (MCP, plugin) are connected to each channel\n\nNo params.",
|
|
244
|
+
"delete": "# connection.delete\nDisconnect all clients (MCP server and Figma plugin) from a channel and reset its state\n\nParams:\n channel (string, optional) \u2014 Channel to reset. Defaults to 'vibma'."
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
"document": {
|
|
248
|
+
"summary": '# document\nNavigate and manage Figma pages (canvases) in the document.\n\nMethods:\n get Get current page with top-level children [read]\n list Get document name and list all pages [read]\n set Switch to a page by ID or name. At least one of pageId or pageName must be provided. [read]\n create Create a new page [create]\n update Rename a page [edit]\n\n// A Figma document contains pages \u2014 each page is an independent canvas with its own node tree.\n// The "current page" is where all node operations happen. Use document.set to switch pages before working with nodes.\n// Page IDs look like "0:1", "1:1", etc. The first page is always "0:1".\n// get returns the current page with its top-level children as stubs. list returns all pages in the document.\n\nUse document(method: "help", topic: "<method>") for method details.',
|
|
249
|
+
"methods": {
|
|
250
|
+
"get": "# document.get\nGet current page with top-level children\n\nNo params.",
|
|
251
|
+
"list": "# document.list\nGet document name and list all pages\n\nNo params.",
|
|
252
|
+
"set": "# document.set\nSwitch to a page by ID or name. At least one of pageId or pageName must be provided.\n\nParams:\n pageId (string, optional) \u2014 Page ID\n pageName (string, optional) \u2014 Page name (case-insensitive, substring match)",
|
|
253
|
+
"create": "# document.create\nCreate a new page\n\nParams:\n name (string, optional) \u2014 Page name (default: 'New Page')",
|
|
254
|
+
"update": "# document.update\nRename a page\n\nParams:\n newName (string, required) \u2014 New page name\n pageId (string, optional) \u2014 Page ID (default: current page)"
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
"fonts": {
|
|
258
|
+
"summary": '# fonts\nSearch available fonts in Figma.\n\nMethods:\n list List available font families, optionally filtered by name [read]\n\n// Returns font family names installed in the Figma environment. Use to verify a fontFamily before text.create or styles.create.\n// query filters by family name substring (case-insensitive), e.g. query:"inter" matches "Inter", "Inter Tight".\n// ---\n// Default response: just family names. Set includeStyles:true to also get available styles per family (e.g. "Regular", "Bold", "Italic").\n// Use fonts.list with query to narrow results before creating text with specific fontFamily + fontStyle.\n\nUse fonts(method: "help", topic: "<method>") for method details.',
|
|
259
|
+
"methods": {
|
|
260
|
+
"list": '# fonts.list\nList available font families, optionally filtered by name\n\nExample: fonts(method:"list", query:"inter")\n\nParams:\n query (string, optional) \u2014 Filter by family name (case-insensitive substring)\n includeStyles (boolean, optional) \u2014 Include available styles per family (default: false)\n offset (number, optional) \u2014 Skip N items for pagination (default 0)\n limit (number, optional) \u2014 Max items per page (default 100)'
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
"frames": {
|
|
264
|
+
"summary": '# frames\nCreate and manage frames, shapes, auto-layout containers, sections, and SVG nodes.\n\nMethods:\n get Get serialized node data [read]\n list Search for nodes (returns stubs only \u2014 use get with depth for full properties) [read]\n update Patch node properties [edit]\n delete Delete nodes [edit]\n clone Duplicate nodes [create]\n audit Run lint on a node \u2014 returns severity-ranked findings [read]\n reparent Move nodes into a new parent [edit]\n create Create frame-like containers [create]\n export Export a node as PNG, JPG, SVG, SVG_STRING, or PDF [read]\n\n// depth: omit \u2192 id+name stubs | 0 \u2192 props + child stubs | N \u2192 recurse N | -1 \u2192 full tree\n// fields: whitelist e.g. ["fills","opacity"] \u2014 id, name, type always included. Pass ["*"] for all.\n// layoutSizingHorizontal/Vertical: FIXED | HUG | FILL \u2014 how the node sizes within auto-layout.\n// Colors: fillVariableName/strokeVariableName bind by name \u2014 preferred over raw color values.\n// Note: node-based endpoints (frames, text, instances, components) use `results` as the list key.\n// Standalone endpoints (styles, variables, variable_collections) use `items`. Components.list uses `items` (catalog view).\n// ---\n// visible: false hides the node. Omitted from response when true (the default).\n// locked: true prevents editing in Figma UI. Omitted when false (the default).\n// rotation: degrees (0-360). Omitted when 0.\n// blendMode: layer blend mode. Omitted when PASS_THROUGH (the default).\n// layoutPositioning: ABSOLUTE = floating inside auto-layout parent. Omitted when AUTO (the default).\n// minWidth/maxWidth/minHeight/maxHeight: responsive constraints for auto-layout children.\n// constraints: position behavior in non-auto-layout parents. Ignored inside auto-layout frames.\n// bindings: bind design variables to node properties. field uses slash path: "fills/0/color" (first fill), "strokes/0/color", "opacity", "width", "height", "cornerRadius", "paddingLeft", "itemSpacing".\n// explicitMode: pin a variable mode on this node. Use { collectionName, modeName } (preferred) or { collectionId, modeId }.\n// properties: escape hatch \u2014 set any Figma node property directly. Use only when no dedicated field exists.\ninterface Node {\n id: string; name: string; type: string;\n visible?: boolean; // omitted when true\n locked?: boolean; // omitted when false\n opacity?: number; // omitted when 1\n rotation?: number; // omitted when 0\n blendMode?: string; // omitted when PASS_THROUGH\n layoutPositioning?: "AUTO" | "ABSOLUTE";\n layoutSizingHorizontal?: "FIXED" | "HUG" | "FILL";\n layoutSizingVertical?: "FIXED" | "HUG" | "FILL";\n minWidth?: number; maxWidth?: number; minHeight?: number; maxHeight?: number;\n absoluteBoundingBox: { x: number; y: number; width: number; height: number };\n fills?: Paint[]; // solid: {type: "SOLID", color: {r, g, b, a}}\n strokes?: Paint[];\n effects?: Effect[]; // DROP_SHADOW | INNER_SHADOW | LAYER_BLUR | BACKGROUND_BLUR\n children?: NodeStub[]; // stubs: {id, name, type} \u2014 use depth to expand\n}\n// PatchItem uses flat params matching create shape \u2014 no nested sub-objects.\n// Fill/stroke/corner/layout/text params are identical to frames.create and text.create.\n// Unknown keys produce a warning, preventing silent failures.\n// Frames are the primary container in Figma. Use auto_layout for responsive containers.\n// Sizing: FIXED = explicit size, HUG = shrink to children, FILL = expand to fill parent.\n// Fill: pass fills:[{type:"SOLID", color:"#hex"}] or [] for transparent. Shorthand: fillColor:"#3B82F6" (auto-binds to matching variable/style).\n// Also: fillVariableName:"bg/primary", fillStyleName:"Surface/Primary".\n// Stroke: pass strokes:[{type:"SOLID", color:"#hex"}] or [] to clear. Shorthand: strokeColor:"#000", strokeVariableName:"border/default".\n// Token fields (cornerRadius, opacity, itemSpacing, padding, strokeWeight): pass number for value, string for variable name/ID.\n// ---\n// SIZING: Always think about both axes. Containers with text need a width constraint \u2014 set width + layoutSizingHorizontal:"FIXED".\n// HUG/HUG is only correct for intrinsically-sized elements (buttons, badges, icons).\n// Smart defaults inside auto-layout parent: cross-axis defaults to FILL, primary axis stays HUG.\n// FILL only works inside an auto-layout parent. Use FIXED for top-level frames.\n// minWidth/maxWidth/minHeight/maxHeight: responsive constraints for auto-layout children.\n// clipsContent: true (default) clips children to the frame bounds. Set false for overflow-visible.\n// Sections are top-level organizers (like artboards) \u2014 they cannot be nested inside frames.\n// Shape primitives: rectangle, ellipse, line \u2014 for decorative/visual elements (not containers).\n// group: wraps existing nodes into a Group. boolean_operation: UNION/SUBTRACT/INTERSECT/EXCLUDE combines shapes.\n// SVG create: pass raw SVG markup string (e.g. "<svg>...</svg>") \u2014 Figma converts it to vector nodes.\n\nUse frames(method: "help", topic: "<method>") for method details.',
|
|
265
|
+
"methods": {
|
|
266
|
+
"get": '# frames.get\nGet serialized node data\n\nParams:\n id (string, required) \u2014 Node ID\n fields (string[], optional) \u2014 Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass ["*"] for all.\n depth (number, optional) \u2014 Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.\n verbose (boolean, optional) \u2014 Include all properties (bounding box, constraints, text style details). Default false \u2014 returns slim, actionable output.',
|
|
267
|
+
"list": '# frames.list\nSearch for nodes (returns stubs only \u2014 use get with depth for full properties)\n\nParams:\n query (string, optional) \u2014 Name search query (case-insensitive substring match)\n types (string[], optional) \u2014 Filter by node types (e.g. ["FRAME", "TEXT"])\n parentId (string, optional) \u2014 Search only within this subtree\n fields (string[], optional) \u2014 Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass ["*"] for all.\n offset (number, optional) \u2014 Skip N items for pagination (default 0)\n limit (number, optional) \u2014 Max items per page (default 100)',
|
|
268
|
+
"update": `# frames.update
|
|
269
|
+
Patch node properties
|
|
270
|
+
|
|
271
|
+
Params:
|
|
272
|
+
items (PatchItem[], required) \u2014 Array of {id, ...properties} to patch
|
|
273
|
+
fills (array, optional) \u2014 Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills.
|
|
274
|
+
fillColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)
|
|
275
|
+
fillStyleName (string, optional) \u2014 Paint style name for fill
|
|
276
|
+
fillVariableName (string, optional) \u2014 Color variable by name e.g. 'bg/primary'
|
|
277
|
+
strokes (array, optional) \u2014 Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes.
|
|
278
|
+
strokeColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)
|
|
279
|
+
strokeStyleName (string, optional) \u2014 Paint style name for stroke
|
|
280
|
+
strokeVariableName (string, optional) \u2014 Color variable by name for stroke
|
|
281
|
+
strokeWeight (string, optional) \u2014 All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight.
|
|
282
|
+
strokeTopWeight (string, optional)
|
|
283
|
+
strokeBottomWeight (string, optional)
|
|
284
|
+
strokeLeftWeight (string, optional)
|
|
285
|
+
strokeRightWeight (string, optional)
|
|
286
|
+
strokeAlign (INSIDE | OUTSIDE | CENTER, optional) \u2014 Stroke position (default: INSIDE)
|
|
287
|
+
strokesIncludedInLayout (boolean, optional) \u2014 Include stroke width in layout measurements (default: false)
|
|
288
|
+
cornerRadius (string, optional) \u2014 All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.
|
|
289
|
+
topLeftRadius (string, optional)
|
|
290
|
+
topRightRadius (string, optional)
|
|
291
|
+
bottomRightRadius (string, optional)
|
|
292
|
+
bottomLeftRadius (string, optional)
|
|
293
|
+
opacity (string, optional) \u2014 Opacity (0-1) or variable name
|
|
294
|
+
visible (boolean, optional) \u2014 Show/hide (default true)
|
|
295
|
+
locked (boolean, optional) \u2014 Lock/unlock (default false)
|
|
296
|
+
blendMode (PASS_THROUGH | NORMAL | DARKEN | MULTIPLY | LINEAR_BURN | COLOR_BURN | LIGHTEN | SCREEN | LINEAR_DODGE | COLOR_DODGE | OVERLAY | SOFT_LIGHT | HARD_LIGHT | DIFFERENCE | EXCLUSION | HUE | SATURATION | COLOR | LUMINOSITY, optional)
|
|
297
|
+
effectStyleName (string, optional) \u2014 Effect style name (e.g. 'Shadow/Card') for shadows, blurs
|
|
298
|
+
layoutMode (NONE | HORIZONTAL | VERTICAL, optional) \u2014 Layout direction (default: NONE)
|
|
299
|
+
layoutWrap (NO_WRAP | WRAP, optional)
|
|
300
|
+
padding (string, optional) \u2014 All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft.
|
|
301
|
+
paddingTop (string, optional)
|
|
302
|
+
paddingRight (string, optional)
|
|
303
|
+
paddingBottom (string, optional)
|
|
304
|
+
paddingLeft (string, optional)
|
|
305
|
+
primaryAxisAlignItems (MIN | MAX | CENTER | SPACE_BETWEEN, optional)
|
|
306
|
+
counterAxisAlignItems (MIN | MAX | CENTER | BASELINE, optional)
|
|
307
|
+
itemSpacing (string, optional) \u2014 Spacing between children (number or variable name string, default: 0)
|
|
308
|
+
counterAxisSpacing (string, optional) \u2014 Gap between wrapped rows (requires layoutWrap: WRAP)
|
|
309
|
+
layoutSizingHorizontal (FIXED | HUG | FILL, optional)
|
|
310
|
+
layoutSizingVertical (FIXED | HUG | FILL, optional)
|
|
311
|
+
layoutPositioning (AUTO | ABSOLUTE, optional) \u2014 ABSOLUTE = floating inside auto-layout parent
|
|
312
|
+
minWidth (number, optional) \u2014 Min width for responsive auto-layout
|
|
313
|
+
maxWidth (number, optional) \u2014 Max width for responsive auto-layout
|
|
314
|
+
minHeight (number, optional) \u2014 Min height for responsive auto-layout
|
|
315
|
+
maxHeight (number, optional) \u2014 Max height for responsive auto-layout
|
|
316
|
+
fontSize (number, optional) \u2014 Font size
|
|
317
|
+
fontFamily (string, optional) \u2014 Font family
|
|
318
|
+
fontStyle (string, optional) \u2014 Font variant e.g. "Bold", "Italic" \u2014 overrides fontWeight
|
|
319
|
+
fontWeight (number, optional) \u2014 100-900. Ignored when fontStyle is set.
|
|
320
|
+
fontColor (Color, optional) \u2014 Shorthand \u2014 sets text color (auto-binds to matching variable/style)
|
|
321
|
+
fontColorVariableName (string, optional) \u2014 Bind color variable by name e.g. 'text/primary'
|
|
322
|
+
fontColorStyleName (string, optional) \u2014 Apply paint style \u2014 overrides fontColor
|
|
323
|
+
textStyleId (string, optional) \u2014 Apply text style by ID \u2014 overrides fontSize/fontWeight
|
|
324
|
+
textStyleName (string, optional) \u2014 Text style by name (case-insensitive)
|
|
325
|
+
textAlignHorizontal (LEFT | CENTER | RIGHT | JUSTIFIED, optional)
|
|
326
|
+
textAlignVertical (TOP | CENTER | BOTTOM, optional)
|
|
327
|
+
textAutoResize (NONE | WIDTH_AND_HEIGHT | HEIGHT | TRUNCATE, optional)
|
|
328
|
+
id (string, required)
|
|
329
|
+
name (string, optional) \u2014 Rename node
|
|
330
|
+
rotation (number, optional) \u2014 Degrees (0-360)
|
|
331
|
+
x (number, optional)
|
|
332
|
+
y (number, optional)
|
|
333
|
+
width (number, optional)
|
|
334
|
+
height (number, optional)
|
|
335
|
+
clearFill (boolean, optional) \u2014 Remove all fills
|
|
336
|
+
effects (array, optional) \u2014 Effect array (DROP_SHADOW, INNER_SHADOW, LAYER_BLUR, BACKGROUND_BLUR)
|
|
337
|
+
overflowDirection (NONE | HORIZONTAL | VERTICAL | BOTH, optional) \u2014 Scroll overflow in prototype (default: NONE)
|
|
338
|
+
constraints (object, optional)
|
|
339
|
+
bindings (array, optional) \u2014 Bind variables to properties. field path examples: 'fills/0/color', 'strokes/0/color', 'opacity', 'width', 'cornerRadius', 'itemSpacing'.
|
|
340
|
+
field (string, required)
|
|
341
|
+
variableName (string, optional)
|
|
342
|
+
variableId (string, optional)
|
|
343
|
+
explicitMode (object, optional) \u2014 Pin variable mode \u2014 use { collectionName, modeName } (preferred) or { collectionId, modeId }
|
|
344
|
+
exportSettings (array, optional) \u2014 Export settings
|
|
345
|
+
properties (object, optional) \u2014 Direct Figma API props (escape hatch)`,
|
|
346
|
+
"delete": "# frames.delete\nDelete nodes\n\nParams:\n id (string, optional) \u2014 Single node ID\n items (array, optional) \u2014 Batch: [{id}, ...]\n id (string, optional)",
|
|
347
|
+
"clone": "# frames.clone\nDuplicate nodes\n\nParams:\n id (string, required) \u2014 Node ID\n parentId (string, optional) \u2014 Parent node ID. Omit to place on current page.\n x (number, optional) \u2014 X position (default: 0)\n y (number, optional) \u2014 Y position (default: 0)\n depth (number, optional) \u2014 Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.",
|
|
348
|
+
"audit": '# frames.audit\nRun lint on a node \u2014 returns severity-ranked findings\n\nParams:\n id (string, required) \u2014 Node ID to audit\n rules (string[], optional) \u2014 Rules to check. Default: ["all"]. Categories: "component", "composition", "token", "naming", "wcag".\n maxDepth (number, optional) \u2014 Max tree depth (default: 10)\n maxFindings (number, optional) \u2014 Max findings (default: 50)',
|
|
349
|
+
"reparent": "# frames.reparent\nMove nodes into a new parent\n\nParams:\n items (array, required) \u2014 Array of {id, parentId, index?}\n id (string, required)\n parentId (string, required)\n index (number, optional)",
|
|
350
|
+
"create": `# frames.create
|
|
351
|
+
Create frame-like containers
|
|
352
|
+
|
|
353
|
+
Example: frames(method:"create", type:"auto_layout", layoutMode:"VERTICAL", itemSpacing:16, padding:24)
|
|
354
|
+
|
|
355
|
+
Discriminant: type (frame | auto_layout | section | rectangle | ellipse | line | group | boolean_operation | svg)
|
|
356
|
+
|
|
357
|
+
## frame \u2014 General-purpose frame \u2014 shrinks to content by default, static when width+height given
|
|
358
|
+
name (string, optional) \u2014 Node name
|
|
359
|
+
parentId (string, optional) \u2014 Parent node ID. Omit to place on current page.
|
|
360
|
+
x (number, optional) \u2014 X position (default: 0)
|
|
361
|
+
y (number, optional) \u2014 Y position (default: 0)
|
|
362
|
+
width (number, optional) \u2014 Width in px (omit to shrink-to-content via HUG)
|
|
363
|
+
height (number, optional) \u2014 Height in px (omit to shrink-to-content via HUG)
|
|
364
|
+
rotation (number, optional) \u2014 Rotation in degrees (0-360)
|
|
365
|
+
opacity (string, optional) \u2014 Opacity (0-1) or variable name
|
|
366
|
+
visible (boolean, optional) \u2014 Show/hide (default true)
|
|
367
|
+
locked (boolean, optional) \u2014 Lock/unlock (default false)
|
|
368
|
+
blendMode (PASS_THROUGH | NORMAL | DARKEN | MULTIPLY | LINEAR_BURN | COLOR_BURN | LIGHTEN | SCREEN | LINEAR_DODGE | COLOR_DODGE | OVERLAY | SOFT_LIGHT | HARD_LIGHT | DIFFERENCE | EXCLUSION | HUE | SATURATION | COLOR | LUMINOSITY, optional)
|
|
369
|
+
layoutPositioning (AUTO | ABSOLUTE, optional) \u2014 ABSOLUTE = floating inside auto-layout parent
|
|
370
|
+
fills (array, optional) \u2014 Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills.
|
|
371
|
+
fillColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)
|
|
372
|
+
fillStyleName (string, optional) \u2014 Paint style name for fill
|
|
373
|
+
fillVariableName (string, optional) \u2014 Color variable by name e.g. 'bg/primary'
|
|
374
|
+
strokes (array, optional) \u2014 Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes.
|
|
375
|
+
strokeColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)
|
|
376
|
+
strokeStyleName (string, optional) \u2014 Paint style name for stroke
|
|
377
|
+
strokeVariableName (string, optional) \u2014 Color variable by name for stroke
|
|
378
|
+
strokeWeight (string, optional) \u2014 All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight.
|
|
379
|
+
strokeTopWeight (string, optional)
|
|
380
|
+
strokeBottomWeight (string, optional)
|
|
381
|
+
strokeLeftWeight (string, optional)
|
|
382
|
+
strokeRightWeight (string, optional)
|
|
383
|
+
strokeAlign (INSIDE | OUTSIDE | CENTER, optional) \u2014 Stroke position (default: INSIDE)
|
|
384
|
+
strokesIncludedInLayout (boolean, optional) \u2014 Include stroke width in layout measurements (default: false)
|
|
385
|
+
cornerRadius (string, optional) \u2014 All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.
|
|
386
|
+
topLeftRadius (string, optional)
|
|
387
|
+
topRightRadius (string, optional)
|
|
388
|
+
bottomRightRadius (string, optional)
|
|
389
|
+
bottomLeftRadius (string, optional)
|
|
390
|
+
effectStyleName (string, optional) \u2014 Effect style name (e.g. 'Shadow/Card') for shadows, blurs
|
|
391
|
+
layoutMode (NONE | HORIZONTAL | VERTICAL, optional) \u2014 Layout direction (default: auto \u2014 NONE when width+height set, otherwise inferred from layout props)
|
|
392
|
+
layoutWrap (NO_WRAP | WRAP, optional)
|
|
393
|
+
padding (string, optional) \u2014 All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft.
|
|
394
|
+
paddingTop (string, optional)
|
|
395
|
+
paddingRight (string, optional)
|
|
396
|
+
paddingBottom (string, optional)
|
|
397
|
+
paddingLeft (string, optional)
|
|
398
|
+
primaryAxisAlignItems (MIN | MAX | CENTER | SPACE_BETWEEN, optional)
|
|
399
|
+
counterAxisAlignItems (MIN | MAX | CENTER | BASELINE, optional)
|
|
400
|
+
layoutSizingHorizontal (FIXED | HUG | FILL, optional)
|
|
401
|
+
layoutSizingVertical (FIXED | HUG | FILL, optional)
|
|
402
|
+
itemSpacing (string, optional) \u2014 Spacing between children (number or variable name string, default: 0)
|
|
403
|
+
counterAxisSpacing (string, optional) \u2014 Gap between wrapped rows (requires layoutWrap: WRAP)
|
|
404
|
+
minWidth (number, optional) \u2014 Min width for responsive auto-layout
|
|
405
|
+
maxWidth (number, optional) \u2014 Max width for responsive auto-layout
|
|
406
|
+
minHeight (number, optional) \u2014 Min height for responsive auto-layout
|
|
407
|
+
maxHeight (number, optional) \u2014 Max height for responsive auto-layout
|
|
408
|
+
overflowDirection (NONE | HORIZONTAL | VERTICAL | BOTH, optional) \u2014 Scroll overflow in prototype (default: NONE)
|
|
409
|
+
clipsContent (boolean, optional)
|
|
410
|
+
children (array, optional) \u2014 Inline child nodes. Text: {type:"text", text, fontFamily?, fontSize?, fontColor?}. Frame: {type:"frame", name?, layoutMode?, fillColor?, children?}. Instance: {type:"instance", componentId, variantProperties?, properties?}. Component: {type:"component", name, children?}. Inside components: add componentPropertyName to auto-bind TEXT or INSTANCE_SWAP properties.
|
|
411
|
+
|
|
412
|
+
## auto_layout \u2014 Auto-layout frame that arranges children automatically
|
|
413
|
+
name (string, optional) \u2014 Node name
|
|
414
|
+
parentId (string, optional) \u2014 Parent node ID. Omit to place on current page.
|
|
415
|
+
x (number, optional) \u2014 X position (default: 0)
|
|
416
|
+
y (number, optional) \u2014 Y position (default: 0)
|
|
417
|
+
width (number, optional) \u2014 Width in px (omit to shrink-to-content via HUG)
|
|
418
|
+
height (number, optional) \u2014 Height in px (omit to shrink-to-content via HUG)
|
|
419
|
+
rotation (number, optional) \u2014 Rotation in degrees (0-360)
|
|
420
|
+
opacity (string, optional) \u2014 Opacity (0-1) or variable name
|
|
421
|
+
visible (boolean, optional) \u2014 Show/hide (default true)
|
|
422
|
+
locked (boolean, optional) \u2014 Lock/unlock (default false)
|
|
423
|
+
blendMode (PASS_THROUGH | NORMAL | DARKEN | MULTIPLY | LINEAR_BURN | COLOR_BURN | LIGHTEN | SCREEN | LINEAR_DODGE | COLOR_DODGE | OVERLAY | SOFT_LIGHT | HARD_LIGHT | DIFFERENCE | EXCLUSION | HUE | SATURATION | COLOR | LUMINOSITY, optional)
|
|
424
|
+
layoutPositioning (AUTO | ABSOLUTE, optional) \u2014 ABSOLUTE = floating inside auto-layout parent
|
|
425
|
+
fills (array, optional) \u2014 Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills.
|
|
426
|
+
fillColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)
|
|
427
|
+
fillStyleName (string, optional) \u2014 Paint style name for fill
|
|
428
|
+
fillVariableName (string, optional) \u2014 Color variable by name e.g. 'bg/primary'
|
|
429
|
+
strokes (array, optional) \u2014 Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes.
|
|
430
|
+
strokeColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)
|
|
431
|
+
strokeStyleName (string, optional) \u2014 Paint style name for stroke
|
|
432
|
+
strokeVariableName (string, optional) \u2014 Color variable by name for stroke
|
|
433
|
+
strokeWeight (string, optional) \u2014 All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight.
|
|
434
|
+
strokeTopWeight (string, optional)
|
|
435
|
+
strokeBottomWeight (string, optional)
|
|
436
|
+
strokeLeftWeight (string, optional)
|
|
437
|
+
strokeRightWeight (string, optional)
|
|
438
|
+
strokeAlign (INSIDE | OUTSIDE | CENTER, optional) \u2014 Stroke position (default: INSIDE)
|
|
439
|
+
strokesIncludedInLayout (boolean, optional) \u2014 Include stroke width in layout measurements (default: false)
|
|
440
|
+
cornerRadius (string, optional) \u2014 All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.
|
|
441
|
+
topLeftRadius (string, optional)
|
|
442
|
+
topRightRadius (string, optional)
|
|
443
|
+
bottomRightRadius (string, optional)
|
|
444
|
+
bottomLeftRadius (string, optional)
|
|
445
|
+
effectStyleName (string, optional) \u2014 Effect style name (e.g. 'Shadow/Card') for shadows, blurs
|
|
446
|
+
layoutMode (HORIZONTAL | VERTICAL, required) \u2014 Primary axis direction
|
|
447
|
+
layoutWrap (NO_WRAP | WRAP, optional)
|
|
448
|
+
padding (string, optional) \u2014 All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft.
|
|
449
|
+
paddingTop (string, optional)
|
|
450
|
+
paddingRight (string, optional)
|
|
451
|
+
paddingBottom (string, optional)
|
|
452
|
+
paddingLeft (string, optional)
|
|
453
|
+
primaryAxisAlignItems (MIN | MAX | CENTER | SPACE_BETWEEN, optional)
|
|
454
|
+
counterAxisAlignItems (MIN | MAX | CENTER | BASELINE, optional)
|
|
455
|
+
layoutSizingHorizontal (FIXED | HUG | FILL, optional)
|
|
456
|
+
layoutSizingVertical (FIXED | HUG | FILL, optional)
|
|
457
|
+
itemSpacing (string, optional) \u2014 Spacing between children (number or variable name string, default: 0)
|
|
458
|
+
counterAxisSpacing (string, optional) \u2014 Gap between wrapped rows (requires layoutWrap: WRAP)
|
|
459
|
+
minWidth (number, optional) \u2014 Min width for responsive auto-layout
|
|
460
|
+
maxWidth (number, optional) \u2014 Max width for responsive auto-layout
|
|
461
|
+
minHeight (number, optional) \u2014 Min height for responsive auto-layout
|
|
462
|
+
maxHeight (number, optional) \u2014 Max height for responsive auto-layout
|
|
463
|
+
overflowDirection (NONE | HORIZONTAL | VERTICAL | BOTH, optional) \u2014 Scroll overflow in prototype (default: NONE)
|
|
464
|
+
clipsContent (boolean, optional)
|
|
465
|
+
nodeIds (string[], optional) \u2014 Existing node IDs to wrap into auto-layout
|
|
466
|
+
children (array, optional) \u2014 Inline child nodes. Text: {type:"text", text, fontFamily?, fontSize?, fontColor?}. Frame: {type:"frame", name?, layoutMode?, fillColor?, children?}. Instance: {type:"instance", componentId, variantProperties?, properties?}. Component: {type:"component", name, children?}. Inside components: add componentPropertyName to auto-bind TEXT or INSTANCE_SWAP properties.
|
|
467
|
+
|
|
468
|
+
## section \u2014 Figma section (top-level organizer)
|
|
469
|
+
name (string, required) \u2014 Section name
|
|
470
|
+
parentId (string, optional) \u2014 Parent node ID. Omit to place on current page.
|
|
471
|
+
x (number, optional) \u2014 X position (default: 0)
|
|
472
|
+
y (number, optional) \u2014 Y position (default: 0)
|
|
473
|
+
width (number, optional) \u2014 Width (default: 500)
|
|
474
|
+
height (number, optional) \u2014 Height (default: 500)
|
|
475
|
+
fills (array, optional) \u2014 Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent
|
|
476
|
+
fillColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)
|
|
477
|
+
fillStyleName (string, optional) \u2014 Paint style name for fill
|
|
478
|
+
fillVariableName (string, optional) \u2014 Color variable by name e.g. 'bg/primary'
|
|
479
|
+
|
|
480
|
+
## rectangle \u2014 Rectangle shape node
|
|
481
|
+
name (string, optional) \u2014 Layer name (default: 'Rectangle')
|
|
482
|
+
parentId (string, optional) \u2014 Parent node ID. Omit to place on current page.
|
|
483
|
+
x (number, optional) \u2014 X position (default: 0)
|
|
484
|
+
y (number, optional) \u2014 Y position (default: 0)
|
|
485
|
+
width (number, optional) \u2014 Width in px (default: 100)
|
|
486
|
+
height (number, optional) \u2014 Height in px (default: 100)
|
|
487
|
+
fills (array, optional) \u2014 Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent
|
|
488
|
+
fillColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)
|
|
489
|
+
fillStyleName (string, optional) \u2014 Paint style name for fill
|
|
490
|
+
fillVariableName (string, optional) \u2014 Color variable by name e.g. 'bg/primary'
|
|
491
|
+
strokes (array, optional) \u2014 Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear
|
|
492
|
+
strokeColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)
|
|
493
|
+
strokeVariableName (string, optional) \u2014 Color variable by name for stroke
|
|
494
|
+
strokeWeight (string, optional)
|
|
495
|
+
cornerRadius (string, optional) \u2014 All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.
|
|
496
|
+
topLeftRadius (string, optional)
|
|
497
|
+
topRightRadius (string, optional)
|
|
498
|
+
bottomRightRadius (string, optional)
|
|
499
|
+
bottomLeftRadius (string, optional)
|
|
500
|
+
opacity (string, optional)
|
|
501
|
+
layoutSizingHorizontal (FIXED | FILL, optional) \u2014 Horizontal sizing in auto-layout parent
|
|
502
|
+
layoutSizingVertical (FIXED | FILL, optional) \u2014 Vertical sizing in auto-layout parent
|
|
503
|
+
|
|
504
|
+
## ellipse \u2014 Ellipse/circle shape node
|
|
505
|
+
name (string, optional) \u2014 Layer name (default: 'Ellipse')
|
|
506
|
+
parentId (string, optional) \u2014 Parent node ID. Omit to place on current page.
|
|
507
|
+
x (number, optional) \u2014 X position (default: 0)
|
|
508
|
+
y (number, optional) \u2014 Y position (default: 0)
|
|
509
|
+
width (number, optional) \u2014 Width in px (default: 100)
|
|
510
|
+
height (number, optional) \u2014 Height in px (default: 100, same as width for circle)
|
|
511
|
+
fills (array, optional) \u2014 Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent
|
|
512
|
+
fillColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)
|
|
513
|
+
fillStyleName (string, optional) \u2014 Paint style name for fill
|
|
514
|
+
fillVariableName (string, optional) \u2014 Color variable by name e.g. 'bg/primary'
|
|
515
|
+
strokes (array, optional) \u2014 Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear
|
|
516
|
+
strokeColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)
|
|
517
|
+
strokeVariableName (string, optional) \u2014 Color variable by name for stroke
|
|
518
|
+
strokeWeight (string, optional)
|
|
519
|
+
opacity (string, optional)
|
|
520
|
+
layoutSizingHorizontal (FIXED | FILL, optional) \u2014 Horizontal sizing in auto-layout parent
|
|
521
|
+
layoutSizingVertical (FIXED | FILL, optional) \u2014 Vertical sizing in auto-layout parent
|
|
522
|
+
|
|
523
|
+
## line \u2014 Line shape node
|
|
524
|
+
name (string, optional) \u2014 Layer name (default: 'Line')
|
|
525
|
+
parentId (string, optional) \u2014 Parent node ID. Omit to place on current page.
|
|
526
|
+
x (number, optional) \u2014 X position (default: 0)
|
|
527
|
+
y (number, optional) \u2014 Y position (default: 0)
|
|
528
|
+
length (number, optional) \u2014 Line length in px (default: 100)
|
|
529
|
+
rotation (number, optional) \u2014 Rotation in degrees (default: 0 = horizontal)
|
|
530
|
+
strokes (array, optional) \u2014 Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear
|
|
531
|
+
strokeColor (Color, optional) \u2014 Line color (default: black, auto-binds to matching variable/style)
|
|
532
|
+
strokeVariableName (string, optional) \u2014 Color variable by name for stroke
|
|
533
|
+
strokeWeight (string, optional) \u2014 Line thickness (default: 1)
|
|
534
|
+
opacity (string, optional)
|
|
535
|
+
layoutSizingHorizontal (FIXED | FILL, optional) \u2014 Horizontal sizing in auto-layout parent (defaults to FILL in vertical auto-layout)
|
|
536
|
+
|
|
537
|
+
## group \u2014 Group existing nodes together
|
|
538
|
+
nodeIds (string[], required) \u2014 Node IDs to group (min 1)
|
|
539
|
+
name (string, optional) \u2014 Group name
|
|
540
|
+
parentId (string, optional) \u2014 Parent node ID. Omit to place on current page.
|
|
541
|
+
|
|
542
|
+
## boolean_operation \u2014 Combine shapes with boolean operations (union, subtract, intersect, exclude)
|
|
543
|
+
operation (UNION | SUBTRACT | INTERSECT | EXCLUDE, required) \u2014 Boolean operation type
|
|
544
|
+
nodeIds (string[], required) \u2014 Node IDs to combine (min 2, first node is the base for SUBTRACT)
|
|
545
|
+
name (string, optional) \u2014 Result node name
|
|
546
|
+
parentId (string, optional) \u2014 Parent node ID. Omit to place on current page.
|
|
547
|
+
|
|
548
|
+
## svg \u2014 Create node from SVG markup
|
|
549
|
+
svg (string, required) \u2014 SVG markup string
|
|
550
|
+
name (string, optional) \u2014 Layer name (default: 'SVG')
|
|
551
|
+
parentId (string, optional) \u2014 Parent node ID. Omit to place on current page.
|
|
552
|
+
x (number, optional) \u2014 X position (default: 0)
|
|
553
|
+
y (number, optional) \u2014 Y position (default: 0)
|
|
554
|
+
fillStyleName (string, optional) \u2014 Paint style to apply to vector fills
|
|
555
|
+
fillVariableName (string, optional) \u2014 Color variable by name for vector fills
|
|
556
|
+
strokeStyleName (string, optional) \u2014 Paint style to apply to vector strokes
|
|
557
|
+
strokeVariableName (string, optional) \u2014 Color variable by name for vector strokes`,
|
|
558
|
+
"export": "# frames.export\nExport a node as PNG, JPG, SVG, SVG_STRING, or PDF\n\nParams:\n id (string, required) \u2014 Node ID to export\n format (PNG | JPG | SVG | SVG_STRING | PDF, optional) \u2014 Export format (default: PNG). SVG_STRING returns raw SVG text.\n scale (number, optional) \u2014 Export scale (default: 1, only for PNG/JPG)"
|
|
559
|
+
}
|
|
560
|
+
},
|
|
561
|
+
"instances": {
|
|
562
|
+
"summary": '# instances\nCreate and manage component instances.\n\nMethods:\n list Search for nodes (returns stubs only \u2014 use get with depth for full properties) [read]\n delete Delete nodes [edit]\n clone Duplicate nodes [create]\n audit Run lint on a node \u2014 returns severity-ranked findings [read]\n reparent Move nodes into a new parent [edit]\n get Get instance detail with component properties and overrides [read]\n create Create component instances [create]\n update Set instance properties [edit]\n swap Swap instance component (preserves overrides) [edit]\n detach Detach instances from their component (converts to frame) [edit]\n reset_overrides Reset all overrides on instances to match their main component [edit]\n\n// depth: omit \u2192 id+name stubs | 0 \u2192 props + child stubs | N \u2192 recurse N | -1 \u2192 full tree\n// fields: whitelist e.g. ["fills","opacity"] \u2014 id, name, type always included. Pass ["*"] for all.\n// layoutSizingHorizontal/Vertical: FIXED | HUG | FILL \u2014 how the node sizes within auto-layout.\n// Colors: fillVariableName/strokeVariableName bind by name \u2014 preferred over raw color values.\n// Note: node-based endpoints (frames, text, instances, components) use `results` as the list key.\n// Standalone endpoints (styles, variables, variable_collections) use `items`. Components.list uses `items` (catalog view).\n// ---\n// visible: false hides the node. Omitted from response when true (the default).\n// locked: true prevents editing in Figma UI. Omitted when false (the default).\n// rotation: degrees (0-360). Omitted when 0.\n// blendMode: layer blend mode. Omitted when PASS_THROUGH (the default).\n// layoutPositioning: ABSOLUTE = floating inside auto-layout parent. Omitted when AUTO (the default).\n// minWidth/maxWidth/minHeight/maxHeight: responsive constraints for auto-layout children.\n// constraints: position behavior in non-auto-layout parents. Ignored inside auto-layout frames.\n// bindings: bind design variables to node properties. field uses slash path: "fills/0/color" (first fill), "strokes/0/color", "opacity", "width", "height", "cornerRadius", "paddingLeft", "itemSpacing".\n// explicitMode: pin a variable mode on this node. Use { collectionName, modeName } (preferred) or { collectionId, modeId }.\n// properties: escape hatch \u2014 set any Figma node property directly. Use only when no dedicated field exists.\ninterface Node {\n id: string; name: string; type: string;\n visible?: boolean; // omitted when true\n locked?: boolean; // omitted when false\n opacity?: number; // omitted when 1\n rotation?: number; // omitted when 0\n blendMode?: string; // omitted when PASS_THROUGH\n layoutPositioning?: "AUTO" | "ABSOLUTE";\n layoutSizingHorizontal?: "FIXED" | "HUG" | "FILL";\n layoutSizingVertical?: "FIXED" | "HUG" | "FILL";\n minWidth?: number; maxWidth?: number; minHeight?: number; maxHeight?: number;\n absoluteBoundingBox: { x: number; y: number; width: number; height: number };\n fills?: Paint[]; // solid: {type: "SOLID", color: {r, g, b, a}}\n strokes?: Paint[];\n effects?: Effect[]; // DROP_SHADOW | INNER_SHADOW | LAYER_BLUR | BACKGROUND_BLUR\n children?: NodeStub[]; // stubs: {id, name, type} \u2014 use depth to expand\n}\n// PatchItem uses flat params matching create shape \u2014 no nested sub-objects.\n// Fill/stroke/corner/layout/text params are identical to frames.create and text.create.\n// Unknown keys produce a warning, preventing silent failures.\n// Instances are linked copies of components. Changes to the component propagate to all instances.\n// Overrides: instance-level changes (text, fills, visibility) that differ from the component. Shown in overrides array.\n// variantProperties: when creating from a component set, pick which variant e.g. {"Style":"Secondary","Size":"Large"}.\n// ---\n// Property keys: read returns clean names ("Label"), write requires the #suffix ("Label#1:0"). Call instances.get(id) to discover exact keys before update.\n// swap: change which component an instance points to while preserving compatible overrides.\n// detach: permanently converts an instance to a regular frame, breaking the component link.\n// reset_overrides: reverts all instance overrides to match the main component.\n// Workflow: components.list \u2192 instances.create with componentId + properties (one call). No separate update needed for text/boolean overrides.\n// Instances support frame-level overrides: layoutSizingHorizontal/Vertical (FIXED, FILL, HUG), opacity, width/height, min/max.\n// Use layoutSizingHorizontal: "FILL" to make instances stretch in auto-layout parents.\n\nUse instances(method: "help", topic: "<method>") for method details.',
|
|
563
|
+
"methods": {
|
|
564
|
+
"list": '# instances.list\nSearch for nodes (returns stubs only \u2014 use get with depth for full properties)\n\nParams:\n query (string, optional) \u2014 Name search query (case-insensitive substring match)\n types (string[], optional) \u2014 Filter by node types (e.g. ["FRAME", "TEXT"])\n parentId (string, optional) \u2014 Search only within this subtree\n fields (string[], optional) \u2014 Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass ["*"] for all.\n offset (number, optional) \u2014 Skip N items for pagination (default 0)\n limit (number, optional) \u2014 Max items per page (default 100)',
|
|
565
|
+
"delete": "# instances.delete\nDelete nodes\n\nParams:\n id (string, optional) \u2014 Single node ID\n items (array, optional) \u2014 Batch: [{id}, ...]\n id (string, optional)",
|
|
566
|
+
"clone": "# instances.clone\nDuplicate nodes\n\nParams:\n id (string, required) \u2014 Node ID\n parentId (string, optional) \u2014 Parent node ID. Omit to place on current page.\n x (number, optional) \u2014 X position (default: 0)\n y (number, optional) \u2014 Y position (default: 0)\n depth (number, optional) \u2014 Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.",
|
|
567
|
+
"audit": '# instances.audit\nRun lint on a node \u2014 returns severity-ranked findings\n\nParams:\n id (string, required) \u2014 Node ID to audit\n rules (string[], optional) \u2014 Rules to check. Default: ["all"]. Categories: "component", "composition", "token", "naming", "wcag".\n maxDepth (number, optional) \u2014 Max tree depth (default: 10)\n maxFindings (number, optional) \u2014 Max findings (default: 50)',
|
|
568
|
+
"reparent": "# instances.reparent\nMove nodes into a new parent\n\nParams:\n items (array, required) \u2014 Array of {id, parentId, index?}\n id (string, required)\n parentId (string, required)\n index (number, optional)",
|
|
569
|
+
"get": '# instances.get\nGet instance detail with component properties and overrides\n\nParams:\n id (string, required) \u2014 Instance node ID\n fields (string[], optional) \u2014 Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass ["*"] for all.\n depth (number, optional) \u2014 Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.\n verbose (boolean, optional) \u2014 Include all properties (bounding box, constraints, text style details). Default false \u2014 returns slim, actionable output.',
|
|
570
|
+
"create": `# instances.create
|
|
571
|
+
Create component instances
|
|
572
|
+
|
|
573
|
+
Example: instances(method:"create", items:[{componentId:"1:23", variantProperties:{"Size":"Large"}, properties:{"Label":"Click me"}, parentId:"2:45", layoutSizingHorizontal:"FILL"}])
|
|
574
|
+
|
|
575
|
+
Params:
|
|
576
|
+
items (InstanceCreateItem[], required) \u2014 Array of {componentId, variantProperties?, x?, y?, parentId?, layoutSizingHorizontal?, ...}
|
|
577
|
+
opacity (string, optional) \u2014 Opacity (0-1) or variable name
|
|
578
|
+
visible (boolean, optional) \u2014 Show/hide (default true)
|
|
579
|
+
locked (boolean, optional) \u2014 Lock/unlock (default false)
|
|
580
|
+
blendMode (PASS_THROUGH | NORMAL | DARKEN | MULTIPLY | LINEAR_BURN | COLOR_BURN | LIGHTEN | SCREEN | LINEAR_DODGE | COLOR_DODGE | OVERLAY | SOFT_LIGHT | HARD_LIGHT | DIFFERENCE | EXCLUSION | HUE | SATURATION | COLOR | LUMINOSITY, optional)
|
|
581
|
+
effectStyleName (string, optional) \u2014 Effect style name (e.g. 'Shadow/Card') for shadows, blurs
|
|
582
|
+
layoutSizingHorizontal (FIXED | HUG | FILL, optional)
|
|
583
|
+
layoutSizingVertical (FIXED | HUG | FILL, optional)
|
|
584
|
+
layoutPositioning (AUTO | ABSOLUTE, optional) \u2014 ABSOLUTE = floating inside auto-layout parent
|
|
585
|
+
minWidth (number, optional) \u2014 Min width for responsive auto-layout
|
|
586
|
+
maxWidth (number, optional) \u2014 Max width for responsive auto-layout
|
|
587
|
+
minHeight (number, optional) \u2014 Min height for responsive auto-layout
|
|
588
|
+
maxHeight (number, optional) \u2014 Max height for responsive auto-layout
|
|
589
|
+
componentId (string, required) \u2014 Component or component set ID
|
|
590
|
+
variantProperties (object, optional) \u2014 Pick variant e.g. {"Style":"Secondary"}
|
|
591
|
+
properties (object, optional) \u2014 Set component properties inline e.g. {"Label":"Click me", "ShowIcon":true}. Same as instances.update properties.
|
|
592
|
+
name (string, optional) \u2014 Instance layer name
|
|
593
|
+
x (number, optional)
|
|
594
|
+
y (number, optional)
|
|
595
|
+
width (number, optional) \u2014 Override width (resize)
|
|
596
|
+
height (number, optional) \u2014 Override height (resize)
|
|
597
|
+
parentId (string, optional) \u2014 Parent node ID. Omit to place on current page.
|
|
598
|
+
depth (number, optional) \u2014 Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.`,
|
|
599
|
+
"update": `# instances.update
|
|
600
|
+
Set instance properties
|
|
601
|
+
|
|
602
|
+
Example: instances(method:"update", items:[{id:"1:23", properties:{"Label#4:0":"Submit"}, fillColor:"#3B82F6", layoutSizingHorizontal:"FILL"}])
|
|
603
|
+
|
|
604
|
+
Params:
|
|
605
|
+
items (InstanceUpdateItem[], required) \u2014 Array of {id, properties: {"Label#1:0":"text"}, fillColor?: ...}
|
|
606
|
+
fills (array, optional) \u2014 Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills.
|
|
607
|
+
fillColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)
|
|
608
|
+
fillStyleName (string, optional) \u2014 Paint style name for fill
|
|
609
|
+
fillVariableName (string, optional) \u2014 Color variable by name e.g. 'bg/primary'
|
|
610
|
+
strokes (array, optional) \u2014 Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes.
|
|
611
|
+
strokeColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)
|
|
612
|
+
strokeStyleName (string, optional) \u2014 Paint style name for stroke
|
|
613
|
+
strokeVariableName (string, optional) \u2014 Color variable by name for stroke
|
|
614
|
+
strokeWeight (string, optional) \u2014 All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight.
|
|
615
|
+
strokeTopWeight (string, optional)
|
|
616
|
+
strokeBottomWeight (string, optional)
|
|
617
|
+
strokeLeftWeight (string, optional)
|
|
618
|
+
strokeRightWeight (string, optional)
|
|
619
|
+
strokeAlign (INSIDE | OUTSIDE | CENTER, optional) \u2014 Stroke position (default: INSIDE)
|
|
620
|
+
strokesIncludedInLayout (boolean, optional) \u2014 Include stroke width in layout measurements (default: false)
|
|
621
|
+
cornerRadius (string, optional) \u2014 All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.
|
|
622
|
+
topLeftRadius (string, optional)
|
|
623
|
+
topRightRadius (string, optional)
|
|
624
|
+
bottomRightRadius (string, optional)
|
|
625
|
+
bottomLeftRadius (string, optional)
|
|
626
|
+
opacity (string, optional) \u2014 Opacity (0-1) or variable name
|
|
627
|
+
visible (boolean, optional) \u2014 Show/hide (default true)
|
|
628
|
+
locked (boolean, optional) \u2014 Lock/unlock (default false)
|
|
629
|
+
blendMode (PASS_THROUGH | NORMAL | DARKEN | MULTIPLY | LINEAR_BURN | COLOR_BURN | LIGHTEN | SCREEN | LINEAR_DODGE | COLOR_DODGE | OVERLAY | SOFT_LIGHT | HARD_LIGHT | DIFFERENCE | EXCLUSION | HUE | SATURATION | COLOR | LUMINOSITY, optional)
|
|
630
|
+
effectStyleName (string, optional) \u2014 Effect style name (e.g. 'Shadow/Card') for shadows, blurs
|
|
631
|
+
layoutMode (NONE | HORIZONTAL | VERTICAL, optional) \u2014 Layout direction (default: NONE)
|
|
632
|
+
layoutWrap (NO_WRAP | WRAP, optional)
|
|
633
|
+
padding (string, optional) \u2014 All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft.
|
|
634
|
+
paddingTop (string, optional)
|
|
635
|
+
paddingRight (string, optional)
|
|
636
|
+
paddingBottom (string, optional)
|
|
637
|
+
paddingLeft (string, optional)
|
|
638
|
+
primaryAxisAlignItems (MIN | MAX | CENTER | SPACE_BETWEEN, optional)
|
|
639
|
+
counterAxisAlignItems (MIN | MAX | CENTER | BASELINE, optional)
|
|
640
|
+
itemSpacing (string, optional) \u2014 Spacing between children (number or variable name string, default: 0)
|
|
641
|
+
counterAxisSpacing (string, optional) \u2014 Gap between wrapped rows (requires layoutWrap: WRAP)
|
|
642
|
+
layoutSizingHorizontal (FIXED | HUG | FILL, optional)
|
|
643
|
+
layoutSizingVertical (FIXED | HUG | FILL, optional)
|
|
644
|
+
layoutPositioning (AUTO | ABSOLUTE, optional) \u2014 ABSOLUTE = floating inside auto-layout parent
|
|
645
|
+
minWidth (number, optional) \u2014 Min width for responsive auto-layout
|
|
646
|
+
maxWidth (number, optional) \u2014 Max width for responsive auto-layout
|
|
647
|
+
minHeight (number, optional) \u2014 Min height for responsive auto-layout
|
|
648
|
+
maxHeight (number, optional) \u2014 Max height for responsive auto-layout
|
|
649
|
+
fontSize (number, optional) \u2014 Font size
|
|
650
|
+
fontFamily (string, optional) \u2014 Font family
|
|
651
|
+
fontStyle (string, optional) \u2014 Font variant e.g. "Bold", "Italic" \u2014 overrides fontWeight
|
|
652
|
+
fontWeight (number, optional) \u2014 100-900. Ignored when fontStyle is set.
|
|
653
|
+
fontColor (Color, optional) \u2014 Shorthand \u2014 sets text color (auto-binds to matching variable/style)
|
|
654
|
+
fontColorVariableName (string, optional) \u2014 Bind color variable by name e.g. 'text/primary'
|
|
655
|
+
fontColorStyleName (string, optional) \u2014 Apply paint style \u2014 overrides fontColor
|
|
656
|
+
textStyleId (string, optional) \u2014 Apply text style by ID \u2014 overrides fontSize/fontWeight
|
|
657
|
+
textStyleName (string, optional) \u2014 Text style by name (case-insensitive)
|
|
658
|
+
textAlignHorizontal (LEFT | CENTER | RIGHT | JUSTIFIED, optional)
|
|
659
|
+
textAlignVertical (TOP | CENTER | BOTTOM, optional)
|
|
660
|
+
textAutoResize (NONE | WIDTH_AND_HEIGHT | HEIGHT | TRUNCATE, optional)
|
|
661
|
+
id (string, required) \u2014 Instance node ID
|
|
662
|
+
properties (object, optional) \u2014 Component property key\u2192value map
|
|
663
|
+
componentProperties (object, optional) \u2014 Alias for properties (matches instances.get response shape)
|
|
664
|
+
name (string, optional) \u2014 Rename node
|
|
665
|
+
rotation (number, optional) \u2014 Degrees (0-360)
|
|
666
|
+
x (number, optional)
|
|
667
|
+
y (number, optional)
|
|
668
|
+
width (number, optional)
|
|
669
|
+
height (number, optional)
|
|
670
|
+
clearFill (boolean, optional) \u2014 Remove all fills
|
|
671
|
+
effects (array, optional) \u2014 Effect array (DROP_SHADOW, INNER_SHADOW, LAYER_BLUR, BACKGROUND_BLUR)
|
|
672
|
+
constraints (object, optional)
|
|
673
|
+
bindings (array, optional) \u2014 Bind variables to properties. field path examples: 'fills/0/color', 'strokes/0/color', 'opacity', 'width', 'cornerRadius', 'itemSpacing'.
|
|
674
|
+
field (string, required)
|
|
675
|
+
variableName (string, optional)
|
|
676
|
+
variableId (string, optional)
|
|
677
|
+
explicitMode (object, optional) \u2014 Pin variable mode \u2014 use { collectionName, modeName } (preferred) or { collectionId, modeId }
|
|
678
|
+
exportSettings (array, optional) \u2014 Export settings`,
|
|
679
|
+
"swap": "# instances.swap\nSwap instance component (preserves overrides)\n\nParams:\n items (array, required) \u2014 Array of {id, componentId}\n id (string, required) \u2014 Instance node ID\n componentId (string, required) \u2014 New component or component set ID",
|
|
680
|
+
"detach": "# instances.detach\nDetach instances from their component (converts to frame)\n\nParams:\n items (array, required) \u2014 Array of {id}\n id (string, required) \u2014 Instance node ID",
|
|
681
|
+
"reset_overrides": "# instances.reset_overrides\nReset all overrides on instances to match their main component\n\nParams:\n items (array, required) \u2014 Array of {id}\n id (string, required) \u2014 Instance node ID"
|
|
682
|
+
}
|
|
683
|
+
},
|
|
684
|
+
"lint": {
|
|
685
|
+
"summary": `# lint
|
|
686
|
+
Run design quality and accessibility checks.
|
|
687
|
+
|
|
688
|
+
Methods:
|
|
689
|
+
check Run design linter on a node tree [read]
|
|
690
|
+
fix Auto-fix frames to auto-layout [edit]
|
|
691
|
+
|
|
692
|
+
// Lint runs automated design quality and accessibility checks on a node tree.
|
|
693
|
+
// ---
|
|
694
|
+
// Rules: "all" (default), or filter by category or specific rule names.
|
|
695
|
+
// Category meta-rules (expand to all rules in that category):
|
|
696
|
+
// "component" \u2014 component property binding checks
|
|
697
|
+
// "composition" \u2014 layout and positioning checks
|
|
698
|
+
// "token" \u2014 design token / style usage checks
|
|
699
|
+
// "naming" \u2014 layer naming checks
|
|
700
|
+
// "wcag" / "accessibility" \u2014 all WCAG accessibility checks
|
|
701
|
+
// ---
|
|
702
|
+
// Severity levels (output is sorted by severity, highest first):
|
|
703
|
+
// "error" \u2014 definite bug, must fix
|
|
704
|
+
// "unsafe" \u2014 likely causes layout/accessibility problems
|
|
705
|
+
// "heuristic" \u2014 probably worth fixing, context-dependent
|
|
706
|
+
// "style" \u2014 opinionated, nice-to-have (leaf nodes, decorative elements often downgraded here)
|
|
707
|
+
// Context-aware: leaf nodes (text, shapes, small frames) are treated differently from containers.
|
|
708
|
+
// Small labels with HUG sizing, leaf nodes on cross-axis \u2014 downgraded to "style" instead of "heuristic".
|
|
709
|
+
// Per-finding severity overrides appear on individual nodes when context changes the default.
|
|
710
|
+
// ---
|
|
711
|
+
// Component rules [component]:
|
|
712
|
+
// "no-text-property" \u2014 component text not exposed as editable property [heuristic]
|
|
713
|
+
// "component-bindings" \u2014 unbound text, orphaned properties, unexposed nested text [heuristic; orphaned\u2192unsafe, nested\u2192style]
|
|
714
|
+
// Composition rules [composition]:
|
|
715
|
+
// "no-autolayout" \u2014 frames with manually positioned children [heuristic; leaf-only containers\u2192style]
|
|
716
|
+
// "overlapping-children" \u2014 children stacked at same position [heuristic]
|
|
717
|
+
// "shape-instead-of-frame" \u2014 shapes used as containers [style]
|
|
718
|
+
// "fixed-in-autolayout" \u2014 FIXED-size children in auto-layout parents [heuristic]
|
|
719
|
+
// "unbounded-hug" \u2014 HUG on both axes [unsafe; short leaf text\u2192style]
|
|
720
|
+
// "hug-cross-axis" \u2014 HUG on cross-axis of constrained parent [heuristic; leaf nodes\u2192style]
|
|
721
|
+
// "empty-container" \u2014 empty frames [style]
|
|
722
|
+
// Token rules [token]:
|
|
723
|
+
// "hardcoded-color" \u2014 colors not using styles or variables [heuristic]
|
|
724
|
+
// "hardcoded-token" \u2014 numeric values not bound to FLOAT variable [heuristic]
|
|
725
|
+
// "no-text-style" \u2014 text without a text style [heuristic]
|
|
726
|
+
// Naming rules [naming]:
|
|
727
|
+
// "default-name" \u2014 default names like "Frame 1" [style]
|
|
728
|
+
// "stale-text-name" \u2014 text node name doesn't match content [style]
|
|
729
|
+
// Accessibility rules [wcag]:
|
|
730
|
+
// "wcag-contrast" \u2014 AA contrast ratio [unsafe]
|
|
731
|
+
// "wcag-contrast-enhanced" \u2014 AAA contrast ratio [style]
|
|
732
|
+
// "wcag-non-text-contrast" \u2014 non-text 3:1 contrast [heuristic]
|
|
733
|
+
// "wcag-target-size" \u2014 targets below 24x24px [unsafe]
|
|
734
|
+
// "wcag-text-size" \u2014 text below 12px [unsafe]
|
|
735
|
+
// "wcag-line-height" \u2014 line height below 1.5x [style]
|
|
736
|
+
// ---
|
|
737
|
+
// maxDepth limits how deep the tree traversal goes (default: 10). maxFindings caps total findings (default: 50).
|
|
738
|
+
// fix: auto-converts frames to auto-layout. Use after lint.check identifies "no-autolayout" issues.
|
|
739
|
+
|
|
740
|
+
Use lint(method: "help", topic: "<method>") for method details.`,
|
|
741
|
+
"methods": {
|
|
742
|
+
"check": '# lint.check\nRun design linter on a node tree\n\nExample: lint(method:"check", nodeId:"0:1", rules:["wcag","hardcoded-color"])\n\nParams:\n nodeId (string, optional) \u2014 Node ID to lint. If omitted: 1 selected node \u2192 lints that node, 2+ selected \u2192 lints entire page (not the selection), 0 selected \u2192 error. Always pass nodeId explicitly for reliable targeting.\n rules (string[], optional) \u2014 Rules to run. Default: ["all"]. Categories: "component", "composition", "token", "naming", "wcag"/"accessibility". Or specific rule names.\n maxDepth (number, optional) \u2014 Max tree depth (default: 10)\n maxFindings (number, optional) \u2014 Max findings (default: 50)',
|
|
743
|
+
"fix": "# lint.fix\nAuto-fix frames to auto-layout\n\nParams:\n items (array, required) \u2014 Array of {nodeId, layoutMode?, itemSpacing?}\n nodeId (string, required) \u2014 Frame node ID\n layoutMode (VERTICAL | HORIZONTAL, optional) \u2014 Direction (default: auto-detected)\n itemSpacing (number, optional) \u2014 Spacing between children\n depth (number, optional) \u2014 Response detail for fixed nodes: omit for stubs, 0=properties, -1=full tree"
|
|
744
|
+
}
|
|
745
|
+
},
|
|
746
|
+
"prototyping": {
|
|
747
|
+
"summary": '# prototyping\nManage prototype interactions, reactions, and navigation flows.\n\nMethods:\n get Get reactions and overflow direction on a node [read]\n add Add a prototype reaction to a node [edit]\n set Replace all reactions on a node (raw reactions array) [edit]\n remove Remove a reaction from a node by index [edit]\n\n// Reactions wire up interactions: trigger (ON_CLICK, ON_HOVER, ...) \u2192 action (navigate, swap, overlay).\n// Common patterns: button ON_CLICK \u2192 NAVIGATE to detail frame; card ON_HOVER \u2192 CHANGE_TO hover variant.\n// Multi-action: pass actions[] array to run multiple actions on one trigger (e.g. navigate + set variable mode).\n// ---\n// TRIGGERS: ON_CLICK | ON_HOVER | ON_PRESS | ON_DRAG | AFTER_TIMEOUT(timeout) | MOUSE_ENTER(delay) | MOUSE_LEAVE(delay) | ON_KEY_DOWN(keyCodes)\n// NAVIGATION: NAVIGATE (go to frame) | SWAP (swap overlay) | OVERLAY (show overlay) | SCROLL_TO | CHANGE_TO (swap component variant)\n// TRANSITIONS: DISSOLVE | SMART_ANIMATE | MOVE_IN | MOVE_OUT | PUSH | SLIDE_IN | SLIDE_OUT (+ direction for directional)\n// EASING: EASE_IN | EASE_OUT | EASE_IN_AND_OUT | LINEAR | GENTLE | QUICK | BOUNCY | SLOW\n// ACTIONS: NODE (navigate/swap) | BACK (go back) | CLOSE (close overlay) | URL (open link) | SET_VARIABLE_MODE (switch theme/mode)\n\nUse prototyping(method: "help", topic: "<method>") for method details.',
|
|
748
|
+
"methods": {
|
|
749
|
+
"get": "# prototyping.get\nGet reactions and overflow direction on a node\n\nParams:\n id (string, required) \u2014 Node ID",
|
|
750
|
+
"add": '# prototyping.add\nAdd a prototype reaction to a node\n\nExample: prototyping(method:"add", id:"btn-1", trigger:"ON_CLICK", destination:"detail-frame-id", navigation:"NAVIGATE")\n\nParams:\n id (string, required) \u2014 Node ID\n trigger (ON_CLICK | ON_HOVER | ON_PRESS | ON_DRAG | AFTER_TIMEOUT | MOUSE_ENTER | MOUSE_LEAVE | ON_KEY_DOWN, required) \u2014 Trigger type\n triggerDelay (number, optional) \u2014 Delay in ms for AFTER_TIMEOUT / MOUSE_ENTER / MOUSE_LEAVE triggers\n triggerKeyCodes (number[], optional) \u2014 Key codes for ON_KEY_DOWN trigger\n triggerDevice (KEYBOARD | XBOX_ONE | PS4 | SWITCH_PRO, optional) \u2014 Device for ON_KEY_DOWN (default: KEYBOARD)\n destination (string, optional) \u2014 Target node ID (required for NODE actions)\n navigation (NAVIGATE | SWAP | OVERLAY | SCROLL_TO | CHANGE_TO, optional) \u2014 Navigation type (default: NAVIGATE)\n transition (DISSOLVE | SMART_ANIMATE | MOVE_IN | MOVE_OUT | PUSH | SLIDE_IN | SLIDE_OUT | INSTANT, optional) \u2014 Transition animation (default: DISSOLVE). INSTANT = no animation.\n transitionDirection (LEFT | RIGHT | TOP | BOTTOM, optional) \u2014 Direction for MOVE_IN, MOVE_OUT, PUSH, SLIDE_IN, SLIDE_OUT\n duration (number, optional) \u2014 Transition duration in seconds (default: 0.3)\n easing (EASE_IN | EASE_OUT | EASE_IN_AND_OUT | LINEAR | GENTLE | QUICK | BOUNCY | SLOW, optional) \u2014 Easing function (default: EASE_OUT)\n actionType (NODE | BACK | CLOSE | URL | SET_VARIABLE_MODE, optional) \u2014 Action type (default: NODE). SET_VARIABLE_MODE switches a variable collection mode.\n url (string, optional) \u2014 URL for URL action type\n collectionName (string, optional) \u2014 Variable collection name (for SET_VARIABLE_MODE)\n modeName (string, optional) \u2014 Mode name to switch to (for SET_VARIABLE_MODE)\n resetScrollPosition (boolean, optional) \u2014 Reset scroll position on navigate (default: true)\n actions (array, optional) \u2014 Multi-action: [{actionType, destination?, navigation?, collectionName?, modeName?, ...}]. Overrides single-action params.',
|
|
751
|
+
"set": "# prototyping.set\nReplace all reactions on a node (raw reactions array)\n\nParams:\n id (string, required) \u2014 Node ID\n reactions (array, required) \u2014 Full reactions array \u2014 [{trigger:{type}, actions:[{type, destinationId, navigation, transition}]}]",
|
|
752
|
+
"remove": "# prototyping.remove\nRemove a reaction from a node by index\n\nParams:\n id (string, required) \u2014 Node ID\n index (number, required) \u2014 Reaction index (0-based)"
|
|
753
|
+
}
|
|
754
|
+
},
|
|
755
|
+
"selection": {
|
|
756
|
+
"summary": '# selection\nRead and set the current Figma selection.\n\nMethods:\n get Get the current selection [read]\n set Set selection to nodes and scroll viewport to show them [read]\n\n// Selection is the set of nodes currently highlighted in the Figma canvas.\n// get returns the current selection. Without depth, returns stubs ({id, name, type}). With depth=0, returns full properties.\n// _truncated: true when the response was cut short due to node budget limits. Use depth=0 or specific fields to reduce payload.\n// set replaces the entire selection AND scrolls the viewport to show the selected nodes.\n\nUse selection(method: "help", topic: "<method>") for method details.',
|
|
757
|
+
"methods": {
|
|
758
|
+
"get": "# selection.get\nGet the current selection\n\nParams:\n depth (number, optional) \u2014 Child recursion depth. Omit for stubs only, 0=selected nodes' properties, -1=unlimited.\n verbose (boolean, optional) \u2014 Include all properties (bounding box, constraints, text style details). Default false \u2014 returns slim, actionable output.",
|
|
759
|
+
"set": '# selection.set\nSet selection to nodes and scroll viewport to show them\n\nParams:\n nodeIds (string[], required) \u2014 Array of node IDs to select. Example: ["1:2","1:3"]'
|
|
760
|
+
}
|
|
761
|
+
},
|
|
762
|
+
"styles": {
|
|
763
|
+
"summary": '# styles\nCRUD for local paint, text, effect, and grid styles.\n\nMethods:\n list List local styles with optional type filter [read]\n get Get full style detail by ID [read]\n create Create local styles [create]\n update Update styles by ID or name [edit]\n delete Delete styles [edit]\n\n// Styles are named, reusable design properties that can be applied to nodes. Four types:\n// paint: a named color (applied to fills/strokes), text: typography settings, effect: shadows/blurs, grid: layout grids.\n// All ID params accept both IDs and display names (case-insensitive). Use whichever you have.\n// ---\n// leadingTrim: "CAP_HEIGHT" trims line-height to cap height (tighter text boxes), "NONE" is default.\n// fontStyle: font variant name like "Bold", "Italic", "Bold Italic". Use fonts.list to find available styles.\n//\n// Effect object shape (for effect styles):\n// { type: "DROP_SHADOW"|"INNER_SHADOW"|"LAYER_BLUR"|"BACKGROUND_BLUR",\n// color?: Color, offset?: {x, y}, radius: number, spread?: number,\n// visible?: boolean, blendMode?: string }\n// DROP_SHADOW/INNER_SHADOW require color, offset, radius. LAYER_BLUR/BACKGROUND_BLUR require radius only.\n// Example: { type: "DROP_SHADOW", color: "#00000040", offset: {x:0,y:4}, radius: 8 }\n//\n// LayoutGrid object shape (for grid styles):\n// Rows/Columns: { pattern: "ROWS"|"COLUMNS", alignment: "MIN"|"MAX"|"STRETCH"|"CENTER",\n// gutterSize: number, count: number, sectionSize?: number, offset?: number, visible?: boolean, color?: Color }\n// Grid: { pattern: "GRID", sectionSize: number, visible?: boolean, color?: Color }\n// Example: { pattern: "COLUMNS", alignment: "STRETCH", gutterSize: 20, count: 12, offset: 40 }\n\nUse styles(method: "help", topic: "<method>") for method details.',
|
|
764
|
+
"methods": {
|
|
765
|
+
"list": '# styles.list\nList local styles with optional type filter\n\nParams:\n type (paint | text | effect | grid, optional) \u2014 Filter by style type\n fields (string[], optional) \u2014 Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass ["*"] for all.\n offset (number, optional) \u2014 Skip N items for pagination (default 0)\n limit (number, optional) \u2014 Max items per page (default 100)',
|
|
766
|
+
"get": '# styles.get\nGet full style detail by ID\n\nParams:\n id (string, required) \u2014 Style ID or name\n fields (string[], optional) \u2014 Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass ["*"] for all.',
|
|
767
|
+
"create": '# styles.create\nCreate local styles\n\nExample: styles(method:"create", type:"effect", name:"Shadow/Medium", effects:[{type:"DROP_SHADOW", color:"#00000040", offset:{x:0,y:4}, radius:8}])\n\nDiscriminant: type (paint | text | effect | grid)\n\n ## paint \u2014 Paint/color style\n name (string, required) \u2014 Style name\n color (Color, required) \u2014 Color value\n colorVariableName (string, optional) \u2014 Bind to a COLOR variable by name (style tracks the variable)\n description (string, optional) \u2014 Style description\n\n ## text \u2014 Text style\n name (string, required) \u2014 Style name\n fontFamily (string, required) \u2014 Font family\n fontStyle (string, optional) \u2014 Font style (default: Regular)\n fontSize (number, required) \u2014 Font size\n lineHeight (line_height, optional)\n letterSpacing (letter_spacing, optional)\n textCase (ORIGINAL | UPPER | LOWER | TITLE | SMALL_CAPS | SMALL_CAPS_FORCED, optional)\n textDecoration (NONE | UNDERLINE | STRIKETHROUGH, optional)\n paragraphIndent (number, optional) \u2014 Paragraph indent (px)\n paragraphSpacing (number, optional) \u2014 Paragraph spacing (px)\n leadingTrim (CAP_HEIGHT | NONE, optional) \u2014 Leading trim mode\n description (string, optional) \u2014 Style description\n\n ## effect \u2014 Effect style\n name (string, required) \u2014 Style name\n effects (array, required) \u2014 Array of Effect objects\n description (string, optional) \u2014 Style description\n\n ## grid \u2014 Grid/layout grid style\n name (string, required) \u2014 Style name\n layoutGrids (array, required) \u2014 Array of LayoutGrid objects\n description (string, optional) \u2014 Style description',
|
|
768
|
+
"update": '# styles.update\nUpdate styles by ID or name\n\nExample: styles(method:"update", items:[{id:"Surface/Primary", color:"#F5F5F5"}])\n\nParams:\n type (paint | text | effect | grid, optional) \u2014 Style type hint for strict validation (optional, auto-detected)\n items (PatchStyleItem[], required) \u2014 Array of {id, ...fields} to update\n id (string, required) \u2014 Style ID or name\n name (string, optional) \u2014 Rename the style\n description (string, optional) \u2014 Style description\n color (Color, optional) \u2014 New color (paint styles)\n colorVariableName (string, optional) \u2014 Bind to a COLOR variable by name (paint styles)\n fontFamily (string, optional)\n fontStyle (string, optional)\n fontSize (number, optional)\n lineHeight (line_height, optional)\n letterSpacing (letter_spacing, optional)\n textCase (ORIGINAL | UPPER | LOWER | TITLE | SMALL_CAPS | SMALL_CAPS_FORCED, optional)\n textDecoration (NONE | UNDERLINE | STRIKETHROUGH, optional)\n paragraphIndent (number, optional) \u2014 Paragraph indent (px)\n paragraphSpacing (number, optional) \u2014 Paragraph spacing (px)\n leadingTrim (CAP_HEIGHT | NONE, optional)\n effects (array, optional) \u2014 Array of Effect objects\n layoutGrids (array, optional) \u2014 Array of LayoutGrid objects (grid styles)',
|
|
769
|
+
"delete": "# styles.delete\nDelete styles\n\nParams:\n id (string, optional) \u2014 Style ID or name\n items (array, optional) \u2014 Batch: [{id}, ...]\n id (string, required) \u2014 Style ID or name"
|
|
770
|
+
}
|
|
771
|
+
},
|
|
772
|
+
"text": {
|
|
773
|
+
"summary": '# text\nCreate and manage text nodes.\n\nMethods:\n get Get serialized node data [read]\n list Search for nodes (returns stubs only \u2014 use get with depth for full properties) [read]\n update Patch node properties [edit]\n delete Delete nodes [edit]\n clone Duplicate nodes [create]\n audit Run lint on a node \u2014 returns severity-ranked findings [read]\n reparent Move nodes into a new parent [edit]\n create Create text nodes [create]\n set_content Replace text content on existing text nodes [edit]\n scan Scan all text nodes within a subtree [read]\n\n// depth: omit \u2192 id+name stubs | 0 \u2192 props + child stubs | N \u2192 recurse N | -1 \u2192 full tree\n// fields: whitelist e.g. ["fills","opacity"] \u2014 id, name, type always included. Pass ["*"] for all.\n// layoutSizingHorizontal/Vertical: FIXED | HUG | FILL \u2014 how the node sizes within auto-layout.\n// Colors: fillVariableName/strokeVariableName bind by name \u2014 preferred over raw color values.\n// Note: node-based endpoints (frames, text, instances, components) use `results` as the list key.\n// Standalone endpoints (styles, variables, variable_collections) use `items`. Components.list uses `items` (catalog view).\n// ---\n// visible: false hides the node. Omitted from response when true (the default).\n// locked: true prevents editing in Figma UI. Omitted when false (the default).\n// rotation: degrees (0-360). Omitted when 0.\n// blendMode: layer blend mode. Omitted when PASS_THROUGH (the default).\n// layoutPositioning: ABSOLUTE = floating inside auto-layout parent. Omitted when AUTO (the default).\n// minWidth/maxWidth/minHeight/maxHeight: responsive constraints for auto-layout children.\n// constraints: position behavior in non-auto-layout parents. Ignored inside auto-layout frames.\n// bindings: bind design variables to node properties. field uses slash path: "fills/0/color" (first fill), "strokes/0/color", "opacity", "width", "height", "cornerRadius", "paddingLeft", "itemSpacing".\n// explicitMode: pin a variable mode on this node. Use { collectionName, modeName } (preferred) or { collectionId, modeId }.\n// properties: escape hatch \u2014 set any Figma node property directly. Use only when no dedicated field exists.\ninterface Node {\n id: string; name: string; type: string;\n visible?: boolean; // omitted when true\n locked?: boolean; // omitted when false\n opacity?: number; // omitted when 1\n rotation?: number; // omitted when 0\n blendMode?: string; // omitted when PASS_THROUGH\n layoutPositioning?: "AUTO" | "ABSOLUTE";\n layoutSizingHorizontal?: "FIXED" | "HUG" | "FILL";\n layoutSizingVertical?: "FIXED" | "HUG" | "FILL";\n minWidth?: number; maxWidth?: number; minHeight?: number; maxHeight?: number;\n absoluteBoundingBox: { x: number; y: number; width: number; height: number };\n fills?: Paint[]; // solid: {type: "SOLID", color: {r, g, b, a}}\n strokes?: Paint[];\n effects?: Effect[]; // DROP_SHADOW | INNER_SHADOW | LAYER_BLUR | BACKGROUND_BLUR\n children?: NodeStub[]; // stubs: {id, name, type} \u2014 use depth to expand\n}\n// PatchItem uses flat params matching create shape \u2014 no nested sub-objects.\n// Fill/stroke/corner/layout/text params are identical to frames.create and text.create.\n// Unknown keys produce a warning, preventing silent failures.\n// Text nodes display text content with typography styling. They inherit node methods (get, list, update, delete, clone, reparent).\n// textAutoResize: NONE (fixed box), WIDTH_AND_HEIGHT (grow both), HEIGHT (fixed width, auto height), TRUNCATE (fixed + ellipsis).\n// Prefer textStyleName for typography, fontColorVariableName/fontColorStyleName for color.\n// Aliases: fillColor \u2192 fontColor, fillVariableName \u2192 fontColorVariableName, fillStyleName \u2192 fontColorStyleName (consistent with frames API).\n// ---\n// Smart defaults inside auto-layout parent: layoutSizingHorizontal defaults to FILL, layoutSizingVertical to HUG, textAutoResize to HEIGHT.\n// Text fills parent width and wraps automatically. Override with explicit values if needed.\n// fontStyle vs fontWeight: fontStyle is a named variant like "Bold", "Italic", "SemiBold". When set, fontWeight is ignored.\n// Use fonts.list to find available fontFamily + fontStyle combinations.\n// scan: finds all text nodes in a subtree. path (when includePath:true) shows the layer hierarchy e.g. "Frame > Card > Label".\n// ScanResult (per-item): { nodeId, count, truncated, textNodes: [{ id, name, characters, fontSize, fontFamily, fontStyle, path?, depth?, absoluteX?, absoluteY?, width?, height? }] }\n\nUse text(method: "help", topic: "<method>") for method details.',
|
|
774
|
+
"methods": {
|
|
775
|
+
"get": '# text.get\nGet serialized node data\n\nParams:\n id (string, required) \u2014 Node ID\n fields (string[], optional) \u2014 Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass ["*"] for all.\n depth (number, optional) \u2014 Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.\n verbose (boolean, optional) \u2014 Include all properties (bounding box, constraints, text style details). Default false \u2014 returns slim, actionable output.',
|
|
776
|
+
"list": '# text.list\nSearch for nodes (returns stubs only \u2014 use get with depth for full properties)\n\nParams:\n query (string, optional) \u2014 Name search query (case-insensitive substring match)\n types (string[], optional) \u2014 Filter by node types (e.g. ["FRAME", "TEXT"])\n parentId (string, optional) \u2014 Search only within this subtree\n fields (string[], optional) \u2014 Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass ["*"] for all.\n offset (number, optional) \u2014 Skip N items for pagination (default 0)\n limit (number, optional) \u2014 Max items per page (default 100)',
|
|
777
|
+
"update": `# text.update
|
|
778
|
+
Patch node properties
|
|
779
|
+
|
|
780
|
+
Params:
|
|
781
|
+
items (PatchItem[], required) \u2014 Array of {id, ...properties} to patch
|
|
782
|
+
fills (array, optional) \u2014 Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills.
|
|
783
|
+
fillColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)
|
|
784
|
+
fillStyleName (string, optional) \u2014 Paint style name for fill
|
|
785
|
+
fillVariableName (string, optional) \u2014 Color variable by name e.g. 'bg/primary'
|
|
786
|
+
strokes (array, optional) \u2014 Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes.
|
|
787
|
+
strokeColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)
|
|
788
|
+
strokeStyleName (string, optional) \u2014 Paint style name for stroke
|
|
789
|
+
strokeVariableName (string, optional) \u2014 Color variable by name for stroke
|
|
790
|
+
strokeWeight (string, optional) \u2014 All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight.
|
|
791
|
+
strokeTopWeight (string, optional)
|
|
792
|
+
strokeBottomWeight (string, optional)
|
|
793
|
+
strokeLeftWeight (string, optional)
|
|
794
|
+
strokeRightWeight (string, optional)
|
|
795
|
+
strokeAlign (INSIDE | OUTSIDE | CENTER, optional) \u2014 Stroke position (default: INSIDE)
|
|
796
|
+
strokesIncludedInLayout (boolean, optional) \u2014 Include stroke width in layout measurements (default: false)
|
|
797
|
+
cornerRadius (string, optional) \u2014 All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.
|
|
798
|
+
topLeftRadius (string, optional)
|
|
799
|
+
topRightRadius (string, optional)
|
|
800
|
+
bottomRightRadius (string, optional)
|
|
801
|
+
bottomLeftRadius (string, optional)
|
|
802
|
+
opacity (string, optional) \u2014 Opacity (0-1) or variable name
|
|
803
|
+
visible (boolean, optional) \u2014 Show/hide (default true)
|
|
804
|
+
locked (boolean, optional) \u2014 Lock/unlock (default false)
|
|
805
|
+
blendMode (PASS_THROUGH | NORMAL | DARKEN | MULTIPLY | LINEAR_BURN | COLOR_BURN | LIGHTEN | SCREEN | LINEAR_DODGE | COLOR_DODGE | OVERLAY | SOFT_LIGHT | HARD_LIGHT | DIFFERENCE | EXCLUSION | HUE | SATURATION | COLOR | LUMINOSITY, optional)
|
|
806
|
+
effectStyleName (string, optional) \u2014 Effect style name (e.g. 'Shadow/Card') for shadows, blurs
|
|
807
|
+
layoutMode (NONE | HORIZONTAL | VERTICAL, optional) \u2014 Layout direction (default: NONE)
|
|
808
|
+
layoutWrap (NO_WRAP | WRAP, optional)
|
|
809
|
+
padding (string, optional) \u2014 All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft.
|
|
810
|
+
paddingTop (string, optional)
|
|
811
|
+
paddingRight (string, optional)
|
|
812
|
+
paddingBottom (string, optional)
|
|
813
|
+
paddingLeft (string, optional)
|
|
814
|
+
primaryAxisAlignItems (MIN | MAX | CENTER | SPACE_BETWEEN, optional)
|
|
815
|
+
counterAxisAlignItems (MIN | MAX | CENTER | BASELINE, optional)
|
|
816
|
+
itemSpacing (string, optional) \u2014 Spacing between children (number or variable name string, default: 0)
|
|
817
|
+
counterAxisSpacing (string, optional) \u2014 Gap between wrapped rows (requires layoutWrap: WRAP)
|
|
818
|
+
layoutSizingHorizontal (FIXED | HUG | FILL, optional)
|
|
819
|
+
layoutSizingVertical (FIXED | HUG | FILL, optional)
|
|
820
|
+
layoutPositioning (AUTO | ABSOLUTE, optional) \u2014 ABSOLUTE = floating inside auto-layout parent
|
|
821
|
+
minWidth (number, optional) \u2014 Min width for responsive auto-layout
|
|
822
|
+
maxWidth (number, optional) \u2014 Max width for responsive auto-layout
|
|
823
|
+
minHeight (number, optional) \u2014 Min height for responsive auto-layout
|
|
824
|
+
maxHeight (number, optional) \u2014 Max height for responsive auto-layout
|
|
825
|
+
fontSize (number, optional) \u2014 Font size
|
|
826
|
+
fontFamily (string, optional) \u2014 Font family
|
|
827
|
+
fontStyle (string, optional) \u2014 Font variant e.g. "Bold", "Italic" \u2014 overrides fontWeight
|
|
828
|
+
fontWeight (number, optional) \u2014 100-900. Ignored when fontStyle is set.
|
|
829
|
+
fontColor (Color, optional) \u2014 Shorthand \u2014 sets text color (auto-binds to matching variable/style)
|
|
830
|
+
fontColorVariableName (string, optional) \u2014 Bind color variable by name e.g. 'text/primary'
|
|
831
|
+
fontColorStyleName (string, optional) \u2014 Apply paint style \u2014 overrides fontColor
|
|
832
|
+
textStyleId (string, optional) \u2014 Apply text style by ID \u2014 overrides fontSize/fontWeight
|
|
833
|
+
textStyleName (string, optional) \u2014 Text style by name (case-insensitive)
|
|
834
|
+
textAlignHorizontal (LEFT | CENTER | RIGHT | JUSTIFIED, optional)
|
|
835
|
+
textAlignVertical (TOP | CENTER | BOTTOM, optional)
|
|
836
|
+
textAutoResize (NONE | WIDTH_AND_HEIGHT | HEIGHT | TRUNCATE, optional)
|
|
837
|
+
id (string, required)
|
|
838
|
+
name (string, optional) \u2014 Rename node
|
|
839
|
+
rotation (number, optional) \u2014 Degrees (0-360)
|
|
840
|
+
x (number, optional)
|
|
841
|
+
y (number, optional)
|
|
842
|
+
width (number, optional)
|
|
843
|
+
height (number, optional)
|
|
844
|
+
clearFill (boolean, optional) \u2014 Remove all fills
|
|
845
|
+
effects (array, optional) \u2014 Effect array (DROP_SHADOW, INNER_SHADOW, LAYER_BLUR, BACKGROUND_BLUR)
|
|
846
|
+
overflowDirection (NONE | HORIZONTAL | VERTICAL | BOTH, optional) \u2014 Scroll overflow in prototype (default: NONE)
|
|
847
|
+
constraints (object, optional)
|
|
848
|
+
bindings (array, optional) \u2014 Bind variables to properties. field path examples: 'fills/0/color', 'strokes/0/color', 'opacity', 'width', 'cornerRadius', 'itemSpacing'.
|
|
849
|
+
field (string, required)
|
|
850
|
+
variableName (string, optional)
|
|
851
|
+
variableId (string, optional)
|
|
852
|
+
explicitMode (object, optional) \u2014 Pin variable mode \u2014 use { collectionName, modeName } (preferred) or { collectionId, modeId }
|
|
853
|
+
exportSettings (array, optional) \u2014 Export settings
|
|
854
|
+
properties (object, optional) \u2014 Direct Figma API props (escape hatch)`,
|
|
855
|
+
"delete": "# text.delete\nDelete nodes\n\nParams:\n id (string, optional) \u2014 Single node ID\n items (array, optional) \u2014 Batch: [{id}, ...]\n id (string, optional)",
|
|
856
|
+
"clone": "# text.clone\nDuplicate nodes\n\nParams:\n id (string, required) \u2014 Node ID\n parentId (string, optional) \u2014 Parent node ID. Omit to place on current page.\n x (number, optional) \u2014 X position (default: 0)\n y (number, optional) \u2014 Y position (default: 0)\n depth (number, optional) \u2014 Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.",
|
|
857
|
+
"audit": '# text.audit\nRun lint on a node \u2014 returns severity-ranked findings\n\nParams:\n id (string, required) \u2014 Node ID to audit\n rules (string[], optional) \u2014 Rules to check. Default: ["all"]. Categories: "component", "composition", "token", "naming", "wcag".\n maxDepth (number, optional) \u2014 Max tree depth (default: 10)\n maxFindings (number, optional) \u2014 Max findings (default: 50)',
|
|
858
|
+
"reparent": "# text.reparent\nMove nodes into a new parent\n\nParams:\n items (array, required) \u2014 Array of {id, parentId, index?}\n id (string, required)\n parentId (string, required)\n index (number, optional)",
|
|
859
|
+
"create": `# text.create
|
|
860
|
+
Create text nodes
|
|
861
|
+
|
|
862
|
+
Example: text(method:"create", items:[{text:"Hello", fontFamily:"Inter", fontSize:16, textStyleName:"body/medium"}])
|
|
863
|
+
|
|
864
|
+
Params:
|
|
865
|
+
items (TextItem[], required) \u2014 Array of text items to create
|
|
866
|
+
text (string, optional) \u2014 Text content
|
|
867
|
+
name (string, optional) \u2014 Layer name
|
|
868
|
+
x (number, optional)
|
|
869
|
+
y (number, optional)
|
|
870
|
+
width (number, optional) \u2014 Fixed width in px \u2014 implies layoutSizingHorizontal: FIXED and textAutoResize: HEIGHT
|
|
871
|
+
parentId (string, optional) \u2014 Parent node ID. Omit to place on current page.
|
|
872
|
+
fontFamily (string, optional) \u2014 Font family (default: Inter). Use fonts.list to find installed fonts.
|
|
873
|
+
fontStyle (string, optional) \u2014 Font variant e.g. "Bold", "Italic" \u2014 overrides fontWeight
|
|
874
|
+
fontSize (number, optional) \u2014 Font size (default: 14)
|
|
875
|
+
fontWeight (number, optional) \u2014 100-900 (default: 400). Ignored when fontStyle is set.
|
|
876
|
+
fills (array, optional) \u2014 Text color paints \u2014 e.g. [{type: 'SOLID', color: '#hex'}]. Same as node fills.
|
|
877
|
+
fontColor (Color, optional) \u2014 Shorthand \u2014 sets text color (auto-binds to matching variable/style)
|
|
878
|
+
fontColorVariableName (string, optional) \u2014 Bind color variable by name e.g. 'text/primary'
|
|
879
|
+
fontColorStyleName (string, optional) \u2014 Apply paint style \u2014 overrides fontColor
|
|
880
|
+
textStyleId (string, optional) \u2014 Text style ID or name (case-insensitive) \u2014 overrides fontSize/fontWeight
|
|
881
|
+
textStyleName (string, optional) \u2014 Alias for textStyleId \u2014 accepts name (case-insensitive)
|
|
882
|
+
textAlignHorizontal (LEFT | CENTER | RIGHT | JUSTIFIED, optional)
|
|
883
|
+
textAlignVertical (TOP | CENTER | BOTTOM, optional)
|
|
884
|
+
layoutSizingHorizontal (FIXED | HUG | FILL, optional)
|
|
885
|
+
layoutSizingVertical (FIXED | HUG | FILL, optional)
|
|
886
|
+
textAutoResize (NONE | WIDTH_AND_HEIGHT | HEIGHT | TRUNCATE, optional) \u2014 NONE (fixed box), WIDTH_AND_HEIGHT (grow both), HEIGHT (fixed width, auto height), TRUNCATE (fixed + ellipsis)
|
|
887
|
+
componentPropertyName (string, optional) \u2014 Bind to a component TEXT property by name. Walks up ancestors to find the nearest component, or targets the component specified by componentId. For deeply nested text, consider using components(method:'create', type:'from_node') with exposeText:true instead \u2014 it auto-discovers and binds all text nodes.
|
|
888
|
+
componentId (string, optional) \u2014 Target component ID for componentPropertyName binding. When omitted, walks up ancestors to find the nearest COMPONENT or COMPONENT_SET.
|
|
889
|
+
depth (number, optional) \u2014 Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.`,
|
|
890
|
+
"set_content": "# text.set_content\nReplace text content on existing text nodes\n\nParams:\n items (array, required) \u2014 Array of {nodeId, text}\n nodeId (string, required) \u2014 Text node ID\n text (string, required) \u2014 New text content\n depth (number, optional) \u2014 Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.",
|
|
891
|
+
"scan": "# text.scan\nScan all text nodes within a subtree\n\nParams:\n items ({ nodeId: string; limit?: number; includePath?: boolean; includeGeometry?: boolean }[], required) \u2014 Array of subtrees to scan"
|
|
892
|
+
}
|
|
893
|
+
},
|
|
894
|
+
"variable_collections": {
|
|
895
|
+
"summary": '# variable_collections\nCRUD for variable collections \u2014 the document-level API for design tokens.\n\nMethods:\n list List variable collections [read]\n get Get collection with all variables and values (full document) [read]\n create Create a collection with modes and variables in one call [create]\n update Rename collections [edit]\n delete Delete collections [edit]\n add_mode Add a mode to a collection [create]\n rename_mode Rename a mode [edit]\n remove_mode Remove a mode from a collection [edit]\n\n// Variable collections group design tokens and define their modes (e.g. Light/Dark, Desktop/Mobile).\n// All ID params accept both IDs and display names.\n// ---\n// valuesByMode: values keyed by mode name, e.g. {"Light": "#FFF", "Dark": "#111"}.\n// Aliases: {type: "VARIABLE_ALIAS", name: "other/variable"}.\n// scopes: see variables endpoint for full list.\n// Deleting a collection deletes all variables inside it.\n// The default mode cannot be removed. Use add_mode/remove_mode for additional modes.\n\nUse variable_collections(method: "help", topic: "<method>") for method details.',
|
|
896
|
+
"methods": {
|
|
897
|
+
"list": '# variable_collections.list\nList variable collections\n\nParams:\n fields (string[], optional) \u2014 Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass ["*"] for all.\n offset (number, optional) \u2014 Skip N items for pagination (default 0)\n limit (number, optional) \u2014 Max items per page (default 100)',
|
|
898
|
+
"get": '# variable_collections.get\nGet collection with all variables and values (full document)\n\nParams:\n id (string, required) \u2014 Collection ID or name\n fields (string[], optional) \u2014 Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass ["*"] for all.',
|
|
899
|
+
"create": `# variable_collections.create
|
|
900
|
+
Create a collection with modes and variables in one call
|
|
901
|
+
|
|
902
|
+
Example: variable_collections(method:"create", items:[{name:"Tokens", modes:["Light","Dark"], variables:[{name:"bg/primary", type:"COLOR", valuesByMode:{"Light":"#FFF","Dark":"#111"}, scopes:["ALL_FILLS"]}, {name:"text/primary", type:"COLOR", valuesByMode:{"Light":"#111","Dark":"#F0F0F0"}, scopes:["TEXT_FILL"]}, {name:"space/16", type:"FLOAT", value:16, scopes:["GAP","WIDTH_HEIGHT"]}, {name:"radius/8", type:"FLOAT", value:8, scopes:["CORNER_RADIUS"]}]}])
|
|
903
|
+
|
|
904
|
+
Params:
|
|
905
|
+
items (array, required) \u2014 Array of collection documents
|
|
906
|
+
name (string, required) \u2014 Collection name
|
|
907
|
+
modes (string[], optional) \u2014 Mode names (e.g. ['Light', 'Dark']). Omit for single-mode collection.
|
|
908
|
+
variables (array, optional) \u2014 Variables to create inside this collection
|
|
909
|
+
name (string, required) \u2014 Variable name (unique within collection)
|
|
910
|
+
type (COLOR | FLOAT | STRING | BOOLEAN, required) \u2014 Variable type
|
|
911
|
+
value (variable_value, optional) \u2014 Shorthand \u2014 sets the default mode value. Use valuesByMode for multi-mode.
|
|
912
|
+
valuesByMode (object, optional) \u2014 Values keyed by mode name (e.g. {"Light": "#FFF", "Dark": "#111"})
|
|
913
|
+
description (string, optional)
|
|
914
|
+
scopes (string[], optional) \u2014 Restrict where variable can be applied (default: ALL_SCOPES)`,
|
|
915
|
+
"update": "# variable_collections.update\nRename collections\n\nParams:\n items (array, required) \u2014 Array of {id, name}\n id (string, required) \u2014 Collection ID or name\n name (string, required) \u2014 New name",
|
|
916
|
+
"delete": "# variable_collections.delete\nDelete collections\n\nParams:\n id (string, optional) \u2014 Collection ID or name\n items (array, optional) \u2014 Batch: [{id}, ...]\n id (string, required)",
|
|
917
|
+
"add_mode": "# variable_collections.add_mode\nAdd a mode to a collection\n\nParams:\n items (array, required) \u2014 Array of {collectionId, name}\n collectionId (string, required) \u2014 Collection ID or name\n name (string, required) \u2014 Mode name",
|
|
918
|
+
"rename_mode": '# variable_collections.rename_mode\nRename a mode\n\nParams:\n items (array, required) \u2014 Array of {collectionId, modeId, name}\n collectionId (string, required) \u2014 Collection ID or name\n modeId (string, required) \u2014 Mode ID or name (e.g. "Dark")\n name (string, required) \u2014 New name',
|
|
919
|
+
"remove_mode": '# variable_collections.remove_mode\nRemove a mode from a collection\n\nParams:\n items (array, required) \u2014 Array of {collectionId, modeId}\n collectionId (string, required) \u2014 Collection ID or name\n modeId (string, required) \u2014 Mode ID or name (e.g. "Dark")'
|
|
920
|
+
}
|
|
921
|
+
},
|
|
922
|
+
"variables": {
|
|
923
|
+
"summary": '# variables\nSearch and update design variables within a collection.\n\nMethods:\n list Search variables within a collection [read]\n get Get variable detail by name [read]\n create Create variables in a collection. Use valuesByMode for multi-mode, or value for default mode only. [create]\n update Update variable metadata and/or set values [edit]\n delete Delete variables [edit]\n\n// Search and update variables within a collection. collectionId is required on all methods.\n// Use variable_collections to create full token sets (collection + modes + variables in one call).\n// ---\n// query: prefix match first, then substring. "bg/" matches bg/canvas, bg/surface, etc.\n// valuesByMode: values keyed by mode name. value is shorthand for the default mode.\n// Aliases: {type: "VARIABLE_ALIAS", name: "other/variable"}.\n// scopes: ALL_SCOPES, TEXT_CONTENT, WIDTH_HEIGHT, GAP, CORNER_RADIUS, ALL_FILLS, FRAME_FILL, SHAPE_FILL,\n// TEXT_FILL, STROKE_COLOR, STROKE_FLOAT, EFFECT_FLOAT, EFFECT_COLOR, OPACITY, FONT_FAMILY, FONT_STYLE,\n// FONT_WEIGHT, FONT_SIZE, LINE_HEIGHT, LETTER_SPACING, PARAGRAPH_SPACING, PARAGRAPH_INDENT\n\nUse variables(method: "help", topic: "<method>") for method details.',
|
|
924
|
+
"methods": {
|
|
925
|
+
"list": '# variables.list\nSearch variables within a collection\n\nExample: variables(method:"list", collectionId:"Colors", query:"bg/")\n\nParams:\n collectionId (string, required) \u2014 Collection ID or name\n query (string, optional) \u2014 Search query \u2014 prefix match first, then substring fallback\n type (COLOR | FLOAT | STRING | BOOLEAN, optional) \u2014 Filter by variable type\n fields (string[], optional) \u2014 Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass ["*"] for all.\n offset (number, optional) \u2014 Skip N items for pagination (default 0)\n limit (number, optional) \u2014 Max items per page (default 100)',
|
|
926
|
+
"get": '# variables.get\nGet variable detail by name\n\nParams:\n name (string, required) \u2014 Variable name (unique within collection)\n collectionId (string, required) \u2014 Collection ID or name\n fields (string[], optional) \u2014 Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass ["*"] for all.',
|
|
927
|
+
"create": '# variables.create\nCreate variables in a collection. Use valuesByMode for multi-mode, or value for default mode only.\n\nExample: variables(method:"create", collectionId:"Colors", items:[{name:"bg/primary", type:"COLOR", valuesByMode:{"Light":"#FFF","Dark":"#111"}, scopes:["ALL_FILLS"]}])\n\nParams:\n collectionId (string, required) \u2014 Collection ID or name\n items (VariableCreateItem[], required) \u2014 Array of variables to create\n name (string, required) \u2014 Variable name (must be unique within collection)\n type (COLOR | FLOAT | STRING | BOOLEAN, required) \u2014 Variable type\n value (variable_value, optional) \u2014 Shorthand \u2014 sets the default mode value. Use valuesByMode for multi-mode.\n valuesByMode (object, optional) \u2014 Values keyed by mode name (e.g. {"Light": "#FFF", "Dark": "#111"}). Takes precedence over value.\n description (string, optional) \u2014 Variable description\n scopes (string[], optional) \u2014 Restrict where variable can be applied (default: ALL_SCOPES)',
|
|
928
|
+
"update": '# variables.update\nUpdate variable metadata and/or set values\n\nExample: variables(method:"update", collectionId:"Colors", items:[{name:"bg/primary", valuesByMode:{"Light":"#FFF","Dark":"#222"}}])\n\nParams:\n collectionId (string, required) \u2014 Collection ID or name\n items (VariableUpdateItem[], required) \u2014 Array of variable updates\n name (string, required) \u2014 Variable name\n rename (string, optional) \u2014 Rename the variable\n description (string, optional) \u2014 Set description\n scopes (string[], optional) \u2014 Update scopes\n value (variable_value, optional) \u2014 Shorthand \u2014 sets the default mode value. Use valuesByMode for multi-mode.\n valuesByMode (object, optional) \u2014 Values keyed by mode name. Takes precedence over value.',
|
|
929
|
+
"delete": "# variables.delete\nDelete variables\n\nParams:\n collectionId (string, required) \u2014 Collection ID or name\n name (string, optional) \u2014 Variable name\n items (array, optional) \u2014 Batch: [{name}, ...]\n name (string, required)"
|
|
930
|
+
}
|
|
931
|
+
},
|
|
932
|
+
"version_history": {
|
|
933
|
+
"summary": `# version_history
|
|
934
|
+
Save named versions to the Figma file's version history.
|
|
935
|
+
|
|
936
|
+
Methods:
|
|
937
|
+
save Save a named version to the file's version history [edit]
|
|
938
|
+
|
|
939
|
+
// Version history lets you create named snapshots of a Figma file.
|
|
940
|
+
// Use this after completing design tasks to create an audit trail of changes.
|
|
941
|
+
// Equivalent to Figma's File \u2192 Save to Version History (Cmd+Opt+S).
|
|
942
|
+
|
|
943
|
+
Use version_history(method: "help", topic: "<method>") for method details.`,
|
|
944
|
+
"methods": {
|
|
945
|
+
"save": `# version_history.save
|
|
946
|
+
Save a named version to the file's version history
|
|
947
|
+
|
|
948
|
+
Params:
|
|
949
|
+
title (string, required) \u2014 Version title (e.g., "Added hero sections with website copy")
|
|
950
|
+
description (string, optional) \u2014 Optional longer description of what changed`
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
};
|
|
954
|
+
var helpTopics = {
|
|
955
|
+
"missing_tools": '# Missing Create / Edit Tools\n\nIf the user asks you to create or modify something in Figma but you cannot find create/edit methods on endpoint tools, the MCP server was started without the correct access tier flag.\n\nVibma filters available methods at startup based on CLI flags passed in the MCP config `args` array:\n\n| Flag | Methods available |\n|------|-----------------|\n| _(none)_ | Read-only (get, list, check, scan, export) |\n| `--create` | Read + creation methods (create, clone) |\n| `--edit` | All methods (read + create + update + delete) |\n\nAsk the user to add `--edit` (or `--create`) to their MCP config args:\n\n```json\n{\n "mcpServers": {\n "Vibma": {\n "command": "npx",\n "args": ["-y", "@ufira/vibma", "--edit"]\n }\n }\n}\n```\n\nAfter updating, the user must restart their AI tool or reload MCP servers \u2014 stdio-based servers cannot hot-reload.'
|
|
956
|
+
};
|
|
957
|
+
var allEndpointNames = Object.keys(helpEndpoints);
|
|
958
|
+
var allTopicNames = Object.keys(helpTopics);
|
|
959
|
+
function resolveHelp(topic) {
|
|
960
|
+
if (!topic) return helpDirectory;
|
|
961
|
+
const dot = topic.indexOf(".");
|
|
962
|
+
if (dot === -1) {
|
|
963
|
+
const ep2 = helpEndpoints[topic];
|
|
964
|
+
if (ep2) return ep2.summary;
|
|
965
|
+
const t = helpTopics[topic];
|
|
966
|
+
if (t) return t;
|
|
967
|
+
const all = [...allEndpointNames, ...allTopicNames];
|
|
968
|
+
return "Unknown topic: " + topic + ". Available: " + all.join(", ");
|
|
969
|
+
}
|
|
970
|
+
const epName = topic.slice(0, dot);
|
|
971
|
+
const methodName = topic.slice(dot + 1);
|
|
972
|
+
const ep = helpEndpoints[epName];
|
|
973
|
+
if (!ep) {
|
|
974
|
+
const all = [...allEndpointNames, ...allTopicNames];
|
|
975
|
+
return "Unknown topic: " + epName + ". Available: " + all.join(", ");
|
|
976
|
+
}
|
|
977
|
+
const method = ep.methods[methodName];
|
|
978
|
+
if (method) return method;
|
|
979
|
+
return "Unknown method: " + methodName + " on " + epName + ". Available methods: " + Object.keys(ep.methods).join(", ");
|
|
980
|
+
}
|
|
981
|
+
function resolveEndpointHelp(endpoint, topic) {
|
|
982
|
+
const ep = helpEndpoints[endpoint];
|
|
983
|
+
if (!ep) return null;
|
|
984
|
+
if (!topic) return ep.summary;
|
|
985
|
+
const method = ep.methods[topic];
|
|
986
|
+
if (method) return method;
|
|
987
|
+
return "Unknown method: " + topic + ". Available methods on " + endpoint + ": " + Object.keys(ep.methods).join(", ");
|
|
988
|
+
}
|
|
989
|
+
|
|
58
990
|
// src/tools/registry.ts
|
|
59
|
-
function
|
|
60
|
-
|
|
991
|
+
function resolveCommand(tool, params) {
|
|
992
|
+
if (tool.commandMap && params.method) {
|
|
993
|
+
const cmd = tool.commandMap[params.method];
|
|
994
|
+
if (cmd) return cmd;
|
|
995
|
+
}
|
|
996
|
+
return tool.command ?? tool.name;
|
|
997
|
+
}
|
|
998
|
+
function registerTools(server2, sendCommand, caps2, tools2) {
|
|
999
|
+
for (const tool of tools2) {
|
|
61
1000
|
if (tool.tier === "create" && !caps2.create) continue;
|
|
62
1001
|
if (tool.tier === "edit" && !caps2.edit) continue;
|
|
63
1002
|
const schema = typeof tool.schema === "function" ? tool.schema(caps2) : tool.schema;
|
|
64
|
-
const command = tool.command ?? tool.name;
|
|
65
1003
|
const timeout = tool.timeout;
|
|
66
|
-
const
|
|
1004
|
+
const defaultFormat = tool.formatResponse ?? mcpJson;
|
|
67
1005
|
server2.registerTool(tool.name, { description: tool.description, inputSchema: schema }, async (params) => {
|
|
68
1006
|
try {
|
|
1007
|
+
if (params.method === "help") {
|
|
1008
|
+
const text = resolveEndpointHelp(tool.name, params.topic) ?? resolveHelp(tool.name);
|
|
1009
|
+
return { content: [{ type: "text", text }] };
|
|
1010
|
+
}
|
|
69
1011
|
if (tool.validate) tool.validate(params);
|
|
1012
|
+
const command = resolveCommand(tool, params);
|
|
70
1013
|
const result = await sendCommand(command, params, timeout);
|
|
1014
|
+
const format = tool.methodFormatters?.[params.method] ?? defaultFormat;
|
|
71
1015
|
return format(result);
|
|
72
1016
|
} catch (e) {
|
|
1017
|
+
if (e instanceof import_zod.ZodError) {
|
|
1018
|
+
const hints = e.issues.map((i) => {
|
|
1019
|
+
const path = i.path.join(".");
|
|
1020
|
+
return `[${path}] ${i.message}`;
|
|
1021
|
+
});
|
|
1022
|
+
return mcpError(`${tool.name} validation error`, hints.join("; "));
|
|
1023
|
+
}
|
|
73
1024
|
return mcpError(`${tool.name} error`, e);
|
|
74
1025
|
}
|
|
75
1026
|
});
|
|
76
1027
|
}
|
|
77
1028
|
}
|
|
78
1029
|
|
|
79
|
-
// src/tools/defs
|
|
80
|
-
var
|
|
81
|
-
{
|
|
82
|
-
name: "ping",
|
|
83
|
-
description: "Verify end-to-end connection to Figma. Call this right after join_channel. Returns { status: 'pong', documentName, currentPage } if the full chain (MCP \u2192 relay \u2192 plugin \u2192 Figma) is working. If this times out, the Figma plugin is not connected \u2014 ask the user to check the plugin window for the correct port and channel name.",
|
|
84
|
-
schema: {},
|
|
85
|
-
tier: "read",
|
|
86
|
-
timeout: 5e3
|
|
87
|
-
}
|
|
88
|
-
];
|
|
89
|
-
|
|
90
|
-
// src/tools/defs/document.ts
|
|
91
|
-
var import_zod = require("zod");
|
|
92
|
-
var tools2 = [
|
|
93
|
-
{
|
|
94
|
-
name: "get_document_info",
|
|
95
|
-
description: "Get the document name, current page, and list of all pages.",
|
|
96
|
-
schema: {},
|
|
97
|
-
tier: "read"
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
name: "get_current_page",
|
|
101
|
-
description: "Get the current page info and its top-level children.",
|
|
102
|
-
schema: {},
|
|
103
|
-
tier: "read"
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
name: "set_current_page",
|
|
107
|
-
description: "Switch to a different page. Provide either pageId or pageName.",
|
|
108
|
-
schema: {
|
|
109
|
-
pageId: import_zod.z.string().optional().describe("The page ID to switch to"),
|
|
110
|
-
pageName: import_zod.z.string().optional().describe("The page name (case-insensitive, partial match)")
|
|
111
|
-
},
|
|
112
|
-
tier: "read"
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
name: "create_page",
|
|
116
|
-
description: "Create a new page in the document",
|
|
117
|
-
schema: { name: import_zod.z.string().optional().describe("Name for the new page (default: 'New Page')") },
|
|
118
|
-
tier: "create"
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
name: "rename_page",
|
|
122
|
-
description: "Rename a page. Defaults to current page if no pageId given.",
|
|
123
|
-
schema: {
|
|
124
|
-
newName: import_zod.z.string().describe("New name for the page"),
|
|
125
|
-
pageId: import_zod.z.string().optional().describe("Page ID (default: current page)")
|
|
126
|
-
},
|
|
127
|
-
tier: "edit"
|
|
128
|
-
}
|
|
129
|
-
];
|
|
130
|
-
|
|
131
|
-
// src/tools/defs/selection.ts
|
|
132
|
-
var import_zod3 = require("zod");
|
|
1030
|
+
// src/tools/generated/defs.ts
|
|
1031
|
+
var import_zod4 = require("zod");
|
|
133
1032
|
|
|
134
1033
|
// src/utils/coercion.ts
|
|
135
1034
|
var import_zod2 = require("zod");
|
|
@@ -148,87 +1047,15 @@ var flexJson = (inner) => import_zod2.z.preprocess((v) => {
|
|
|
148
1047
|
}
|
|
149
1048
|
return v;
|
|
150
1049
|
}, inner);
|
|
151
|
-
var flexNum = (inner) => import_zod2.z.preprocess((v) => {
|
|
152
|
-
if (typeof v === "string") {
|
|
153
|
-
const n = Number(v);
|
|
154
|
-
if (!isNaN(n) && v.trim() !== "") return n;
|
|
155
|
-
}
|
|
156
|
-
return v;
|
|
157
|
-
}, inner);
|
|
158
|
-
|
|
159
|
-
// src/tools/defs/selection.ts
|
|
160
|
-
var tools3 = [
|
|
161
|
-
{
|
|
162
|
-
name: "get_selection",
|
|
163
|
-
description: "Get the current selection. Without depth, returns stubs (id/name/type). With depth, returns full serialized node trees.",
|
|
164
|
-
schema: { depth: import_zod3.z.coerce.number().optional().describe("Child recursion depth. Omit for stubs only, 0=selected nodes' properties, -1=unlimited.") },
|
|
165
|
-
tier: "read"
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
name: "set_selection",
|
|
169
|
-
description: "Set selection to nodes and scroll viewport to show them. Also works as focus (single node).",
|
|
170
|
-
schema: {
|
|
171
|
-
nodeIds: flexJson(import_zod3.z.array(import_zod3.z.string())).describe('Array of node IDs to select. Example: ["1:2","1:3"]')
|
|
172
|
-
},
|
|
173
|
-
tier: "read"
|
|
174
|
-
}
|
|
175
|
-
];
|
|
176
|
-
|
|
177
|
-
// src/tools/defs/node-info.ts
|
|
178
|
-
var import_zod4 = require("zod");
|
|
179
|
-
var tools4 = [
|
|
180
|
-
{
|
|
181
|
-
name: "get_node_info",
|
|
182
|
-
description: "Get detailed information about one or more nodes. Always pass an array of IDs. Use `fields` to select only the properties you need (reduces context size).",
|
|
183
|
-
schema: {
|
|
184
|
-
nodeIds: flexJson(import_zod4.z.array(import_zod4.z.string())).describe('Array of node IDs. Example: ["1:2","1:3"]'),
|
|
185
|
-
depth: import_zod4.z.coerce.number().optional().describe("Child recursion depth (default: unlimited). 0=stubs only."),
|
|
186
|
-
fields: flexJson(import_zod4.z.array(import_zod4.z.string())).optional().describe('Whitelist of property names to include. Example: ["absoluteBoundingBox","layoutMode","fills"]. Omit to return all properties.')
|
|
187
|
-
},
|
|
188
|
-
tier: "read"
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
name: "search_nodes",
|
|
192
|
-
description: "Search nodes on the current page by name and/or type. Use set_current_page first to search other pages. Paginated (default 50).",
|
|
193
|
-
schema: {
|
|
194
|
-
query: import_zod4.z.string().optional().describe("Name search (case-insensitive substring). Omit to match all names."),
|
|
195
|
-
types: flexJson(import_zod4.z.array(import_zod4.z.string())).optional().describe('Filter by types. Example: ["FRAME","TEXT"]. Omit to match all types.'),
|
|
196
|
-
scopeNodeId: import_zod4.z.string().optional().describe("Node ID to search within (defaults to current page)"),
|
|
197
|
-
caseSensitive: flexBool(import_zod4.z.boolean()).optional().describe("Case-sensitive name match (default false)"),
|
|
198
|
-
limit: import_zod4.z.coerce.number().optional().describe("Max results (default 50)"),
|
|
199
|
-
offset: import_zod4.z.coerce.number().optional().describe("Skip N results for pagination (default 0)")
|
|
200
|
-
},
|
|
201
|
-
tier: "read"
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
name: "export_node_as_image",
|
|
205
|
-
description: "Export a node as an image from Figma",
|
|
206
|
-
schema: {
|
|
207
|
-
nodeId: import_zod4.z.string().describe("The node ID to export"),
|
|
208
|
-
format: import_zod4.z.enum(["PNG", "JPG", "SVG", "PDF"]).optional().describe("Export format (default: PNG)"),
|
|
209
|
-
scale: import_zod4.z.coerce.number().positive().optional().describe("Export scale (default: 1)")
|
|
210
|
-
},
|
|
211
|
-
tier: "read",
|
|
212
|
-
formatResponse: (result) => {
|
|
213
|
-
const r = result;
|
|
214
|
-
return {
|
|
215
|
-
content: [{ type: "image", data: r.imageData, mimeType: r.mimeType || "image/png" }]
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
];
|
|
220
|
-
|
|
221
|
-
// src/tools/defs/create-shape.ts
|
|
222
|
-
var import_zod6 = require("zod");
|
|
223
1050
|
|
|
224
1051
|
// src/tools/schemas.ts
|
|
225
|
-
var
|
|
226
|
-
var nodeId =
|
|
227
|
-
var nodeIds = flexJson(
|
|
228
|
-
var parentId =
|
|
229
|
-
var depth =
|
|
230
|
-
var xPos =
|
|
231
|
-
var yPos =
|
|
1052
|
+
var import_zod3 = require("zod");
|
|
1053
|
+
var nodeId = import_zod3.z.string().describe("Node ID");
|
|
1054
|
+
var nodeIds = flexJson(import_zod3.z.array(import_zod3.z.string())).describe("Array of node IDs");
|
|
1055
|
+
var parentId = import_zod3.z.string().optional().describe("Parent node ID. Omit to place on current page.");
|
|
1056
|
+
var depth = import_zod3.z.coerce.number().optional().describe("Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.");
|
|
1057
|
+
var xPos = import_zod3.z.coerce.number().optional().describe("X position (default: 0)");
|
|
1058
|
+
var yPos = import_zod3.z.coerce.number().optional().describe("Y position (default: 0)");
|
|
232
1059
|
function parseHex(hex) {
|
|
233
1060
|
const m = hex.match(/^#?([0-9a-f]{3,8})$/i);
|
|
234
1061
|
if (!m) return null;
|
|
@@ -242,765 +1069,1436 @@ function parseHex(hex) {
|
|
|
242
1069
|
if (h.length === 8) return { r, g, b, a: parseInt(h.slice(6, 8), 16) / 255 };
|
|
243
1070
|
return { r, g, b };
|
|
244
1071
|
}
|
|
245
|
-
var colorRgba =
|
|
1072
|
+
var colorRgba = import_zod3.z.preprocess((v) => {
|
|
1073
|
+
if (typeof v === "string") return parseHex(v) ?? v;
|
|
1074
|
+
return v;
|
|
1075
|
+
}, import_zod3.z.union([
|
|
1076
|
+
import_zod3.z.object({
|
|
1077
|
+
r: import_zod3.z.coerce.number().min(0).max(1),
|
|
1078
|
+
g: import_zod3.z.coerce.number().min(0).max(1),
|
|
1079
|
+
b: import_zod3.z.coerce.number().min(0).max(1),
|
|
1080
|
+
a: import_zod3.z.coerce.number().min(0).max(1).optional()
|
|
1081
|
+
}),
|
|
1082
|
+
import_zod3.z.string()
|
|
1083
|
+
// Non-hex strings pass through for handler-level style/variable resolution
|
|
1084
|
+
])).describe('Hex "#FF0000", {r,g,b,a?} 0-1, or style/variable name.');
|
|
1085
|
+
var variableValue = import_zod3.z.preprocess((v) => {
|
|
246
1086
|
if (typeof v === "string") return parseHex(v) ?? v;
|
|
247
1087
|
return v;
|
|
248
|
-
},
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
1088
|
+
}, import_zod3.z.union([
|
|
1089
|
+
import_zod3.z.number(),
|
|
1090
|
+
import_zod3.z.boolean(),
|
|
1091
|
+
import_zod3.z.string(),
|
|
1092
|
+
import_zod3.z.object({ r: import_zod3.z.number(), g: import_zod3.z.number(), b: import_zod3.z.number(), a: import_zod3.z.number().optional() }),
|
|
1093
|
+
import_zod3.z.object({ type: import_zod3.z.literal("VARIABLE_ALIAS"), name: import_zod3.z.string() })
|
|
1094
|
+
])).describe('number, boolean, string, hex "#FF0000", {r,g,b,a?}, or {type:"VARIABLE_ALIAS",name:"other/variable"}');
|
|
1095
|
+
var lineHeight = import_zod3.z.union([
|
|
1096
|
+
import_zod3.z.coerce.number(),
|
|
1097
|
+
import_zod3.z.object({ value: import_zod3.z.coerce.number(), unit: import_zod3.z.enum(["PIXELS", "PERCENT", "AUTO"]) })
|
|
1098
|
+
]).describe('number (px) or {value, unit: "PIXELS"|"PERCENT"|"AUTO"}');
|
|
1099
|
+
var letterSpacing = import_zod3.z.union([
|
|
1100
|
+
import_zod3.z.coerce.number(),
|
|
1101
|
+
import_zod3.z.object({ value: import_zod3.z.coerce.number(), unit: import_zod3.z.enum(["PIXELS", "PERCENT"]) })
|
|
1102
|
+
]).describe('number (px) or {value, unit: "PIXELS"|"PERCENT"}');
|
|
1103
|
+
var stringOrBoolean = import_zod3.z.union([import_zod3.z.string(), import_zod3.z.boolean()]);
|
|
1104
|
+
var token = import_zod3.z.preprocess((v) => {
|
|
1105
|
+
if (typeof v === "number") return String(v);
|
|
1106
|
+
return v;
|
|
1107
|
+
}, import_zod3.z.string()).describe('number as string ("8") or variable name ("Radii/Medium")');
|
|
1108
|
+
var effectEntry = import_zod3.z.object({
|
|
1109
|
+
type: import_zod3.z.enum(["DROP_SHADOW", "INNER_SHADOW", "LAYER_BLUR", "BACKGROUND_BLUR"]),
|
|
256
1110
|
color: flexJson(colorRgba).optional(),
|
|
257
|
-
offset: flexJson(
|
|
258
|
-
radius:
|
|
259
|
-
spread:
|
|
260
|
-
visible: flexBool(
|
|
261
|
-
blendMode:
|
|
1111
|
+
offset: flexJson(import_zod3.z.object({ x: import_zod3.z.coerce.number(), y: import_zod3.z.coerce.number() })).optional(),
|
|
1112
|
+
radius: import_zod3.z.coerce.number(),
|
|
1113
|
+
spread: import_zod3.z.coerce.number().optional(),
|
|
1114
|
+
visible: flexBool(import_zod3.z.boolean()).optional(),
|
|
1115
|
+
blendMode: import_zod3.z.string().optional()
|
|
262
1116
|
});
|
|
263
1117
|
|
|
264
|
-
// src/tools/defs
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
var svgItem = import_zod6.z.object({
|
|
277
|
-
svg: import_zod6.z.string().describe("SVG markup string"),
|
|
278
|
-
name: import_zod6.z.string().optional().describe("Layer name (default: 'SVG')"),
|
|
279
|
-
x: xPos,
|
|
280
|
-
y: yPos,
|
|
281
|
-
parentId
|
|
282
|
-
});
|
|
283
|
-
var tools5 = [
|
|
1118
|
+
// src/tools/generated/defs.ts
|
|
1119
|
+
function filterMethodsByTier(schema, caps2, methodTiers) {
|
|
1120
|
+
const methods = Object.keys(methodTiers).filter((m) => {
|
|
1121
|
+
const tier = methodTiers[m];
|
|
1122
|
+
if (tier === "read") return true;
|
|
1123
|
+
if (tier === "create") return caps2.create;
|
|
1124
|
+
if (tier === "edit") return caps2.edit;
|
|
1125
|
+
return false;
|
|
1126
|
+
});
|
|
1127
|
+
return { ...schema, method: import_zod4.z.enum(methods) };
|
|
1128
|
+
}
|
|
1129
|
+
var tools = [
|
|
284
1130
|
{
|
|
285
|
-
name: "
|
|
286
|
-
description:
|
|
287
|
-
schema:
|
|
288
|
-
|
|
1131
|
+
name: "components",
|
|
1132
|
+
description: '/** Create and manage reusable components and variant sets. Use method "help" for detailed parameter docs. */\n clone (id, parentId?, x?, y?, depth?) \u2192 { results: {id}[] } // Duplicate nodes\n audit (id, rules?, maxDepth?, maxFindings?) \u2192 { nodeId?, nodeName?, categories? } // Run lint on a node \u2014 returns severity-ranked findings\n reparent (items: { id: string; parentId: string; index?: number }[]) \u2192 { results: "ok"[] } // Move nodes into a new parent\n list (query?, offset?, limit?) \u2192 { totalCount, items } // List local component names (variant sets as single entries)\n get (id?, names?) \u2192 { results } // Get component detail \u2014 property definitions + ID for instances.create\n create (type: component|from_node|variant_set, items: (ComponentItem | FromNodeItem | VariantSetItem)[]) \u2192 { results: {id}[] } // Create components\n update (items: UpdatePropertyItem[], depth?) \u2192 { results: ("ok" | {error})[] } // Add, edit, or delete component properties\n delete (id) \u2192 { results: "ok"[] } // Delete components or component sets\n// depth: omit \u2192 id+name stubs | 0 \u2192 props + child stubs | N \u2192 recurse N | -1 \u2192 full tree\n// fields: whitelist e.g. ["fills","opacity"] \u2014 id, name, type always included. Pass ["*"] for all.\n// layoutSizingHorizontal/Vertical: FIXED | HUG | FILL \u2014 how the node sizes within auto-layout.\n// Colors: fillVariableName/strokeVariableName bind by name \u2014 preferred over raw color values.\n// Note: node-based endpoints (frames, text, instances, components) use `results` as the list key.\n// Standalone endpoints (styles, variables, variable_collections) use `items`. Components.list uses `items` (catalog view).',
|
|
1133
|
+
schema: (caps2) => filterMethodsByTier({
|
|
1134
|
+
method: import_zod4.z.enum(["clone", "audit", "reparent", "list", "get", "create", "update", "delete", "help"]),
|
|
1135
|
+
id: import_zod4.z.string().optional().describe("Node ID"),
|
|
1136
|
+
parentId: import_zod4.z.string().optional().describe("Parent node ID. Omit to place on current page."),
|
|
1137
|
+
x: import_zod4.z.coerce.number().optional().describe("X position (default: 0)"),
|
|
1138
|
+
y: import_zod4.z.coerce.number().optional().describe("Y position (default: 0)"),
|
|
1139
|
+
depth: import_zod4.z.coerce.number().optional().describe("Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited."),
|
|
1140
|
+
rules: flexJson(import_zod4.z.array(import_zod4.z.string())).optional().describe('Rules to check. Default: ["all"]. Categories: "component", "composition", "token", "naming", "wcag".'),
|
|
1141
|
+
maxDepth: import_zod4.z.coerce.number().optional().describe("Max tree depth (default: 10)"),
|
|
1142
|
+
maxFindings: import_zod4.z.coerce.number().optional().describe("Max findings (default: 50)"),
|
|
1143
|
+
items: flexJson(import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()))).optional().describe("Array of {id, ...properties} to reparent/update"),
|
|
1144
|
+
query: import_zod4.z.string().optional().describe("Name search query (case-insensitive substring match)"),
|
|
1145
|
+
offset: import_zod4.z.coerce.number().optional().default(0).describe("Skip N items for pagination (default 0)"),
|
|
1146
|
+
limit: import_zod4.z.coerce.number().optional().default(100).describe("Max items per page (default 100)"),
|
|
1147
|
+
names: flexJson(import_zod4.z.array(import_zod4.z.string())).optional().describe("Batch lookup by name (case-insensitive). Either id or names is required."),
|
|
1148
|
+
type: import_zod4.z.enum(["component", "from_node", "variant_set"]).optional().describe("Discriminant for create method"),
|
|
1149
|
+
topic: import_zod4.z.string().optional().describe('Help topic \u2014 method name for endpoint help, e.g. "create"')
|
|
1150
|
+
}, caps2, { "clone": "create", "audit": "read", "reparent": "edit", "list": "read", "get": "read", "create": "create", "update": "edit", "delete": "edit", "help": "read" }),
|
|
1151
|
+
tier: "read",
|
|
1152
|
+
validate: (params) => {
|
|
1153
|
+
const m = params.method;
|
|
1154
|
+
if (m === "delete") {
|
|
1155
|
+
if (params.id === void 0) throw new Error('delete requires "id"');
|
|
1156
|
+
}
|
|
1157
|
+
if (!params.items) return;
|
|
1158
|
+
if (m === "create") {
|
|
1159
|
+
if (params.items) {
|
|
1160
|
+
if (params.type === "variant_set") for (const it of params.items) {
|
|
1161
|
+
if (it.nodeIds !== void 0 && it.componentIds === void 0) {
|
|
1162
|
+
it.componentIds = it.nodeIds;
|
|
1163
|
+
delete it.nodeIds;
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
const schemas = {
|
|
1168
|
+
"component": import_zod4.z.object({
|
|
1169
|
+
name: import_zod4.z.string().describe("Component name"),
|
|
1170
|
+
parentId: import_zod4.z.string().optional().describe("Parent node ID. Omit to place on current page."),
|
|
1171
|
+
x: import_zod4.z.coerce.number().optional().describe("X position (default: 0)"),
|
|
1172
|
+
y: import_zod4.z.coerce.number().optional().describe("Y position (default: 0)"),
|
|
1173
|
+
width: import_zod4.z.coerce.number().optional().describe("Width in px (omit to shrink-to-content via HUG)"),
|
|
1174
|
+
height: import_zod4.z.coerce.number().optional().describe("Height in px (omit to shrink-to-content via HUG)"),
|
|
1175
|
+
rotation: import_zod4.z.coerce.number().optional().describe("Rotation in degrees (0-360)"),
|
|
1176
|
+
opacity: token.optional().describe("Opacity (0-1) or variable name"),
|
|
1177
|
+
visible: flexBool(import_zod4.z.boolean()).optional().describe("Show/hide (default true)"),
|
|
1178
|
+
locked: flexBool(import_zod4.z.boolean()).optional().describe("Lock/unlock (default false)"),
|
|
1179
|
+
blendMode: import_zod4.z.enum(["PASS_THROUGH", "NORMAL", "DARKEN", "MULTIPLY", "LINEAR_BURN", "COLOR_BURN", "LIGHTEN", "SCREEN", "LINEAR_DODGE", "COLOR_DODGE", "OVERLAY", "SOFT_LIGHT", "HARD_LIGHT", "DIFFERENCE", "EXCLUSION", "HUE", "SATURATION", "COLOR", "LUMINOSITY"]).optional(),
|
|
1180
|
+
layoutPositioning: import_zod4.z.enum(["AUTO", "ABSOLUTE"]).optional().describe("ABSOLUTE = floating inside auto-layout parent"),
|
|
1181
|
+
fills: import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown())).optional().describe("Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills."),
|
|
1182
|
+
fillColor: colorRgba.optional().describe("Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)"),
|
|
1183
|
+
fillStyleName: import_zod4.z.string().optional().describe("Paint style name for fill"),
|
|
1184
|
+
fillVariableName: import_zod4.z.string().optional().describe("Color variable by name e.g. 'bg/primary'"),
|
|
1185
|
+
strokes: import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown())).optional().describe("Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes."),
|
|
1186
|
+
strokeColor: colorRgba.optional().describe("Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)"),
|
|
1187
|
+
strokeStyleName: import_zod4.z.string().optional().describe("Paint style name for stroke"),
|
|
1188
|
+
strokeVariableName: import_zod4.z.string().optional().describe("Color variable by name for stroke"),
|
|
1189
|
+
strokeWeight: token.optional().describe("All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight."),
|
|
1190
|
+
strokeTopWeight: token.optional(),
|
|
1191
|
+
strokeBottomWeight: token.optional(),
|
|
1192
|
+
strokeLeftWeight: token.optional(),
|
|
1193
|
+
strokeRightWeight: token.optional(),
|
|
1194
|
+
strokeAlign: import_zod4.z.enum(["INSIDE", "OUTSIDE", "CENTER"]).optional().describe("Stroke position (default: INSIDE)"),
|
|
1195
|
+
strokesIncludedInLayout: flexBool(import_zod4.z.boolean()).optional().describe("Include stroke width in layout measurements (default: false)"),
|
|
1196
|
+
cornerRadius: token.optional().describe("All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius."),
|
|
1197
|
+
topLeftRadius: token.optional(),
|
|
1198
|
+
topRightRadius: token.optional(),
|
|
1199
|
+
bottomRightRadius: token.optional(),
|
|
1200
|
+
bottomLeftRadius: token.optional(),
|
|
1201
|
+
effectStyleName: import_zod4.z.string().optional().describe("Effect style name (e.g. 'Shadow/Card') for shadows, blurs"),
|
|
1202
|
+
layoutMode: import_zod4.z.enum(["NONE", "HORIZONTAL", "VERTICAL"]).optional().describe("Layout direction (default: auto \u2014 NONE when width+height set, otherwise inferred from layout props)"),
|
|
1203
|
+
layoutWrap: import_zod4.z.enum(["NO_WRAP", "WRAP"]).optional(),
|
|
1204
|
+
padding: token.optional().describe("All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft."),
|
|
1205
|
+
paddingTop: token.optional(),
|
|
1206
|
+
paddingRight: token.optional(),
|
|
1207
|
+
paddingBottom: token.optional(),
|
|
1208
|
+
paddingLeft: token.optional(),
|
|
1209
|
+
primaryAxisAlignItems: import_zod4.z.enum(["MIN", "MAX", "CENTER", "SPACE_BETWEEN"]).optional(),
|
|
1210
|
+
counterAxisAlignItems: import_zod4.z.enum(["MIN", "MAX", "CENTER", "BASELINE"]).optional(),
|
|
1211
|
+
layoutSizingHorizontal: import_zod4.z.enum(["FIXED", "HUG", "FILL"]).optional(),
|
|
1212
|
+
layoutSizingVertical: import_zod4.z.enum(["FIXED", "HUG", "FILL"]).optional(),
|
|
1213
|
+
itemSpacing: token.optional().describe("Spacing between children (number or variable name string, default: 0)"),
|
|
1214
|
+
counterAxisSpacing: token.optional().describe("Gap between wrapped rows (requires layoutWrap: WRAP)"),
|
|
1215
|
+
minWidth: import_zod4.z.coerce.number().optional().describe("Min width for responsive auto-layout"),
|
|
1216
|
+
maxWidth: import_zod4.z.coerce.number().optional().describe("Max width for responsive auto-layout"),
|
|
1217
|
+
minHeight: import_zod4.z.coerce.number().optional().describe("Min height for responsive auto-layout"),
|
|
1218
|
+
maxHeight: import_zod4.z.coerce.number().optional().describe("Max height for responsive auto-layout"),
|
|
1219
|
+
overflowDirection: import_zod4.z.enum(["NONE", "HORIZONTAL", "VERTICAL", "BOTH"]).optional().describe("Scroll overflow in prototype (default: NONE)"),
|
|
1220
|
+
description: import_zod4.z.string().optional().describe("Component description (shown in Figma's component panel)"),
|
|
1221
|
+
children: flexJson(import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()))).optional().describe('Inline child nodes. Text: {type:"text", text, componentPropertyName?, fontFamily?, fontSize?, fontColor?}. Frame: {type:"frame", name?, layoutMode?, fillColor?, children?}. Instance: {type:"instance", componentId, componentPropertyName?, variantProperties?, properties?}. Component: {type:"component", name, children?}. componentPropertyName auto-creates and binds a TEXT (text) or INSTANCE_SWAP (instance) property.'),
|
|
1222
|
+
properties: flexJson(import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()))).optional().describe("Component properties to define at creation: [{propertyName, type, defaultValue}]. TEXT properties for inline children with componentPropertyName are created automatically.")
|
|
1223
|
+
}).passthrough(),
|
|
1224
|
+
"from_node": import_zod4.z.object({
|
|
1225
|
+
nodeId: import_zod4.z.string().describe("Node ID to convert"),
|
|
1226
|
+
exposeText: flexBool(import_zod4.z.boolean()).optional().describe("Auto-expose text as editable properties (default: true)")
|
|
1227
|
+
}).passthrough(),
|
|
1228
|
+
"variant_set": import_zod4.z.object({
|
|
1229
|
+
name: import_zod4.z.string().optional().describe("Node name"),
|
|
1230
|
+
parentId: import_zod4.z.string().optional().describe("Parent node ID. Omit to place on current page."),
|
|
1231
|
+
x: import_zod4.z.coerce.number().optional().describe("X position (default: 0)"),
|
|
1232
|
+
y: import_zod4.z.coerce.number().optional().describe("Y position (default: 0)"),
|
|
1233
|
+
width: import_zod4.z.coerce.number().optional().describe("Width in px (omit to shrink-to-content via HUG)"),
|
|
1234
|
+
height: import_zod4.z.coerce.number().optional().describe("Height in px (omit to shrink-to-content via HUG)"),
|
|
1235
|
+
rotation: import_zod4.z.coerce.number().optional().describe("Rotation in degrees (0-360)"),
|
|
1236
|
+
opacity: token.optional().describe("Opacity (0-1) or variable name"),
|
|
1237
|
+
visible: flexBool(import_zod4.z.boolean()).optional().describe("Show/hide (default true)"),
|
|
1238
|
+
locked: flexBool(import_zod4.z.boolean()).optional().describe("Lock/unlock (default false)"),
|
|
1239
|
+
blendMode: import_zod4.z.enum(["PASS_THROUGH", "NORMAL", "DARKEN", "MULTIPLY", "LINEAR_BURN", "COLOR_BURN", "LIGHTEN", "SCREEN", "LINEAR_DODGE", "COLOR_DODGE", "OVERLAY", "SOFT_LIGHT", "HARD_LIGHT", "DIFFERENCE", "EXCLUSION", "HUE", "SATURATION", "COLOR", "LUMINOSITY"]).optional(),
|
|
1240
|
+
layoutPositioning: import_zod4.z.enum(["AUTO", "ABSOLUTE"]).optional().describe("ABSOLUTE = floating inside auto-layout parent"),
|
|
1241
|
+
fills: import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown())).optional().describe("Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills."),
|
|
1242
|
+
fillColor: colorRgba.optional().describe("Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)"),
|
|
1243
|
+
fillStyleName: import_zod4.z.string().optional().describe("Paint style name for fill"),
|
|
1244
|
+
fillVariableName: import_zod4.z.string().optional().describe("Color variable by name e.g. 'bg/primary'"),
|
|
1245
|
+
strokes: import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown())).optional().describe("Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes."),
|
|
1246
|
+
strokeColor: colorRgba.optional().describe("Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)"),
|
|
1247
|
+
strokeStyleName: import_zod4.z.string().optional().describe("Paint style name for stroke"),
|
|
1248
|
+
strokeVariableName: import_zod4.z.string().optional().describe("Color variable by name for stroke"),
|
|
1249
|
+
strokeWeight: token.optional().describe("All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight."),
|
|
1250
|
+
strokeTopWeight: token.optional(),
|
|
1251
|
+
strokeBottomWeight: token.optional(),
|
|
1252
|
+
strokeLeftWeight: token.optional(),
|
|
1253
|
+
strokeRightWeight: token.optional(),
|
|
1254
|
+
strokeAlign: import_zod4.z.enum(["INSIDE", "OUTSIDE", "CENTER"]).optional().describe("Stroke position (default: INSIDE)"),
|
|
1255
|
+
strokesIncludedInLayout: flexBool(import_zod4.z.boolean()).optional().describe("Include stroke width in layout measurements (default: false)"),
|
|
1256
|
+
cornerRadius: token.optional().describe("All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius."),
|
|
1257
|
+
topLeftRadius: token.optional(),
|
|
1258
|
+
topRightRadius: token.optional(),
|
|
1259
|
+
bottomRightRadius: token.optional(),
|
|
1260
|
+
bottomLeftRadius: token.optional(),
|
|
1261
|
+
effectStyleName: import_zod4.z.string().optional().describe("Effect style name (e.g. 'Shadow/Card') for shadows, blurs"),
|
|
1262
|
+
layoutMode: import_zod4.z.enum(["NONE", "HORIZONTAL", "VERTICAL"]).optional().describe("Layout direction (default: auto \u2014 NONE when width+height set, otherwise inferred from layout props)"),
|
|
1263
|
+
layoutWrap: import_zod4.z.enum(["NO_WRAP", "WRAP"]).optional(),
|
|
1264
|
+
padding: token.optional().describe("All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft."),
|
|
1265
|
+
paddingTop: token.optional(),
|
|
1266
|
+
paddingRight: token.optional(),
|
|
1267
|
+
paddingBottom: token.optional(),
|
|
1268
|
+
paddingLeft: token.optional(),
|
|
1269
|
+
primaryAxisAlignItems: import_zod4.z.enum(["MIN", "MAX", "CENTER", "SPACE_BETWEEN"]).optional(),
|
|
1270
|
+
counterAxisAlignItems: import_zod4.z.enum(["MIN", "MAX", "CENTER", "BASELINE"]).optional(),
|
|
1271
|
+
layoutSizingHorizontal: import_zod4.z.enum(["FIXED", "HUG", "FILL"]).optional(),
|
|
1272
|
+
layoutSizingVertical: import_zod4.z.enum(["FIXED", "HUG", "FILL"]).optional(),
|
|
1273
|
+
itemSpacing: token.optional().describe("Spacing between children (number or variable name string, default: 0)"),
|
|
1274
|
+
counterAxisSpacing: token.optional().describe("Gap between wrapped rows (requires layoutWrap: WRAP)"),
|
|
1275
|
+
minWidth: import_zod4.z.coerce.number().optional().describe("Min width for responsive auto-layout"),
|
|
1276
|
+
maxWidth: import_zod4.z.coerce.number().optional().describe("Max width for responsive auto-layout"),
|
|
1277
|
+
minHeight: import_zod4.z.coerce.number().optional().describe("Min height for responsive auto-layout"),
|
|
1278
|
+
maxHeight: import_zod4.z.coerce.number().optional().describe("Max height for responsive auto-layout"),
|
|
1279
|
+
overflowDirection: import_zod4.z.enum(["NONE", "HORIZONTAL", "VERTICAL", "BOTH"]).optional().describe("Scroll overflow in prototype (default: NONE)"),
|
|
1280
|
+
componentIds: flexJson(import_zod4.z.array(import_zod4.z.string())).optional().describe("Existing component IDs to combine (min 2). Alternative to children."),
|
|
1281
|
+
variantPropertyName: import_zod4.z.string().optional().describe("Rename the auto-generated variant property (default: 'Property 1')"),
|
|
1282
|
+
children: flexJson(import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()))).optional().describe('Inline variant components. Each must be {type:"component", name, children?, ...frame_params}. All variants must share the same child structure. Alternative to componentIds \u2014 do not combine both.')
|
|
1283
|
+
}).passthrough()
|
|
1284
|
+
};
|
|
1285
|
+
const s = params.type && schemas[params.type];
|
|
1286
|
+
if (s) {
|
|
1287
|
+
try {
|
|
1288
|
+
params.items = import_zod4.z.array(s).parse(params.items);
|
|
1289
|
+
} catch (e) {
|
|
1290
|
+
if (e instanceof import_zod4.z.ZodError) {
|
|
1291
|
+
throw new Error(e.issues.map((i) => {
|
|
1292
|
+
const path = i.path.join(".");
|
|
1293
|
+
const shape = s instanceof import_zod4.z.ZodObject ? s.shape : null;
|
|
1294
|
+
const desc = shape?.[i.path[1]]?.description;
|
|
1295
|
+
return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
|
|
1296
|
+
}).join("; "));
|
|
1297
|
+
}
|
|
1298
|
+
throw e;
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
if (m === "update") {
|
|
1303
|
+
const itemSchema = import_zod4.z.object({
|
|
1304
|
+
id: import_zod4.z.string().describe("Component or component set ID"),
|
|
1305
|
+
propertyName: import_zod4.z.string().describe('Property name with #suffix for edit/delete (e.g. "Label#1:0"). Call components.get to find exact keys. For add, plain name works.'),
|
|
1306
|
+
action: import_zod4.z.enum(["add", "edit", "delete", "rename_variant"]).optional().describe('"add" (default): requires type + defaultValue. "edit": pass defaultValue to change default, name to rename property. "delete": just propertyName. "rename_variant": pass defaultValue=current option name, name=new option name.'),
|
|
1307
|
+
type: import_zod4.z.enum(["BOOLEAN", "TEXT", "INSTANCE_SWAP", "VARIANT"]).optional().describe("Property type (required for add)"),
|
|
1308
|
+
defaultValue: stringOrBoolean.optional().describe("Default value (add/edit). For rename_variant: the CURRENT option name to rename"),
|
|
1309
|
+
name: import_zod4.z.string().optional().describe("New name \u2014 for edit: renames the property itself, for rename_variant: the new option value name"),
|
|
1310
|
+
preferredValues: flexJson(import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()))).optional().describe("Preferred values for INSTANCE_SWAP")
|
|
1311
|
+
}).passthrough();
|
|
1312
|
+
try {
|
|
1313
|
+
params.items = import_zod4.z.array(itemSchema).parse(params.items);
|
|
1314
|
+
} catch (e) {
|
|
1315
|
+
if (e instanceof import_zod4.z.ZodError) {
|
|
1316
|
+
throw new Error(e.issues.map((i) => {
|
|
1317
|
+
const path = i.path.join(".");
|
|
1318
|
+
const shape = itemSchema instanceof import_zod4.z.ZodObject ? itemSchema.shape : null;
|
|
1319
|
+
const desc = shape?.[i.path[1]]?.description;
|
|
1320
|
+
return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
|
|
1321
|
+
}).join("; "));
|
|
1322
|
+
}
|
|
1323
|
+
throw e;
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
},
|
|
1327
|
+
commandMap: { "clone": "components.clone", "audit": "components.audit", "reparent": "components.reparent", "list": "components.list", "get": "components.get", "create": "components.create", "update": "components.update", "delete": "components.delete" }
|
|
289
1328
|
},
|
|
290
1329
|
{
|
|
291
|
-
name: "
|
|
292
|
-
description: "
|
|
293
|
-
schema:
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
name: import_zod7.z.string().optional().describe("Frame name (default: 'Frame')"),
|
|
302
|
-
x: xPos,
|
|
303
|
-
y: yPos,
|
|
304
|
-
width: import_zod7.z.coerce.number().optional().describe("Width (default: 100)"),
|
|
305
|
-
height: import_zod7.z.coerce.number().optional().describe("Height (default: 100)"),
|
|
306
|
-
parentId,
|
|
307
|
-
fillColor: flexJson(colorRgba).optional().describe("Fill color. Default: no fill."),
|
|
308
|
-
strokeColor: flexJson(colorRgba).optional().describe("Stroke color. Default: none."),
|
|
309
|
-
strokeWeight: import_zod7.z.coerce.number().positive().optional().describe("Stroke weight (default: 1)"),
|
|
310
|
-
cornerRadius: import_zod7.z.coerce.number().min(0).optional().describe("Corner radius (default: 0)"),
|
|
311
|
-
layoutMode: import_zod7.z.enum(["NONE", "HORIZONTAL", "VERTICAL"]).optional().describe("Auto-layout direction (default: NONE)"),
|
|
312
|
-
layoutWrap: import_zod7.z.enum(["NO_WRAP", "WRAP"]).optional().describe("Wrap (default: NO_WRAP)"),
|
|
313
|
-
paddingTop: import_zod7.z.coerce.number().optional().describe("Top padding (default: 0)"),
|
|
314
|
-
paddingRight: import_zod7.z.coerce.number().optional().describe("Right padding (default: 0)"),
|
|
315
|
-
paddingBottom: import_zod7.z.coerce.number().optional().describe("Bottom padding (default: 0)"),
|
|
316
|
-
paddingLeft: import_zod7.z.coerce.number().optional().describe("Left padding (default: 0)"),
|
|
317
|
-
primaryAxisAlignItems: import_zod7.z.enum(["MIN", "MAX", "CENTER", "SPACE_BETWEEN"]).optional(),
|
|
318
|
-
counterAxisAlignItems: import_zod7.z.enum(["MIN", "MAX", "CENTER", "BASELINE"]).optional(),
|
|
319
|
-
layoutSizingHorizontal: import_zod7.z.enum(["FIXED", "HUG", "FILL"]).optional(),
|
|
320
|
-
layoutSizingVertical: import_zod7.z.enum(["FIXED", "HUG", "FILL"]).optional(),
|
|
321
|
-
itemSpacing: import_zod7.z.coerce.number().optional().describe("Spacing between children (default: 0)"),
|
|
322
|
-
fillStyleName: import_zod7.z.string().optional().describe("Apply a fill paint style by name (case-insensitive). Omit to skip."),
|
|
323
|
-
strokeStyleName: import_zod7.z.string().optional().describe("Apply a stroke paint style by name. Omit to skip."),
|
|
324
|
-
fillVariableId: import_zod7.z.string().optional().describe("Bind a color variable to the fill. Creates a solid fill and binds the variable to fills/0/color."),
|
|
325
|
-
strokeVariableId: import_zod7.z.string().optional().describe("Bind a color variable to the stroke. Creates a solid stroke and binds the variable to strokes/0/color.")
|
|
326
|
-
});
|
|
327
|
-
var autoLayoutItem = import_zod7.z.object({
|
|
328
|
-
nodeIds: flexJson(import_zod7.z.array(import_zod7.z.string())).describe("Array of node IDs to wrap"),
|
|
329
|
-
name: import_zod7.z.string().optional().describe("Frame name (default: 'Auto Layout')"),
|
|
330
|
-
layoutMode: import_zod7.z.enum(["HORIZONTAL", "VERTICAL"]).optional().describe("Direction (default: VERTICAL)"),
|
|
331
|
-
itemSpacing: import_zod7.z.coerce.number().optional().describe("Spacing between children (default: 0)"),
|
|
332
|
-
paddingTop: import_zod7.z.coerce.number().optional().describe("Top padding (default: 0)"),
|
|
333
|
-
paddingRight: import_zod7.z.coerce.number().optional().describe("Right padding (default: 0)"),
|
|
334
|
-
paddingBottom: import_zod7.z.coerce.number().optional().describe("Bottom padding (default: 0)"),
|
|
335
|
-
paddingLeft: import_zod7.z.coerce.number().optional().describe("Left padding (default: 0)"),
|
|
336
|
-
primaryAxisAlignItems: import_zod7.z.enum(["MIN", "MAX", "CENTER", "SPACE_BETWEEN"]).optional(),
|
|
337
|
-
counterAxisAlignItems: import_zod7.z.enum(["MIN", "MAX", "CENTER", "BASELINE"]).optional(),
|
|
338
|
-
layoutSizingHorizontal: import_zod7.z.enum(["FIXED", "HUG", "FILL"]).optional(),
|
|
339
|
-
layoutSizingVertical: import_zod7.z.enum(["FIXED", "HUG", "FILL"]).optional(),
|
|
340
|
-
layoutWrap: import_zod7.z.enum(["NO_WRAP", "WRAP"]).optional()
|
|
341
|
-
});
|
|
342
|
-
var tools6 = [
|
|
343
|
-
{
|
|
344
|
-
name: "create_frame",
|
|
345
|
-
description: "Create frames in Figma. Batch supported. Use fillStyleName/fillVariableId and strokeStyleName/strokeVariableId instead of hardcoded colors \u2014 hardcoded values skip design tokens and will trigger lint warnings.",
|
|
346
|
-
schema: { items: flexJson(import_zod7.z.array(frameItem)).describe("Array of frames to create"), depth },
|
|
347
|
-
tier: "create"
|
|
1330
|
+
name: "connection",
|
|
1331
|
+
description: '/** Manage the Figma plugin connection. Use method "help" for detailed parameter docs. */\n create (channel?) \u2192 string // Join a relay channel (required first step before any other tool)\n get () \u2192 { status, documentName, currentPage, timestamp } // Verify end-to-end connection to Figma\n list () \u2192 unknown // Inspect which clients (MCP, plugin) are connected to each channel\n delete (channel?) \u2192 string // Disconnect all clients (MCP server and Figma plugin) from a channel and reset its state\n// Connection manages the WebSocket link between the MCP server and the Figma plugin.\n// Channels are named rooms \u2014 both the MCP server and Figma plugin must join the same channel to communicate.\n// Workflow: connection(method:"create") to join a channel \u2192 connection(method:"get") to verify Figma plugin is connected.\n// If get times out (5s), the Figma plugin is not running or not on the same channel.\n// list shows all active channels and their connected clients. delete factory-resets a channel.',
|
|
1332
|
+
schema: (caps2) => filterMethodsByTier({
|
|
1333
|
+
method: import_zod4.z.enum(["create", "get", "list", "delete", "help"]),
|
|
1334
|
+
channel: import_zod4.z.string().optional().default("vibma").describe("The channel name displayed in the Figma plugin panel. Defaults to 'vibma' if omitted."),
|
|
1335
|
+
topic: import_zod4.z.string().optional().describe('Help topic \u2014 method name for endpoint help, e.g. "create"')
|
|
1336
|
+
}, caps2, { "create": "read", "get": "read", "list": "read", "delete": "edit", "help": "read" }),
|
|
1337
|
+
tier: "read",
|
|
1338
|
+
timeout: 5e3,
|
|
1339
|
+
commandMap: { "create": "connection.create", "get": "connection.get", "list": "connection.list", "delete": "connection.delete" }
|
|
348
1340
|
},
|
|
349
1341
|
{
|
|
350
|
-
name: "
|
|
351
|
-
description:
|
|
352
|
-
schema:
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
fontColor: flexJson(colorRgba).optional().describe("Font color. Default: black."),
|
|
369
|
-
fontColorVariableId: import_zod8.z.string().optional().describe("Bind a color variable to the text fill instead of hardcoded fontColor."),
|
|
370
|
-
fontColorStyleName: import_zod8.z.string().optional().describe("Apply a paint style to the text fill by name (case-insensitive). Overrides fontColor."),
|
|
371
|
-
parentId,
|
|
372
|
-
textStyleId: import_zod8.z.string().optional().describe("Text style ID to apply (overrides fontSize/fontWeight). Omit to skip."),
|
|
373
|
-
textStyleName: import_zod8.z.string().optional().describe("Text style name (case-insensitive match). Omit to skip."),
|
|
374
|
-
textAlignHorizontal: import_zod8.z.enum(["LEFT", "CENTER", "RIGHT", "JUSTIFIED"]).optional().describe("Horizontal text alignment (default: LEFT)"),
|
|
375
|
-
textAlignVertical: import_zod8.z.enum(["TOP", "CENTER", "BOTTOM"]).optional().describe("Vertical text alignment (default: TOP)"),
|
|
376
|
-
layoutSizingHorizontal: import_zod8.z.enum(["FIXED", "HUG", "FILL"]).optional().describe("Horizontal sizing. FILL auto-sets textAutoResize to HEIGHT."),
|
|
377
|
-
layoutSizingVertical: import_zod8.z.enum(["FIXED", "HUG", "FILL"]).optional().describe("Vertical sizing (default: HUG)"),
|
|
378
|
-
textAutoResize: import_zod8.z.enum(["NONE", "WIDTH_AND_HEIGHT", "HEIGHT", "TRUNCATE"]).optional().describe("Text auto-resize behavior (default: WIDTH_AND_HEIGHT when FILL)")
|
|
379
|
-
});
|
|
380
|
-
var tools7 = [
|
|
381
|
-
{
|
|
382
|
-
name: "create_text",
|
|
383
|
-
description: "Create text nodes. Prefer textStyleName for typography and fontColorStyleName or fontColorVariableId for color \u2014 hardcoded values skip design tokens. Supports custom fonts via fontFamily.",
|
|
384
|
-
schema: { items: flexJson(import_zod8.z.array(textItem)).describe("Array of text nodes to create"), depth },
|
|
385
|
-
tier: "create"
|
|
386
|
-
}
|
|
387
|
-
];
|
|
388
|
-
|
|
389
|
-
// src/tools/defs/modify-node.ts
|
|
390
|
-
var import_zod9 = require("zod");
|
|
391
|
-
var deleteItem = import_zod9.z.object({
|
|
392
|
-
nodeId: import_zod9.z.string().describe("Node ID to delete")
|
|
393
|
-
});
|
|
394
|
-
var cloneItem = import_zod9.z.object({
|
|
395
|
-
nodeId: import_zod9.z.string().describe("Node ID to clone"),
|
|
396
|
-
parentId: import_zod9.z.string().optional().describe("Parent for the clone (e.g. a page ID). Defaults to same parent as original."),
|
|
397
|
-
x: import_zod9.z.coerce.number().optional().describe("New X for clone. Omit to keep original position."),
|
|
398
|
-
y: import_zod9.z.coerce.number().optional().describe("New Y for clone. Omit to keep original position.")
|
|
399
|
-
});
|
|
400
|
-
var insertItem = import_zod9.z.object({
|
|
401
|
-
parentId: import_zod9.z.string().describe("Parent node ID"),
|
|
402
|
-
childId: import_zod9.z.string().describe("Child node ID to move"),
|
|
403
|
-
index: import_zod9.z.coerce.number().optional().describe("Index to insert at (0=first). Omit to append.")
|
|
404
|
-
});
|
|
405
|
-
var tools8 = [
|
|
406
|
-
{
|
|
407
|
-
name: "delete_node",
|
|
408
|
-
description: "Delete nodes. Batch: pass multiple items.",
|
|
409
|
-
schema: { items: flexJson(import_zod9.z.array(deleteItem)).describe("Array of {nodeId}") },
|
|
410
|
-
tier: "edit"
|
|
1342
|
+
name: "document",
|
|
1343
|
+
description: '/** Navigate and manage Figma pages (canvases) in the document. Use method "help" for detailed parameter docs. */\n get () \u2192 { id, name, backgroundColor?, children: NodeStub[] } // Get current page with top-level children\n list () \u2192 { name, currentPageId, pages } // Get document name and list all pages\n set (pageId?, pageName?) \u2192 { id, name } // Switch to a page by ID or name. At least one of pageId or pageName must be provided.\n create (name?) \u2192 { id } // Create a new page\n update (newName, pageId?) \u2192 string // Rename a page\n// A Figma document contains pages \u2014 each page is an independent canvas with its own node tree.\n// The "current page" is where all node operations happen. Use document.set to switch pages before working with nodes.\n// Page IDs look like "0:1", "1:1", etc. The first page is always "0:1".\n// get returns the current page with its top-level children as stubs. list returns all pages in the document.\n// Shared types:\n// NodeStub: {id: string, name: string, type: string}',
|
|
1344
|
+
schema: (caps2) => filterMethodsByTier({
|
|
1345
|
+
method: import_zod4.z.enum(["get", "list", "set", "create", "update", "help"]),
|
|
1346
|
+
pageId: import_zod4.z.string().optional().describe("Page ID"),
|
|
1347
|
+
pageName: import_zod4.z.string().optional().describe("Page name (case-insensitive, substring match)"),
|
|
1348
|
+
name: import_zod4.z.string().optional().describe("Page name (default: 'New Page')"),
|
|
1349
|
+
newName: import_zod4.z.string().optional().describe("New page name"),
|
|
1350
|
+
topic: import_zod4.z.string().optional().describe('Help topic \u2014 method name for endpoint help, e.g. "create"')
|
|
1351
|
+
}, caps2, { "get": "read", "list": "read", "set": "read", "create": "create", "update": "edit", "help": "read" }),
|
|
1352
|
+
tier: "read",
|
|
1353
|
+
validate: (params) => {
|
|
1354
|
+
const m = params.method;
|
|
1355
|
+
if (m === "update") {
|
|
1356
|
+
if (params.newName === void 0) throw new Error('update requires "newName"');
|
|
1357
|
+
}
|
|
1358
|
+
},
|
|
1359
|
+
commandMap: { "get": "document.get", "list": "document.list", "set": "document.set", "create": "document.create", "update": "document.update" }
|
|
411
1360
|
},
|
|
412
1361
|
{
|
|
413
|
-
name: "
|
|
414
|
-
description: "
|
|
415
|
-
schema:
|
|
416
|
-
|
|
1362
|
+
name: "fonts",
|
|
1363
|
+
description: '/** Search available fonts in Figma. Use method "help" for detailed parameter docs. */\n list (query?, includeStyles?, offset?, limit?) \u2192 { count, fonts } // List available font families, optionally filtered by name\n// Returns font family names installed in the Figma environment. Use to verify a fontFamily before text.create or styles.create.\n// query filters by family name substring (case-insensitive), e.g. query:"inter" matches "Inter", "Inter Tight".',
|
|
1364
|
+
schema: (caps2) => filterMethodsByTier({
|
|
1365
|
+
method: import_zod4.z.enum(["list", "help"]),
|
|
1366
|
+
query: import_zod4.z.string().optional().describe("Filter by family name (case-insensitive substring)"),
|
|
1367
|
+
includeStyles: flexBool(import_zod4.z.boolean()).optional().describe("Include available styles per family (default: false)"),
|
|
1368
|
+
offset: import_zod4.z.coerce.number().optional().default(0).describe("Skip N items for pagination (default 0)"),
|
|
1369
|
+
limit: import_zod4.z.coerce.number().optional().default(100).describe("Max items per page (default 100)"),
|
|
1370
|
+
topic: import_zod4.z.string().optional().describe('Help topic \u2014 method name for endpoint help, e.g. "create"')
|
|
1371
|
+
}, caps2, { "list": "read", "help": "read" }),
|
|
1372
|
+
tier: "read",
|
|
1373
|
+
commandMap: { "list": "fonts.list" }
|
|
417
1374
|
},
|
|
418
1375
|
{
|
|
419
|
-
name: "
|
|
420
|
-
description: "Move nodes into a parent
|
|
421
|
-
schema:
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
]
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
})
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
1376
|
+
name: "frames",
|
|
1377
|
+
description: '/** Create and manage frames, shapes, auto-layout containers, sections, and SVG nodes. Use method "help" for detailed parameter docs. */\n get (id, fields?, depth?, verbose?) \u2192 { results: Node[], _truncated?, _notice? } // Get serialized node data\n list (query?, types?, parentId?, fields?, offset?, limit?) \u2192 { totalCount, returned?, offset?, limit?, results } // Search for nodes (returns stubs only \u2014 use get with depth for full properties)\n update (items: PatchItem[]) \u2192 { results: ("ok" | {error})[] } // Patch node properties\n delete (id?, items?: { id?: string }[]) \u2192 { results: "ok"[] } // Delete nodes\n clone (id, parentId?, x?, y?, depth?) \u2192 { results: {id}[] } // Duplicate nodes\n audit (id, rules?, maxDepth?, maxFindings?) \u2192 { nodeId?, nodeName?, categories? } // Run lint on a node \u2014 returns severity-ranked findings\n reparent (items: { id: string; parentId: string; index?: number }[]) \u2192 { results: "ok"[] } // Move nodes into a new parent\n create (type: frame|auto_layout|section|rectangle|ellipse|line|group|boolean_operation|svg, items: (FrameItem | AutoLayoutItem | SectionItem | RectangleItem | EllipseItem | LineItem | GroupItem | BooleanOperationItem | SvgItem)[]) \u2192 { results: {id}[] } // Create frame-like containers\n export (id, format?: PNG|JPG|SVG|SVG_STRING|PDF, scale?) \u2192 { imageData?, mimeType? } // Export a node as PNG, JPG, SVG, SVG_STRING, or PDF\n// depth: omit \u2192 id+name stubs | 0 \u2192 props + child stubs | N \u2192 recurse N | -1 \u2192 full tree\n// fields: whitelist e.g. ["fills","opacity"] \u2014 id, name, type always included. Pass ["*"] for all.\n// layoutSizingHorizontal/Vertical: FIXED | HUG | FILL \u2014 how the node sizes within auto-layout.\n// Colors: fillVariableName/strokeVariableName bind by name \u2014 preferred over raw color values.\n// Note: node-based endpoints (frames, text, instances, components) use `results` as the list key.\n// Standalone endpoints (styles, variables, variable_collections) use `items`. Components.list uses `items` (catalog view).',
|
|
1378
|
+
schema: (caps2) => filterMethodsByTier({
|
|
1379
|
+
method: import_zod4.z.enum(["get", "list", "update", "delete", "clone", "audit", "reparent", "create", "export", "help"]),
|
|
1380
|
+
id: import_zod4.z.string().optional().describe("Node ID"),
|
|
1381
|
+
fields: flexJson(import_zod4.z.array(import_zod4.z.string())).optional().describe('Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass ["*"] for all.'),
|
|
1382
|
+
depth: import_zod4.z.coerce.number().optional().describe("Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited."),
|
|
1383
|
+
verbose: import_zod4.z.boolean().optional().describe("Include all properties (bounding box, constraints, text style details). Default false \u2014 returns slim, actionable output."),
|
|
1384
|
+
query: import_zod4.z.string().optional().describe("Name search query (case-insensitive substring match)"),
|
|
1385
|
+
types: flexJson(import_zod4.z.array(import_zod4.z.string())).optional().describe('Filter by node types (e.g. ["FRAME", "TEXT"])'),
|
|
1386
|
+
parentId: import_zod4.z.string().optional().describe("Search only within this subtree"),
|
|
1387
|
+
offset: import_zod4.z.coerce.number().optional().default(0).describe("Skip N items for pagination (default 0)"),
|
|
1388
|
+
limit: import_zod4.z.coerce.number().optional().default(100).describe("Max items per page (default 100)"),
|
|
1389
|
+
items: flexJson(import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()))).optional().describe("Array of {id, ...properties} to update/delete/reparent"),
|
|
1390
|
+
x: import_zod4.z.coerce.number().optional().describe("X position (default: 0)"),
|
|
1391
|
+
y: import_zod4.z.coerce.number().optional().describe("Y position (default: 0)"),
|
|
1392
|
+
rules: flexJson(import_zod4.z.array(import_zod4.z.string())).optional().describe('Rules to check. Default: ["all"]. Categories: "component", "composition", "token", "naming", "wcag".'),
|
|
1393
|
+
maxDepth: import_zod4.z.coerce.number().optional().describe("Max tree depth (default: 10)"),
|
|
1394
|
+
maxFindings: import_zod4.z.coerce.number().optional().describe("Max findings (default: 50)"),
|
|
1395
|
+
type: import_zod4.z.enum(["frame", "auto_layout", "section", "rectangle", "ellipse", "line", "group", "boolean_operation", "svg"]).optional().describe("Discriminant for create method"),
|
|
1396
|
+
format: import_zod4.z.enum(["PNG", "JPG", "SVG", "SVG_STRING", "PDF"]).optional().describe("Export format (default: PNG). SVG_STRING returns raw SVG text."),
|
|
1397
|
+
scale: import_zod4.z.coerce.number().optional().describe("Export scale (default: 1, only for PNG/JPG)"),
|
|
1398
|
+
topic: import_zod4.z.string().optional().describe('Help topic \u2014 method name for endpoint help, e.g. "create"')
|
|
1399
|
+
}, caps2, { "get": "read", "list": "read", "update": "edit", "delete": "edit", "clone": "create", "audit": "read", "reparent": "edit", "create": "create", "export": "read", "help": "read" }),
|
|
1400
|
+
tier: "read",
|
|
1401
|
+
validate: (params) => {
|
|
1402
|
+
const m = params.method;
|
|
1403
|
+
if (m === "export") {
|
|
1404
|
+
if (params.id === void 0) throw new Error('export requires "id"');
|
|
1405
|
+
}
|
|
1406
|
+
if (!params.items) return;
|
|
1407
|
+
if (m === "create") {
|
|
1408
|
+
const schemas = {
|
|
1409
|
+
"frame": import_zod4.z.object({
|
|
1410
|
+
name: import_zod4.z.string().optional().describe("Node name"),
|
|
1411
|
+
parentId: import_zod4.z.string().optional().describe("Parent node ID. Omit to place on current page."),
|
|
1412
|
+
x: import_zod4.z.coerce.number().optional().describe("X position (default: 0)"),
|
|
1413
|
+
y: import_zod4.z.coerce.number().optional().describe("Y position (default: 0)"),
|
|
1414
|
+
width: import_zod4.z.coerce.number().optional().describe("Width in px (omit to shrink-to-content via HUG)"),
|
|
1415
|
+
height: import_zod4.z.coerce.number().optional().describe("Height in px (omit to shrink-to-content via HUG)"),
|
|
1416
|
+
rotation: import_zod4.z.coerce.number().optional().describe("Rotation in degrees (0-360)"),
|
|
1417
|
+
opacity: token.optional().describe("Opacity (0-1) or variable name"),
|
|
1418
|
+
visible: flexBool(import_zod4.z.boolean()).optional().describe("Show/hide (default true)"),
|
|
1419
|
+
locked: flexBool(import_zod4.z.boolean()).optional().describe("Lock/unlock (default false)"),
|
|
1420
|
+
blendMode: import_zod4.z.enum(["PASS_THROUGH", "NORMAL", "DARKEN", "MULTIPLY", "LINEAR_BURN", "COLOR_BURN", "LIGHTEN", "SCREEN", "LINEAR_DODGE", "COLOR_DODGE", "OVERLAY", "SOFT_LIGHT", "HARD_LIGHT", "DIFFERENCE", "EXCLUSION", "HUE", "SATURATION", "COLOR", "LUMINOSITY"]).optional(),
|
|
1421
|
+
layoutPositioning: import_zod4.z.enum(["AUTO", "ABSOLUTE"]).optional().describe("ABSOLUTE = floating inside auto-layout parent"),
|
|
1422
|
+
fills: import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown())).optional().describe("Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills."),
|
|
1423
|
+
fillColor: colorRgba.optional().describe("Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)"),
|
|
1424
|
+
fillStyleName: import_zod4.z.string().optional().describe("Paint style name for fill"),
|
|
1425
|
+
fillVariableName: import_zod4.z.string().optional().describe("Color variable by name e.g. 'bg/primary'"),
|
|
1426
|
+
strokes: import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown())).optional().describe("Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes."),
|
|
1427
|
+
strokeColor: colorRgba.optional().describe("Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)"),
|
|
1428
|
+
strokeStyleName: import_zod4.z.string().optional().describe("Paint style name for stroke"),
|
|
1429
|
+
strokeVariableName: import_zod4.z.string().optional().describe("Color variable by name for stroke"),
|
|
1430
|
+
strokeWeight: token.optional().describe("All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight."),
|
|
1431
|
+
strokeTopWeight: token.optional(),
|
|
1432
|
+
strokeBottomWeight: token.optional(),
|
|
1433
|
+
strokeLeftWeight: token.optional(),
|
|
1434
|
+
strokeRightWeight: token.optional(),
|
|
1435
|
+
strokeAlign: import_zod4.z.enum(["INSIDE", "OUTSIDE", "CENTER"]).optional().describe("Stroke position (default: INSIDE)"),
|
|
1436
|
+
strokesIncludedInLayout: flexBool(import_zod4.z.boolean()).optional().describe("Include stroke width in layout measurements (default: false)"),
|
|
1437
|
+
cornerRadius: token.optional().describe("All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius."),
|
|
1438
|
+
topLeftRadius: token.optional(),
|
|
1439
|
+
topRightRadius: token.optional(),
|
|
1440
|
+
bottomRightRadius: token.optional(),
|
|
1441
|
+
bottomLeftRadius: token.optional(),
|
|
1442
|
+
effectStyleName: import_zod4.z.string().optional().describe("Effect style name (e.g. 'Shadow/Card') for shadows, blurs"),
|
|
1443
|
+
layoutMode: import_zod4.z.enum(["NONE", "HORIZONTAL", "VERTICAL"]).optional().describe("Layout direction (default: auto \u2014 NONE when width+height set, otherwise inferred from layout props)"),
|
|
1444
|
+
layoutWrap: import_zod4.z.enum(["NO_WRAP", "WRAP"]).optional(),
|
|
1445
|
+
padding: token.optional().describe("All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft."),
|
|
1446
|
+
paddingTop: token.optional(),
|
|
1447
|
+
paddingRight: token.optional(),
|
|
1448
|
+
paddingBottom: token.optional(),
|
|
1449
|
+
paddingLeft: token.optional(),
|
|
1450
|
+
primaryAxisAlignItems: import_zod4.z.enum(["MIN", "MAX", "CENTER", "SPACE_BETWEEN"]).optional(),
|
|
1451
|
+
counterAxisAlignItems: import_zod4.z.enum(["MIN", "MAX", "CENTER", "BASELINE"]).optional(),
|
|
1452
|
+
layoutSizingHorizontal: import_zod4.z.enum(["FIXED", "HUG", "FILL"]).optional(),
|
|
1453
|
+
layoutSizingVertical: import_zod4.z.enum(["FIXED", "HUG", "FILL"]).optional(),
|
|
1454
|
+
itemSpacing: token.optional().describe("Spacing between children (number or variable name string, default: 0)"),
|
|
1455
|
+
counterAxisSpacing: token.optional().describe("Gap between wrapped rows (requires layoutWrap: WRAP)"),
|
|
1456
|
+
minWidth: import_zod4.z.coerce.number().optional().describe("Min width for responsive auto-layout"),
|
|
1457
|
+
maxWidth: import_zod4.z.coerce.number().optional().describe("Max width for responsive auto-layout"),
|
|
1458
|
+
minHeight: import_zod4.z.coerce.number().optional().describe("Min height for responsive auto-layout"),
|
|
1459
|
+
maxHeight: import_zod4.z.coerce.number().optional().describe("Max height for responsive auto-layout"),
|
|
1460
|
+
overflowDirection: import_zod4.z.enum(["NONE", "HORIZONTAL", "VERTICAL", "BOTH"]).optional().describe("Scroll overflow in prototype (default: NONE)"),
|
|
1461
|
+
clipsContent: flexBool(import_zod4.z.boolean()).optional(),
|
|
1462
|
+
children: flexJson(import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()))).optional().describe('Inline child nodes. Text: {type:"text", text, fontFamily?, fontSize?, fontColor?}. Frame: {type:"frame", name?, layoutMode?, fillColor?, children?}. Instance: {type:"instance", componentId, variantProperties?, properties?}. Component: {type:"component", name, children?}. Inside components: add componentPropertyName to auto-bind TEXT or INSTANCE_SWAP properties.')
|
|
1463
|
+
}).passthrough(),
|
|
1464
|
+
"auto_layout": import_zod4.z.object({
|
|
1465
|
+
name: import_zod4.z.string().optional().describe("Node name"),
|
|
1466
|
+
parentId: import_zod4.z.string().optional().describe("Parent node ID. Omit to place on current page."),
|
|
1467
|
+
x: import_zod4.z.coerce.number().optional().describe("X position (default: 0)"),
|
|
1468
|
+
y: import_zod4.z.coerce.number().optional().describe("Y position (default: 0)"),
|
|
1469
|
+
width: import_zod4.z.coerce.number().optional().describe("Width in px (omit to shrink-to-content via HUG)"),
|
|
1470
|
+
height: import_zod4.z.coerce.number().optional().describe("Height in px (omit to shrink-to-content via HUG)"),
|
|
1471
|
+
rotation: import_zod4.z.coerce.number().optional().describe("Rotation in degrees (0-360)"),
|
|
1472
|
+
opacity: token.optional().describe("Opacity (0-1) or variable name"),
|
|
1473
|
+
visible: flexBool(import_zod4.z.boolean()).optional().describe("Show/hide (default true)"),
|
|
1474
|
+
locked: flexBool(import_zod4.z.boolean()).optional().describe("Lock/unlock (default false)"),
|
|
1475
|
+
blendMode: import_zod4.z.enum(["PASS_THROUGH", "NORMAL", "DARKEN", "MULTIPLY", "LINEAR_BURN", "COLOR_BURN", "LIGHTEN", "SCREEN", "LINEAR_DODGE", "COLOR_DODGE", "OVERLAY", "SOFT_LIGHT", "HARD_LIGHT", "DIFFERENCE", "EXCLUSION", "HUE", "SATURATION", "COLOR", "LUMINOSITY"]).optional(),
|
|
1476
|
+
layoutPositioning: import_zod4.z.enum(["AUTO", "ABSOLUTE"]).optional().describe("ABSOLUTE = floating inside auto-layout parent"),
|
|
1477
|
+
fills: import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown())).optional().describe("Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills."),
|
|
1478
|
+
fillColor: colorRgba.optional().describe("Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)"),
|
|
1479
|
+
fillStyleName: import_zod4.z.string().optional().describe("Paint style name for fill"),
|
|
1480
|
+
fillVariableName: import_zod4.z.string().optional().describe("Color variable by name e.g. 'bg/primary'"),
|
|
1481
|
+
strokes: import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown())).optional().describe("Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes."),
|
|
1482
|
+
strokeColor: colorRgba.optional().describe("Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)"),
|
|
1483
|
+
strokeStyleName: import_zod4.z.string().optional().describe("Paint style name for stroke"),
|
|
1484
|
+
strokeVariableName: import_zod4.z.string().optional().describe("Color variable by name for stroke"),
|
|
1485
|
+
strokeWeight: token.optional().describe("All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight."),
|
|
1486
|
+
strokeTopWeight: token.optional(),
|
|
1487
|
+
strokeBottomWeight: token.optional(),
|
|
1488
|
+
strokeLeftWeight: token.optional(),
|
|
1489
|
+
strokeRightWeight: token.optional(),
|
|
1490
|
+
strokeAlign: import_zod4.z.enum(["INSIDE", "OUTSIDE", "CENTER"]).optional().describe("Stroke position (default: INSIDE)"),
|
|
1491
|
+
strokesIncludedInLayout: flexBool(import_zod4.z.boolean()).optional().describe("Include stroke width in layout measurements (default: false)"),
|
|
1492
|
+
cornerRadius: token.optional().describe("All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius."),
|
|
1493
|
+
topLeftRadius: token.optional(),
|
|
1494
|
+
topRightRadius: token.optional(),
|
|
1495
|
+
bottomRightRadius: token.optional(),
|
|
1496
|
+
bottomLeftRadius: token.optional(),
|
|
1497
|
+
effectStyleName: import_zod4.z.string().optional().describe("Effect style name (e.g. 'Shadow/Card') for shadows, blurs"),
|
|
1498
|
+
layoutMode: import_zod4.z.enum(["HORIZONTAL", "VERTICAL"]).describe("Primary axis direction"),
|
|
1499
|
+
layoutWrap: import_zod4.z.enum(["NO_WRAP", "WRAP"]).optional(),
|
|
1500
|
+
padding: token.optional().describe("All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft."),
|
|
1501
|
+
paddingTop: token.optional(),
|
|
1502
|
+
paddingRight: token.optional(),
|
|
1503
|
+
paddingBottom: token.optional(),
|
|
1504
|
+
paddingLeft: token.optional(),
|
|
1505
|
+
primaryAxisAlignItems: import_zod4.z.enum(["MIN", "MAX", "CENTER", "SPACE_BETWEEN"]).optional(),
|
|
1506
|
+
counterAxisAlignItems: import_zod4.z.enum(["MIN", "MAX", "CENTER", "BASELINE"]).optional(),
|
|
1507
|
+
layoutSizingHorizontal: import_zod4.z.enum(["FIXED", "HUG", "FILL"]).optional(),
|
|
1508
|
+
layoutSizingVertical: import_zod4.z.enum(["FIXED", "HUG", "FILL"]).optional(),
|
|
1509
|
+
itemSpacing: token.optional().describe("Spacing between children (number or variable name string, default: 0)"),
|
|
1510
|
+
counterAxisSpacing: token.optional().describe("Gap between wrapped rows (requires layoutWrap: WRAP)"),
|
|
1511
|
+
minWidth: import_zod4.z.coerce.number().optional().describe("Min width for responsive auto-layout"),
|
|
1512
|
+
maxWidth: import_zod4.z.coerce.number().optional().describe("Max width for responsive auto-layout"),
|
|
1513
|
+
minHeight: import_zod4.z.coerce.number().optional().describe("Min height for responsive auto-layout"),
|
|
1514
|
+
maxHeight: import_zod4.z.coerce.number().optional().describe("Max height for responsive auto-layout"),
|
|
1515
|
+
overflowDirection: import_zod4.z.enum(["NONE", "HORIZONTAL", "VERTICAL", "BOTH"]).optional().describe("Scroll overflow in prototype (default: NONE)"),
|
|
1516
|
+
clipsContent: flexBool(import_zod4.z.boolean()).optional(),
|
|
1517
|
+
nodeIds: flexJson(import_zod4.z.array(import_zod4.z.string())).optional().describe("Existing node IDs to wrap into auto-layout"),
|
|
1518
|
+
children: flexJson(import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()))).optional().describe('Inline child nodes. Text: {type:"text", text, fontFamily?, fontSize?, fontColor?}. Frame: {type:"frame", name?, layoutMode?, fillColor?, children?}. Instance: {type:"instance", componentId, variantProperties?, properties?}. Component: {type:"component", name, children?}. Inside components: add componentPropertyName to auto-bind TEXT or INSTANCE_SWAP properties.')
|
|
1519
|
+
}).passthrough(),
|
|
1520
|
+
"section": import_zod4.z.object({
|
|
1521
|
+
name: import_zod4.z.string().describe("Section name"),
|
|
1522
|
+
parentId: import_zod4.z.string().optional().describe("Parent node ID. Omit to place on current page."),
|
|
1523
|
+
x: import_zod4.z.coerce.number().optional().describe("X position (default: 0)"),
|
|
1524
|
+
y: import_zod4.z.coerce.number().optional().describe("Y position (default: 0)"),
|
|
1525
|
+
width: import_zod4.z.coerce.number().optional().describe("Width (default: 500)"),
|
|
1526
|
+
height: import_zod4.z.coerce.number().optional().describe("Height (default: 500)"),
|
|
1527
|
+
fills: import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown())).optional().describe("Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent"),
|
|
1528
|
+
fillColor: colorRgba.optional().describe("Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)"),
|
|
1529
|
+
fillStyleName: import_zod4.z.string().optional().describe("Paint style name for fill"),
|
|
1530
|
+
fillVariableName: import_zod4.z.string().optional().describe("Color variable by name e.g. 'bg/primary'")
|
|
1531
|
+
}).passthrough(),
|
|
1532
|
+
"rectangle": import_zod4.z.object({
|
|
1533
|
+
name: import_zod4.z.string().optional().describe("Layer name (default: 'Rectangle')"),
|
|
1534
|
+
parentId: import_zod4.z.string().optional().describe("Parent node ID. Omit to place on current page."),
|
|
1535
|
+
x: import_zod4.z.coerce.number().optional().describe("X position (default: 0)"),
|
|
1536
|
+
y: import_zod4.z.coerce.number().optional().describe("Y position (default: 0)"),
|
|
1537
|
+
width: import_zod4.z.coerce.number().optional().describe("Width in px (default: 100)"),
|
|
1538
|
+
height: import_zod4.z.coerce.number().optional().describe("Height in px (default: 100)"),
|
|
1539
|
+
fills: import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown())).optional().describe("Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent"),
|
|
1540
|
+
fillColor: colorRgba.optional().describe("Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)"),
|
|
1541
|
+
fillStyleName: import_zod4.z.string().optional().describe("Paint style name for fill"),
|
|
1542
|
+
fillVariableName: import_zod4.z.string().optional().describe("Color variable by name e.g. 'bg/primary'"),
|
|
1543
|
+
strokes: import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown())).optional().describe("Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear"),
|
|
1544
|
+
strokeColor: colorRgba.optional().describe("Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)"),
|
|
1545
|
+
strokeVariableName: import_zod4.z.string().optional().describe("Color variable by name for stroke"),
|
|
1546
|
+
strokeWeight: token.optional(),
|
|
1547
|
+
cornerRadius: token.optional().describe("All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius."),
|
|
1548
|
+
topLeftRadius: token.optional(),
|
|
1549
|
+
topRightRadius: token.optional(),
|
|
1550
|
+
bottomRightRadius: token.optional(),
|
|
1551
|
+
bottomLeftRadius: token.optional(),
|
|
1552
|
+
opacity: token.optional(),
|
|
1553
|
+
layoutSizingHorizontal: import_zod4.z.enum(["FIXED", "FILL"]).optional().describe("Horizontal sizing in auto-layout parent"),
|
|
1554
|
+
layoutSizingVertical: import_zod4.z.enum(["FIXED", "FILL"]).optional().describe("Vertical sizing in auto-layout parent")
|
|
1555
|
+
}).passthrough(),
|
|
1556
|
+
"ellipse": import_zod4.z.object({
|
|
1557
|
+
name: import_zod4.z.string().optional().describe("Layer name (default: 'Ellipse')"),
|
|
1558
|
+
parentId: import_zod4.z.string().optional().describe("Parent node ID. Omit to place on current page."),
|
|
1559
|
+
x: import_zod4.z.coerce.number().optional().describe("X position (default: 0)"),
|
|
1560
|
+
y: import_zod4.z.coerce.number().optional().describe("Y position (default: 0)"),
|
|
1561
|
+
width: import_zod4.z.coerce.number().optional().describe("Width in px (default: 100)"),
|
|
1562
|
+
height: import_zod4.z.coerce.number().optional().describe("Height in px (default: 100, same as width for circle)"),
|
|
1563
|
+
fills: import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown())).optional().describe("Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent"),
|
|
1564
|
+
fillColor: colorRgba.optional().describe("Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)"),
|
|
1565
|
+
fillStyleName: import_zod4.z.string().optional().describe("Paint style name for fill"),
|
|
1566
|
+
fillVariableName: import_zod4.z.string().optional().describe("Color variable by name e.g. 'bg/primary'"),
|
|
1567
|
+
strokes: import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown())).optional().describe("Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear"),
|
|
1568
|
+
strokeColor: colorRgba.optional().describe("Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)"),
|
|
1569
|
+
strokeVariableName: import_zod4.z.string().optional().describe("Color variable by name for stroke"),
|
|
1570
|
+
strokeWeight: token.optional(),
|
|
1571
|
+
opacity: token.optional(),
|
|
1572
|
+
layoutSizingHorizontal: import_zod4.z.enum(["FIXED", "FILL"]).optional().describe("Horizontal sizing in auto-layout parent"),
|
|
1573
|
+
layoutSizingVertical: import_zod4.z.enum(["FIXED", "FILL"]).optional().describe("Vertical sizing in auto-layout parent")
|
|
1574
|
+
}).passthrough(),
|
|
1575
|
+
"line": import_zod4.z.object({
|
|
1576
|
+
name: import_zod4.z.string().optional().describe("Layer name (default: 'Line')"),
|
|
1577
|
+
parentId: import_zod4.z.string().optional().describe("Parent node ID. Omit to place on current page."),
|
|
1578
|
+
x: import_zod4.z.coerce.number().optional().describe("X position (default: 0)"),
|
|
1579
|
+
y: import_zod4.z.coerce.number().optional().describe("Y position (default: 0)"),
|
|
1580
|
+
length: import_zod4.z.coerce.number().optional().describe("Line length in px (default: 100)"),
|
|
1581
|
+
rotation: import_zod4.z.coerce.number().optional().describe("Rotation in degrees (default: 0 = horizontal)"),
|
|
1582
|
+
strokes: import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown())).optional().describe("Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear"),
|
|
1583
|
+
strokeColor: colorRgba.optional().describe("Line color (default: black, auto-binds to matching variable/style)"),
|
|
1584
|
+
strokeVariableName: import_zod4.z.string().optional().describe("Color variable by name for stroke"),
|
|
1585
|
+
strokeWeight: token.optional().describe("Line thickness (default: 1)"),
|
|
1586
|
+
opacity: token.optional(),
|
|
1587
|
+
layoutSizingHorizontal: import_zod4.z.enum(["FIXED", "FILL"]).optional().describe("Horizontal sizing in auto-layout parent (defaults to FILL in vertical auto-layout)")
|
|
1588
|
+
}).passthrough(),
|
|
1589
|
+
"group": import_zod4.z.object({
|
|
1590
|
+
nodeIds: import_zod4.z.array(import_zod4.z.string()).describe("Node IDs to group (min 1)"),
|
|
1591
|
+
name: import_zod4.z.string().optional().describe("Group name"),
|
|
1592
|
+
parentId: import_zod4.z.string().optional().describe("Parent node ID. Omit to place on current page.")
|
|
1593
|
+
}).passthrough(),
|
|
1594
|
+
"boolean_operation": import_zod4.z.object({
|
|
1595
|
+
operation: import_zod4.z.enum(["UNION", "SUBTRACT", "INTERSECT", "EXCLUDE"]).describe("Boolean operation type"),
|
|
1596
|
+
nodeIds: import_zod4.z.array(import_zod4.z.string()).describe("Node IDs to combine (min 2, first node is the base for SUBTRACT)"),
|
|
1597
|
+
name: import_zod4.z.string().optional().describe("Result node name"),
|
|
1598
|
+
parentId: import_zod4.z.string().optional().describe("Parent node ID. Omit to place on current page.")
|
|
1599
|
+
}).passthrough(),
|
|
1600
|
+
"svg": import_zod4.z.object({
|
|
1601
|
+
svg: import_zod4.z.string().describe("SVG markup string"),
|
|
1602
|
+
name: import_zod4.z.string().optional().describe("Layer name (default: 'SVG')"),
|
|
1603
|
+
parentId: import_zod4.z.string().optional().describe("Parent node ID. Omit to place on current page."),
|
|
1604
|
+
x: import_zod4.z.coerce.number().optional().describe("X position (default: 0)"),
|
|
1605
|
+
y: import_zod4.z.coerce.number().optional().describe("Y position (default: 0)"),
|
|
1606
|
+
fillStyleName: import_zod4.z.string().optional().describe("Paint style to apply to vector fills"),
|
|
1607
|
+
fillVariableName: import_zod4.z.string().optional().describe("Color variable by name for vector fills"),
|
|
1608
|
+
strokeStyleName: import_zod4.z.string().optional().describe("Paint style to apply to vector strokes"),
|
|
1609
|
+
strokeVariableName: import_zod4.z.string().optional().describe("Color variable by name for vector strokes")
|
|
1610
|
+
}).passthrough()
|
|
1611
|
+
};
|
|
1612
|
+
const s = params.type && schemas[params.type];
|
|
1613
|
+
if (s) {
|
|
1614
|
+
try {
|
|
1615
|
+
params.items = import_zod4.z.array(s).parse(params.items);
|
|
1616
|
+
} catch (e) {
|
|
1617
|
+
if (e instanceof import_zod4.z.ZodError) {
|
|
1618
|
+
throw new Error(e.issues.map((i) => {
|
|
1619
|
+
const path = i.path.join(".");
|
|
1620
|
+
const shape = s instanceof import_zod4.z.ZodObject ? s.shape : null;
|
|
1621
|
+
const desc = shape?.[i.path[1]]?.description;
|
|
1622
|
+
return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
|
|
1623
|
+
}).join("; "));
|
|
1624
|
+
}
|
|
1625
|
+
throw e;
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
},
|
|
1630
|
+
commandMap: { "get": "frames.get", "list": "frames.list", "update": "frames.update", "delete": "frames.delete", "clone": "frames.clone", "audit": "frames.audit", "reparent": "frames.reparent", "create": "frames.create", "export": "frames.export" }
|
|
527
1631
|
},
|
|
528
1632
|
{
|
|
529
|
-
name: "
|
|
530
|
-
description: "
|
|
531
|
-
schema:
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
]
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
1633
|
+
name: "instances",
|
|
1634
|
+
description: '/** Create and manage component instances. Use method "help" for detailed parameter docs. */\n list (query?, types?, parentId?, fields?, offset?, limit?) \u2192 { totalCount, returned?, offset?, limit?, results } // Search for nodes (returns stubs only \u2014 use get with depth for full properties)\n delete (id?, items?: { id?: string }[]) \u2192 { results: "ok"[] } // Delete nodes\n clone (id, parentId?, x?, y?, depth?) \u2192 { results: {id}[] } // Duplicate nodes\n audit (id, rules?, maxDepth?, maxFindings?) \u2192 { nodeId?, nodeName?, categories? } // Run lint on a node \u2014 returns severity-ranked findings\n reparent (items: { id: string; parentId: string; index?: number }[]) \u2192 { results: "ok"[] } // Move nodes into a new parent\n get (id, fields?, depth?, verbose?) \u2192 { results, _truncated? } // Get instance detail with component properties and overrides\n create (items: InstanceCreateItem[], depth?) \u2192 { results: {id}[] } // Create component instances\n update (items: InstanceUpdateItem[]) \u2192 { results: ("ok" | {error})[] } // Set instance properties\n swap (items: { id: string; componentId: string }[]) \u2192 { results: ("ok" | {error})[] } // Swap instance component (preserves overrides)\n detach (items: { id: string }[]) \u2192 { results: {id}[] } // Detach instances from their component (converts to frame)\n reset_overrides(items: { id: string }[]) \u2192 { results: ("ok" | {error})[] } // Reset all overrides on instances to match their main component\n// depth: omit \u2192 id+name stubs | 0 \u2192 props + child stubs | N \u2192 recurse N | -1 \u2192 full tree\n// fields: whitelist e.g. ["fills","opacity"] \u2014 id, name, type always included. Pass ["*"] for all.\n// layoutSizingHorizontal/Vertical: FIXED | HUG | FILL \u2014 how the node sizes within auto-layout.\n// Colors: fillVariableName/strokeVariableName bind by name \u2014 preferred over raw color values.\n// Note: node-based endpoints (frames, text, instances, components) use `results` as the list key.\n// Standalone endpoints (styles, variables, variable_collections) use `items`. Components.list uses `items` (catalog view).',
|
|
1635
|
+
schema: (caps2) => filterMethodsByTier({
|
|
1636
|
+
method: import_zod4.z.enum(["list", "delete", "clone", "audit", "reparent", "get", "create", "update", "swap", "detach", "reset_overrides", "help"]),
|
|
1637
|
+
query: import_zod4.z.string().optional().describe("Name search query (case-insensitive substring match)"),
|
|
1638
|
+
types: flexJson(import_zod4.z.array(import_zod4.z.string())).optional().describe('Filter by node types (e.g. ["FRAME", "TEXT"])'),
|
|
1639
|
+
parentId: import_zod4.z.string().optional().describe("Search only within this subtree"),
|
|
1640
|
+
fields: flexJson(import_zod4.z.array(import_zod4.z.string())).optional().describe('Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass ["*"] for all.'),
|
|
1641
|
+
offset: import_zod4.z.coerce.number().optional().default(0).describe("Skip N items for pagination (default 0)"),
|
|
1642
|
+
limit: import_zod4.z.coerce.number().optional().default(100).describe("Max items per page (default 100)"),
|
|
1643
|
+
id: import_zod4.z.string().optional().describe("Single node ID"),
|
|
1644
|
+
items: flexJson(import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()))).optional().describe("Array of {id, ...properties} to delete/reparent/create/update/swap/detach/reset_overrides"),
|
|
1645
|
+
x: import_zod4.z.coerce.number().optional().describe("X position (default: 0)"),
|
|
1646
|
+
y: import_zod4.z.coerce.number().optional().describe("Y position (default: 0)"),
|
|
1647
|
+
depth: import_zod4.z.coerce.number().optional().describe("Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited."),
|
|
1648
|
+
rules: flexJson(import_zod4.z.array(import_zod4.z.string())).optional().describe('Rules to check. Default: ["all"]. Categories: "component", "composition", "token", "naming", "wcag".'),
|
|
1649
|
+
maxDepth: import_zod4.z.coerce.number().optional().describe("Max tree depth (default: 10)"),
|
|
1650
|
+
maxFindings: import_zod4.z.coerce.number().optional().describe("Max findings (default: 50)"),
|
|
1651
|
+
verbose: import_zod4.z.boolean().optional().describe("Include all properties (bounding box, constraints, text style details). Default false \u2014 returns slim, actionable output."),
|
|
1652
|
+
topic: import_zod4.z.string().optional().describe('Help topic \u2014 method name for endpoint help, e.g. "create"')
|
|
1653
|
+
}, caps2, { "list": "read", "delete": "edit", "clone": "create", "audit": "read", "reparent": "edit", "get": "read", "create": "create", "update": "edit", "swap": "edit", "detach": "edit", "reset_overrides": "edit", "help": "read" }),
|
|
1654
|
+
tier: "read",
|
|
1655
|
+
validate: (params) => {
|
|
1656
|
+
const m = params.method;
|
|
1657
|
+
if (m === "get") {
|
|
1658
|
+
if (params.id === void 0) throw new Error('get requires "id"');
|
|
1659
|
+
}
|
|
1660
|
+
if (!params.items) return;
|
|
1661
|
+
if (m === "create") {
|
|
1662
|
+
for (const it of params.items) {
|
|
1663
|
+
if (it.id !== void 0 && it.componentId === void 0) {
|
|
1664
|
+
it.componentId = it.id;
|
|
1665
|
+
delete it.id;
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
const itemSchema = import_zod4.z.object({
|
|
1669
|
+
opacity: token.optional().describe("Opacity (0-1) or variable name"),
|
|
1670
|
+
visible: flexBool(import_zod4.z.boolean()).optional().describe("Show/hide (default true)"),
|
|
1671
|
+
locked: flexBool(import_zod4.z.boolean()).optional().describe("Lock/unlock (default false)"),
|
|
1672
|
+
blendMode: import_zod4.z.enum(["PASS_THROUGH", "NORMAL", "DARKEN", "MULTIPLY", "LINEAR_BURN", "COLOR_BURN", "LIGHTEN", "SCREEN", "LINEAR_DODGE", "COLOR_DODGE", "OVERLAY", "SOFT_LIGHT", "HARD_LIGHT", "DIFFERENCE", "EXCLUSION", "HUE", "SATURATION", "COLOR", "LUMINOSITY"]).optional(),
|
|
1673
|
+
effectStyleName: import_zod4.z.string().optional().describe("Effect style name (e.g. 'Shadow/Card') for shadows, blurs"),
|
|
1674
|
+
layoutSizingHorizontal: import_zod4.z.enum(["FIXED", "HUG", "FILL"]).optional(),
|
|
1675
|
+
layoutSizingVertical: import_zod4.z.enum(["FIXED", "HUG", "FILL"]).optional(),
|
|
1676
|
+
layoutPositioning: import_zod4.z.enum(["AUTO", "ABSOLUTE"]).optional().describe("ABSOLUTE = floating inside auto-layout parent"),
|
|
1677
|
+
minWidth: import_zod4.z.coerce.number().optional().describe("Min width for responsive auto-layout"),
|
|
1678
|
+
maxWidth: import_zod4.z.coerce.number().optional().describe("Max width for responsive auto-layout"),
|
|
1679
|
+
minHeight: import_zod4.z.coerce.number().optional().describe("Min height for responsive auto-layout"),
|
|
1680
|
+
maxHeight: import_zod4.z.coerce.number().optional().describe("Max height for responsive auto-layout"),
|
|
1681
|
+
componentId: import_zod4.z.string().describe("Component or component set ID"),
|
|
1682
|
+
variantProperties: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()).optional().describe('Pick variant e.g. {"Style":"Secondary"}'),
|
|
1683
|
+
properties: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()).optional().describe('Set component properties inline e.g. {"Label":"Click me", "ShowIcon":true}. Same as instances.update properties.'),
|
|
1684
|
+
name: import_zod4.z.string().optional().describe("Instance layer name"),
|
|
1685
|
+
x: import_zod4.z.coerce.number().optional(),
|
|
1686
|
+
y: import_zod4.z.coerce.number().optional(),
|
|
1687
|
+
width: import_zod4.z.coerce.number().optional().describe("Override width (resize)"),
|
|
1688
|
+
height: import_zod4.z.coerce.number().optional().describe("Override height (resize)"),
|
|
1689
|
+
parentId: import_zod4.z.string().optional().describe("Parent node ID. Omit to place on current page.")
|
|
1690
|
+
}).passthrough();
|
|
1691
|
+
try {
|
|
1692
|
+
params.items = import_zod4.z.array(itemSchema).parse(params.items);
|
|
1693
|
+
} catch (e) {
|
|
1694
|
+
if (e instanceof import_zod4.z.ZodError) {
|
|
1695
|
+
throw new Error(e.issues.map((i) => {
|
|
1696
|
+
const path = i.path.join(".");
|
|
1697
|
+
const shape = itemSchema instanceof import_zod4.z.ZodObject ? itemSchema.shape : null;
|
|
1698
|
+
const desc = shape?.[i.path[1]]?.description;
|
|
1699
|
+
return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
|
|
1700
|
+
}).join("; "));
|
|
1701
|
+
}
|
|
1702
|
+
throw e;
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
if (m === "update") {
|
|
1706
|
+
const itemSchema = import_zod4.z.object({
|
|
1707
|
+
fills: import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown())).optional().describe("Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills."),
|
|
1708
|
+
fillColor: colorRgba.optional().describe("Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)"),
|
|
1709
|
+
fillStyleName: import_zod4.z.string().optional().describe("Paint style name for fill"),
|
|
1710
|
+
fillVariableName: import_zod4.z.string().optional().describe("Color variable by name e.g. 'bg/primary'"),
|
|
1711
|
+
strokes: import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown())).optional().describe("Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes."),
|
|
1712
|
+
strokeColor: colorRgba.optional().describe("Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)"),
|
|
1713
|
+
strokeStyleName: import_zod4.z.string().optional().describe("Paint style name for stroke"),
|
|
1714
|
+
strokeVariableName: import_zod4.z.string().optional().describe("Color variable by name for stroke"),
|
|
1715
|
+
strokeWeight: token.optional().describe("All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight."),
|
|
1716
|
+
strokeTopWeight: token.optional(),
|
|
1717
|
+
strokeBottomWeight: token.optional(),
|
|
1718
|
+
strokeLeftWeight: token.optional(),
|
|
1719
|
+
strokeRightWeight: token.optional(),
|
|
1720
|
+
strokeAlign: import_zod4.z.enum(["INSIDE", "OUTSIDE", "CENTER"]).optional().describe("Stroke position (default: INSIDE)"),
|
|
1721
|
+
strokesIncludedInLayout: flexBool(import_zod4.z.boolean()).optional().describe("Include stroke width in layout measurements (default: false)"),
|
|
1722
|
+
cornerRadius: token.optional().describe("All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius."),
|
|
1723
|
+
topLeftRadius: token.optional(),
|
|
1724
|
+
topRightRadius: token.optional(),
|
|
1725
|
+
bottomRightRadius: token.optional(),
|
|
1726
|
+
bottomLeftRadius: token.optional(),
|
|
1727
|
+
opacity: token.optional().describe("Opacity (0-1) or variable name"),
|
|
1728
|
+
visible: import_zod4.z.boolean().optional().describe("Show/hide (default true)"),
|
|
1729
|
+
locked: import_zod4.z.boolean().optional().describe("Lock/unlock (default false)"),
|
|
1730
|
+
blendMode: import_zod4.z.enum(["PASS_THROUGH", "NORMAL", "DARKEN", "MULTIPLY", "LINEAR_BURN", "COLOR_BURN", "LIGHTEN", "SCREEN", "LINEAR_DODGE", "COLOR_DODGE", "OVERLAY", "SOFT_LIGHT", "HARD_LIGHT", "DIFFERENCE", "EXCLUSION", "HUE", "SATURATION", "COLOR", "LUMINOSITY"]).optional(),
|
|
1731
|
+
effectStyleName: import_zod4.z.string().optional().describe("Effect style name (e.g. 'Shadow/Card') for shadows, blurs"),
|
|
1732
|
+
layoutMode: import_zod4.z.enum(["NONE", "HORIZONTAL", "VERTICAL"]).optional().describe("Layout direction (default: NONE)"),
|
|
1733
|
+
layoutWrap: import_zod4.z.enum(["NO_WRAP", "WRAP"]).optional(),
|
|
1734
|
+
padding: token.optional().describe("All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft."),
|
|
1735
|
+
paddingTop: token.optional(),
|
|
1736
|
+
paddingRight: token.optional(),
|
|
1737
|
+
paddingBottom: token.optional(),
|
|
1738
|
+
paddingLeft: token.optional(),
|
|
1739
|
+
primaryAxisAlignItems: import_zod4.z.enum(["MIN", "MAX", "CENTER", "SPACE_BETWEEN"]).optional(),
|
|
1740
|
+
counterAxisAlignItems: import_zod4.z.enum(["MIN", "MAX", "CENTER", "BASELINE"]).optional(),
|
|
1741
|
+
itemSpacing: token.optional().describe("Spacing between children (number or variable name string, default: 0)"),
|
|
1742
|
+
counterAxisSpacing: token.optional().describe("Gap between wrapped rows (requires layoutWrap: WRAP)"),
|
|
1743
|
+
layoutSizingHorizontal: import_zod4.z.enum(["FIXED", "HUG", "FILL"]).optional(),
|
|
1744
|
+
layoutSizingVertical: import_zod4.z.enum(["FIXED", "HUG", "FILL"]).optional(),
|
|
1745
|
+
layoutPositioning: import_zod4.z.enum(["AUTO", "ABSOLUTE"]).optional().describe("ABSOLUTE = floating inside auto-layout parent"),
|
|
1746
|
+
minWidth: import_zod4.z.coerce.number().optional().describe("Min width for responsive auto-layout"),
|
|
1747
|
+
maxWidth: import_zod4.z.coerce.number().optional().describe("Max width for responsive auto-layout"),
|
|
1748
|
+
minHeight: import_zod4.z.coerce.number().optional().describe("Min height for responsive auto-layout"),
|
|
1749
|
+
maxHeight: import_zod4.z.coerce.number().optional().describe("Max height for responsive auto-layout"),
|
|
1750
|
+
fontSize: import_zod4.z.number().optional().describe("Font size"),
|
|
1751
|
+
fontFamily: import_zod4.z.string().optional().describe("Font family"),
|
|
1752
|
+
fontStyle: import_zod4.z.string().optional().describe('Font variant e.g. "Bold", "Italic" \u2014 overrides fontWeight'),
|
|
1753
|
+
fontWeight: import_zod4.z.number().optional().describe("100-900. Ignored when fontStyle is set."),
|
|
1754
|
+
fontColor: colorRgba.optional().describe("Shorthand \u2014 sets text color (auto-binds to matching variable/style)"),
|
|
1755
|
+
fontColorVariableName: import_zod4.z.string().optional().describe("Bind color variable by name e.g. 'text/primary'"),
|
|
1756
|
+
fontColorStyleName: import_zod4.z.string().optional().describe("Apply paint style \u2014 overrides fontColor"),
|
|
1757
|
+
textStyleId: import_zod4.z.string().optional().describe("Apply text style by ID \u2014 overrides fontSize/fontWeight"),
|
|
1758
|
+
textStyleName: import_zod4.z.string().optional().describe("Text style by name (case-insensitive)"),
|
|
1759
|
+
textAlignHorizontal: import_zod4.z.enum(["LEFT", "CENTER", "RIGHT", "JUSTIFIED"]).optional(),
|
|
1760
|
+
textAlignVertical: import_zod4.z.enum(["TOP", "CENTER", "BOTTOM"]).optional(),
|
|
1761
|
+
textAutoResize: import_zod4.z.enum(["NONE", "WIDTH_AND_HEIGHT", "HEIGHT", "TRUNCATE"]).optional(),
|
|
1762
|
+
id: import_zod4.z.string().describe("Instance node ID"),
|
|
1763
|
+
properties: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()).optional().describe("Component property key\u2192value map"),
|
|
1764
|
+
componentProperties: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()).optional().describe("Alias for properties (matches instances.get response shape)"),
|
|
1765
|
+
name: import_zod4.z.string().optional().describe("Rename node"),
|
|
1766
|
+
rotation: import_zod4.z.number().optional().describe("Degrees (0-360)"),
|
|
1767
|
+
x: import_zod4.z.number().optional(),
|
|
1768
|
+
y: import_zod4.z.number().optional(),
|
|
1769
|
+
width: import_zod4.z.number().optional(),
|
|
1770
|
+
height: import_zod4.z.number().optional(),
|
|
1771
|
+
clearFill: import_zod4.z.boolean().optional().describe("Remove all fills"),
|
|
1772
|
+
effects: import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown())).optional().describe("Effect array (DROP_SHADOW, INNER_SHADOW, LAYER_BLUR, BACKGROUND_BLUR)"),
|
|
1773
|
+
constraints: import_zod4.z.object({
|
|
1774
|
+
horizontal: import_zod4.z.enum(["MIN", "CENTER", "MAX", "STRETCH", "SCALE"]),
|
|
1775
|
+
vertical: import_zod4.z.enum(["MIN", "CENTER", "MAX", "STRETCH", "SCALE"])
|
|
1776
|
+
}).optional(),
|
|
1777
|
+
bindings: import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown())).optional().describe("Bind variables to properties. field path examples: 'fills/0/color', 'strokes/0/color', 'opacity', 'width', 'cornerRadius', 'itemSpacing'."),
|
|
1778
|
+
explicitMode: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()).optional().describe("Pin variable mode \u2014 use { collectionName, modeName } (preferred) or { collectionId, modeId }"),
|
|
1779
|
+
exportSettings: import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown())).optional().describe("Export settings")
|
|
1780
|
+
}).passthrough();
|
|
1781
|
+
try {
|
|
1782
|
+
params.items = import_zod4.z.array(itemSchema).parse(params.items);
|
|
1783
|
+
} catch (e) {
|
|
1784
|
+
if (e instanceof import_zod4.z.ZodError) {
|
|
1785
|
+
throw new Error(e.issues.map((i) => {
|
|
1786
|
+
const path = i.path.join(".");
|
|
1787
|
+
const shape = itemSchema instanceof import_zod4.z.ZodObject ? itemSchema.shape : null;
|
|
1788
|
+
const desc = shape?.[i.path[1]]?.description;
|
|
1789
|
+
return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
|
|
1790
|
+
}).join("; "));
|
|
1791
|
+
}
|
|
1792
|
+
throw e;
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
if (m === "swap") {
|
|
1796
|
+
const itemSchema = import_zod4.z.object({
|
|
1797
|
+
id: import_zod4.z.string().describe("Instance node ID"),
|
|
1798
|
+
componentId: import_zod4.z.string().describe("New component or component set ID")
|
|
1799
|
+
}).passthrough();
|
|
1800
|
+
try {
|
|
1801
|
+
params.items = import_zod4.z.array(itemSchema).parse(params.items);
|
|
1802
|
+
} catch (e) {
|
|
1803
|
+
if (e instanceof import_zod4.z.ZodError) {
|
|
1804
|
+
throw new Error(e.issues.map((i) => {
|
|
1805
|
+
const path = i.path.join(".");
|
|
1806
|
+
const shape = itemSchema instanceof import_zod4.z.ZodObject ? itemSchema.shape : null;
|
|
1807
|
+
const desc = shape?.[i.path[1]]?.description;
|
|
1808
|
+
return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
|
|
1809
|
+
}).join("; "));
|
|
1810
|
+
}
|
|
1811
|
+
throw e;
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
if (m === "detach") {
|
|
1815
|
+
const itemSchema = import_zod4.z.object({
|
|
1816
|
+
id: import_zod4.z.string().describe("Instance node ID")
|
|
1817
|
+
}).passthrough();
|
|
1818
|
+
try {
|
|
1819
|
+
params.items = import_zod4.z.array(itemSchema).parse(params.items);
|
|
1820
|
+
} catch (e) {
|
|
1821
|
+
if (e instanceof import_zod4.z.ZodError) {
|
|
1822
|
+
throw new Error(e.issues.map((i) => {
|
|
1823
|
+
const path = i.path.join(".");
|
|
1824
|
+
const shape = itemSchema instanceof import_zod4.z.ZodObject ? itemSchema.shape : null;
|
|
1825
|
+
const desc = shape?.[i.path[1]]?.description;
|
|
1826
|
+
return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
|
|
1827
|
+
}).join("; "));
|
|
1828
|
+
}
|
|
1829
|
+
throw e;
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1832
|
+
if (m === "reset_overrides") {
|
|
1833
|
+
const itemSchema = import_zod4.z.object({
|
|
1834
|
+
id: import_zod4.z.string().describe("Instance node ID")
|
|
1835
|
+
}).passthrough();
|
|
1836
|
+
try {
|
|
1837
|
+
params.items = import_zod4.z.array(itemSchema).parse(params.items);
|
|
1838
|
+
} catch (e) {
|
|
1839
|
+
if (e instanceof import_zod4.z.ZodError) {
|
|
1840
|
+
throw new Error(e.issues.map((i) => {
|
|
1841
|
+
const path = i.path.join(".");
|
|
1842
|
+
const shape = itemSchema instanceof import_zod4.z.ZodObject ? itemSchema.shape : null;
|
|
1843
|
+
const desc = shape?.[i.path[1]]?.description;
|
|
1844
|
+
return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
|
|
1845
|
+
}).join("; "));
|
|
1846
|
+
}
|
|
1847
|
+
throw e;
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
1850
|
+
},
|
|
1851
|
+
commandMap: { "list": "instances.list", "delete": "instances.delete", "clone": "instances.clone", "audit": "instances.audit", "reparent": "instances.reparent", "get": "instances.get", "create": "instances.create", "update": "instances.update", "swap": "instances.swap", "detach": "instances.detach", "reset_overrides": "instances.reset_overrides" }
|
|
1852
|
+
},
|
|
539
1853
|
{
|
|
540
|
-
name: "
|
|
541
|
-
description: "
|
|
542
|
-
schema:
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
]
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
1854
|
+
name: "lint",
|
|
1855
|
+
description: '/** Run design quality and accessibility checks. Use method "help" for detailed parameter docs. */\n check (nodeId?, rules?, maxDepth?, maxFindings?) \u2192 { nodeId, nodeName, categories, warning? } // Run design linter on a node tree\n fix (items: { nodeId: string; layoutMode?: "VERTICAL" | "HORIZONTAL"; itemSpacing?: number }[], depth?) \u2192 { results: ("ok" | {error})[] } // Auto-fix frames to auto-layout\n// Lint runs automated design quality and accessibility checks on a node tree.',
|
|
1856
|
+
schema: (caps2) => filterMethodsByTier({
|
|
1857
|
+
method: import_zod4.z.enum(["check", "fix", "help"]),
|
|
1858
|
+
nodeId: import_zod4.z.string().optional().describe("Node ID to lint. If omitted: 1 selected node \u2192 lints that node, 2+ selected \u2192 lints entire page (not the selection), 0 selected \u2192 error. Always pass nodeId explicitly for reliable targeting."),
|
|
1859
|
+
rules: flexJson(import_zod4.z.array(import_zod4.z.string())).optional().describe('Rules to run. Default: ["all"]. Categories: "component", "composition", "token", "naming", "wcag"/"accessibility". Or specific rule names.'),
|
|
1860
|
+
maxDepth: import_zod4.z.coerce.number().optional().describe("Max tree depth (default: 10)"),
|
|
1861
|
+
maxFindings: import_zod4.z.coerce.number().optional().describe("Max findings (default: 50)"),
|
|
1862
|
+
items: flexJson(import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()))).optional().describe("Array of {nodeId, layoutMode?, itemSpacing?}"),
|
|
1863
|
+
depth: import_zod4.z.coerce.number().optional().describe("Response detail for fixed nodes: omit for stubs, 0=properties, -1=full tree"),
|
|
1864
|
+
topic: import_zod4.z.string().optional().describe('Help topic \u2014 method name for endpoint help, e.g. "create"')
|
|
1865
|
+
}, caps2, { "check": "read", "fix": "edit", "help": "read" }),
|
|
1866
|
+
tier: "read",
|
|
1867
|
+
validate: (params) => {
|
|
1868
|
+
const m = params.method;
|
|
1869
|
+
if (!params.items) return;
|
|
1870
|
+
if (m === "fix") {
|
|
1871
|
+
for (const it of params.items) {
|
|
1872
|
+
if (it.id !== void 0 && it.nodeId === void 0) {
|
|
1873
|
+
it.nodeId = it.id;
|
|
1874
|
+
delete it.id;
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
const itemSchema = import_zod4.z.object({
|
|
1878
|
+
nodeId: import_zod4.z.string().describe("Frame node ID"),
|
|
1879
|
+
layoutMode: import_zod4.z.enum(["VERTICAL", "HORIZONTAL"]).optional().describe("Direction (default: auto-detected)"),
|
|
1880
|
+
itemSpacing: import_zod4.z.coerce.number().optional().describe("Spacing between children")
|
|
1881
|
+
}).passthrough();
|
|
1882
|
+
try {
|
|
1883
|
+
params.items = import_zod4.z.array(itemSchema).parse(params.items);
|
|
1884
|
+
} catch (e) {
|
|
1885
|
+
if (e instanceof import_zod4.z.ZodError) {
|
|
1886
|
+
throw new Error(e.issues.map((i) => {
|
|
1887
|
+
const path = i.path.join(".");
|
|
1888
|
+
const shape = itemSchema instanceof import_zod4.z.ZodObject ? itemSchema.shape : null;
|
|
1889
|
+
const desc = shape?.[i.path[1]]?.description;
|
|
1890
|
+
return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
|
|
1891
|
+
}).join("; "));
|
|
1892
|
+
}
|
|
1893
|
+
throw e;
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
},
|
|
1897
|
+
commandMap: { "check": "lint.check", "fix": "lint.fix" }
|
|
1898
|
+
},
|
|
569
1899
|
{
|
|
570
|
-
name: "
|
|
571
|
-
description: "
|
|
572
|
-
schema: {
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
1900
|
+
name: "prototyping",
|
|
1901
|
+
description: '/** Manage prototype interactions, reactions, and navigation flows. Use method "help" for detailed parameter docs. */\n get (id) \u2192 { reactions?, overflowDirection? } // Get reactions and overflow direction on a node\n add (id, trigger: ON_CLICK|ON_HOVER|ON_PRESS|ON_DRAG|AFTER_TIMEOUT|MOUSE_ENTER|MOUSE_LEAVE|ON_KEY_DOWN, triggerDelay?, triggerKeyCodes?, triggerDevice?: KEYBOARD|XBOX_ONE|PS4|SWITCH_PRO, destination?, navigation?: NAVIGATE|SWAP|OVERLAY|SCROLL_TO|CHANGE_TO, transition?: DISSOLVE|SMART_ANIMATE|MOVE_IN|MOVE_OUT|PUSH|SLIDE_IN|SLIDE_OUT|INSTANT, transitionDirection?: LEFT|RIGHT|TOP|BOTTOM, duration?, easing?: EASE_IN|EASE_OUT|EASE_IN_AND_OUT|LINEAR|GENTLE|QUICK|BOUNCY|SLOW, actionType?: NODE|BACK|CLOSE|URL|SET_VARIABLE_MODE, url?, collectionName?, modeName?, resetScrollPosition?, actions?) \u2192 { results: "ok"[] } // Add a prototype reaction to a node\n set (id, reactions) \u2192 { results: "ok"[] } // Replace all reactions on a node (raw reactions array)\n remove (id, index) \u2192 { results: "ok"[] } // Remove a reaction from a node by index\n// Reactions wire up interactions: trigger (ON_CLICK, ON_HOVER, ...) \u2192 action (navigate, swap, overlay).\n// Common patterns: button ON_CLICK \u2192 NAVIGATE to detail frame; card ON_HOVER \u2192 CHANGE_TO hover variant.\n// Multi-action: pass actions[] array to run multiple actions on one trigger (e.g. navigate + set variable mode).',
|
|
1902
|
+
schema: (caps2) => filterMethodsByTier({
|
|
1903
|
+
method: import_zod4.z.enum(["get", "add", "set", "remove", "help"]),
|
|
1904
|
+
id: import_zod4.z.string().optional().describe("Node ID"),
|
|
1905
|
+
trigger: import_zod4.z.enum(["ON_CLICK", "ON_HOVER", "ON_PRESS", "ON_DRAG", "AFTER_TIMEOUT", "MOUSE_ENTER", "MOUSE_LEAVE", "ON_KEY_DOWN"]).optional().describe("Trigger type"),
|
|
1906
|
+
triggerDelay: import_zod4.z.coerce.number().optional().describe("Delay in ms for AFTER_TIMEOUT / MOUSE_ENTER / MOUSE_LEAVE triggers"),
|
|
1907
|
+
triggerKeyCodes: import_zod4.z.unknown().optional().describe("Key codes for ON_KEY_DOWN trigger"),
|
|
1908
|
+
triggerDevice: import_zod4.z.enum(["KEYBOARD", "XBOX_ONE", "PS4", "SWITCH_PRO"]).optional().describe("Device for ON_KEY_DOWN (default: KEYBOARD)"),
|
|
1909
|
+
destination: import_zod4.z.string().optional().describe("Target node ID (required for NODE actions)"),
|
|
1910
|
+
navigation: import_zod4.z.enum(["NAVIGATE", "SWAP", "OVERLAY", "SCROLL_TO", "CHANGE_TO"]).optional().describe("Navigation type (default: NAVIGATE)"),
|
|
1911
|
+
transition: import_zod4.z.enum(["DISSOLVE", "SMART_ANIMATE", "MOVE_IN", "MOVE_OUT", "PUSH", "SLIDE_IN", "SLIDE_OUT", "INSTANT"]).optional().describe("Transition animation (default: DISSOLVE). INSTANT = no animation."),
|
|
1912
|
+
transitionDirection: import_zod4.z.enum(["LEFT", "RIGHT", "TOP", "BOTTOM"]).optional().describe("Direction for MOVE_IN, MOVE_OUT, PUSH, SLIDE_IN, SLIDE_OUT"),
|
|
1913
|
+
duration: import_zod4.z.coerce.number().optional().describe("Transition duration in seconds (default: 0.3)"),
|
|
1914
|
+
easing: import_zod4.z.enum(["EASE_IN", "EASE_OUT", "EASE_IN_AND_OUT", "LINEAR", "GENTLE", "QUICK", "BOUNCY", "SLOW"]).optional().describe("Easing function (default: EASE_OUT)"),
|
|
1915
|
+
actionType: import_zod4.z.enum(["NODE", "BACK", "CLOSE", "URL", "SET_VARIABLE_MODE"]).optional().describe("Action type (default: NODE). SET_VARIABLE_MODE switches a variable collection mode."),
|
|
1916
|
+
url: import_zod4.z.string().optional().describe("URL for URL action type"),
|
|
1917
|
+
collectionName: import_zod4.z.string().optional().describe("Variable collection name (for SET_VARIABLE_MODE)"),
|
|
1918
|
+
modeName: import_zod4.z.string().optional().describe("Mode name to switch to (for SET_VARIABLE_MODE)"),
|
|
1919
|
+
resetScrollPosition: flexBool(import_zod4.z.boolean()).optional().describe("Reset scroll position on navigate (default: true)"),
|
|
1920
|
+
actions: flexJson(import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()))).optional().describe("Multi-action: [{actionType, destination?, navigation?, collectionName?, modeName?, ...}]. Overrides single-action params."),
|
|
1921
|
+
reactions: flexJson(import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()))).optional().describe("Full reactions array \u2014 [{trigger:{type}, actions:[{type, destinationId, navigation, transition}]}]"),
|
|
1922
|
+
index: import_zod4.z.coerce.number().optional().describe("Reaction index (0-based)"),
|
|
1923
|
+
topic: import_zod4.z.string().optional().describe('Help topic \u2014 method name for endpoint help, e.g. "create"')
|
|
1924
|
+
}, caps2, { "get": "read", "add": "edit", "set": "edit", "remove": "edit", "help": "read" }),
|
|
1925
|
+
tier: "read",
|
|
1926
|
+
validate: (params) => {
|
|
1927
|
+
const m = params.method;
|
|
1928
|
+
if (m === "get") {
|
|
1929
|
+
if (params.id === void 0) throw new Error('get requires "id"');
|
|
1930
|
+
}
|
|
1931
|
+
if (m === "add") {
|
|
1932
|
+
if (params.id === void 0) throw new Error('add requires "id"');
|
|
1933
|
+
if (params.trigger === void 0) throw new Error('add requires "trigger"');
|
|
1934
|
+
}
|
|
1935
|
+
if (m === "set") {
|
|
1936
|
+
if (params.id === void 0) throw new Error('set requires "id"');
|
|
1937
|
+
if (params.reactions === void 0) throw new Error('set requires "reactions"');
|
|
1938
|
+
}
|
|
1939
|
+
if (m === "remove") {
|
|
1940
|
+
if (params.id === void 0) throw new Error('remove requires "id"');
|
|
1941
|
+
if (params.index === void 0) throw new Error('remove requires "index"');
|
|
1942
|
+
}
|
|
577
1943
|
},
|
|
578
|
-
|
|
1944
|
+
commandMap: { "get": "prototyping.get", "add": "prototyping.add", "set": "prototyping.set", "remove": "prototyping.remove" }
|
|
579
1945
|
},
|
|
580
1946
|
{
|
|
581
|
-
name: "
|
|
582
|
-
description: "
|
|
583
|
-
schema: {
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
1947
|
+
name: "selection",
|
|
1948
|
+
description: '/** Read and set the current Figma selection. Use method "help" for detailed parameter docs. */\n get (depth?, verbose?) \u2192 { results, _truncated?, _notice? } // Get the current selection\n set (nodeIds) \u2192 { count, selectedNodes, notFoundIds? } // Set selection to nodes and scroll viewport to show them\n// Selection is the set of nodes currently highlighted in the Figma canvas.\n// get returns the current selection. Without depth, returns stubs ({id, name, type}). With depth=0, returns full properties.\n// _truncated: true when the response was cut short due to node budget limits. Use depth=0 or specific fields to reduce payload.\n// set replaces the entire selection AND scrolls the viewport to show the selected nodes.',
|
|
1949
|
+
schema: (caps2) => filterMethodsByTier({
|
|
1950
|
+
method: import_zod4.z.enum(["get", "set", "help"]),
|
|
1951
|
+
depth: import_zod4.z.coerce.number().optional().describe("Child recursion depth. Omit for stubs only, 0=selected nodes' properties, -1=unlimited."),
|
|
1952
|
+
verbose: import_zod4.z.boolean().optional().describe("Include all properties (bounding box, constraints, text style details). Default false \u2014 returns slim, actionable output."),
|
|
1953
|
+
nodeIds: flexJson(import_zod4.z.array(import_zod4.z.string())).optional().describe('Array of node IDs to select. Example: ["1:2","1:3"]'),
|
|
1954
|
+
topic: import_zod4.z.string().optional().describe('Help topic \u2014 method name for endpoint help, e.g. "create"')
|
|
1955
|
+
}, caps2, { "get": "read", "set": "read", "help": "read" }),
|
|
1956
|
+
tier: "read",
|
|
1957
|
+
validate: (params) => {
|
|
1958
|
+
const m = params.method;
|
|
1959
|
+
if (m === "set") {
|
|
1960
|
+
if (params.nodeIds === void 0) throw new Error('set requires "nodeIds"');
|
|
1961
|
+
}
|
|
590
1962
|
},
|
|
591
|
-
|
|
592
|
-
}
|
|
593
|
-
];
|
|
594
|
-
|
|
595
|
-
// src/tools/defs/styles.ts
|
|
596
|
-
var import_zod15 = require("zod");
|
|
597
|
-
|
|
598
|
-
// src/tools/endpoint.ts
|
|
599
|
-
var import_zod14 = require("zod");
|
|
600
|
-
var DEFAULT_TIERS = {
|
|
601
|
-
get: "read",
|
|
602
|
-
list: "read",
|
|
603
|
-
create: "create",
|
|
604
|
-
update: "edit",
|
|
605
|
-
delete: "edit"
|
|
606
|
-
};
|
|
607
|
-
function endpointSchema(methods, capsOrExtra, extraOrTiers, methodTiers) {
|
|
608
|
-
let caps2;
|
|
609
|
-
let extra;
|
|
610
|
-
if (capsOrExtra && "create" in capsOrExtra && "edit" in capsOrExtra && typeof capsOrExtra.create === "boolean") {
|
|
611
|
-
caps2 = capsOrExtra;
|
|
612
|
-
extra = extraOrTiers;
|
|
613
|
-
} else {
|
|
614
|
-
extra = capsOrExtra;
|
|
615
|
-
}
|
|
616
|
-
let filtered = methods;
|
|
617
|
-
if (caps2) {
|
|
618
|
-
const tiers = { ...DEFAULT_TIERS, ...methodTiers };
|
|
619
|
-
filtered = methods.filter((m) => {
|
|
620
|
-
const tier = tiers[m] ?? "edit";
|
|
621
|
-
if (tier === "read") return true;
|
|
622
|
-
if (tier === "create") return caps2.create;
|
|
623
|
-
if (tier === "edit") return caps2.edit;
|
|
624
|
-
return false;
|
|
625
|
-
});
|
|
626
|
-
}
|
|
627
|
-
const schema = {
|
|
628
|
-
method: import_zod14.z.enum(filtered)
|
|
629
|
-
};
|
|
630
|
-
if (filtered.includes("get") || filtered.includes("delete")) {
|
|
631
|
-
schema.id = import_zod14.z.string().optional().describe("Resource ID (get, delete)");
|
|
632
|
-
}
|
|
633
|
-
if (filtered.includes("get") || filtered.includes("list")) {
|
|
634
|
-
schema.fields = flexJson(import_zod14.z.array(import_zod14.z.string())).optional().describe('Property whitelist (get/list). Identity fields (id, name, type) always included. Omit for stubs on list, full detail on get. Pass ["*"] for all fields.');
|
|
635
|
-
}
|
|
636
|
-
if (filtered.includes("list")) {
|
|
637
|
-
schema.offset = import_zod14.z.coerce.number().optional().describe("Skip N items for pagination (default 0)");
|
|
638
|
-
schema.limit = import_zod14.z.coerce.number().optional().describe("Max items per page (default 100)");
|
|
639
|
-
}
|
|
640
|
-
return { ...schema, ...extra };
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
// src/tools/defs/styles.ts
|
|
644
|
-
var paintStyleItem = import_zod15.z.object({
|
|
645
|
-
name: import_zod15.z.string().describe("Style name"),
|
|
646
|
-
color: flexJson(colorRgba).describe("Color.")
|
|
647
|
-
});
|
|
648
|
-
var textStyleItem = import_zod15.z.object({
|
|
649
|
-
name: import_zod15.z.string().describe("Style name"),
|
|
650
|
-
fontFamily: import_zod15.z.string().describe("Font family"),
|
|
651
|
-
fontStyle: import_zod15.z.string().optional().describe("Font style (default: Regular)"),
|
|
652
|
-
fontSize: import_zod15.z.coerce.number().describe("Font size"),
|
|
653
|
-
lineHeight: flexNum(import_zod15.z.union([
|
|
654
|
-
import_zod15.z.number(),
|
|
655
|
-
import_zod15.z.object({ value: import_zod15.z.coerce.number(), unit: import_zod15.z.enum(["PIXELS", "PERCENT", "AUTO"]) })
|
|
656
|
-
])).optional().describe("Line height \u2014 number (px) or {value, unit}. Default: auto."),
|
|
657
|
-
letterSpacing: flexNum(import_zod15.z.union([
|
|
658
|
-
import_zod15.z.number(),
|
|
659
|
-
import_zod15.z.object({ value: import_zod15.z.coerce.number(), unit: import_zod15.z.enum(["PIXELS", "PERCENT"]) })
|
|
660
|
-
])).optional().describe("Letter spacing \u2014 number (px) or {value, unit}. Default: 0."),
|
|
661
|
-
textCase: import_zod15.z.enum(["ORIGINAL", "UPPER", "LOWER", "TITLE"]).optional(),
|
|
662
|
-
textDecoration: import_zod15.z.enum(["NONE", "UNDERLINE", "STRIKETHROUGH"]).optional()
|
|
663
|
-
});
|
|
664
|
-
var effectStyleItem = import_zod15.z.object({
|
|
665
|
-
name: import_zod15.z.string().describe("Style name"),
|
|
666
|
-
effects: flexJson(import_zod15.z.array(effectEntry)).describe("Array of effects")
|
|
667
|
-
});
|
|
668
|
-
var patchBase = {
|
|
669
|
-
id: import_zod15.z.string().describe("Style ID or name (case-insensitive match)"),
|
|
670
|
-
name: import_zod15.z.string().optional().describe("Rename the style")
|
|
671
|
-
};
|
|
672
|
-
var patchPaintItem = import_zod15.z.object({
|
|
673
|
-
...patchBase,
|
|
674
|
-
color: flexJson(colorRgba).optional().describe("New color.")
|
|
675
|
-
});
|
|
676
|
-
var patchTextItem = import_zod15.z.object({
|
|
677
|
-
...patchBase,
|
|
678
|
-
fontFamily: import_zod15.z.string().optional().describe("Font family"),
|
|
679
|
-
fontStyle: import_zod15.z.string().optional().describe("Font style, e.g. Regular, Bold"),
|
|
680
|
-
fontSize: import_zod15.z.coerce.number().optional().describe("Font size"),
|
|
681
|
-
lineHeight: flexNum(import_zod15.z.union([
|
|
682
|
-
import_zod15.z.number(),
|
|
683
|
-
import_zod15.z.object({ value: import_zod15.z.coerce.number(), unit: import_zod15.z.enum(["PIXELS", "PERCENT", "AUTO"]) })
|
|
684
|
-
])).optional().describe("Line height \u2014 number (px) or {value, unit}"),
|
|
685
|
-
letterSpacing: flexNum(import_zod15.z.union([
|
|
686
|
-
import_zod15.z.number(),
|
|
687
|
-
import_zod15.z.object({ value: import_zod15.z.coerce.number(), unit: import_zod15.z.enum(["PIXELS", "PERCENT"]) })
|
|
688
|
-
])).optional().describe("Letter spacing \u2014 number (px) or {value, unit}"),
|
|
689
|
-
textCase: import_zod15.z.enum(["ORIGINAL", "UPPER", "LOWER", "TITLE"]).optional(),
|
|
690
|
-
textDecoration: import_zod15.z.enum(["NONE", "UNDERLINE", "STRIKETHROUGH"]).optional()
|
|
691
|
-
});
|
|
692
|
-
var patchEffectItem = import_zod15.z.object({
|
|
693
|
-
...patchBase,
|
|
694
|
-
effects: flexJson(import_zod15.z.array(effectEntry)).optional().describe("Array of effects")
|
|
695
|
-
});
|
|
696
|
-
var patchAnyItem = import_zod15.z.object({
|
|
697
|
-
...patchBase,
|
|
698
|
-
color: flexJson(colorRgba).optional(),
|
|
699
|
-
fontFamily: import_zod15.z.string().optional(),
|
|
700
|
-
fontStyle: import_zod15.z.string().optional(),
|
|
701
|
-
fontSize: import_zod15.z.coerce.number().optional(),
|
|
702
|
-
lineHeight: flexNum(import_zod15.z.union([
|
|
703
|
-
import_zod15.z.number(),
|
|
704
|
-
import_zod15.z.object({ value: import_zod15.z.coerce.number(), unit: import_zod15.z.enum(["PIXELS", "PERCENT", "AUTO"]) })
|
|
705
|
-
])).optional(),
|
|
706
|
-
letterSpacing: flexNum(import_zod15.z.union([
|
|
707
|
-
import_zod15.z.number(),
|
|
708
|
-
import_zod15.z.object({ value: import_zod15.z.coerce.number(), unit: import_zod15.z.enum(["PIXELS", "PERCENT"]) })
|
|
709
|
-
])).optional(),
|
|
710
|
-
textCase: import_zod15.z.enum(["ORIGINAL", "UPPER", "LOWER", "TITLE"]).optional(),
|
|
711
|
-
textDecoration: import_zod15.z.enum(["NONE", "UNDERLINE", "STRIKETHROUGH"]).optional(),
|
|
712
|
-
effects: flexJson(import_zod15.z.array(effectEntry)).optional()
|
|
713
|
-
});
|
|
714
|
-
var createSchemas = {
|
|
715
|
-
paint: paintStyleItem,
|
|
716
|
-
text: textStyleItem,
|
|
717
|
-
effect: effectStyleItem
|
|
718
|
-
};
|
|
719
|
-
var updateSchemas = {
|
|
720
|
-
paint: patchPaintItem,
|
|
721
|
-
text: patchTextItem,
|
|
722
|
-
effect: patchEffectItem
|
|
723
|
-
};
|
|
724
|
-
var tools13 = [
|
|
1963
|
+
commandMap: { "get": "selection.get", "set": "selection.set" }
|
|
1964
|
+
},
|
|
725
1965
|
{
|
|
726
1966
|
name: "styles",
|
|
727
|
-
description:
|
|
728
|
-
schema: (caps2) =>
|
|
729
|
-
["
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
1967
|
+
description: '/** CRUD for local paint, text, effect, and grid styles. Use method "help" for detailed parameter docs. */\n list (type?: paint|text|effect|grid, fields?, offset?, limit?) \u2192 { totalCount, items } // List local styles with optional type filter\n get (id, fields?) \u2192 { id, name, type, paints?, fontFamily?, fontSize?, effects?, layoutGrids? } // Get full style detail by ID\n create (type: paint|text|effect|grid, items: (PaintItem | TextItem | EffectItem | GridItem)[]) \u2192 { results: {id}[] } // Create local styles\n update (type?: paint|text|effect|grid, items: PatchStyleItem[]) \u2192 { results: ("ok" | {error})[] } // Update styles by ID or name\n delete (id?, items?: { id: string }[]) \u2192 { results: "ok"[] } // Delete styles\n// Styles are named, reusable design properties that can be applied to nodes. Four types:\n// paint: a named color (applied to fills/strokes), text: typography settings, effect: shadows/blurs, grid: layout grids.\n// All ID params accept both IDs and display names (case-insensitive). Use whichever you have.',
|
|
1968
|
+
schema: (caps2) => filterMethodsByTier({
|
|
1969
|
+
method: import_zod4.z.enum(["list", "get", "create", "update", "delete", "help"]),
|
|
1970
|
+
type: import_zod4.z.enum(["paint", "text", "effect", "grid"]).optional().describe("Filter by style type"),
|
|
1971
|
+
fields: flexJson(import_zod4.z.array(import_zod4.z.string())).optional().describe('Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass ["*"] for all.'),
|
|
1972
|
+
offset: import_zod4.z.coerce.number().optional().default(0).describe("Skip N items for pagination (default 0)"),
|
|
1973
|
+
limit: import_zod4.z.coerce.number().optional().default(100).describe("Max items per page (default 100)"),
|
|
1974
|
+
id: import_zod4.z.string().optional().describe("Style ID or name"),
|
|
1975
|
+
items: flexJson(import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()))).optional().describe("Array of {id, ...properties} to create/update/delete"),
|
|
1976
|
+
topic: import_zod4.z.string().optional().describe('Help topic \u2014 method name for endpoint help, e.g. "create"')
|
|
1977
|
+
}, caps2, { "list": "read", "get": "read", "create": "create", "update": "edit", "delete": "edit", "help": "read" }),
|
|
1978
|
+
tier: "read",
|
|
1979
|
+
validate: (params) => {
|
|
1980
|
+
const m = params.method;
|
|
1981
|
+
if (m === "get") {
|
|
1982
|
+
if (params.id === void 0) throw new Error('get requires "id"');
|
|
735
1983
|
}
|
|
736
|
-
|
|
1984
|
+
if (!params.items) return;
|
|
1985
|
+
if (m === "create") {
|
|
1986
|
+
const schemas = {
|
|
1987
|
+
"paint": import_zod4.z.object({
|
|
1988
|
+
name: import_zod4.z.string().describe("Style name"),
|
|
1989
|
+
color: colorRgba.describe("Color value"),
|
|
1990
|
+
colorVariableName: import_zod4.z.string().optional().describe("Bind to a COLOR variable by name (style tracks the variable)"),
|
|
1991
|
+
description: import_zod4.z.string().optional().describe("Style description")
|
|
1992
|
+
}).passthrough(),
|
|
1993
|
+
"text": import_zod4.z.object({
|
|
1994
|
+
name: import_zod4.z.string().describe("Style name"),
|
|
1995
|
+
fontFamily: import_zod4.z.string().describe("Font family"),
|
|
1996
|
+
fontStyle: import_zod4.z.string().optional().describe("Font style (default: Regular)"),
|
|
1997
|
+
fontSize: import_zod4.z.coerce.number().describe("Font size"),
|
|
1998
|
+
lineHeight: lineHeight.optional(),
|
|
1999
|
+
letterSpacing: letterSpacing.optional(),
|
|
2000
|
+
textCase: import_zod4.z.enum(["ORIGINAL", "UPPER", "LOWER", "TITLE", "SMALL_CAPS", "SMALL_CAPS_FORCED"]).optional(),
|
|
2001
|
+
textDecoration: import_zod4.z.enum(["NONE", "UNDERLINE", "STRIKETHROUGH"]).optional(),
|
|
2002
|
+
paragraphIndent: import_zod4.z.coerce.number().optional().describe("Paragraph indent (px)"),
|
|
2003
|
+
paragraphSpacing: import_zod4.z.coerce.number().optional().describe("Paragraph spacing (px)"),
|
|
2004
|
+
leadingTrim: import_zod4.z.enum(["CAP_HEIGHT", "NONE"]).optional().describe("Leading trim mode"),
|
|
2005
|
+
description: import_zod4.z.string().optional().describe("Style description")
|
|
2006
|
+
}).passthrough(),
|
|
2007
|
+
"effect": import_zod4.z.object({
|
|
2008
|
+
name: import_zod4.z.string().describe("Style name"),
|
|
2009
|
+
effects: flexJson(import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()))).describe("Array of Effect objects"),
|
|
2010
|
+
description: import_zod4.z.string().optional().describe("Style description")
|
|
2011
|
+
}).passthrough(),
|
|
2012
|
+
"grid": import_zod4.z.object({
|
|
2013
|
+
name: import_zod4.z.string().describe("Style name"),
|
|
2014
|
+
layoutGrids: flexJson(import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()))).describe("Array of LayoutGrid objects"),
|
|
2015
|
+
description: import_zod4.z.string().optional().describe("Style description")
|
|
2016
|
+
}).passthrough()
|
|
2017
|
+
};
|
|
2018
|
+
const s = params.type && schemas[params.type];
|
|
2019
|
+
if (s) {
|
|
2020
|
+
try {
|
|
2021
|
+
params.items = import_zod4.z.array(s).parse(params.items);
|
|
2022
|
+
} catch (e) {
|
|
2023
|
+
if (e instanceof import_zod4.z.ZodError) {
|
|
2024
|
+
throw new Error(e.issues.map((i) => {
|
|
2025
|
+
const path = i.path.join(".");
|
|
2026
|
+
const shape = s instanceof import_zod4.z.ZodObject ? s.shape : null;
|
|
2027
|
+
const desc = shape?.[i.path[1]]?.description;
|
|
2028
|
+
return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
|
|
2029
|
+
}).join("; "));
|
|
2030
|
+
}
|
|
2031
|
+
throw e;
|
|
2032
|
+
}
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
if (m === "update") {
|
|
2036
|
+
const itemSchema = import_zod4.z.object({
|
|
2037
|
+
id: import_zod4.z.string().describe("Style ID or name"),
|
|
2038
|
+
name: import_zod4.z.string().optional().describe("Rename the style"),
|
|
2039
|
+
description: import_zod4.z.string().optional().describe("Style description"),
|
|
2040
|
+
color: colorRgba.optional().describe("New color (paint styles)"),
|
|
2041
|
+
colorVariableName: import_zod4.z.string().optional().describe("Bind to a COLOR variable by name (paint styles)"),
|
|
2042
|
+
fontFamily: import_zod4.z.string().optional(),
|
|
2043
|
+
fontStyle: import_zod4.z.string().optional(),
|
|
2044
|
+
fontSize: import_zod4.z.coerce.number().optional(),
|
|
2045
|
+
lineHeight: lineHeight.optional(),
|
|
2046
|
+
letterSpacing: letterSpacing.optional(),
|
|
2047
|
+
textCase: import_zod4.z.enum(["ORIGINAL", "UPPER", "LOWER", "TITLE", "SMALL_CAPS", "SMALL_CAPS_FORCED"]).optional(),
|
|
2048
|
+
textDecoration: import_zod4.z.enum(["NONE", "UNDERLINE", "STRIKETHROUGH"]).optional(),
|
|
2049
|
+
paragraphIndent: import_zod4.z.coerce.number().optional().describe("Paragraph indent (px)"),
|
|
2050
|
+
paragraphSpacing: import_zod4.z.coerce.number().optional().describe("Paragraph spacing (px)"),
|
|
2051
|
+
leadingTrim: import_zod4.z.enum(["CAP_HEIGHT", "NONE"]).optional(),
|
|
2052
|
+
effects: flexJson(import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()))).optional().describe("Array of Effect objects"),
|
|
2053
|
+
layoutGrids: flexJson(import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()))).optional().describe("Array of LayoutGrid objects (grid styles)")
|
|
2054
|
+
}).passthrough();
|
|
2055
|
+
try {
|
|
2056
|
+
params.items = import_zod4.z.array(itemSchema).parse(params.items);
|
|
2057
|
+
} catch (e) {
|
|
2058
|
+
if (e instanceof import_zod4.z.ZodError) {
|
|
2059
|
+
throw new Error(e.issues.map((i) => {
|
|
2060
|
+
const path = i.path.join(".");
|
|
2061
|
+
const shape = itemSchema instanceof import_zod4.z.ZodObject ? itemSchema.shape : null;
|
|
2062
|
+
const desc = shape?.[i.path[1]]?.description;
|
|
2063
|
+
return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
|
|
2064
|
+
}).join("; "));
|
|
2065
|
+
}
|
|
2066
|
+
throw e;
|
|
2067
|
+
}
|
|
2068
|
+
}
|
|
2069
|
+
if (m === "delete") {
|
|
2070
|
+
const itemSchema = import_zod4.z.object({
|
|
2071
|
+
id: import_zod4.z.string().describe("Style ID or name")
|
|
2072
|
+
}).passthrough();
|
|
2073
|
+
try {
|
|
2074
|
+
params.items = import_zod4.z.array(itemSchema).parse(params.items);
|
|
2075
|
+
} catch (e) {
|
|
2076
|
+
if (e instanceof import_zod4.z.ZodError) {
|
|
2077
|
+
throw new Error(e.issues.map((i) => {
|
|
2078
|
+
const path = i.path.join(".");
|
|
2079
|
+
const shape = itemSchema instanceof import_zod4.z.ZodObject ? itemSchema.shape : null;
|
|
2080
|
+
const desc = shape?.[i.path[1]]?.description;
|
|
2081
|
+
return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
|
|
2082
|
+
}).join("; "));
|
|
2083
|
+
}
|
|
2084
|
+
throw e;
|
|
2085
|
+
}
|
|
2086
|
+
}
|
|
2087
|
+
},
|
|
2088
|
+
commandMap: { "list": "styles.list", "get": "styles.get", "create": "styles.create", "update": "styles.update", "delete": "styles.delete" }
|
|
2089
|
+
},
|
|
2090
|
+
{
|
|
2091
|
+
name: "text",
|
|
2092
|
+
description: '/** Create and manage text nodes. Use method "help" for detailed parameter docs. */\n get (id, fields?, depth?, verbose?) \u2192 { results: Node[], _truncated?, _notice? } // Get serialized node data\n list (query?, types?, parentId?, fields?, offset?, limit?) \u2192 { totalCount, returned?, offset?, limit?, results } // Search for nodes (returns stubs only \u2014 use get with depth for full properties)\n update (items: PatchItem[]) \u2192 { results: ("ok" | {error})[] } // Patch node properties\n delete (id?, items?: { id?: string }[]) \u2192 { results: "ok"[] } // Delete nodes\n clone (id, parentId?, x?, y?, depth?) \u2192 { results: {id}[] } // Duplicate nodes\n audit (id, rules?, maxDepth?, maxFindings?) \u2192 { nodeId?, nodeName?, categories? } // Run lint on a node \u2014 returns severity-ranked findings\n reparent (items: { id: string; parentId: string; index?: number }[]) \u2192 { results: "ok"[] } // Move nodes into a new parent\n create (items: TextItem[], depth?) \u2192 { results: {id}[] } // Create text nodes\n set_content(items: { nodeId: string; text: string }[], depth?) \u2192 { results: "ok"[] } // Replace text content on existing text nodes\n scan (items: { nodeId: string; limit?: number; includePath?: boolean; includeGeometry?: boolean }[]) \u2192 { results: ("ok" | {error})[] } // Scan all text nodes within a subtree\n// depth: omit \u2192 id+name stubs | 0 \u2192 props + child stubs | N \u2192 recurse N | -1 \u2192 full tree\n// fields: whitelist e.g. ["fills","opacity"] \u2014 id, name, type always included. Pass ["*"] for all.\n// layoutSizingHorizontal/Vertical: FIXED | HUG | FILL \u2014 how the node sizes within auto-layout.\n// Colors: fillVariableName/strokeVariableName bind by name \u2014 preferred over raw color values.\n// Note: node-based endpoints (frames, text, instances, components) use `results` as the list key.\n// Standalone endpoints (styles, variables, variable_collections) use `items`. Components.list uses `items` (catalog view).',
|
|
2093
|
+
schema: (caps2) => filterMethodsByTier({
|
|
2094
|
+
method: import_zod4.z.enum(["get", "list", "update", "delete", "clone", "audit", "reparent", "create", "set_content", "scan", "help"]),
|
|
2095
|
+
id: import_zod4.z.string().optional().describe("Node ID"),
|
|
2096
|
+
fields: flexJson(import_zod4.z.array(import_zod4.z.string())).optional().describe('Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass ["*"] for all.'),
|
|
2097
|
+
depth: import_zod4.z.coerce.number().optional().describe("Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited."),
|
|
2098
|
+
verbose: import_zod4.z.boolean().optional().describe("Include all properties (bounding box, constraints, text style details). Default false \u2014 returns slim, actionable output."),
|
|
2099
|
+
query: import_zod4.z.string().optional().describe("Name search query (case-insensitive substring match)"),
|
|
2100
|
+
types: flexJson(import_zod4.z.array(import_zod4.z.string())).optional().describe('Filter by node types (e.g. ["FRAME", "TEXT"])'),
|
|
2101
|
+
parentId: import_zod4.z.string().optional().describe("Search only within this subtree"),
|
|
2102
|
+
offset: import_zod4.z.coerce.number().optional().default(0).describe("Skip N items for pagination (default 0)"),
|
|
2103
|
+
limit: import_zod4.z.coerce.number().optional().default(100).describe("Max items per page (default 100)"),
|
|
2104
|
+
items: flexJson(import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()))).optional().describe("Array of {id, ...properties} to update/delete/reparent/create/set_content/scan"),
|
|
2105
|
+
x: import_zod4.z.coerce.number().optional().describe("X position (default: 0)"),
|
|
2106
|
+
y: import_zod4.z.coerce.number().optional().describe("Y position (default: 0)"),
|
|
2107
|
+
rules: flexJson(import_zod4.z.array(import_zod4.z.string())).optional().describe('Rules to check. Default: ["all"]. Categories: "component", "composition", "token", "naming", "wcag".'),
|
|
2108
|
+
maxDepth: import_zod4.z.coerce.number().optional().describe("Max tree depth (default: 10)"),
|
|
2109
|
+
maxFindings: import_zod4.z.coerce.number().optional().describe("Max findings (default: 50)"),
|
|
2110
|
+
topic: import_zod4.z.string().optional().describe('Help topic \u2014 method name for endpoint help, e.g. "create"')
|
|
2111
|
+
}, caps2, { "get": "read", "list": "read", "update": "edit", "delete": "edit", "clone": "create", "audit": "read", "reparent": "edit", "create": "create", "set_content": "edit", "scan": "read", "help": "read" }),
|
|
737
2112
|
tier: "read",
|
|
738
2113
|
validate: (params) => {
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
2114
|
+
const m = params.method;
|
|
2115
|
+
if (!params.items) return;
|
|
2116
|
+
if (m === "create") {
|
|
2117
|
+
for (const it of params.items) {
|
|
2118
|
+
if (it.characters !== void 0 && it.text === void 0) {
|
|
2119
|
+
it.text = it.characters;
|
|
2120
|
+
delete it.characters;
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
const itemSchema = import_zod4.z.object({
|
|
2124
|
+
text: import_zod4.z.string().optional().describe("Text content"),
|
|
2125
|
+
name: import_zod4.z.string().optional().describe("Layer name"),
|
|
2126
|
+
x: import_zod4.z.number().optional(),
|
|
2127
|
+
y: import_zod4.z.number().optional(),
|
|
2128
|
+
width: import_zod4.z.number().optional().describe("Fixed width in px \u2014 implies layoutSizingHorizontal: FIXED and textAutoResize: HEIGHT"),
|
|
2129
|
+
parentId: import_zod4.z.string().optional().describe("Parent node ID. Omit to place on current page."),
|
|
2130
|
+
fontFamily: import_zod4.z.string().optional().describe("Font family (default: Inter). Use fonts.list to find installed fonts."),
|
|
2131
|
+
fontStyle: import_zod4.z.string().optional().describe('Font variant e.g. "Bold", "Italic" \u2014 overrides fontWeight'),
|
|
2132
|
+
fontSize: import_zod4.z.number().optional().describe("Font size (default: 14)"),
|
|
2133
|
+
fontWeight: import_zod4.z.number().optional().describe("100-900 (default: 400). Ignored when fontStyle is set."),
|
|
2134
|
+
fills: import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown())).optional().describe("Text color paints \u2014 e.g. [{type: 'SOLID', color: '#hex'}]. Same as node fills."),
|
|
2135
|
+
fontColor: colorRgba.optional().describe("Shorthand \u2014 sets text color (auto-binds to matching variable/style)"),
|
|
2136
|
+
fontColorVariableName: import_zod4.z.string().optional().describe("Bind color variable by name e.g. 'text/primary'"),
|
|
2137
|
+
fontColorStyleName: import_zod4.z.string().optional().describe("Apply paint style \u2014 overrides fontColor"),
|
|
2138
|
+
textStyleId: import_zod4.z.string().optional().describe("Text style ID or name (case-insensitive) \u2014 overrides fontSize/fontWeight"),
|
|
2139
|
+
textStyleName: import_zod4.z.string().optional().describe("Alias for textStyleId \u2014 accepts name (case-insensitive)"),
|
|
2140
|
+
textAlignHorizontal: import_zod4.z.enum(["LEFT", "CENTER", "RIGHT", "JUSTIFIED"]).optional(),
|
|
2141
|
+
textAlignVertical: import_zod4.z.enum(["TOP", "CENTER", "BOTTOM"]).optional(),
|
|
2142
|
+
layoutSizingHorizontal: import_zod4.z.enum(["FIXED", "HUG", "FILL"]).optional(),
|
|
2143
|
+
layoutSizingVertical: import_zod4.z.enum(["FIXED", "HUG", "FILL"]).optional(),
|
|
2144
|
+
textAutoResize: import_zod4.z.enum(["NONE", "WIDTH_AND_HEIGHT", "HEIGHT", "TRUNCATE"]).optional().describe("NONE (fixed box), WIDTH_AND_HEIGHT (grow both), HEIGHT (fixed width, auto height), TRUNCATE (fixed + ellipsis)"),
|
|
2145
|
+
componentPropertyName: import_zod4.z.string().optional().describe("Bind to a component TEXT property by name. Walks up ancestors to find the nearest component, or targets the component specified by componentId. For deeply nested text, consider using components(method:'create', type:'from_node') with exposeText:true instead \u2014 it auto-discovers and binds all text nodes."),
|
|
2146
|
+
componentId: import_zod4.z.string().optional().describe("Target component ID for componentPropertyName binding. When omitted, walks up ancestors to find the nearest COMPONENT or COMPONENT_SET.")
|
|
2147
|
+
}).passthrough();
|
|
2148
|
+
try {
|
|
2149
|
+
params.items = import_zod4.z.array(itemSchema).parse(params.items);
|
|
2150
|
+
} catch (e) {
|
|
2151
|
+
if (e instanceof import_zod4.z.ZodError) {
|
|
2152
|
+
throw new Error(e.issues.map((i) => {
|
|
2153
|
+
const path = i.path.join(".");
|
|
2154
|
+
const shape = itemSchema instanceof import_zod4.z.ZodObject ? itemSchema.shape : null;
|
|
2155
|
+
const desc = shape?.[i.path[1]]?.description;
|
|
2156
|
+
return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
|
|
2157
|
+
}).join("; "));
|
|
2158
|
+
}
|
|
2159
|
+
throw e;
|
|
2160
|
+
}
|
|
743
2161
|
}
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
})
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
});
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
}
|
|
776
|
-
var variableCreateItem = import_zod16.z.object({
|
|
777
|
-
collectionId: import_zod16.z.string().describe("Variable collection ID"),
|
|
778
|
-
name: import_zod16.z.string().describe("Variable name"),
|
|
779
|
-
resolvedType: import_zod16.z.enum(["COLOR", "FLOAT", "STRING", "BOOLEAN"]).describe("Variable type")
|
|
780
|
-
});
|
|
781
|
-
var variableUpdateItem = import_zod16.z.object({
|
|
782
|
-
id: import_zod16.z.string().describe("Variable ID (full ID, e.g. VariableID:1:6)"),
|
|
783
|
-
modeId: import_zod16.z.string().describe("Mode ID"),
|
|
784
|
-
value: flexJson(import_zod16.z.union([
|
|
785
|
-
import_zod16.z.number(),
|
|
786
|
-
import_zod16.z.boolean(),
|
|
787
|
-
colorRgba
|
|
788
|
-
])).describe('Value: number, boolean, or color (hex "#RRGGBB" or {r,g,b,a?} 0-1)')
|
|
789
|
-
});
|
|
790
|
-
var variableMethodSchemas = {
|
|
791
|
-
create: variableCreateItem,
|
|
792
|
-
update: variableUpdateItem
|
|
793
|
-
};
|
|
794
|
-
var bindingItem = import_zod16.z.object({
|
|
795
|
-
nodeId: import_zod16.z.string().describe("Node ID"),
|
|
796
|
-
field: import_zod16.z.string().describe("Property field (e.g., 'opacity', 'fills/0/color')"),
|
|
797
|
-
variableId: import_zod16.z.string().describe("Variable ID (use full ID from create_variable response, e.g. VariableID:1:6)")
|
|
798
|
-
});
|
|
799
|
-
var setExplicitModeItem = import_zod16.z.object({
|
|
800
|
-
nodeId,
|
|
801
|
-
collectionId: import_zod16.z.string().describe("Variable collection ID"),
|
|
802
|
-
modeId: import_zod16.z.string().describe("Mode ID to pin (e.g. Dark mode)")
|
|
803
|
-
});
|
|
804
|
-
var vcMethodTiers = {
|
|
805
|
-
add_mode: "create",
|
|
806
|
-
rename_mode: "edit",
|
|
807
|
-
remove_mode: "edit"
|
|
808
|
-
};
|
|
809
|
-
var tools14 = [
|
|
2162
|
+
if (m === "set_content") {
|
|
2163
|
+
for (const it of params.items) {
|
|
2164
|
+
if (it.id !== void 0 && it.nodeId === void 0) {
|
|
2165
|
+
it.nodeId = it.id;
|
|
2166
|
+
delete it.id;
|
|
2167
|
+
}
|
|
2168
|
+
if (it.characters !== void 0 && it.text === void 0) {
|
|
2169
|
+
it.text = it.characters;
|
|
2170
|
+
delete it.characters;
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
const itemSchema = import_zod4.z.object({
|
|
2174
|
+
nodeId: import_zod4.z.string().describe("Text node ID"),
|
|
2175
|
+
text: import_zod4.z.string().describe("New text content")
|
|
2176
|
+
}).passthrough();
|
|
2177
|
+
try {
|
|
2178
|
+
params.items = import_zod4.z.array(itemSchema).parse(params.items);
|
|
2179
|
+
} catch (e) {
|
|
2180
|
+
if (e instanceof import_zod4.z.ZodError) {
|
|
2181
|
+
throw new Error(e.issues.map((i) => {
|
|
2182
|
+
const path = i.path.join(".");
|
|
2183
|
+
const shape = itemSchema instanceof import_zod4.z.ZodObject ? itemSchema.shape : null;
|
|
2184
|
+
const desc = shape?.[i.path[1]]?.description;
|
|
2185
|
+
return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
|
|
2186
|
+
}).join("; "));
|
|
2187
|
+
}
|
|
2188
|
+
throw e;
|
|
2189
|
+
}
|
|
2190
|
+
}
|
|
2191
|
+
},
|
|
2192
|
+
commandMap: { "get": "text.get", "list": "text.list", "update": "text.update", "delete": "text.delete", "clone": "text.clone", "audit": "text.audit", "reparent": "text.reparent", "create": "text.create", "set_content": "text.set_content", "scan": "text.scan" }
|
|
2193
|
+
},
|
|
810
2194
|
{
|
|
811
2195
|
name: "variable_collections",
|
|
812
|
-
description:
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
caps2,
|
|
823
|
-
{
|
|
824
|
-
items: flexJson(import_zod16.z.array(import_zod16.z.any())).optional().describe("create: [{name}]. delete (batch): [{id}]. add_mode: [{collectionId, name}]. rename_mode: [{collectionId, modeId, name}]. remove_mode: [{collectionId, modeId}].")
|
|
825
|
-
},
|
|
826
|
-
vcMethodTiers
|
|
827
|
-
),
|
|
2196
|
+
description: '/** CRUD for variable collections \u2014 the document-level API for design tokens. Use method "help" for detailed parameter docs. */\n list (fields?, offset?, limit?) \u2192 { totalCount, items } // List variable collections\n get (id, fields?) \u2192 { id?, name?, modes?, variables? } // Get collection with all variables and values (full document)\n create (items: { name: string; modes?: string[]; variables?: { name: string; type: "COLOR" | "FLOAT" | "STRING" | "BOOLEAN"; value?: number | boolean | string | Color | {type: "VARIABLE_ALIAS", name: string}; valuesByMode?: Record<string, unknown>; description?: string; scopes?: string[] }[] }[]) \u2192 { results: {id}[] } // Create a collection with modes and variables in one call\n update (items: { id: string; name: string }[]) \u2192 { results: ("ok" | {error})[] } // Rename collections\n delete (id?, items?: { id: string }[]) \u2192 { results: "ok"[] } // Delete collections\n add_mode (items: { collectionId: string; name: string }[]) \u2192 { results: {modeId}[] } // Add a mode to a collection\n rename_mode(items: { collectionId: string; modeId: string; name: string }[]) \u2192 { results: ("ok" | {error})[] } // Rename a mode\n remove_mode(items: { collectionId: string; modeId: string }[]) \u2192 { results: "ok"[] } // Remove a mode from a collection\n// Variable collections group design tokens and define their modes (e.g. Light/Dark, Desktop/Mobile).\n// All ID params accept both IDs and display names.\n// Shared types:\n// Color: hex "#FF0000" or {r: 0-1, g: 0-1, b: 0-1, a?: 0-1}',
|
|
2197
|
+
schema: (caps2) => filterMethodsByTier({
|
|
2198
|
+
method: import_zod4.z.enum(["list", "get", "create", "update", "delete", "add_mode", "rename_mode", "remove_mode", "help"]),
|
|
2199
|
+
fields: flexJson(import_zod4.z.array(import_zod4.z.string())).optional().describe('Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass ["*"] for all.'),
|
|
2200
|
+
offset: import_zod4.z.coerce.number().optional().default(0).describe("Skip N items for pagination (default 0)"),
|
|
2201
|
+
limit: import_zod4.z.coerce.number().optional().default(100).describe("Max items per page (default 100)"),
|
|
2202
|
+
id: import_zod4.z.string().optional().describe("Collection ID or name"),
|
|
2203
|
+
items: flexJson(import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()))).optional().describe("Array of {id, ...properties} to create/update/delete/add_mode/rename_mode/remove_mode"),
|
|
2204
|
+
topic: import_zod4.z.string().optional().describe('Help topic \u2014 method name for endpoint help, e.g. "create"')
|
|
2205
|
+
}, caps2, { "list": "read", "get": "read", "create": "create", "update": "edit", "delete": "edit", "add_mode": "create", "rename_mode": "edit", "remove_mode": "edit", "help": "read" }),
|
|
828
2206
|
tier: "read",
|
|
829
2207
|
validate: (params) => {
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
if (
|
|
2208
|
+
const m = params.method;
|
|
2209
|
+
if (m === "get") {
|
|
2210
|
+
if (params.id === void 0) throw new Error('get requires "id"');
|
|
833
2211
|
}
|
|
834
|
-
|
|
2212
|
+
if (!params.items) return;
|
|
2213
|
+
if (m === "create") {
|
|
2214
|
+
const itemSchema = import_zod4.z.object({
|
|
2215
|
+
name: import_zod4.z.string().describe("Collection name"),
|
|
2216
|
+
modes: flexJson(import_zod4.z.array(import_zod4.z.string())).optional().describe("Mode names (e.g. ['Light', 'Dark']). Omit for single-mode collection."),
|
|
2217
|
+
variables: flexJson(import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()))).optional().describe("Variables to create inside this collection")
|
|
2218
|
+
}).passthrough();
|
|
2219
|
+
try {
|
|
2220
|
+
params.items = import_zod4.z.array(itemSchema).parse(params.items);
|
|
2221
|
+
} catch (e) {
|
|
2222
|
+
if (e instanceof import_zod4.z.ZodError) {
|
|
2223
|
+
throw new Error(e.issues.map((i) => {
|
|
2224
|
+
const path = i.path.join(".");
|
|
2225
|
+
const shape = itemSchema instanceof import_zod4.z.ZodObject ? itemSchema.shape : null;
|
|
2226
|
+
const desc = shape?.[i.path[1]]?.description;
|
|
2227
|
+
return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
|
|
2228
|
+
}).join("; "));
|
|
2229
|
+
}
|
|
2230
|
+
throw e;
|
|
2231
|
+
}
|
|
2232
|
+
}
|
|
2233
|
+
if (m === "update") {
|
|
2234
|
+
const itemSchema = import_zod4.z.object({
|
|
2235
|
+
id: import_zod4.z.string().describe("Collection ID or name"),
|
|
2236
|
+
name: import_zod4.z.string().describe("New name")
|
|
2237
|
+
}).passthrough();
|
|
2238
|
+
try {
|
|
2239
|
+
params.items = import_zod4.z.array(itemSchema).parse(params.items);
|
|
2240
|
+
} catch (e) {
|
|
2241
|
+
if (e instanceof import_zod4.z.ZodError) {
|
|
2242
|
+
throw new Error(e.issues.map((i) => {
|
|
2243
|
+
const path = i.path.join(".");
|
|
2244
|
+
const shape = itemSchema instanceof import_zod4.z.ZodObject ? itemSchema.shape : null;
|
|
2245
|
+
const desc = shape?.[i.path[1]]?.description;
|
|
2246
|
+
return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
|
|
2247
|
+
}).join("; "));
|
|
2248
|
+
}
|
|
2249
|
+
throw e;
|
|
2250
|
+
}
|
|
2251
|
+
}
|
|
2252
|
+
if (m === "delete") {
|
|
2253
|
+
const itemSchema = import_zod4.z.object({
|
|
2254
|
+
id: import_zod4.z.string()
|
|
2255
|
+
}).passthrough();
|
|
2256
|
+
try {
|
|
2257
|
+
params.items = import_zod4.z.array(itemSchema).parse(params.items);
|
|
2258
|
+
} catch (e) {
|
|
2259
|
+
if (e instanceof import_zod4.z.ZodError) {
|
|
2260
|
+
throw new Error(e.issues.map((i) => {
|
|
2261
|
+
const path = i.path.join(".");
|
|
2262
|
+
const shape = itemSchema instanceof import_zod4.z.ZodObject ? itemSchema.shape : null;
|
|
2263
|
+
const desc = shape?.[i.path[1]]?.description;
|
|
2264
|
+
return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
|
|
2265
|
+
}).join("; "));
|
|
2266
|
+
}
|
|
2267
|
+
throw e;
|
|
2268
|
+
}
|
|
2269
|
+
}
|
|
2270
|
+
if (m === "add_mode") {
|
|
2271
|
+
const itemSchema = import_zod4.z.object({
|
|
2272
|
+
collectionId: import_zod4.z.string().describe("Collection ID or name"),
|
|
2273
|
+
name: import_zod4.z.string().describe("Mode name")
|
|
2274
|
+
}).passthrough();
|
|
2275
|
+
try {
|
|
2276
|
+
params.items = import_zod4.z.array(itemSchema).parse(params.items);
|
|
2277
|
+
} catch (e) {
|
|
2278
|
+
if (e instanceof import_zod4.z.ZodError) {
|
|
2279
|
+
throw new Error(e.issues.map((i) => {
|
|
2280
|
+
const path = i.path.join(".");
|
|
2281
|
+
const shape = itemSchema instanceof import_zod4.z.ZodObject ? itemSchema.shape : null;
|
|
2282
|
+
const desc = shape?.[i.path[1]]?.description;
|
|
2283
|
+
return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
|
|
2284
|
+
}).join("; "));
|
|
2285
|
+
}
|
|
2286
|
+
throw e;
|
|
2287
|
+
}
|
|
2288
|
+
}
|
|
2289
|
+
if (m === "rename_mode") {
|
|
2290
|
+
const itemSchema = import_zod4.z.object({
|
|
2291
|
+
collectionId: import_zod4.z.string().describe("Collection ID or name"),
|
|
2292
|
+
modeId: import_zod4.z.string().describe('Mode ID or name (e.g. "Dark")'),
|
|
2293
|
+
name: import_zod4.z.string().describe("New name")
|
|
2294
|
+
}).passthrough();
|
|
2295
|
+
try {
|
|
2296
|
+
params.items = import_zod4.z.array(itemSchema).parse(params.items);
|
|
2297
|
+
} catch (e) {
|
|
2298
|
+
if (e instanceof import_zod4.z.ZodError) {
|
|
2299
|
+
throw new Error(e.issues.map((i) => {
|
|
2300
|
+
const path = i.path.join(".");
|
|
2301
|
+
const shape = itemSchema instanceof import_zod4.z.ZodObject ? itemSchema.shape : null;
|
|
2302
|
+
const desc = shape?.[i.path[1]]?.description;
|
|
2303
|
+
return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
|
|
2304
|
+
}).join("; "));
|
|
2305
|
+
}
|
|
2306
|
+
throw e;
|
|
2307
|
+
}
|
|
2308
|
+
}
|
|
2309
|
+
if (m === "remove_mode") {
|
|
2310
|
+
const itemSchema = import_zod4.z.object({
|
|
2311
|
+
collectionId: import_zod4.z.string().describe("Collection ID or name"),
|
|
2312
|
+
modeId: import_zod4.z.string().describe('Mode ID or name (e.g. "Dark")')
|
|
2313
|
+
}).passthrough();
|
|
2314
|
+
try {
|
|
2315
|
+
params.items = import_zod4.z.array(itemSchema).parse(params.items);
|
|
2316
|
+
} catch (e) {
|
|
2317
|
+
if (e instanceof import_zod4.z.ZodError) {
|
|
2318
|
+
throw new Error(e.issues.map((i) => {
|
|
2319
|
+
const path = i.path.join(".");
|
|
2320
|
+
const shape = itemSchema instanceof import_zod4.z.ZodObject ? itemSchema.shape : null;
|
|
2321
|
+
const desc = shape?.[i.path[1]]?.description;
|
|
2322
|
+
return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
|
|
2323
|
+
}).join("; "));
|
|
2324
|
+
}
|
|
2325
|
+
throw e;
|
|
2326
|
+
}
|
|
2327
|
+
}
|
|
2328
|
+
},
|
|
2329
|
+
commandMap: { "list": "variable_collections.list", "get": "variable_collections.get", "create": "variable_collections.create", "update": "variable_collections.update", "delete": "variable_collections.delete", "add_mode": "variable_collections.add_mode", "rename_mode": "variable_collections.rename_mode", "remove_mode": "variable_collections.remove_mode" }
|
|
835
2330
|
},
|
|
836
2331
|
{
|
|
837
2332
|
name: "variables",
|
|
838
|
-
description:
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
2333
|
+
description: '/** Search and update design variables within a collection. Use method "help" for detailed parameter docs. */\n list (collectionId, query?, type?: COLOR|FLOAT|STRING|BOOLEAN, fields?, offset?, limit?) \u2192 { totalCount, items } // Search variables within a collection\n get (name, collectionId, fields?) \u2192 { name, type, collectionId, valuesByMode: Record<string, number | boolean | string | Color | {type: "VARIABLE_ALIAS", name: string}>, description?, scopes? } // Get variable detail by name\n create (collectionId, items: VariableCreateItem[]) \u2192 { results: {name}[] } // Create variables in a collection. Use valuesByMode for multi-mode, or value for default mode only.\n update (collectionId, items: VariableUpdateItem[]) \u2192 { results: ("ok" | {error})[] } // Update variable metadata and/or set values\n delete (collectionId, name?, items?: { name: string }[]) \u2192 { results: "ok"[] } // Delete variables\n// Search and update variables within a collection. collectionId is required on all methods.\n// Use variable_collections to create full token sets (collection + modes + variables in one call).\n// Shared types:\n// Color: hex "#FF0000" or {r: 0-1, g: 0-1, b: 0-1, a?: 0-1}',
|
|
2334
|
+
schema: (caps2) => filterMethodsByTier({
|
|
2335
|
+
method: import_zod4.z.enum(["list", "get", "create", "update", "delete", "help"]),
|
|
2336
|
+
collectionId: import_zod4.z.string().optional().describe("Collection ID or name"),
|
|
2337
|
+
query: import_zod4.z.string().optional().describe("Search query \u2014 prefix match first, then substring fallback"),
|
|
2338
|
+
type: import_zod4.z.enum(["COLOR", "FLOAT", "STRING", "BOOLEAN"]).optional().describe("Filter by variable type"),
|
|
2339
|
+
fields: flexJson(import_zod4.z.array(import_zod4.z.string())).optional().describe('Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass ["*"] for all.'),
|
|
2340
|
+
offset: import_zod4.z.coerce.number().optional().default(0).describe("Skip N items for pagination (default 0)"),
|
|
2341
|
+
limit: import_zod4.z.coerce.number().optional().default(100).describe("Max items per page (default 100)"),
|
|
2342
|
+
name: import_zod4.z.string().optional().describe("Variable name (unique within collection)"),
|
|
2343
|
+
items: flexJson(import_zod4.z.array(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()))).optional().describe("Array of {id, ...properties} to create/update/delete"),
|
|
2344
|
+
topic: import_zod4.z.string().optional().describe('Help topic \u2014 method name for endpoint help, e.g. "create"')
|
|
2345
|
+
}, caps2, { "list": "read", "get": "read", "create": "create", "update": "edit", "delete": "edit", "help": "read" }),
|
|
2346
|
+
tier: "read",
|
|
2347
|
+
validate: (params) => {
|
|
2348
|
+
const m = params.method;
|
|
2349
|
+
if (m === "list") {
|
|
2350
|
+
if (params.collectionId === void 0) throw new Error('list requires "collectionId"');
|
|
2351
|
+
}
|
|
2352
|
+
if (m === "get") {
|
|
2353
|
+
if (params.name === void 0) throw new Error('get requires "name"');
|
|
2354
|
+
if (params.collectionId === void 0) throw new Error('get requires "collectionId"');
|
|
2355
|
+
}
|
|
2356
|
+
if (m === "create") {
|
|
2357
|
+
if (params.collectionId === void 0) throw new Error('create requires "collectionId"');
|
|
2358
|
+
}
|
|
2359
|
+
if (m === "update") {
|
|
2360
|
+
if (params.collectionId === void 0) throw new Error('update requires "collectionId"');
|
|
2361
|
+
}
|
|
2362
|
+
if (m === "delete") {
|
|
2363
|
+
if (params.collectionId === void 0) throw new Error('delete requires "collectionId"');
|
|
2364
|
+
}
|
|
2365
|
+
if (!params.items) return;
|
|
2366
|
+
if (m === "create") {
|
|
2367
|
+
const itemSchema = import_zod4.z.object({
|
|
2368
|
+
name: import_zod4.z.string().describe("Variable name (must be unique within collection)"),
|
|
2369
|
+
type: import_zod4.z.enum(["COLOR", "FLOAT", "STRING", "BOOLEAN"]).describe("Variable type"),
|
|
2370
|
+
value: variableValue.optional().describe("Shorthand \u2014 sets the default mode value. Use valuesByMode for multi-mode."),
|
|
2371
|
+
valuesByMode: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()).optional().describe('Values keyed by mode name (e.g. {"Light": "#FFF", "Dark": "#111"}). Takes precedence over value.'),
|
|
2372
|
+
description: import_zod4.z.string().optional().describe("Variable description"),
|
|
2373
|
+
scopes: flexJson(import_zod4.z.array(import_zod4.z.string())).optional().describe("Restrict where variable can be applied (default: ALL_SCOPES)")
|
|
2374
|
+
}).passthrough();
|
|
2375
|
+
try {
|
|
2376
|
+
params.items = import_zod4.z.array(itemSchema).parse(params.items);
|
|
2377
|
+
} catch (e) {
|
|
2378
|
+
if (e instanceof import_zod4.z.ZodError) {
|
|
2379
|
+
throw new Error(e.issues.map((i) => {
|
|
2380
|
+
const path = i.path.join(".");
|
|
2381
|
+
const shape = itemSchema instanceof import_zod4.z.ZodObject ? itemSchema.shape : null;
|
|
2382
|
+
const desc = shape?.[i.path[1]]?.description;
|
|
2383
|
+
return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
|
|
2384
|
+
}).join("; "));
|
|
2385
|
+
}
|
|
2386
|
+
throw e;
|
|
2387
|
+
}
|
|
2388
|
+
}
|
|
2389
|
+
if (m === "update") {
|
|
2390
|
+
const itemSchema = import_zod4.z.object({
|
|
2391
|
+
name: import_zod4.z.string().describe("Variable name"),
|
|
2392
|
+
rename: import_zod4.z.string().optional().describe("Rename the variable"),
|
|
2393
|
+
description: import_zod4.z.string().optional().describe("Set description"),
|
|
2394
|
+
scopes: flexJson(import_zod4.z.array(import_zod4.z.string())).optional().describe("Update scopes"),
|
|
2395
|
+
value: variableValue.optional().describe("Shorthand \u2014 sets the default mode value. Use valuesByMode for multi-mode."),
|
|
2396
|
+
valuesByMode: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()).optional().describe("Values keyed by mode name. Takes precedence over value.")
|
|
2397
|
+
}).passthrough();
|
|
2398
|
+
try {
|
|
2399
|
+
params.items = import_zod4.z.array(itemSchema).parse(params.items);
|
|
2400
|
+
} catch (e) {
|
|
2401
|
+
if (e instanceof import_zod4.z.ZodError) {
|
|
2402
|
+
throw new Error(e.issues.map((i) => {
|
|
2403
|
+
const path = i.path.join(".");
|
|
2404
|
+
const shape = itemSchema instanceof import_zod4.z.ZodObject ? itemSchema.shape : null;
|
|
2405
|
+
const desc = shape?.[i.path[1]]?.description;
|
|
2406
|
+
return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
|
|
2407
|
+
}).join("; "));
|
|
2408
|
+
}
|
|
2409
|
+
throw e;
|
|
2410
|
+
}
|
|
2411
|
+
}
|
|
2412
|
+
if (m === "delete") {
|
|
2413
|
+
const itemSchema = import_zod4.z.object({
|
|
2414
|
+
name: import_zod4.z.string()
|
|
2415
|
+
}).passthrough();
|
|
2416
|
+
try {
|
|
2417
|
+
params.items = import_zod4.z.array(itemSchema).parse(params.items);
|
|
2418
|
+
} catch (e) {
|
|
2419
|
+
if (e instanceof import_zod4.z.ZodError) {
|
|
2420
|
+
throw new Error(e.issues.map((i) => {
|
|
2421
|
+
const path = i.path.join(".");
|
|
2422
|
+
const shape = itemSchema instanceof import_zod4.z.ZodObject ? itemSchema.shape : null;
|
|
2423
|
+
const desc = shape?.[i.path[1]]?.description;
|
|
2424
|
+
return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
|
|
2425
|
+
}).join("; "));
|
|
2426
|
+
}
|
|
2427
|
+
throw e;
|
|
2428
|
+
}
|
|
850
2429
|
}
|
|
851
|
-
|
|
2430
|
+
},
|
|
2431
|
+
commandMap: { "list": "variables.list", "get": "variables.get", "create": "variables.create", "update": "variables.update", "delete": "variables.delete" }
|
|
2432
|
+
},
|
|
2433
|
+
{
|
|
2434
|
+
name: "version_history",
|
|
2435
|
+
description: `/** Save named versions to the Figma file's version history. Use method "help" for detailed parameter docs. */
|
|
2436
|
+
save (title, description?) \u2192 { id } // Save a named version to the file's version history
|
|
2437
|
+
// Version history lets you create named snapshots of a Figma file.
|
|
2438
|
+
// Use this after completing design tasks to create an audit trail of changes.
|
|
2439
|
+
// Equivalent to Figma's File \u2192 Save to Version History (Cmd+Opt+S).`,
|
|
2440
|
+
schema: (caps2) => filterMethodsByTier({
|
|
2441
|
+
method: import_zod4.z.enum(["save", "help"]),
|
|
2442
|
+
title: import_zod4.z.string().optional().describe('Version title (e.g., "Added hero sections with website copy")'),
|
|
2443
|
+
description: import_zod4.z.string().optional().describe("Optional longer description of what changed"),
|
|
2444
|
+
topic: import_zod4.z.string().optional().describe('Help topic \u2014 method name for endpoint help, e.g. "create"')
|
|
2445
|
+
}, caps2, { "save": "edit", "help": "read" }),
|
|
852
2446
|
tier: "read",
|
|
853
2447
|
validate: (params) => {
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
if (
|
|
2448
|
+
const m = params.method;
|
|
2449
|
+
if (m === "save") {
|
|
2450
|
+
if (params.title === void 0) throw new Error('save requires "title"');
|
|
857
2451
|
}
|
|
858
|
-
}
|
|
2452
|
+
},
|
|
2453
|
+
commandMap: { "save": "version_history.save" }
|
|
2454
|
+
}
|
|
2455
|
+
];
|
|
2456
|
+
|
|
2457
|
+
// src/tools/generated/guidelines.ts
|
|
2458
|
+
var guidelinesList = [
|
|
2459
|
+
{
|
|
2460
|
+
"name": "component-structure",
|
|
2461
|
+
"title": "Component Structure"
|
|
859
2462
|
},
|
|
860
2463
|
{
|
|
861
|
-
name: "
|
|
862
|
-
|
|
863
|
-
schema: { items: flexJson(import_zod16.z.array(bindingItem)).describe("Array of {nodeId, field, variableId}") },
|
|
864
|
-
tier: "edit"
|
|
2464
|
+
"name": "library-components",
|
|
2465
|
+
"title": "Working with Library Components"
|
|
865
2466
|
},
|
|
866
2467
|
{
|
|
867
|
-
name: "
|
|
868
|
-
|
|
869
|
-
schema: { items: flexJson(import_zod16.z.array(setExplicitModeItem)).describe("Array of {nodeId, collectionId, modeId}") },
|
|
870
|
-
tier: "edit"
|
|
2468
|
+
"name": "responsive-designs",
|
|
2469
|
+
"title": "Responsive Sizing"
|
|
871
2470
|
},
|
|
872
2471
|
{
|
|
873
|
-
name: "
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
2472
|
+
"name": "token-discipline",
|
|
2473
|
+
"title": "Token Discipline"
|
|
2474
|
+
},
|
|
2475
|
+
{
|
|
2476
|
+
"name": "vibma-workflow",
|
|
2477
|
+
"title": "Vibma Workflow"
|
|
877
2478
|
}
|
|
878
2479
|
];
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
name:
|
|
884
|
-
|
|
885
|
-
y: yPos,
|
|
886
|
-
width: import_zod17.z.coerce.number().optional().describe("Width (default: 100)"),
|
|
887
|
-
height: import_zod17.z.coerce.number().optional().describe("Height (default: 100)"),
|
|
888
|
-
parentId,
|
|
889
|
-
fillColor: flexJson(colorRgba).optional().describe("Fill color. Omit for no fill."),
|
|
890
|
-
fillStyleName: import_zod17.z.string().optional().describe("Apply a fill paint style by name (case-insensitive)."),
|
|
891
|
-
fillVariableId: import_zod17.z.string().optional().describe("Bind a color variable to the fill."),
|
|
892
|
-
strokeColor: flexJson(colorRgba).optional().describe("Stroke color. Omit for no stroke."),
|
|
893
|
-
strokeStyleName: import_zod17.z.string().optional().describe("Apply a stroke paint style by name."),
|
|
894
|
-
strokeVariableId: import_zod17.z.string().optional().describe("Bind a color variable to the stroke."),
|
|
895
|
-
strokeWeight: import_zod17.z.coerce.number().positive().optional().describe("Stroke weight (default: 1)"),
|
|
896
|
-
cornerRadius: import_zod17.z.coerce.number().optional().describe("Corner radius (default: 0)"),
|
|
897
|
-
layoutMode: import_zod17.z.enum(["NONE", "HORIZONTAL", "VERTICAL"]).optional().describe("Layout direction (default: NONE)"),
|
|
898
|
-
layoutWrap: import_zod17.z.enum(["NO_WRAP", "WRAP"]).optional().describe("Wrap behavior (default: NO_WRAP)"),
|
|
899
|
-
paddingTop: import_zod17.z.coerce.number().optional().describe("Top padding (default: 0)"),
|
|
900
|
-
paddingRight: import_zod17.z.coerce.number().optional().describe("Right padding (default: 0)"),
|
|
901
|
-
paddingBottom: import_zod17.z.coerce.number().optional().describe("Bottom padding (default: 0)"),
|
|
902
|
-
paddingLeft: import_zod17.z.coerce.number().optional().describe("Left padding (default: 0)"),
|
|
903
|
-
primaryAxisAlignItems: import_zod17.z.enum(["MIN", "MAX", "CENTER", "SPACE_BETWEEN"]).optional().describe("Primary axis alignment (default: MIN)"),
|
|
904
|
-
counterAxisAlignItems: import_zod17.z.enum(["MIN", "MAX", "CENTER", "BASELINE"]).optional().describe("Counter axis alignment (default: MIN)"),
|
|
905
|
-
layoutSizingHorizontal: import_zod17.z.enum(["FIXED", "HUG", "FILL"]).optional().describe("Horizontal sizing (default: FIXED)"),
|
|
906
|
-
layoutSizingVertical: import_zod17.z.enum(["FIXED", "HUG", "FILL"]).optional().describe("Vertical sizing (default: FIXED)"),
|
|
907
|
-
itemSpacing: import_zod17.z.coerce.number().optional().describe("Spacing between children (default: 0)")
|
|
908
|
-
});
|
|
909
|
-
var fromNodeItem = import_zod17.z.object({
|
|
910
|
-
nodeId,
|
|
911
|
-
exposeText: flexBool(import_zod17.z.boolean()).default(true).describe("Auto-expose text children as editable TEXT properties and bind them (default: true). Set false to skip.")
|
|
912
|
-
});
|
|
913
|
-
var combineItem = import_zod17.z.object({
|
|
914
|
-
componentIds: flexJson(import_zod17.z.array(import_zod17.z.string())).describe("Component IDs to combine (min 2)"),
|
|
915
|
-
name: import_zod17.z.string().optional().describe("Name for the component set. Omit to auto-generate.")
|
|
916
|
-
});
|
|
917
|
-
var updateComponentItem = import_zod17.z.object({
|
|
918
|
-
id: import_zod17.z.string().describe("Component node ID"),
|
|
919
|
-
propertyName: import_zod17.z.string().describe("Property name"),
|
|
920
|
-
type: import_zod17.z.enum(["BOOLEAN", "TEXT", "INSTANCE_SWAP", "VARIANT"]).describe("Property type"),
|
|
921
|
-
defaultValue: flexBool(import_zod17.z.union([import_zod17.z.string(), import_zod17.z.boolean()])).describe("Default value (string for TEXT/VARIANT, boolean for BOOLEAN)"),
|
|
922
|
-
preferredValues: flexJson(import_zod17.z.array(import_zod17.z.object({
|
|
923
|
-
type: import_zod17.z.enum(["COMPONENT", "COMPONENT_SET"]),
|
|
924
|
-
key: import_zod17.z.string()
|
|
925
|
-
})).optional()).describe("Preferred values for INSTANCE_SWAP type. Omit for none.")
|
|
926
|
-
});
|
|
927
|
-
var componentCreateSchemas = {
|
|
928
|
-
component: componentItem,
|
|
929
|
-
from_node: fromNodeItem,
|
|
930
|
-
variant_set: combineItem
|
|
2480
|
+
var guidelinesContent = {
|
|
2481
|
+
"component-structure": '# Component Structure\n\nComponents need correct sizing, property bindings, and token usage to work well as instances.\n\n## Width Constraints\n\nComponents with text content need a width \u2014 otherwise text never wraps.\n\n- Set `width` and `layoutSizingHorizontal:"FIXED"` on cards, panels, list items\n- HUG on both axes is only correct for buttons, badges, icons \u2014 intrinsically-sized elements\n\n## Property Bindings\n\nEvery text node inside a component should be bound to a TEXT property so instances can edit the content.\n\n- On creation: `children:[{type:"text", text:"Title", componentPropertyName:"Title"}]` auto-creates and binds\n- After creation: `frames(method:"update", items:[{id:"<textNodeId>", componentPropertyName:"<propName>"}])`\n- For existing nodes with many text children: `components(method:"create", type:"from_node", exposeText:true)`\n\nOrphaned properties (defined but not bound to any node) should be deleted:\n```\ncomponents(method:"update", items:[{id, propertyName:"<key>", action:"delete"}])\n```\n\n## Variant Sets\n\nGroup related components as variants \u2014 don\'t leave them as separate components.\n\n- Name variants with the property format: `Style=Primary`, `Style=Secondary`\n- Combine: `components(method:"create", type:"variant_set", items:[{componentIds:[...], name:"Button"}])`\n- Instances pick variants via `variantProperties:{"Style":"Primary"}`\n\n## Checking\n\nRun `components(method:"audit", id)` \u2014 checks both lint rules and property bindings in one call.',
|
|
2482
|
+
"library-components": '# Working with Library Components\n\nLibrary components are read-only \u2014 they come from external team libraries and cannot be edited in the current file.\n\n## Reading\n\nWhen reading nodes, library instances appear as stubs with their overridable properties:\n```\n{name: "Header", type: "INSTANCE", componentProperties: {"Platform": "Desktop"}}\n```\n\nLibrary internals are hidden: no `componentId`, no variable names, no style names. You see resolved values (hex colors, numbers) instead.\n\n## Using\n\nPlace library instances via `instances(method:"create", items:[{componentId:"<id>"}])` when you have a local component ID. For library components, instances are already placed by the designer \u2014 interact via `instances(method:"update")` to set properties.\n\n## Customizing\n\nTo edit a library component, clone it into the local file first:\n\n```\ncomponents(method:"clone", id:"<instanceId>")\n```\n\nThis resolves the instance to its source component (or full component set) and creates a local copy with a new ID. Edit the local copy freely \u2014 it is independent of the library.\n\nDo not attempt to `components(method:"get")` or `components(method:"update")` a library component directly \u2014 these will error.\n\n## Overriding Instance Properties\n\nUse `instances(method:"update")` to change overridable properties on library instances:\n```\ninstances(method:"update", items:[{id:"<instanceId>", properties:{"Label":"New Text", "State":"Hover"}}])\n```\n\nProperty names are clean (no hash suffixes needed for update \u2014 the system resolves partial keys).',
|
|
2483
|
+
"responsive-designs": "# Responsive Sizing\n\n## FIXED / FILL / HUG\n\n- **FIXED** \u2014 layout boundaries: page shell, sidebar width, modal max-width\n- **FILL** \u2014 children that adapt to parent: main content area, nav stacks, cards in columns, text that should wrap\n- **HUG** \u2014 content-sized leaves only: icons, badges, pills, button labels\n\n## Component Sizing\n\nComponent roots use `FILL` when placed in a parent \u2014 they adapt to context, not a fixed specimen width.\n\nExample sidebar item:\n- Instance: `FILL` in parent nav stack\n- Icon child: fixed 18x18\n- Label child: `FILL`\n- Badge child: `HUG`\n\n## Text Sizing\n\n- Body text inside containers: `FILL` width, `HUG` height (auto-wraps)\n- Single-line labels: `FILL` horizontal (truncates if needed)\n- Standalone headings: `HUG` is fine\n\nInside auto-layout parents, text defaults to `FILL` horizontal + `HUG` vertical + `textAutoResize: HEIGHT`.",
|
|
2484
|
+
"token-discipline": '# Token Discipline\n\nEvery color, spacing value, and text style should come from a design token \u2014 not hardcoded values.\n\n## Colors\n\nBind fills and strokes to color variables instead of hex values.\n\n- Fill: `fillVariableName:"bg/primary"` or `fillStyleName:"Surface/Primary"`\n- Stroke: `strokeVariableName:"border/default"`\n- Text color: `fontColorVariableName:"text/primary"`\n\nIf no matching variable exists, create one first:\n```\nvariables(method:"create", collectionId:"Colors", items:[{name:"bg/accent", type:"COLOR", valuesByMode:{"Light":"#E8F0FE","Dark":"#1A3A5C"}, scopes:["ALL_FILLS"]}])\n```\n\n## Spacing and Radius\n\nPass a variable name string instead of a number for cornerRadius, padding, itemSpacing, strokeWeight, opacity.\n\n- `cornerRadius:"radius/8"` not `cornerRadius:8`\n- `paddingTop:"space/16"` not `paddingTop:16`\n- `itemSpacing:"space/8"` not `itemSpacing:8`\n\nCreate FLOAT variables with appropriate scopes:\n```\nvariables(method:"create", collectionId:"Metrics", items:[{name:"space/12", type:"FLOAT", value:12, scopes:["GAP","WIDTH_HEIGHT"]}])\n```\n\n## Text Styles\n\nApply text styles by name \u2014 don\'t set fontSize/fontFamily/fontWeight manually.\n\n- `textStyleName:"Body/M"` on text.create or frames.update\n- Create styles with `styles(method:"create", type:"text", items:[{name:"Body/M", fontFamily:"Inter", fontSize:14, lineHeight:{value:20, unit:"PIXELS"}}])`\n\n## Common Scopes\n\nCOLOR variables:\n- `ALL_FILLS` \u2014 background fills\n- `TEXT_FILL` \u2014 text color\n- `STROKE_COLOR` \u2014 borders and outlines\n\nFLOAT variables:\n- `GAP`, `WIDTH_HEIGHT` \u2014 spacing and padding\n- `CORNER_RADIUS` \u2014 border radius\n- `STROKE_FLOAT` \u2014 stroke weight\n- `OPACITY` \u2014 transparency\n\n## Checking\n\nLint rules `hardcoded-color`, `hardcoded-token`, `no-text-style` catch unbound values. Run `audit` on any node to check.',
|
|
2485
|
+
"vibma-workflow": '# Vibma Workflow\n\nWork with the tool in a predictable sequence: read before writing, create parents before children, verify after mutations.\n\n## Build Order\n\n1. `connection.create` \u2192 `connection.get` to verify\n2. Inspect existing structure: `document.get`, `variables.list`, `styles.list`, `components.list`\n3. Create design tokens: variable collections \u2192 variables \u2192 text styles \u2192 effect styles\n4. Create components from tokens\n5. Assemble screens from component instances\n6. Verify with `lint.check` and `frames.export`\n\n## Parent-First Rule\n\nCreate parent containers before children. Dependent creates must be sequential \u2014 never parallelize when the child needs the parent ID.\n\n## Component Creation\n\nBuild components early \u2014 they are the building blocks for screens. A component IS a frame: create it directly with layout properties, then add children.\n\n- Use `components.create(type: "component")` with properties for TEXT, BOOLEAN, INSTANCE_SWAP\n- TEXT properties auto-bind to child text nodes with matching names\n- Group related components into variant sets with `components.create(type: "variant_set")` for state dimensions (Style, Size, State)\n- Use flat components (not variant sets) for INSTANCE_SWAP slots like icons or avatars\n- Assemble screens from `instances.create`, not by cloning frames\n\n## Placement Rule\n\nAlways pass `x` and `y` for top-level nodes and clones. Do not stack everything at `0,0`.\n\n## Instance Rule\n\nCall `components.get` or `instances.get` to discover property keys (including `#suffix`) before setting overrides. Do not guess property names.\n\n## Verify After Mutations\n\n`"ok"` means the write succeeded, not that the result is correct. Read back the node after clone, swap, mode pinning, or large batch updates.'
|
|
931
2486
|
};
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
parentId
|
|
938
|
-
});
|
|
939
|
-
var instanceUpdateItem = import_zod17.z.object({
|
|
940
|
-
id: nodeId,
|
|
941
|
-
properties: flexJson(import_zod17.z.record(import_zod17.z.string(), import_zod17.z.union([import_zod17.z.string(), import_zod17.z.boolean()]))).describe('Property key\u2192value map, e.g. {"Label#1:0":"Click Me"}')
|
|
942
|
-
});
|
|
943
|
-
var tools15 = [
|
|
944
|
-
{
|
|
945
|
-
name: "components",
|
|
946
|
-
description: `CRUD endpoint for components.
|
|
947
|
-
create \u2192 {type, items, depth?} \u2192 {results: [{id}, ...]}
|
|
948
|
-
type 'component': create from scratch with layout/style params
|
|
949
|
-
type 'from_node': convert existing nodes to components. Text children are auto-exposed as editable properties by default (exposeText: true) \u2014 instances can set text directly via properties.
|
|
950
|
-
type 'variant_set': combine components into variant sets
|
|
951
|
-
get \u2192 {id, fields?} \u2192 component object (full detail, field-filterable)
|
|
952
|
-
list \u2192 {name?, setsOnly?, fields?, offset?, limit?} \u2192 paginated stubs
|
|
953
|
-
update \u2192 {items: [{id, propertyName, type, defaultValue}]} \u2192 creates property AND binds matching text node automatically`,
|
|
954
|
-
schema: (caps2) => endpointSchema(
|
|
955
|
-
["create", "get", "list", "update"],
|
|
956
|
-
caps2,
|
|
957
|
-
{
|
|
958
|
-
items: flexJson(import_zod17.z.array(import_zod17.z.any())).optional().describe("create (component): [{name, parentId?, ...layout}]. create (from_node): [{nodeId, exposeText?}]. create (variant_set): [{componentIds, name?}]. update: [{id, propertyName, type, defaultValue}]."),
|
|
959
|
-
type: import_zod17.z.enum(["component", "from_node", "variant_set"]).optional().describe("Create type. Required for create: 'component' (from scratch), 'from_node' (convert existing), 'variant_set' (combine as variants)."),
|
|
960
|
-
depth,
|
|
961
|
-
name: import_zod17.z.string().optional().describe("Filter list by name (case-insensitive substring)."),
|
|
962
|
-
setsOnly: flexBool(import_zod17.z.boolean()).optional().describe("If true, list returns only COMPONENT_SET nodes.")
|
|
963
|
-
}
|
|
964
|
-
),
|
|
965
|
-
tier: "read",
|
|
966
|
-
validate: (params) => {
|
|
967
|
-
if (params.items) {
|
|
968
|
-
if (params.method === "create") {
|
|
969
|
-
const schema = params.type && componentCreateSchemas[params.type];
|
|
970
|
-
if (!schema) throw new Error(`create requires type: component, from_node, or variant_set`);
|
|
971
|
-
params.items = import_zod17.z.array(schema).parse(params.items);
|
|
972
|
-
} else if (params.method === "update") {
|
|
973
|
-
params.items = import_zod17.z.array(updateComponentItem).parse(params.items);
|
|
974
|
-
}
|
|
975
|
-
}
|
|
976
|
-
}
|
|
977
|
-
},
|
|
978
|
-
{
|
|
979
|
-
name: "instances",
|
|
980
|
-
description: `CRUD endpoint for component instances.
|
|
981
|
-
create \u2192 {items: [{componentId, variantProperties?, x?, y?, parentId?}], depth?} \u2192 {results: [{id}]}
|
|
982
|
-
get \u2192 {id} \u2192 {mainComponentId, overrides: [{id, fields}]}
|
|
983
|
-
update \u2192 {items: [{id, properties}]} \u2192 {results: ['ok', ...]}`,
|
|
984
|
-
schema: (caps2) => endpointSchema(
|
|
985
|
-
["create", "get", "update"],
|
|
986
|
-
caps2,
|
|
987
|
-
{
|
|
988
|
-
items: flexJson(import_zod17.z.array(import_zod17.z.any())).optional().describe("create: [{componentId, variantProperties?, x?, y?, parentId?}]. update: [{id, properties}]."),
|
|
989
|
-
depth
|
|
990
|
-
}
|
|
991
|
-
),
|
|
992
|
-
tier: "read",
|
|
993
|
-
validate: (params) => {
|
|
994
|
-
if (params.items) {
|
|
995
|
-
if (params.method === "create") {
|
|
996
|
-
params.items = import_zod17.z.array(instanceCreateItem).parse(params.items);
|
|
997
|
-
} else if (params.method === "update") {
|
|
998
|
-
params.items = import_zod17.z.array(instanceUpdateItem).parse(params.items);
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
2487
|
+
function resolveGuideline(topic) {
|
|
2488
|
+
if (!topic) {
|
|
2489
|
+
const dir = ["# Design Guidelines", ""];
|
|
2490
|
+
for (const g of guidelinesList) {
|
|
2491
|
+
dir.push(" " + g.name.padEnd(30) + g.title);
|
|
1001
2492
|
}
|
|
2493
|
+
dir.push("");
|
|
2494
|
+
dir.push('Use guidelines(topic: "<name>") for full guideline text.');
|
|
2495
|
+
return dir.join("\n");
|
|
1002
2496
|
}
|
|
1003
|
-
];
|
|
2497
|
+
const content = guidelinesContent[topic];
|
|
2498
|
+
if (content) return content;
|
|
2499
|
+
const names = guidelinesList.map((g) => g.name);
|
|
2500
|
+
return "Unknown guideline: " + topic + ". Available: " + names.join(", ");
|
|
2501
|
+
}
|
|
1004
2502
|
|
|
1005
2503
|
// src/tools/prompts.ts
|
|
1006
2504
|
function registerPrompts(server2) {
|
|
@@ -1012,41 +2510,26 @@ function registerPrompts(server2) {
|
|
|
1012
2510
|
role: "assistant",
|
|
1013
2511
|
content: {
|
|
1014
2512
|
type: "text",
|
|
1015
|
-
text: `
|
|
2513
|
+
text: `Figma design best practices:
|
|
1016
2514
|
|
|
1017
|
-
1.
|
|
1018
|
-
- Use get_document_info() to see pages and current page
|
|
1019
|
-
- Use styles(method: "list") and get_local_variables() to discover existing design tokens
|
|
1020
|
-
- Plan layout hierarchy before creating elements
|
|
2515
|
+
1. Discover First: document(method:"list"), styles(method:"list"), variables(method:"list") \u2014 know what exists before creating.
|
|
1021
2516
|
|
|
1022
|
-
2.
|
|
1023
|
-
-
|
|
1024
|
-
-
|
|
1025
|
-
- Effects: use effectStyleName to apply shadow/blur styles
|
|
1026
|
-
- Only use raw fillColor/fontColor for one-off values not in the design system
|
|
2517
|
+
2. Design Tokens \u2014 Never Hardcode Colors:
|
|
2518
|
+
- Use fillStyleName/strokeStyleName (paint styles) or fillVariableName/strokeVariableName (variables)
|
|
2519
|
+
- Use textStyleName for typography. Only use raw fillColor/fontColor for one-off values.
|
|
1027
2520
|
|
|
1028
2521
|
3. Auto-Layout First:
|
|
1029
|
-
-
|
|
1030
|
-
-
|
|
1031
|
-
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
-
|
|
1040
|
-
- Use get_node_variables() to verify which variables are bound to a node
|
|
1041
|
-
|
|
1042
|
-
6. Quality Check \u2014 Run Lint:
|
|
1043
|
-
- After building a section, run lint_node() to catch common issues:
|
|
1044
|
-
* hardcoded-color: fills/strokes not using styles or variables
|
|
1045
|
-
* no-text-style: text without a text style applied
|
|
1046
|
-
* no-autolayout: frames with children but no auto-layout
|
|
1047
|
-
* default-name: nodes still named "Frame", "Rectangle", etc.
|
|
1048
|
-
- Use lint_fix_autolayout() to auto-fix layout issues
|
|
1049
|
-
- Lint early and often \u2014 it is cheaper to fix issues during creation than after`
|
|
2522
|
+
- frames(method:"create", type:"auto_layout") for containers, components(method:"create", type:"component") for reusable elements.
|
|
2523
|
+
- A component IS a frame \u2014 create it directly with layout/fill/stroke params, then add children. No need to create a frame first and convert.
|
|
2524
|
+
- layoutSizingHorizontal/Vertical: "FILL" for responsive children, "HUG" to shrink-wrap.
|
|
2525
|
+
|
|
2526
|
+
4. Naming: descriptive names for all elements. Property=Value pattern (e.g. "Size=Small") for variant components.
|
|
2527
|
+
|
|
2528
|
+
5. Lint After Every Section:
|
|
2529
|
+
- Run lint(method:"check") after building. Always attempt to fix warnings unless you understand the specific warning and it's intentional.
|
|
2530
|
+
- Each warning includes a fix instruction with the exact tool call to use \u2014 follow it.
|
|
2531
|
+
- Use lint(method:"fix") to auto-convert frames to auto-layout.
|
|
2532
|
+
- Lint early and often \u2014 cheaper to fix during creation than after.`
|
|
1050
2533
|
}
|
|
1051
2534
|
}],
|
|
1052
2535
|
description: "Best practices for working with Figma designs"
|
|
@@ -1060,12 +2543,7 @@ function registerPrompts(server2) {
|
|
|
1060
2543
|
role: "assistant",
|
|
1061
2544
|
content: {
|
|
1062
2545
|
type: "text",
|
|
1063
|
-
text:
|
|
1064
|
-
|
|
1065
|
-
1. Start with selection:
|
|
1066
|
-
- First use get_selection() to understand the current selection
|
|
1067
|
-
- If no selection ask user to select single or multiple nodes
|
|
1068
|
-
`
|
|
2546
|
+
text: 'When reading Figma designs, follow these best practices:\n\n1. Start with selection:\n - First use selection(method: "get") to understand the current selection\n - If no selection ask user to select single or multiple nodes'
|
|
1069
2547
|
}
|
|
1070
2548
|
}],
|
|
1071
2549
|
description: "Best practices for reading Figma designs"
|
|
@@ -1079,120 +2557,7 @@ function registerPrompts(server2) {
|
|
|
1079
2557
|
role: "assistant",
|
|
1080
2558
|
content: {
|
|
1081
2559
|
type: "text",
|
|
1082
|
-
text:
|
|
1083
|
-
|
|
1084
|
-
## 1. Analyze Design & Identify Structure
|
|
1085
|
-
- Scan text nodes to understand the overall structure of the design
|
|
1086
|
-
- Use AI pattern recognition to identify logical groupings:
|
|
1087
|
-
* Tables (rows, columns, headers, cells)
|
|
1088
|
-
* Lists (items, headers, nested lists)
|
|
1089
|
-
* Card groups (similar cards with recurring text fields)
|
|
1090
|
-
* Forms (labels, input fields, validation text)
|
|
1091
|
-
* Navigation (menu items, breadcrumbs)
|
|
1092
|
-
\`\`\`
|
|
1093
|
-
scan_text_nodes(nodeId: "node-id")
|
|
1094
|
-
get_node_info(nodeId: "node-id") // optional
|
|
1095
|
-
\`\`\`
|
|
1096
|
-
|
|
1097
|
-
## 2. Strategic Chunking for Complex Designs
|
|
1098
|
-
- Divide replacement tasks into logical content chunks based on design structure
|
|
1099
|
-
- Use one of these chunking strategies that best fits the design:
|
|
1100
|
-
* **Structural Chunking**: Table rows/columns, list sections, card groups
|
|
1101
|
-
* **Spatial Chunking**: Top-to-bottom, left-to-right in screen areas
|
|
1102
|
-
* **Semantic Chunking**: Content related to the same topic or functionality
|
|
1103
|
-
* **Component-Based Chunking**: Process similar component instances together
|
|
1104
|
-
|
|
1105
|
-
## 3. Progressive Replacement with Verification
|
|
1106
|
-
- Create a safe copy of the node for text replacement
|
|
1107
|
-
- Replace text chunk by chunk with continuous progress updates
|
|
1108
|
-
- After each chunk is processed:
|
|
1109
|
-
* Export that section as a small, manageable image
|
|
1110
|
-
* Verify text fits properly and maintain design integrity
|
|
1111
|
-
* Fix issues before proceeding to the next chunk
|
|
1112
|
-
|
|
1113
|
-
\`\`\`
|
|
1114
|
-
// Clone the node to create a safe copy
|
|
1115
|
-
clone_node(nodeId: "selected-node-id", x: [new-x], y: [new-y])
|
|
1116
|
-
|
|
1117
|
-
// Replace text chunk by chunk
|
|
1118
|
-
set_text_content(
|
|
1119
|
-
items: [
|
|
1120
|
-
{ nodeId: "node-id-1", text: "New text 1" },
|
|
1121
|
-
// More nodes in this chunk...
|
|
1122
|
-
]
|
|
1123
|
-
)
|
|
1124
|
-
|
|
1125
|
-
// Verify chunk with small, targeted image exports
|
|
1126
|
-
export_node_as_image(nodeId: "chunk-node-id", format: "PNG", scale: 0.5)
|
|
1127
|
-
\`\`\`
|
|
1128
|
-
|
|
1129
|
-
## 4. Intelligent Handling for Table Data
|
|
1130
|
-
- For tabular content:
|
|
1131
|
-
* Process one row or column at a time
|
|
1132
|
-
* Maintain alignment and spacing between cells
|
|
1133
|
-
* Consider conditional formatting based on cell content
|
|
1134
|
-
* Preserve header/data relationships
|
|
1135
|
-
|
|
1136
|
-
## 5. Smart Text Adaptation
|
|
1137
|
-
- Adaptively handle text based on container constraints:
|
|
1138
|
-
* Auto-detect space constraints and adjust text length
|
|
1139
|
-
* Apply line breaks at appropriate linguistic points
|
|
1140
|
-
* Maintain text hierarchy and emphasis
|
|
1141
|
-
* Consider font scaling for critical content that must fit
|
|
1142
|
-
|
|
1143
|
-
## 6. Progressive Feedback Loop
|
|
1144
|
-
- Establish a continuous feedback loop during replacement:
|
|
1145
|
-
* Real-time progress updates (0-100%)
|
|
1146
|
-
* Small image exports after each chunk for verification
|
|
1147
|
-
* Issues identified early and resolved incrementally
|
|
1148
|
-
* Quick adjustments applied to subsequent chunks
|
|
1149
|
-
|
|
1150
|
-
## 7. Final Verification & Context-Aware QA
|
|
1151
|
-
- After all chunks are processed:
|
|
1152
|
-
* Export the entire design at reduced scale for final verification
|
|
1153
|
-
* Check for cross-chunk consistency issues
|
|
1154
|
-
* Verify proper text flow between different sections
|
|
1155
|
-
* Ensure design harmony across the full composition
|
|
1156
|
-
|
|
1157
|
-
## 8. Chunk-Specific Export Scale Guidelines
|
|
1158
|
-
- Scale exports appropriately based on chunk size:
|
|
1159
|
-
* Small chunks (1-5 elements): scale 1.0
|
|
1160
|
-
* Medium chunks (6-20 elements): scale 0.7
|
|
1161
|
-
* Large chunks (21-50 elements): scale 0.5
|
|
1162
|
-
* Very large chunks (50+ elements): scale 0.3
|
|
1163
|
-
* Full design verification: scale 0.2
|
|
1164
|
-
|
|
1165
|
-
## Sample Chunking Strategy for Common Design Types
|
|
1166
|
-
|
|
1167
|
-
### Tables
|
|
1168
|
-
- Process by logical rows (5-10 rows per chunk)
|
|
1169
|
-
- Alternative: Process by column for columnar analysis
|
|
1170
|
-
- Tip: Always include header row in first chunk for reference
|
|
1171
|
-
|
|
1172
|
-
### Card Lists
|
|
1173
|
-
- Group 3-5 similar cards per chunk
|
|
1174
|
-
- Process entire cards to maintain internal consistency
|
|
1175
|
-
- Verify text-to-image ratio within cards after each chunk
|
|
1176
|
-
|
|
1177
|
-
### Forms
|
|
1178
|
-
- Group related fields (e.g., "Personal Information", "Payment Details")
|
|
1179
|
-
- Process labels and input fields together
|
|
1180
|
-
- Ensure validation messages and hints are updated with their fields
|
|
1181
|
-
|
|
1182
|
-
### Navigation & Menus
|
|
1183
|
-
- Process hierarchical levels together (main menu, submenu)
|
|
1184
|
-
- Respect information architecture relationships
|
|
1185
|
-
- Verify menu fit and alignment after replacement
|
|
1186
|
-
|
|
1187
|
-
## Best Practices
|
|
1188
|
-
- **Preserve Design Intent**: Always prioritize design integrity
|
|
1189
|
-
- **Structural Consistency**: Maintain alignment, spacing, and hierarchy
|
|
1190
|
-
- **Visual Feedback**: Verify each chunk visually before proceeding
|
|
1191
|
-
- **Incremental Improvement**: Learn from each chunk to improve subsequent ones
|
|
1192
|
-
- **Balance Automation & Control**: Let AI handle repetitive replacements but maintain oversight
|
|
1193
|
-
- **Respect Content Relationships**: Keep related content consistent across chunks
|
|
1194
|
-
|
|
1195
|
-
Remember that text is never just text\u2014it's a core design element that must work harmoniously with the overall composition. This chunk-based strategy allows you to methodically transform text while maintaining design integrity.`
|
|
2560
|
+
text: '# Intelligent Text Replacement Strategy\n\n## 1. Analyze Design & Identify Structure\n- Scan text nodes to understand the overall structure of the design\n- Use AI pattern recognition to identify logical groupings:\n * Tables (rows, columns, headers, cells)\n * Lists (items, headers, nested lists)\n * Card groups (similar cards with recurring text fields)\n * Forms (labels, input fields, validation text)\n * Navigation (menu items, breadcrumbs)\n```\ntext(method: "scan", items: [{nodeId: "node-id"}])\nframes(method: "get", id: "node-id", depth: 1) // optional\n```\n\n## 2. Strategic Chunking for Complex Designs\n- Divide replacement tasks into logical content chunks based on design structure\n- Use one of these chunking strategies that best fits the design:\n * **Structural Chunking**: Table rows/columns, list sections, card groups\n * **Spatial Chunking**: Top-to-bottom, left-to-right in screen areas\n * **Semantic Chunking**: Content related to the same topic or functionality\n * **Component-Based Chunking**: Process similar component instances together\n\n## 3. Progressive Replacement with Verification\n- Create a safe copy of the node for text replacement\n- Replace text chunk by chunk with continuous progress updates\n- After each chunk is processed:\n * Export that section as a small, manageable image\n * Verify text fits properly and maintain design integrity\n * Fix issues before proceeding to the next chunk\n\n```\n// Clone the node to create a safe copy\nframes(method: "clone", id: "selected-node-id", x: [new-x], y: [new-y])\n\n// Replace text chunk by chunk\ntext(method: "set_content", items: [\n { nodeId: "node-id-1", text: "New text 1" },\n // More nodes in this chunk...\n])\n\n// Verify chunk with small, targeted image exports\nframes(method: "export", nodeId: "chunk-node-id", format: "PNG", scale: 0.5)\n```\n\n## 4. Intelligent Handling for Table Data\n- For tabular content:\n * Process one row or column at a time\n * Maintain alignment and spacing between cells\n * Consider conditional formatting based on cell content\n * Preserve header/data relationships\n\n## 5. Smart Text Adaptation\n- Adaptively handle text based on container constraints:\n * Auto-detect space constraints and adjust text length\n * Apply line breaks at appropriate linguistic points\n * Maintain text hierarchy and emphasis\n * Consider font scaling for critical content that must fit\n\n## 6. Progressive Feedback Loop\n- Establish a continuous feedback loop during replacement:\n * Real-time progress updates (0-100%)\n * Small image exports after each chunk for verification\n * Issues identified early and resolved incrementally\n * Quick adjustments applied to subsequent chunks\n\n## 7. Final Verification & Context-Aware QA\n- After all chunks are processed:\n * Export the entire design at reduced scale for final verification\n * Check for cross-chunk consistency issues\n * Verify proper text flow between different sections\n * Ensure design harmony across the full composition\n\n## 8. Chunk-Specific Export Scale Guidelines\n- Scale exports appropriately based on chunk size:\n * Small chunks (1-5 elements): scale 1.0\n * Medium chunks (6-20 elements): scale 0.7\n * Large chunks (21-50 elements): scale 0.5\n * Very large chunks (50+ elements): scale 0.3\n * Full design verification: scale 0.2\n\n## Sample Chunking Strategy for Common Design Types\n\n### Tables\n- Process by logical rows (5-10 rows per chunk)\n- Alternative: Process by column for columnar analysis\n- Tip: Always include header row in first chunk for reference\n\n### Card Lists\n- Group 3-5 similar cards per chunk\n- Process entire cards to maintain internal consistency\n- Verify text-to-image ratio within cards after each chunk\n\n### Forms\n- Group related fields (e.g., "Personal Information", "Payment Details")\n- Process labels and input fields together\n- Ensure validation messages and hints are updated with their fields\n\n### Navigation & Menus\n- Process hierarchical levels together (main menu, submenu)\n- Respect information architecture relationships\n- Verify menu fit and alignment after replacement\n\n## Best Practices\n- **Preserve Design Intent**: Always prioritize design integrity\n- **Structural Consistency**: Maintain alignment, spacing, and hierarchy\n- **Visual Feedback**: Verify each chunk visually before proceeding\n- **Incremental Improvement**: Learn from each chunk to improve subsequent ones\n- **Balance Automation & Control**: Let AI handle repetitive replacements but maintain oversight\n- **Respect Content Relationships**: Keep related content consistent across chunks\n\nRemember that text is never just text \u2014 it\'s a core design element that must work harmoniously with the overall composition. This chunk-based strategy allows you to methodically transform text while maintaining design integrity.'
|
|
1196
2561
|
}
|
|
1197
2562
|
}],
|
|
1198
2563
|
description: "Systematic approach for replacing text in Figma designs"
|
|
@@ -1206,32 +2571,10 @@ Remember that text is never just text\u2014it's a core design element that must
|
|
|
1206
2571
|
role: "assistant",
|
|
1207
2572
|
content: {
|
|
1208
2573
|
type: "text",
|
|
1209
|
-
text:
|
|
1210
|
-
|
|
1211
|
-
## Overview
|
|
1212
|
-
Transfer content overrides from a source instance to target instances.
|
|
1213
|
-
|
|
1214
|
-
## Process
|
|
1215
|
-
|
|
1216
|
-
### 1. Identify Instances
|
|
1217
|
-
- Use \`get_selection()\` to identify selected instances
|
|
1218
|
-
- Use \`search_nodes(types: ["INSTANCE"])\` to find instances on the page
|
|
1219
|
-
|
|
1220
|
-
### 2. Extract Source Overrides
|
|
1221
|
-
- \`instances(method: "get", id: "source-instance-id")\`
|
|
1222
|
-
- Returns mainComponentId and per-child override fields (characters, fills, fontSize, etc.)
|
|
1223
|
-
|
|
1224
|
-
### 3. Apply to Targets
|
|
1225
|
-
- For text overrides: use \`set_text_content\` on matching child node IDs
|
|
1226
|
-
- For style overrides: use \`patch_nodes\` with fill/stroke/text/effects styleName fields
|
|
1227
|
-
- Match children by name path \u2014 source and target instances share the same internal structure
|
|
1228
|
-
|
|
1229
|
-
### 4. Verify
|
|
1230
|
-
- \`get_node_info(nodeId, depth: 1)\` on target instances
|
|
1231
|
-
- \`export_node_as_image\` for visual verification`
|
|
2574
|
+
text: '# Swap Component Instance Overrides\n\n## Overview\nTransfer content overrides from a source instance to target instances.\n\n## Process\n\n### 1. Identify Instances\n- Use `selection(method: "get")` to identify selected instances\n- Use `frames(method: "list", types: ["INSTANCE"])` to find instances on the page\n\n### 2. Extract Source Overrides\n- `instances(method: "get", id: "source-instance-id")`\n- Returns mainComponentId and per-child override fields (characters, fills, fontSize, etc.)\n\n### 3. Apply to Targets\n- For text overrides: use `text(method: "set_content")` on matching child node IDs\n- For style overrides: use `frames(method: "update")` with fill/stroke/text/effects styleName fields\n- Match children by name path \u2014 source and target instances share the same internal structure\n\n### 4. Verify\n- `frames(method: "get", id: "target-id", depth: 1)` on target instances\n- `frames(method: "export", nodeId: "target-id")` for visual verification'
|
|
1232
2575
|
}
|
|
1233
2576
|
}],
|
|
1234
|
-
description: "
|
|
2577
|
+
description: "Guide to swap instance overrides between instances"
|
|
1235
2578
|
})
|
|
1236
2579
|
);
|
|
1237
2580
|
server2.registerPrompt(
|
|
@@ -1242,32 +2585,7 @@ Transfer content overrides from a source instance to target instances.
|
|
|
1242
2585
|
role: "assistant",
|
|
1243
2586
|
content: {
|
|
1244
2587
|
type: "text",
|
|
1245
|
-
text:
|
|
1246
|
-
|
|
1247
|
-
If the user asks you to create or modify something in Figma but you cannot find tools like \`create_frame\`, \`create_text\`, \`patch_nodes\`, \`delete_node\`, or \`set_text_content\`, the MCP server was started without the correct access tier flag.
|
|
1248
|
-
|
|
1249
|
-
Vibma filters tools at startup based on CLI flags passed in the MCP config \`args\` array:
|
|
1250
|
-
|
|
1251
|
-
| Flag | Tools available |
|
|
1252
|
-
|------|----------------|
|
|
1253
|
-
| _(none)_ | Read-only (inspect, search, export) |
|
|
1254
|
-
| \`--create\` | Read + creation tools |
|
|
1255
|
-
| \`--edit\` | All tools (read + create + edit + delete) |
|
|
1256
|
-
|
|
1257
|
-
Ask the user to add \`--edit\` (or \`--create\`) to their MCP config args:
|
|
1258
|
-
|
|
1259
|
-
\`\`\`json
|
|
1260
|
-
{
|
|
1261
|
-
"mcpServers": {
|
|
1262
|
-
"Vibma": {
|
|
1263
|
-
"command": "npx",
|
|
1264
|
-
"args": ["-y", "@ufira/vibma", "--edit"]
|
|
1265
|
-
}
|
|
1266
|
-
}
|
|
1267
|
-
}
|
|
1268
|
-
\`\`\`
|
|
1269
|
-
|
|
1270
|
-
After updating, the user must restart their AI tool or reload MCP servers \u2014 stdio-based servers cannot hot-reload.`
|
|
2588
|
+
text: '# Missing Create / Edit Tools\n\nIf the user asks you to create or modify something in Figma but you cannot find create/edit methods on endpoint tools, the MCP server was started without the correct access tier flag.\n\nVibma filters available methods at startup based on CLI flags passed in the MCP config `args` array:\n\n| Flag | Methods available |\n|------|-----------------|\n| _(none)_ | Read-only (get, list, check, scan, export) |\n| `--create` | Read + creation methods (create, clone) |\n| `--edit` | All methods (read + create + update + delete) |\n\nAsk the user to add `--edit` (or `--create`) to their MCP config args:\n\n```json\n{\n "mcpServers": {\n "Vibma": {\n "command": "npx",\n "args": ["-y", "@ufira/vibma", "--edit"]\n }\n }\n}\n```\n\nAfter updating, the user must restart their AI tool or reload MCP servers \u2014 stdio-based servers cannot hot-reload.'
|
|
1271
2589
|
}
|
|
1272
2590
|
}],
|
|
1273
2591
|
description: "Why create or edit tools are missing and how to fix it"
|
|
@@ -1276,24 +2594,39 @@ After updating, the user must restart their AI tool or reload MCP servers \u2014
|
|
|
1276
2594
|
}
|
|
1277
2595
|
|
|
1278
2596
|
// src/tools/mcp-registry.ts
|
|
1279
|
-
var
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
];
|
|
2597
|
+
var endpointTools = tools.filter((t) => t.name !== "connection");
|
|
2598
|
+
var framesTool = endpointTools.find((t) => t.name === "frames");
|
|
2599
|
+
if (framesTool) {
|
|
2600
|
+
framesTool.methodFormatters = {
|
|
2601
|
+
export: (result) => {
|
|
2602
|
+
const r = result;
|
|
2603
|
+
if (r.isString) {
|
|
2604
|
+
return { content: [{ type: "text", text: r.imageData }] };
|
|
2605
|
+
}
|
|
2606
|
+
return {
|
|
2607
|
+
content: [{ type: "image", data: r.imageData, mimeType: r.mimeType || "image/png" }]
|
|
2608
|
+
};
|
|
2609
|
+
}
|
|
2610
|
+
};
|
|
2611
|
+
}
|
|
2612
|
+
var allTools = [...endpointTools];
|
|
1296
2613
|
function registerAllTools(server2, sendCommand, caps2) {
|
|
2614
|
+
server2.registerTool("help", {
|
|
2615
|
+
description: 'Get help on any endpoint or method. Lists all endpoints, their methods, and detailed parameter docs.\nExamples: help() \u2192 directory, help(topic: "components") \u2192 endpoint details, help(topic: "components.create") \u2192 method params.',
|
|
2616
|
+
inputSchema: {
|
|
2617
|
+
topic: import_zod5.z.string().optional().describe('Endpoint or endpoint.method name, e.g. "components" or "components.create"')
|
|
2618
|
+
}
|
|
2619
|
+
}, async (params) => {
|
|
2620
|
+
return { content: [{ type: "text", text: resolveHelp(params.topic) }] };
|
|
2621
|
+
});
|
|
2622
|
+
server2.registerTool("guidelines", {
|
|
2623
|
+
description: 'Design guidelines for building quality Figma designs. Covers layout, responsiveness, tokens, components, accessibility, naming, and workflow.\nExamples: guidelines() \u2192 list topics, guidelines(topic: "responsive-designs") \u2192 full guideline.',
|
|
2624
|
+
inputSchema: {
|
|
2625
|
+
topic: import_zod5.z.string().optional().describe('Guideline topic name, e.g. "responsive-designs" or "token-discipline"')
|
|
2626
|
+
}
|
|
2627
|
+
}, async (params) => {
|
|
2628
|
+
return { content: [{ type: "text", text: resolveGuideline(params.topic) }] };
|
|
2629
|
+
});
|
|
1297
2630
|
registerTools(server2, sendCommand, caps2, allTools);
|
|
1298
2631
|
registerPrompts(server2);
|
|
1299
2632
|
}
|
|
@@ -1344,9 +2677,10 @@ var versionWarning = null;
|
|
|
1344
2677
|
var args = process.argv.slice(2);
|
|
1345
2678
|
var serverArg = args.find((a) => a.startsWith("--server="));
|
|
1346
2679
|
var portArg = args.find((a) => a.startsWith("--port="));
|
|
1347
|
-
var serverUrl = serverArg ? serverArg.split("=")[1] : "localhost";
|
|
2680
|
+
var serverUrl = serverArg ? serverArg.split("=")[1] : process.env.VIBMA_SERVER || "localhost";
|
|
1348
2681
|
if (portArg) activePort = parseInt(portArg.split("=")[1]);
|
|
1349
|
-
var
|
|
2682
|
+
var isLocal = /^(localhost|127\.0\.0\.1|host\.docker\.internal|0\.0\.0\.0)(:|$)/.test(serverUrl) || serverUrl.endsWith(".local");
|
|
2683
|
+
var WS_URL = isLocal ? `ws://${serverUrl}` : `wss://${serverUrl}`;
|
|
1350
2684
|
var caps = {
|
|
1351
2685
|
create: args.includes("--create") || args.includes("--edit"),
|
|
1352
2686
|
edit: args.includes("--edit")
|
|
@@ -1357,7 +2691,7 @@ function connectToFigma(port = activePort) {
|
|
|
1357
2691
|
logger.info("Already connected to Figma");
|
|
1358
2692
|
return;
|
|
1359
2693
|
}
|
|
1360
|
-
const wsUrl =
|
|
2694
|
+
const wsUrl = isLocal ? `${WS_URL}:${port}` : WS_URL;
|
|
1361
2695
|
logger.info(`Connecting to Figma socket server at ${wsUrl}...`);
|
|
1362
2696
|
ws = new import_ws.default(wsUrl);
|
|
1363
2697
|
ws.on("open", () => {
|
|
@@ -1447,7 +2781,7 @@ function connectToFigma(port = activePort) {
|
|
|
1447
2781
|
pendingRequests.delete(id);
|
|
1448
2782
|
}
|
|
1449
2783
|
if (rejected) {
|
|
1450
|
-
logger.info(
|
|
2784
|
+
logger.info('Not reconnecting \u2014 channel role was rejected. Call connection(method: "create") to retry.');
|
|
1451
2785
|
} else {
|
|
1452
2786
|
logger.info("Attempting to reconnect in 2 seconds...");
|
|
1453
2787
|
setTimeout(() => connectToFigma(port), 2e3);
|
|
@@ -1482,7 +2816,7 @@ function sendCommandToFigma(command, params = {}, timeoutMs = 3e4) {
|
|
|
1482
2816
|
}
|
|
1483
2817
|
const requiresChannel = command !== "join";
|
|
1484
2818
|
if (requiresChannel && !currentChannel) {
|
|
1485
|
-
reject(new Error(
|
|
2819
|
+
reject(new Error('No channel joined. Call connection(method: "create") first with the channel name shown in the Figma plugin panel.'));
|
|
1486
2820
|
return;
|
|
1487
2821
|
}
|
|
1488
2822
|
const id = (0, import_uuid.v4)();
|
|
@@ -1518,105 +2852,73 @@ var server = new import_mcp.McpServer({
|
|
|
1518
2852
|
name: "VibmaMCP",
|
|
1519
2853
|
version: "1.0.0"
|
|
1520
2854
|
});
|
|
2855
|
+
var connectionDef = tools.find((t) => t.name === "connection");
|
|
2856
|
+
var connectionSchema = typeof connectionDef.schema === "function" ? connectionDef.schema(caps) : connectionDef.schema;
|
|
1521
2857
|
server.registerTool(
|
|
1522
|
-
"
|
|
1523
|
-
{
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
},
|
|
1527
|
-
async ({ channel }) => {
|
|
2858
|
+
"connection",
|
|
2859
|
+
{ description: connectionDef.description, inputSchema: connectionSchema },
|
|
2860
|
+
async (params) => {
|
|
2861
|
+
const method = params.method;
|
|
1528
2862
|
try {
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
2863
|
+
if (method === "help") {
|
|
2864
|
+
const text = resolveEndpointHelp("connection", params.topic) ?? "No help available for connection";
|
|
2865
|
+
return { content: [{ type: "text", text }] };
|
|
2866
|
+
}
|
|
2867
|
+
if (method === "create") {
|
|
2868
|
+
const channel = params.channel || "vibma";
|
|
2869
|
+
await joinChannel(channel);
|
|
2870
|
+
await new Promise((r) => setTimeout(r, 200));
|
|
2871
|
+
let msg = `Joined channel "${channel}" on port ${activePort}. Call connection(method: "get") to verify the Figma plugin is connected.`;
|
|
2872
|
+
if (versionWarning) msg += `
|
|
1533
2873
|
|
|
1534
2874
|
\u26A0\uFE0F ${versionWarning}
|
|
1535
2875
|
See "Version mismatch" in CARRYME.md or DRAGME.md for update steps.`;
|
|
1536
|
-
|
|
1537
|
-
content: [{ type: "text", text: msg }]
|
|
1538
|
-
};
|
|
1539
|
-
} catch (error) {
|
|
1540
|
-
return {
|
|
1541
|
-
content: [{
|
|
1542
|
-
type: "text",
|
|
1543
|
-
text: `Error joining channel: ${error instanceof Error ? error.message : String(error)}. MCP is using port ${activePort} \u2014 confirm the relay is running on the same port.`
|
|
1544
|
-
}]
|
|
1545
|
-
};
|
|
1546
|
-
}
|
|
1547
|
-
}
|
|
1548
|
-
);
|
|
1549
|
-
server.registerTool(
|
|
1550
|
-
"channel_info",
|
|
1551
|
-
{
|
|
1552
|
-
description: "Debug: inspect which clients (MCP, plugin) are connected to each relay channel. Useful for diagnosing connection issues. Does not require an active channel."
|
|
1553
|
-
},
|
|
1554
|
-
async () => {
|
|
1555
|
-
try {
|
|
1556
|
-
const url = serverUrl === "localhost" ? `http://localhost:${activePort}/channels` : `https://${serverUrl}/channels`;
|
|
1557
|
-
const response = await fetch(url);
|
|
1558
|
-
if (!response.ok) {
|
|
1559
|
-
return { content: [{ type: "text", text: `Relay returned ${response.status}: ${await response.text()}` }] };
|
|
2876
|
+
msg += "\n\nWelcome to Vibma! As you work, the MCP will give you warnings when it spots issues \u2014 hardcoded colors, missing auto-layout, unbound tokens, etc. Following these best practices will reduce the noise from the MCP and help you create a well-structured design system that designers enjoy working with.";
|
|
2877
|
+
return { content: [{ type: "text", text: msg }] };
|
|
1560
2878
|
}
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
text: `Could not reach relay at port ${activePort}: ${error instanceof Error ? error.message : String(error)}`
|
|
1568
|
-
}]
|
|
1569
|
-
};
|
|
1570
|
-
}
|
|
1571
|
-
}
|
|
1572
|
-
);
|
|
1573
|
-
server.registerTool(
|
|
1574
|
-
"reset_tunnel",
|
|
1575
|
-
{
|
|
1576
|
-
description: "DESTRUCTIVE: Factory-reset a channel on the relay via HTTP, disconnecting ALL occupants (MCP + Figma plugin). Only use this when the channel is stuck or occupied by another MCP \u2014 do NOT use it just to reconnect yourself (use `join_channel` instead). After reset, ask the user to reopen the Vibma plugin in Figma, then call `join_channel` and `ping`.",
|
|
1577
|
-
inputSchema: {
|
|
1578
|
-
channel: import_zod18.z.string().describe("Channel to reset. Defaults to 'vibma'.").default("vibma")
|
|
1579
|
-
}
|
|
1580
|
-
},
|
|
1581
|
-
async ({ channel }) => {
|
|
1582
|
-
const targetChannel = channel || currentChannel || "vibma";
|
|
1583
|
-
try {
|
|
1584
|
-
const url = serverUrl === "localhost" ? `http://localhost:${activePort}/channels/${encodeURIComponent(targetChannel)}` : `https://${serverUrl}/channels/${encodeURIComponent(targetChannel)}`;
|
|
1585
|
-
const res = await fetch(url, { method: "DELETE" });
|
|
1586
|
-
const body = await res.json();
|
|
1587
|
-
for (const [reqId, request] of pendingRequests.entries()) {
|
|
1588
|
-
clearTimeout(request.timeout);
|
|
1589
|
-
request.reject(new Error("Tunnel reset by user"));
|
|
1590
|
-
pendingRequests.delete(reqId);
|
|
2879
|
+
if (method === "list") {
|
|
2880
|
+
const url = isLocal ? `http://${serverUrl}:${activePort}/channels` : `https://${serverUrl}/channels`;
|
|
2881
|
+
const response = await fetch(url);
|
|
2882
|
+
if (!response.ok) return { content: [{ type: "text", text: `Relay returned ${response.status}: ${await response.text()}` }] };
|
|
2883
|
+
const data = await response.json();
|
|
2884
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
1591
2885
|
}
|
|
1592
|
-
if (
|
|
1593
|
-
const
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
2886
|
+
if (method === "delete") {
|
|
2887
|
+
const targetChannel = params.channel || currentChannel || "vibma";
|
|
2888
|
+
const url = isLocal ? `http://${serverUrl}:${activePort}/channels/${encodeURIComponent(targetChannel)}` : `https://${serverUrl}/channels/${encodeURIComponent(targetChannel)}`;
|
|
2889
|
+
const res = await fetch(url, { method: "DELETE" });
|
|
2890
|
+
const body = await res.json();
|
|
2891
|
+
for (const [reqId, request] of pendingRequests.entries()) {
|
|
2892
|
+
clearTimeout(request.timeout);
|
|
2893
|
+
request.reject(new Error("Tunnel reset by user"));
|
|
2894
|
+
pendingRequests.delete(reqId);
|
|
2895
|
+
}
|
|
2896
|
+
if (ws) {
|
|
2897
|
+
const old = ws;
|
|
2898
|
+
ws = null;
|
|
2899
|
+
old.removeAllListeners();
|
|
2900
|
+
old.close(1e3, "Tunnel reset");
|
|
2901
|
+
}
|
|
2902
|
+
currentChannel = null;
|
|
2903
|
+
rejected = false;
|
|
2904
|
+
connectToFigma();
|
|
2905
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
2906
|
+
const connected = ws && ws.readyState === import_ws.default.OPEN;
|
|
2907
|
+
return {
|
|
2908
|
+
content: [{
|
|
2909
|
+
type: "text",
|
|
2910
|
+
text: connected ? `Tunnel reset: ${body.message}. Reconnected on port ${activePort}.
|
|
2911
|
+
|
|
2912
|
+
IMPORTANT: The Figma plugin was also disconnected. Ask the user to reopen the Vibma plugin, then call connection(method: "create") followed by connection(method: "get").` : `Tunnel reset: ${body.message}. Reconnection in progress.
|
|
2913
|
+
|
|
2914
|
+
IMPORTANT: The Figma plugin was also disconnected. Ask the user to reopen the Vibma plugin, then call connection(method: "create") to retry.`
|
|
2915
|
+
}]
|
|
2916
|
+
};
|
|
1597
2917
|
}
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
connectToFigma();
|
|
1601
|
-
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
1602
|
-
const connected = ws && ws.readyState === import_ws.default.OPEN;
|
|
1603
|
-
return {
|
|
1604
|
-
content: [{
|
|
1605
|
-
type: "text",
|
|
1606
|
-
text: connected ? `Tunnel reset: ${body.message}. Reconnected on port ${activePort}.
|
|
1607
|
-
|
|
1608
|
-
IMPORTANT: The Figma plugin was also disconnected. Ask the user to reopen the Vibma plugin in Figma (or click "Reset tunnel" in the plugin panel). Then call \`join_channel\` followed by \`ping\`.` : `Tunnel reset: ${body.message}. Reconnection in progress.
|
|
1609
|
-
|
|
1610
|
-
IMPORTANT: The Figma plugin was also disconnected. Ask the user to reopen the Vibma plugin in Figma (or click "Reset tunnel" in the plugin panel). Then call \`join_channel\` to retry.`
|
|
1611
|
-
}]
|
|
1612
|
-
};
|
|
2918
|
+
const result = await sendCommandToFigma("connection.get", params, 5e3);
|
|
2919
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
1613
2920
|
} catch (error) {
|
|
1614
|
-
return {
|
|
1615
|
-
content: [{
|
|
1616
|
-
type: "text",
|
|
1617
|
-
text: `Error resetting tunnel: ${error instanceof Error ? error.message : String(error)}`
|
|
1618
|
-
}]
|
|
1619
|
-
};
|
|
2921
|
+
return { content: [{ type: "text", text: `connection.${method} error: ${error instanceof Error ? error.message : String(error)}` }] };
|
|
1620
2922
|
}
|
|
1621
2923
|
}
|
|
1622
2924
|
);
|