@ufira/vibma 1.1.3 → 1.1.4

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/dist/mcp.js CHANGED
@@ -80,15 +80,15 @@ Use help(topic: "<endpoint>") for endpoint details.
80
80
  Use help(topic: "<endpoint>.<method>") for method details.`;
81
81
  var helpEndpoints = {
82
82
  "annotations": {
83
- "summary": '# annotations\nRead and manage design annotations and annotation categories.\n\nMethods:\n get Read all annotations on a node (full detail with resolved category names) [read]\n list Search annotations across a subtree, optionally filtered by category [read]\n set Replace all annotations on a node [edit]\n add Add an annotation to a node [edit]\n remove Remove an annotation from a node by index [edit]\n categories List all annotation categories in the file [read]\n create_category Create a new annotation category [create]\n update_category Update an annotation category\'s label or color [edit]\n delete_category Delete an annotation category [edit]\n\n// Annotations are designer-authored notes attached to nodes \u2014 specs, intent, constraints.\n// Every node-returning endpoint includes an annotation brief: { label, properties?, categoryId? }.\n// Use this endpoint for full CRUD and to manage annotation categories.\n// Workflow: read annotations on a node with get, add new ones with add, manage categories with categories/create_category.\n// Batch: get/set/add/remove accept items:[{id, ...}] for multi-node operations, or single-item params (id, label, etc).\n// properties: measurement indicators Figma displays on the canvas \u2014 validated per node type and state.\n// labelMarkdown: rich text label supporting **bold**, *italic*, `code`, [links](url).\n// categoryId: group annotations by category (e.g. "Spacing", "Typography"). Create categories first.\n// ---\n// AnnotationPropertyType values (node-type-dependent \u2014 invalid ones are rejected with the available list):\n// Dimension: width, height, maxWidth, minWidth, maxHeight, minHeight\n// Paint: fills, strokes, effects, strokeWeight, cornerRadius, opacity\n// Text (TEXT nodes only): textStyleId, textAlignHorizontal, fontFamily, fontStyle, fontSize, fontWeight, lineHeight, letterSpacing\n// Layout (auto-layout only): itemSpacing, padding, layoutMode, alignItems\n// Instance (INSTANCE only): mainComponent\n// Grid (grid layout only): gridRowGap, gridColumnGap, gridRowCount, gridColumnCount, gridRowAnchorIndex, gridColumnAnchorIndex, gridRowSpan, gridColumnSpan\n// AnnotationCategoryColor values: yellow, orange, red, pink, violet, blue, teal, green.\n\nUse annotations(method: "help", topic: "<method>") for method details.',
83
+ "summary": '# annotations\nRead and manage design annotations and annotation categories.\n\nMethods:\n get Read all annotations on a node (full detail with resolved category names) [read]\n list Search annotations across a subtree, optionally filtered by category [read]\n set Replace all annotations on a node [edit]\n add Add an annotation to a node [edit]\n remove Remove an annotation from a node by index [edit]\n categories List all annotation categories in the file [read]\n create_category Create a new annotation category [create]\n update_category Update an annotation category\'s label or color [edit]\n delete_category Delete an annotation category [edit]\n\n// Annotations are designer-authored notes attached to nodes \u2014 specs, intent, constraints.\n// Every node-returning endpoint includes an annotation brief: { label, properties?, categoryId? }.\n// Use this endpoint for full CRUD and to manage annotation categories.\n// Workflow: read annotations on a node with get, add new ones with add, manage categories with categories/create_category.\n// Batch: get/set/add/remove accept items:[{id, ...}] for multi-node operations, or single-item params (id, label, etc).\n// properties: measurement indicators Figma displays on the canvas \u2014 validated per node type and state.\n// labelMarkdown: rich text label supporting **bold**, *italic*, `code`, [links](url).\n// categoryId: group annotations by category (e.g. "Spacing", "Typography"). Create categories first.\n// ---\n// AnnotationPropertyType values (node-type-dependent \u2014 invalid ones are rejected with the available list):\n// Dimension: width, height, maxWidth, minWidth, maxHeight, minHeight\n// Paint: fills, strokes, effects, strokeWeight, cornerRadius, opacity\n// Text (TEXT nodes only): textStyleId, textAlignHorizontal, fontFamily, fontStyle, fontSize, fontWeight, lineHeight, letterSpacing\n// Layout (auto-layout only): itemSpacing, padding, layoutMode, alignItems\n// Instance (INSTANCE only): mainComponent\n// Grid (grid layout only): gridRowGap, gridColumnGap, gridRowCount, gridColumnCount, gridRowAnchorIndex, gridColumnAnchorIndex, gridRowSpan, gridColumnSpan\n// AnnotationCategoryColor values: yellow, orange, red, pink, violet, blue, teal, green.\n\nUse annotations(method: "help", topic: "<method>") for method details.\n// Shared types:\n// Color: hex "#RGB"|"#RGBA"|"#RRGGBB"|"#RRGGBBAA" or {r: 0-1, g: 0-1, b: 0-1, a?: 0-1}\n// VariableAlias: {type: "VARIABLE_ALIAS", id: string}. The id must be a Figma VariableID; discover it via variables.get/list or variable_collections.get. Prefer colorVariableName/fillVariableName/strokeVariableName when available; Paint[] VariableAlias is mainly for precise Paint[] round-trips and gradient stop bindings.\n// Transform: [[number, number, number], [number, number, number]] (Figma Plugin API 2\xD73 matrix)\n// 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"\n// ColorStop: {position: 0-1, color: Color, boundVariables?: {color?: VariableAlias}}\n// GradientPaint: {type: "GRADIENT_LINEAR"|"GRADIENT_RADIAL"|"GRADIENT_ANGULAR"|"GRADIENT_DIAMOND", gradientTransform: Transform, gradientStops: ColorStop[], visible?: boolean, opacity?: number, blendMode?: BlendMode}. Use gradientTransform + gradientStops (basic left-to-right: [[1,0,0],[0,1,0]]); do not use CSS gradients or REST gradientHandlePositions.\n// Paint: Paint[] authoring accepts only SOLID and GRADIENT_LINEAR/GRADIENT_RADIAL/GRADIENT_ANGULAR/GRADIENT_DIAMOND. SolidPaint: {type: "SOLID", color: Color, visible?: boolean, opacity?: number, blendMode?: BlendMode, boundVariables?: {color?: VariableAlias}}. GradientPaint authoring: {type: GRADIENT_*, gradientTransform: Transform, gradientStops: ColorStop[], visible?, opacity?, blendMode?}; bind variables on gradientStops[].boundVariables.color, not top-level gradient boundVariables. Do not pass IMAGE/VIDEO/PATTERN to create/update Paint[]; those may appear only in readback metadata from existing Figma content. Use imageUrl/images for image authoring. VIDEO/PATTERN authoring is not supported here. Do not use CSS gradients or REST gradientHandlePositions.',
84
84
  "methods": {
85
- "get": '# annotations.get\nRead all annotations on a node (full detail with resolved category names)\n\nExample: annotations(method:"get", id:"1:23")\n\nParams:\n id (string, optional) \u2014 Node ID\n categoryId (string, optional) \u2014 Filter \u2014 only return annotations in this category\n items (array, optional) \u2014 Batch: [{id, categoryId?}, ...]\n id (string, required)\n categoryId (string, optional)',
86
- "list": '# annotations.list\nSearch annotations across a subtree, optionally filtered by category\n\nExample: annotations(method:"list", parentId:"1:2", categoryId:"113:0")\n\nParams:\n parentId (string, optional) \u2014 Root node to search within (default: current page)\n categoryId (string, optional) \u2014 Filter by category ID\n limit (number, optional) \u2014 Max items per page (default 100)',
87
- "set": '# annotations.set\nReplace all annotations on a node\n\nExample: annotations(method:"set", id:"1:23", annotations:[{label:"Spacing: 16px", properties:["padding"]}])\n\nParams:\n id (string, optional) \u2014 Node ID\n annotations (array, optional) \u2014 Array of annotation objects to set (replaces all existing)\n label (string, optional) \u2014 Plain text label\n labelMarkdown (string, optional) \u2014 Rich text label (Markdown)\n properties (string[], optional) \u2014 Measurement property types to display\n categoryId (string, optional) \u2014 Category ID\n items (array, optional) \u2014 Batch: [{id, annotations: [...]}, ...]\n id (string, required)\n annotations (array, required) \u2014 Annotations to set on this node',
88
- "add": '# annotations.add\nAdd an annotation to a node\n\nExample: annotations(method:"add", id:"1:23", labelMarkdown:"**Width**: 320px fixed", properties:["width"])\n\nParams:\n id (string, optional) \u2014 Node ID\n label (string, optional) \u2014 Plain text label (use label or labelMarkdown, not both)\n labelMarkdown (string, optional) \u2014 Rich text label with Markdown formatting\n properties (string[], optional) \u2014 Measurement property types to display on canvas\n categoryId (string, optional) \u2014 Category ID to group this annotation\n items (array, optional) \u2014 Batch: [{id, label?, labelMarkdown?, properties?, categoryId?}, ...]\n id (string, required)\n label (string, optional)\n labelMarkdown (string, optional)\n properties (string[], optional)\n categoryId (string, optional)',
89
- "remove": '# annotations.remove\nRemove an annotation from a node by index\n\nExample: annotations(method:"remove", id:"1:23", index:0)\n\nParams:\n id (string, optional) \u2014 Node ID\n index (number, optional) \u2014 Annotation index to remove (from get response)\n items (array, optional) \u2014 Batch: [{id, index}, ...]\n id (string, required)\n index (number, required)',
90
- "categories": '# annotations.categories\nList all annotation categories in the file\n\nExample: annotations(method:"categories")\n\nNo params.',
91
- "create_category": '# annotations.create_category\nCreate a new annotation category\n\nExample: annotations(method:"create_category", label:"Spacing", color:"blue")\n\nParams:\n label (string, required) \u2014 Category label\n color (yellow | orange | red | pink | violet | blue | teal | green, required) \u2014 Category color',
85
+ "get": '# annotations.get\nRead all annotations on a node (full detail with resolved category names)\n\nExample: annotations(method:"get", id:"1:23")\n\nParams:\n id (string, optional) \u2014 Node ID\n categoryId (string, optional) \u2014 Filter \u2014 only return annotations in this category\n items (array, optional) \u2014 Batch: [{id, categoryId?}, ...]\n id (string, required)\n categoryId (string, optional)\n\nResponse:\n { results: ({id} | {error})[] }',
86
+ "list": '# annotations.list\nSearch annotations across a subtree, optionally filtered by category\n\nExample: annotations(method:"list", parentId:"1:2", categoryId:"113:0")\n\nParams:\n parentId (string, optional) \u2014 Root node to search within (default: current page)\n categoryId (string, optional) \u2014 Filter by category ID\n limit (number, optional) \u2014 Max items per page (default 100)\n\nResponse:\n results (array, optional) \u2014 Annotations found across the subtree\n nodeId (string, optional)\n nodeName (string, optional)\n nodeType (string, optional)\n index (number, optional)\n label (string, optional)\n labelMarkdown (string, optional)\n properties (array, optional)\n category (object, optional)\n count (number, optional)\n _truncated (boolean, optional)',
87
+ "set": '# annotations.set\nReplace all annotations on a node\n\nExample: annotations(method:"set", id:"1:23", annotations:[{label:"Spacing: 16px", properties:["padding"]}])\n\nParams:\n id (string, optional) \u2014 Node ID\n annotations (array, optional) \u2014 Array of annotation objects to set (replaces all existing)\n label (string, optional) \u2014 Plain text label\n labelMarkdown (string, optional) \u2014 Rich text label (Markdown)\n properties (string[], optional) \u2014 Measurement property types to display\n categoryId (string, optional) \u2014 Category ID\n items (array, optional) \u2014 Batch: [{id, annotations: [...]}, ...]\n id (string, required)\n annotations (array, required) \u2014 Annotations to set on this node\n\nResponse:\n { results: ({id} | {error})[] }',
88
+ "add": '# annotations.add\nAdd an annotation to a node\n\nExample: annotations(method:"add", id:"1:23", labelMarkdown:"**Width**: 320px fixed", properties:["width"])\n\nParams:\n id (string, optional) \u2014 Node ID\n label (string, optional) \u2014 Plain text label (use label or labelMarkdown, not both)\n labelMarkdown (string, optional) \u2014 Rich text label with Markdown formatting\n properties (string[], optional) \u2014 Measurement property types to display on canvas\n categoryId (string, optional) \u2014 Category ID to group this annotation\n items (array, optional) \u2014 Batch: [{id, label?, labelMarkdown?, properties?, categoryId?}, ...]\n id (string, required)\n label (string, optional)\n labelMarkdown (string, optional)\n properties (string[], optional)\n categoryId (string, optional)\n\nResponse:\n { results: ({id} | {error})[] }',
89
+ "remove": '# annotations.remove\nRemove an annotation from a node by index\n\nExample: annotations(method:"remove", id:"1:23", index:0)\n\nParams:\n id (string, optional) \u2014 Node ID\n index (number, optional) \u2014 Annotation index to remove (from get response)\n items (array, optional) \u2014 Batch: [{id, index}, ...]\n id (string, required)\n index (number, required)\n\nResponse:\n { results: ({id} | {error})[] }',
90
+ "categories": '# annotations.categories\nList all annotation categories in the file\n\nExample: annotations(method:"categories")\n\nNo params.\n\nResponse:\n categories (array, optional)\n id (string, optional)\n label (string, optional)\n color (string, optional)\n isPreset (boolean, optional)',
91
+ "create_category": '# annotations.create_category\nCreate a new annotation category\n\nExample: annotations(method:"create_category", label:"Spacing", color:"blue")\n\nParams:\n label (string, required) \u2014 Category label\n color (yellow | orange | red | pink | violet | blue | teal | green, required) \u2014 Category color\n\nResponse:\n id (string, optional)\n label (string, optional)\n color (string, optional)',
92
92
  "update_category": `# annotations.update_category
93
93
  Update an annotation category's label or color
94
94
 
@@ -97,14 +97,33 @@ Example: annotations(method:"update_category", id:"cat:123", label:"Layout", col
97
97
  Params:
98
98
  id (string, required) \u2014 Category ID
99
99
  label (string, optional) \u2014 New label
100
- color (yellow | orange | red | pink | violet | blue | teal | green, optional) \u2014 New color`,
101
- "delete_category": '# annotations.delete_category\nDelete an annotation category\n\nExample: annotations(method:"delete_category", id:"cat:123")\n\nParams:\n id (string, required) \u2014 Category ID to delete'
100
+ color (yellow | orange | red | pink | violet | blue | teal | green, optional) \u2014 New color
101
+
102
+ Response:
103
+ id (string, optional)
104
+ label (string, optional)
105
+ color (string, optional)`,
106
+ "delete_category": '# annotations.delete_category\nDelete an annotation category\n\nExample: annotations(method:"delete_category", id:"cat:123")\n\nParams:\n id (string, required) \u2014 Category ID to delete\n\nResponse:\n deleted (boolean, optional)'
102
107
  }
103
108
  },
104
109
  "components": {
105
- "summary": '# components\nCreate and manage reusable components and variant sets.\n\nMethods:\n clone Duplicate nodes \u2014 produces a same-type copy (frame\u2192frame, instance\u2192instance, component\u2192component). Instance clones reference the same source component; they do not duplicate the component definition. [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 + optional node tree for structural inspection [read]\n create Create components [create]\n commit Commit a staged component \u2014 unwraps from [STAGED] container into the original target location. [edit]\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// Adding variants: clone an existing variant into the set with a new name. See guidelines(topic:"component-structure") for workflow.\n\nUse components(method: "help", topic: "<method>") for method details.',
110
+ "summary": '# components\nCreate and manage reusable components and variant sets.\n\nMethods:\n clone Duplicate nodes \u2014 produces a same-type copy (frame\u2192frame, instance\u2192instance, component\u2192component). Instance clones reference the same source component; they do not duplicate the component definition. [create]\n scale Proportionally rescale a node subtree using Figma\'s visual Scale tool behavior. This is for visual/artifact scaling, not responsive layout resizing. [edit]\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 + optional node tree for structural inspection [read]\n create Create components [create]\n commit Commit a staged component \u2014 unwraps from [STAGED] container into the original target location. [edit]\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// clipsContent: clip children to the node bounds where supported (frames/components/instances). Set false for overflow-visible layouts.\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[]; // readback Paint[]; authoring supports SOLID + gradients via gradientTransform + gradientStops\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. Paint[] authoring supports SOLID + gradients only; IMAGE/VIDEO/PATTERN are readback-only metadata.\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// Examples assume design tokens/styles already exist. Build components from tokens/styles, not raw color/spacing/type values.\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// Adding variants: clone an existing variant into the set with a new name. See guidelines(topic:"component-structure") for workflow.\n\nUse components(method: "help", topic: "<method>") for method details.\n// Shared types:\n// Color: hex "#RGB"|"#RGBA"|"#RRGGBB"|"#RRGGBBAA" or {r: 0-1, g: 0-1, b: 0-1, a?: 0-1}\n// VariableAlias: {type: "VARIABLE_ALIAS", id: string}. The id must be a Figma VariableID; discover it via variables.get/list or variable_collections.get. Prefer colorVariableName/fillVariableName/strokeVariableName when available; Paint[] VariableAlias is mainly for precise Paint[] round-trips and gradient stop bindings.\n// Transform: [[number, number, number], [number, number, number]] (Figma Plugin API 2\xD73 matrix)\n// 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"\n// ColorStop: {position: 0-1, color: Color, boundVariables?: {color?: VariableAlias}}\n// GradientPaint: {type: "GRADIENT_LINEAR"|"GRADIENT_RADIAL"|"GRADIENT_ANGULAR"|"GRADIENT_DIAMOND", gradientTransform: Transform, gradientStops: ColorStop[], visible?: boolean, opacity?: number, blendMode?: BlendMode}. Use gradientTransform + gradientStops (basic left-to-right: [[1,0,0],[0,1,0]]); do not use CSS gradients or REST gradientHandlePositions.\n// Effect: {type: "DROP_SHADOW"|"INNER_SHADOW"|"LAYER_BLUR"|"BACKGROUND_BLUR", radius: number, color?: {r,g,b,a} (0-1), offset?: {x, y}, spread?: number, visible?: boolean}\n// Paint: Paint[] authoring accepts only SOLID and GRADIENT_LINEAR/GRADIENT_RADIAL/GRADIENT_ANGULAR/GRADIENT_DIAMOND. SolidPaint: {type: "SOLID", color: Color, visible?: boolean, opacity?: number, blendMode?: BlendMode, boundVariables?: {color?: VariableAlias}}. GradientPaint authoring: {type: GRADIENT_*, gradientTransform: Transform, gradientStops: ColorStop[], visible?, opacity?, blendMode?}; bind variables on gradientStops[].boundVariables.color, not top-level gradient boundVariables. Do not pass IMAGE/VIDEO/PATTERN to create/update Paint[]; those may appear only in readback metadata from existing Figma content. Use imageUrl/images for image authoring. VIDEO/PATTERN authoring is not supported here. Do not use CSS gradients or REST gradientHandlePositions.\n// NodeStub: {id: string, name: string, type: string}',
106
111
  "methods": {
107
- "clone": "# components.clone\nDuplicate nodes \u2014 produces a same-type copy (frame\u2192frame, instance\u2192instance, component\u2192component). Instance clones reference the same source component; they do not duplicate the component definition.\n\nParams:\n id (string, optional) \u2014 Node ID\n name (string, optional) \u2014 Rename the clone (set before appending to parent \u2014 required when cloning a variant into its component set to avoid duplicate names)\n parentId (string, optional) \u2014 Parent node ID. Omit to place at current page root.\n x (number, optional) \u2014 X position (default: 0)\n y (number, optional) \u2014 Y position (default: 0)\n items (array, optional) \u2014 Batch: [{id, name?, parentId?, x?, y?}, ...]. Alternative to single-item params.\n id (string, required) \u2014 Node ID to clone\n name (string, optional) \u2014 Rename the clone\n parentId (string, optional) \u2014 Target parent\n x (number, optional)\n y (number, optional)\n depth (number, optional) \u2014 Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.",
112
+ "clone": "# components.clone\nDuplicate nodes \u2014 produces a same-type copy (frame\u2192frame, instance\u2192instance, component\u2192component). Instance clones reference the same source component; they do not duplicate the component definition.\n\nParams:\n id (string, optional) \u2014 Node ID\n name (string, optional) \u2014 Rename the clone (set before appending to parent \u2014 required when cloning a variant into its component set to avoid duplicate names)\n parentId (string, optional) \u2014 Parent node ID. Omit to place at current page root.\n x (number, optional) \u2014 X position (default: 0)\n y (number, optional) \u2014 Y position (default: 0)\n items (array, optional) \u2014 Batch: [{id, name?, parentId?, x?, y?}, ...]. Alternative to single-item params.\n id (string, required) \u2014 Node ID to clone\n name (string, optional) \u2014 Rename the clone\n parentId (string, optional) \u2014 Target parent\n x (number, optional)\n y (number, optional)\n depth (number, optional) \u2014 Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.\n\nResponse:\n { results: ({id} | {error})[] }",
113
+ "scale": `# components.scale
114
+ Proportionally rescale a node subtree using Figma's visual Scale tool behavior. This is for visual/artifact scaling, not responsive layout resizing.
115
+
116
+ Example: components(method:"scale", id:"1:23", factor:0.5)
117
+
118
+ Params:
119
+ id (string, optional) \u2014 Node ID to scale
120
+ factor (number, optional) \u2014 Scale factor, >= 0.01. 0.5 = 50%, 2 = 200%. Scales children, text, strokes, effects, and layout geometry from the node's top-left. On auto-layout or HUG/FILL nodes, Figma may resolve responsive sizing to fixed width/height.
121
+ items (array, optional) \u2014 Batch: [{id, factor}, ...]. Alternative to single-item params.
122
+ id (string, required) \u2014 Node ID to scale
123
+ factor (number, required) \u2014 Scale factor, >= 0.01. 0.5 = 50%, 2 = 200%.
124
+
125
+ Response:
126
+ { results: ("ok" | {error})[] }`,
108
127
  "audit": `# components.audit
109
128
  Run lint on a node \u2014 returns severity-ranked findings
110
129
 
@@ -114,189 +133,216 @@ Params:
114
133
  maxDepth (number, optional) \u2014 Max tree depth (default: 10)
115
134
  maxFindings (number, optional) \u2014 Max findings (default: 50)
116
135
  minSeverity (error | unsafe | heuristic | style | verbose, optional) \u2014 Minimum severity to report (default: style). Set to 'verbose' to include AAA contrast and line-height checks.
117
- skipInstances (boolean, optional) \u2014 Skip instance internals \u2014 findings inside instances are owned by the component (default: true)`,
118
- "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)",
119
- "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)",
120
- "get": "# components.get\nGet component detail \u2014 property definitions + optional node tree for structural inspection\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.\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.",
136
+ skipInstances (boolean, optional) \u2014 Skip instance internals \u2014 findings inside instances are owned by the component (default: true)
137
+
138
+ Response:
139
+ nodeId (string, optional)
140
+ nodeName (string, optional)
141
+ categories (array, optional) \u2014 Sorted by severity (error > unsafe > heuristic > style)`,
142
+ "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)\n\nResponse:\n { results: ("ok" | {error})[] }',
143
+ "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)\n\nResponse:\n totalCount (number, required)\n returned (number, optional)\n offset (number, optional)\n limit (number, optional)\n items (array, required)",
144
+ "get": "# components.get\nGet component detail \u2014 property definitions + optional node tree for structural inspection\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.\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.\n\nResponse:\n results (array, required) \u2014 Component summaries (without depth) or full node trees with properties merged (with depth)\n id (string, optional)\n name (string, optional)\n description (string, optional)\n properties (object, optional) \u2014 Property definitions \u2014 {name: {type, defaultValue, options?}}\n _truncated (boolean, optional)",
121
145
  "create": `# components.create
122
146
  Create components
123
147
 
124
- 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}]}])
148
+ Call shape: components(method:"create", type:"<type>", items:[{...type-specific fields...}])
149
+ Do not pass type-specific item fields at the top level; put them inside items[].
125
150
 
126
151
  Discriminant: type (component | from_node | variant_set)
152
+ Top-level params:
153
+ type (component | from_node | variant_set, required) \u2014 Selects which item shape to use
154
+ items (array, required) \u2014 One or more type-specific item objects
127
155
 
128
156
  ## 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.
129
- name (string, required) \u2014 Component name
130
- parentId (string, optional) \u2014 Parent node ID. Omit to place at current page root.
131
- x (number, optional) \u2014 X position (default: 0)
132
- y (number, optional) \u2014 Y position (default: 0)
133
- width (number, optional) \u2014 Width in px (omit to shrink-to-content via HUG)
134
- height (number, optional) \u2014 Height in px (omit to shrink-to-content via HUG)
135
- rotation (number, optional) \u2014 Rotation in degrees (0-360)
136
- visible (boolean, optional) \u2014 Show/hide (default true)
137
- locked (boolean, optional) \u2014 Lock/unlock (default false)
138
- opacity (string, optional) \u2014 Opacity (0-1) or variable name
139
- 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)
140
- effectStyleName (string, optional) \u2014 Effect style name (e.g. 'Shadow/Card') for shadows, blurs
141
- fills (array, optional) \u2014 Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills.
142
- fillColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)
143
- fillStyleName (string, optional) \u2014 Paint style name for fill
144
- fillVariableName (string, optional) \u2014 Color variable by name e.g. 'bg/primary'
145
- imageUrl (string, optional) \u2014 Image source \u2014 'pexel:<id>' for Pexels photos, a public URL, or a local file path. SVGs are inserted as vectors; raster images become IMAGE fills.
146
- imageScaleMode (FILL | FIT | CROP | TILE, optional) \u2014 How the image is scaled within the frame (default: FILL)
147
- strokes (array, optional) \u2014 Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes.
148
- strokeColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)
149
- strokeStyleName (string, optional) \u2014 Paint style name for stroke
150
- strokeVariableName (string, optional) \u2014 Color variable by name for stroke
151
- strokeWeight (string, optional) \u2014 All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight.
152
- strokeTopWeight (string, optional)
153
- strokeBottomWeight (string, optional)
154
- strokeLeftWeight (string, optional)
155
- strokeRightWeight (string, optional)
156
- strokeAlign (INSIDE | OUTSIDE | CENTER, optional) \u2014 Stroke position (default: INSIDE)
157
- cornerRadius (string, optional) \u2014 All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.
158
- topLeftRadius (string, optional)
159
- topRightRadius (string, optional)
160
- bottomRightRadius (string, optional)
161
- bottomLeftRadius (string, optional)
162
- layoutMode (NONE | HORIZONTAL | VERTICAL, optional) \u2014 Layout direction (default: auto \u2014 NONE when width+height set, otherwise inferred from layout props)
163
- layoutWrap (NO_WRAP | WRAP, optional) \u2014 Wrap children to new rows (HORIZONTAL layout only \u2014 Figma does not support WRAP on VERTICAL layouts). Use column frames inside a HORIZONTAL parent for vertical grid patterns.
164
- padding (string, optional) \u2014 All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft.
165
- paddingTop (string, optional)
166
- paddingRight (string, optional)
167
- paddingBottom (string, optional)
168
- paddingLeft (string, optional)
169
- primaryAxisAlignItems (MIN | MAX | CENTER | SPACE_BETWEEN, optional)
170
- counterAxisAlignItems (MIN | MAX | CENTER | BASELINE, optional)
171
- itemSpacing (string, optional) \u2014 Spacing between children (number or variable name string, default: 0)
172
- counterAxisSpacing (string, optional) \u2014 Gap between wrapped rows (requires layoutWrap: WRAP)
173
- strokesIncludedInLayout (boolean, optional) \u2014 Include stroke width in layout measurements (default: false)
174
- overflowDirection (NONE | HORIZONTAL | VERTICAL | BOTH, optional) \u2014 Scroll overflow in prototype (default: NONE)
175
- layoutPositioning (AUTO | ABSOLUTE, optional) \u2014 ABSOLUTE = floating inside auto-layout parent
176
- layoutSizingHorizontal (FIXED | HUG | FILL, optional)
177
- layoutSizingVertical (FIXED | HUG | FILL, optional)
178
- minWidth (number, optional) \u2014 Min width for responsive auto-layout
179
- maxWidth (number, optional) \u2014 Max width for responsive auto-layout
180
- minHeight (number, optional) \u2014 Min height for responsive auto-layout
181
- maxHeight (number, optional) \u2014 Max height for responsive auto-layout
182
- annotations (array, optional) \u2014 Set annotations \u2014 [{label?, labelMarkdown?, properties?, categoryId?}]. Properties validated per node type.
183
- description (string, optional) \u2014 Component description (shown in Figma's component panel)
184
- children (array, optional) \u2014 Inline child nodes \u2014 build nested trees in one call. Types: text: {type:"text", text, componentPropertyName?, fontFamily?, fontSize?, fontWeight?, fontStyle?, fontColor?, layoutSizingHorizontal?}. frame: {type:"frame", name?, layoutMode?, fillColor?, width?, layoutSizingHorizontal?, children?}. instance: {type:"instance", componentId, componentPropertyName?, variantProperties?, properties?}. component: {type:"component", name, children?}. All params from text/frame endpoints are supported on their respective types. componentPropertyName auto-creates and binds a TEXT (text) or INSTANCE_SWAP (instance) property. Always set layoutSizingHorizontal + layoutSizingVertical on children inside auto-layout parents (FILL, HUG, or FIXED). Example: children:[{type:"text", text:"Label", componentPropertyName:"Label", fontSize:14, fontColorVariableName:"text/primary", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG"}, {type:"frame", name:"Actions", layoutMode:"HORIZONTAL", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG", itemSpacing:8, children:[{type:"instance", componentId:"1:2", componentPropertyName:"Action", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG"}]}]
157
+ Example: components(method:"create", type:"component", items:[{name:"Card", width:320, height:200, layoutMode:"VERTICAL", padding:"space/16", itemSpacing:"space/8", fillVariableName:"bg/surface", strokeVariableName:"border/subtle", strokeWeight:"stroke/1", cornerRadius:"radius/12", children:[{type:"text", name:"Title", text:"Title", componentPropertyName:"Title", textStyleName:"Heading/Medium", fontColorVariableName:"text/primary", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG"}]}])
158
+ Item fields for items[] when type:"component":
159
+ name (string, required) \u2014 Component name
160
+ parentId (string, optional) \u2014 Parent node ID. Omit to place at current page root.
161
+ x (number, optional) \u2014 X position (default: 0)
162
+ y (number, optional) \u2014 Y position (default: 0)
163
+ width (number, optional) \u2014 Width in px (omit to shrink-to-content via HUG)
164
+ height (number, optional) \u2014 Height in px (omit to shrink-to-content via HUG)
165
+ rotation (number, optional) \u2014 Rotation in degrees (0-360)
166
+ visible (boolean, optional) \u2014 Show/hide (default true)
167
+ locked (boolean, optional) \u2014 Lock/unlock (default false)
168
+ opacity (string, optional) \u2014 Opacity (0-1) or variable name
169
+ 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)
170
+ effectStyleName (string, optional) \u2014 Effect style name (e.g. 'Shadow/Card') for shadows, blurs
171
+ fills (Paint[], optional) \u2014 Fill Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] for transparent. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables; use imageUrl/images for image authoring. IMAGE/VIDEO/PATTERN may appear in readback metadata only. Primary way to set non-image fills.
172
+ fillColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)
173
+ fillStyleName (string, optional) \u2014 Paint style name for fill
174
+ fillVariableName (string, optional) \u2014 Color variable by name e.g. 'bg/surface'
175
+ imageUrl (string, optional) \u2014 Image source \u2014 'pexel:<id>' for Pexels photos, a public URL, or a local file path. SVGs are inserted as vectors; raster images become IMAGE fills.
176
+ imageScaleMode (FILL | FIT | CROP | TILE, optional) \u2014 How the image is scaled within the frame (default: FILL)
177
+ strokes (Paint[], optional) \u2014 Stroke Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] to clear. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables. IMAGE/VIDEO/PATTERN may appear in readback metadata only. Primary way to set strokes.
178
+ strokeColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)
179
+ strokeStyleName (string, optional) \u2014 Paint style name for stroke
180
+ strokeVariableName (string, optional) \u2014 Color variable by name for stroke
181
+ strokeWeight (string, optional) \u2014 All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight.
182
+ strokeTopWeight (string, optional)
183
+ strokeBottomWeight (string, optional)
184
+ strokeLeftWeight (string, optional)
185
+ strokeRightWeight (string, optional)
186
+ strokeAlign (INSIDE | OUTSIDE | CENTER, optional) \u2014 Stroke position (default: INSIDE)
187
+ cornerRadius (string, optional) \u2014 All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.
188
+ topLeftRadius (string, optional)
189
+ topRightRadius (string, optional)
190
+ bottomRightRadius (string, optional)
191
+ bottomLeftRadius (string, optional)
192
+ layoutMode (NONE | HORIZONTAL | VERTICAL, optional) \u2014 Layout direction (default: auto \u2014 NONE when width+height set, otherwise inferred from layout props)
193
+ layoutWrap (NO_WRAP | WRAP, optional) \u2014 Wrap children to new rows (HORIZONTAL layout only \u2014 Figma does not support WRAP on VERTICAL layouts). Use column frames inside a HORIZONTAL parent for vertical grid patterns.
194
+ padding (string, optional) \u2014 All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft.
195
+ paddingTop (string, optional)
196
+ paddingRight (string, optional)
197
+ paddingBottom (string, optional)
198
+ paddingLeft (string, optional)
199
+ primaryAxisAlignItems (MIN | MAX | CENTER | SPACE_BETWEEN, optional)
200
+ counterAxisAlignItems (MIN | MAX | CENTER | BASELINE, optional)
201
+ itemSpacing (string, optional) \u2014 Spacing between children (number or variable name string, default: 0)
202
+ counterAxisSpacing (string, optional) \u2014 Gap between wrapped rows (requires layoutWrap: WRAP)
203
+ strokesIncludedInLayout (boolean, optional) \u2014 Include stroke width in layout measurements (default: false)
204
+ overflowDirection (NONE | HORIZONTAL | VERTICAL | BOTH, optional) \u2014 Scroll overflow in prototype (default: NONE)
205
+ layoutPositioning (AUTO | ABSOLUTE, optional) \u2014 ABSOLUTE = floating inside auto-layout parent
206
+ layoutSizingHorizontal (FIXED | HUG | FILL, optional)
207
+ layoutSizingVertical (FIXED | HUG | FILL, optional)
208
+ minWidth (number, optional) \u2014 Min width for responsive auto-layout
209
+ maxWidth (number, optional) \u2014 Max width for responsive auto-layout
210
+ minHeight (number, optional) \u2014 Min height for responsive auto-layout
211
+ maxHeight (number, optional) \u2014 Max height for responsive auto-layout
212
+ annotations (array, optional) \u2014 Set annotations \u2014 [{label?, labelMarkdown?, properties?, categoryId?}]. Properties validated per node type.
213
+ description (string, optional) \u2014 Component description (shown in Figma's component panel)
214
+ children (array, optional) \u2014 Inline child nodes \u2014 build nested trees in one call. Types: text: {type:"text", text, componentPropertyName?, textStyleName?, fontColorVariableName?, layoutSizingHorizontal?}. frame: {type:"frame", name?, layoutMode?, fillVariableName?, itemSpacing?, layoutSizingHorizontal?, children?}. instance: {type:"instance", componentId, componentPropertyName?, variantProperties?, properties?}. component: {type:"component", name, children?}. rectangle / ellipse / line: same params as the corresponding frames(method:"create", type:"rectangle"|"ellipse"|"line") branch. All params from text/frame endpoints are supported on their respective types. Inline fills/strokes accept Paint[] authoring input: SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. Do not use CSS gradients, REST gradientHandlePositions, or IMAGE/VIDEO/PATTERN in Paint[] authoring. componentPropertyName auto-creates and binds a TEXT (text) or INSTANCE_SWAP (instance) property. Always set layoutSizingHorizontal + layoutSizingVertical on children inside auto-layout parents (FILL, HUG, or FIXED). Example: children:[{type:"ellipse", name:"Dot", width:6, height:6, fillVariableName:"status/active"}, {type:"text", name:"Label", text:"Button", componentPropertyName:"Label", textStyleName:"Body/Medium", fontColorVariableName:"text/primary", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG"}, {type:"frame", name:"Actions", layoutMode:"HORIZONTAL", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG", itemSpacing:"space/8", children:[{type:"instance", componentId:"1:2", componentPropertyName:"Action", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG"}]}]
185
215
 
186
- properties (array, optional) \u2014 Component properties to define at creation: [{propertyName, type, defaultValue}]. TEXT properties for inline children with componentPropertyName are created automatically.
187
- propertyName (string, required) \u2014 Property name
188
- type (BOOLEAN | TEXT | INSTANCE_SWAP, required) \u2014 Property type
189
- defaultValue (string_or_boolean, required) \u2014 Default value
190
- preferredValues (array, optional) \u2014 Preferred values for INSTANCE_SWAP
216
+ properties (array, optional) \u2014 Component properties to define at creation: [{propertyName, type, defaultValue}]. TEXT properties for inline children with componentPropertyName are created automatically.
217
+ propertyName (string, required) \u2014 Property name
218
+ type (BOOLEAN | TEXT | INSTANCE_SWAP, required) \u2014 Property type
219
+ defaultValue (string_or_boolean, required) \u2014 Default value
220
+ preferredValues (array, optional) \u2014 Preferred values for INSTANCE_SWAP
191
221
 
192
222
  ## from_node \u2014 Convert existing nodes to components. Text children auto-exposed as editable properties (exposeText: true).
193
- nodeId (string, required) \u2014 Node ID to convert
194
- name (string, optional) \u2014 Rename the component (default: keeps the node's current name)
195
- exposeText (boolean, optional) \u2014 Auto-expose text as editable properties (default: true)
223
+ Example: components(method:"create", type:"from_node", items:[{nodeId:"1:23", name:"Button", exposeText:true}])
224
+ Item fields for items[] when type:"from_node":
225
+ nodeId (string, required) \u2014 Node ID to convert
226
+ name (string, optional) \u2014 Rename the component (default: keeps the node's current name)
227
+ exposeText (boolean, optional) \u2014 Auto-expose text as editable properties (default: true)
196
228
 
197
229
  ## variant_set \u2014 Combine components into a variant set. The resulting set is a frame \u2014 accepts all frame properties for layout/styling.
198
- name (string, optional) \u2014 Node name
199
- parentId (string, optional) \u2014 Parent node ID. Omit to place at current page root.
200
- x (number, optional) \u2014 X position (default: 0)
201
- y (number, optional) \u2014 Y position (default: 0)
202
- width (number, optional) \u2014 Width in px (omit to shrink-to-content via HUG)
203
- height (number, optional) \u2014 Height in px (omit to shrink-to-content via HUG)
204
- rotation (number, optional) \u2014 Rotation in degrees (0-360)
205
- visible (boolean, optional) \u2014 Show/hide (default true)
206
- locked (boolean, optional) \u2014 Lock/unlock (default false)
207
- opacity (string, optional) \u2014 Opacity (0-1) or variable name
208
- 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)
209
- effectStyleName (string, optional) \u2014 Effect style name (e.g. 'Shadow/Card') for shadows, blurs
210
- fills (array, optional) \u2014 Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills.
211
- fillColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)
212
- fillStyleName (string, optional) \u2014 Paint style name for fill
213
- fillVariableName (string, optional) \u2014 Color variable by name e.g. 'bg/primary'
214
- imageUrl (string, optional) \u2014 Image source \u2014 'pexel:<id>' for Pexels photos, a public URL, or a local file path. SVGs are inserted as vectors; raster images become IMAGE fills.
215
- imageScaleMode (FILL | FIT | CROP | TILE, optional) \u2014 How the image is scaled within the frame (default: FILL)
216
- strokes (array, optional) \u2014 Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes.
217
- strokeColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)
218
- strokeStyleName (string, optional) \u2014 Paint style name for stroke
219
- strokeVariableName (string, optional) \u2014 Color variable by name for stroke
220
- strokeWeight (string, optional) \u2014 All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight.
221
- strokeTopWeight (string, optional)
222
- strokeBottomWeight (string, optional)
223
- strokeLeftWeight (string, optional)
224
- strokeRightWeight (string, optional)
225
- strokeAlign (INSIDE | OUTSIDE | CENTER, optional) \u2014 Stroke position (default: INSIDE)
226
- cornerRadius (string, optional) \u2014 All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.
227
- topLeftRadius (string, optional)
228
- topRightRadius (string, optional)
229
- bottomRightRadius (string, optional)
230
- bottomLeftRadius (string, optional)
231
- layoutMode (NONE | HORIZONTAL | VERTICAL, optional) \u2014 Layout direction (default: auto \u2014 NONE when width+height set, otherwise inferred from layout props)
232
- layoutWrap (NO_WRAP | WRAP, optional) \u2014 Wrap children to new rows (HORIZONTAL layout only \u2014 Figma does not support WRAP on VERTICAL layouts). Use column frames inside a HORIZONTAL parent for vertical grid patterns.
233
- padding (string, optional) \u2014 All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft.
234
- paddingTop (string, optional)
235
- paddingRight (string, optional)
236
- paddingBottom (string, optional)
237
- paddingLeft (string, optional)
238
- primaryAxisAlignItems (MIN | MAX | CENTER | SPACE_BETWEEN, optional)
239
- counterAxisAlignItems (MIN | MAX | CENTER | BASELINE, optional)
240
- itemSpacing (string, optional) \u2014 Spacing between children (number or variable name string, default: 0)
241
- counterAxisSpacing (string, optional) \u2014 Gap between wrapped rows (requires layoutWrap: WRAP)
242
- strokesIncludedInLayout (boolean, optional) \u2014 Include stroke width in layout measurements (default: false)
243
- overflowDirection (NONE | HORIZONTAL | VERTICAL | BOTH, optional) \u2014 Scroll overflow in prototype (default: NONE)
244
- layoutPositioning (AUTO | ABSOLUTE, optional) \u2014 ABSOLUTE = floating inside auto-layout parent
245
- layoutSizingHorizontal (FIXED | HUG | FILL, optional)
246
- layoutSizingVertical (FIXED | HUG | FILL, optional)
247
- minWidth (number, optional) \u2014 Min width for responsive auto-layout
248
- maxWidth (number, optional) \u2014 Max width for responsive auto-layout
249
- minHeight (number, optional) \u2014 Min height for responsive auto-layout
250
- maxHeight (number, optional) \u2014 Max height for responsive auto-layout
251
- annotations (array, optional) \u2014 Set annotations \u2014 [{label?, labelMarkdown?, properties?, categoryId?}]. Properties validated per node type.
252
- componentIds (string[], optional) \u2014 Existing component IDs to combine (min 2). Alternative to children.
253
- variantPropertyName (string, optional) \u2014 Rename the auto-generated variant property (default: 'Property 1')
254
- 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.`,
255
- "commit": '# components.commit\nCommit a staged component \u2014 unwraps from [STAGED] container into the original target location.\n\nExample: components(method:"commit", id:"1:234")\n\nParams:\n id (string, required) \u2014 Staged node ID to commit',
256
- "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.',
257
- "delete": "# components.delete\nDelete components or component sets\n\nParams:\n id (string, required) \u2014 Component or component set ID"
230
+ Example: components(method:"create", type:"variant_set", items:[{name:"Button", layoutMode:"HORIZONTAL", layoutSizingHorizontal:"HUG", layoutSizingVertical:"HUG", padding:"space/8", itemSpacing:"space/8", children:[{type:"component", name:"Style=Primary", minWidth:120, height:48, layoutMode:"HORIZONTAL", layoutSizingHorizontal:"HUG", layoutSizingVertical:"FIXED", padding:"space/12", cornerRadius:"radius/8", fillVariableName:"bg/accent", primaryAxisAlignItems:"CENTER", counterAxisAlignItems:"MIN", children:[{type:"text", name:"Button", text:"Button", width:72, componentPropertyName:"Button", textStyleName:"Body/Medium", fontColorVariableName:"text/inverse", textAlignHorizontal:"CENTER", textAlignVertical:"CENTER", layoutSizingHorizontal:"FIXED", layoutSizingVertical:"FILL"}]}, {type:"component", name:"Style=Secondary", minWidth:120, height:48, layoutMode:"HORIZONTAL", layoutSizingHorizontal:"HUG", layoutSizingVertical:"FIXED", padding:"space/12", cornerRadius:"radius/8", fillVariableName:"bg/surface", strokeVariableName:"border/subtle", strokeWeight:"stroke/1", primaryAxisAlignItems:"CENTER", counterAxisAlignItems:"MIN", children:[{type:"text", name:"Button", text:"Button", width:72, componentPropertyName:"Button", textStyleName:"Body/Medium", fontColorVariableName:"text/primary", textAlignHorizontal:"CENTER", textAlignVertical:"CENTER", layoutSizingHorizontal:"FIXED", layoutSizingVertical:"FILL"}]}]}])
231
+ Item fields for items[] when type:"variant_set":
232
+ name (string, optional) \u2014 Node name
233
+ parentId (string, optional) \u2014 Parent node ID. Omit to place at current page root.
234
+ x (number, optional) \u2014 X position (default: 0)
235
+ y (number, optional) \u2014 Y position (default: 0)
236
+ width (number, optional) \u2014 Width in px (omit to shrink-to-content via HUG)
237
+ height (number, optional) \u2014 Height in px (omit to shrink-to-content via HUG)
238
+ rotation (number, optional) \u2014 Rotation in degrees (0-360)
239
+ visible (boolean, optional) \u2014 Show/hide (default true)
240
+ locked (boolean, optional) \u2014 Lock/unlock (default false)
241
+ opacity (string, optional) \u2014 Opacity (0-1) or variable name
242
+ 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)
243
+ effectStyleName (string, optional) \u2014 Effect style name (e.g. 'Shadow/Card') for shadows, blurs
244
+ fills (Paint[], optional) \u2014 Fill Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] for transparent. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables; use imageUrl/images for image authoring. IMAGE/VIDEO/PATTERN may appear in readback metadata only. Primary way to set non-image fills.
245
+ fillColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)
246
+ fillStyleName (string, optional) \u2014 Paint style name for fill
247
+ fillVariableName (string, optional) \u2014 Color variable by name e.g. 'bg/surface'
248
+ imageUrl (string, optional) \u2014 Image source \u2014 'pexel:<id>' for Pexels photos, a public URL, or a local file path. SVGs are inserted as vectors; raster images become IMAGE fills.
249
+ imageScaleMode (FILL | FIT | CROP | TILE, optional) \u2014 How the image is scaled within the frame (default: FILL)
250
+ strokes (Paint[], optional) \u2014 Stroke Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] to clear. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables. IMAGE/VIDEO/PATTERN may appear in readback metadata only. Primary way to set strokes.
251
+ strokeColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)
252
+ strokeStyleName (string, optional) \u2014 Paint style name for stroke
253
+ strokeVariableName (string, optional) \u2014 Color variable by name for stroke
254
+ strokeWeight (string, optional) \u2014 All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight.
255
+ strokeTopWeight (string, optional)
256
+ strokeBottomWeight (string, optional)
257
+ strokeLeftWeight (string, optional)
258
+ strokeRightWeight (string, optional)
259
+ strokeAlign (INSIDE | OUTSIDE | CENTER, optional) \u2014 Stroke position (default: INSIDE)
260
+ cornerRadius (string, optional) \u2014 All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.
261
+ topLeftRadius (string, optional)
262
+ topRightRadius (string, optional)
263
+ bottomRightRadius (string, optional)
264
+ bottomLeftRadius (string, optional)
265
+ layoutMode (NONE | HORIZONTAL | VERTICAL, optional) \u2014 Layout direction (default: auto \u2014 NONE when width+height set, otherwise inferred from layout props)
266
+ layoutWrap (NO_WRAP | WRAP, optional) \u2014 Wrap children to new rows (HORIZONTAL layout only \u2014 Figma does not support WRAP on VERTICAL layouts). Use column frames inside a HORIZONTAL parent for vertical grid patterns.
267
+ padding (string, optional) \u2014 All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft.
268
+ paddingTop (string, optional)
269
+ paddingRight (string, optional)
270
+ paddingBottom (string, optional)
271
+ paddingLeft (string, optional)
272
+ primaryAxisAlignItems (MIN | MAX | CENTER | SPACE_BETWEEN, optional)
273
+ counterAxisAlignItems (MIN | MAX | CENTER | BASELINE, optional)
274
+ itemSpacing (string, optional) \u2014 Spacing between children (number or variable name string, default: 0)
275
+ counterAxisSpacing (string, optional) \u2014 Gap between wrapped rows (requires layoutWrap: WRAP)
276
+ strokesIncludedInLayout (boolean, optional) \u2014 Include stroke width in layout measurements (default: false)
277
+ overflowDirection (NONE | HORIZONTAL | VERTICAL | BOTH, optional) \u2014 Scroll overflow in prototype (default: NONE)
278
+ layoutPositioning (AUTO | ABSOLUTE, optional) \u2014 ABSOLUTE = floating inside auto-layout parent
279
+ layoutSizingHorizontal (FIXED | HUG | FILL, optional)
280
+ layoutSizingVertical (FIXED | HUG | FILL, optional)
281
+ minWidth (number, optional) \u2014 Min width for responsive auto-layout
282
+ maxWidth (number, optional) \u2014 Max width for responsive auto-layout
283
+ minHeight (number, optional) \u2014 Min height for responsive auto-layout
284
+ maxHeight (number, optional) \u2014 Max height for responsive auto-layout
285
+ annotations (array, optional) \u2014 Set annotations \u2014 [{label?, labelMarkdown?, properties?, categoryId?}]. Properties validated per node type.
286
+ componentIds (string[], optional) \u2014 Existing component IDs to combine (min 2). Alternative to children.
287
+ variantPropertyName (string, optional) \u2014 Rename the auto-generated variant property (default: 'Property 1')
288
+ children (array, optional) \u2014 Inline variant components. Each must be {type:"component", name, children?, ...frame_params}. Variant children use the same inline child types as components.create, including rectangle / ellipse / line. All variants must share the same child structure. Alternative to componentIds \u2014 do not combine both.
289
+
290
+ Response:
291
+ { results: ({id} | {error})[] }
292
+ // Shared types:
293
+ // Color: hex "#RGB"|"#RGBA"|"#RRGGBB"|"#RRGGBBAA" or {r: 0-1, g: 0-1, b: 0-1, a?: 0-1}
294
+ // VariableAlias: {type: "VARIABLE_ALIAS", id: string}. The id must be a Figma VariableID; discover it via variables.get/list or variable_collections.get. Prefer colorVariableName/fillVariableName/strokeVariableName when available; Paint[] VariableAlias is mainly for precise Paint[] round-trips and gradient stop bindings.
295
+ // Transform: [[number, number, number], [number, number, number]] (Figma Plugin API 2\xD73 matrix)
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"
297
+ // ColorStop: {position: 0-1, color: Color, boundVariables?: {color?: VariableAlias}}
298
+ // GradientPaint: {type: "GRADIENT_LINEAR"|"GRADIENT_RADIAL"|"GRADIENT_ANGULAR"|"GRADIENT_DIAMOND", gradientTransform: Transform, gradientStops: ColorStop[], visible?: boolean, opacity?: number, blendMode?: BlendMode}. Use gradientTransform + gradientStops (basic left-to-right: [[1,0,0],[0,1,0]]); do not use CSS gradients or REST gradientHandlePositions.
299
+ // Effect: {type: "DROP_SHADOW"|"INNER_SHADOW"|"LAYER_BLUR"|"BACKGROUND_BLUR", radius: number, color?: {r,g,b,a} (0-1), offset?: {x, y}, spread?: number, visible?: boolean}
300
+ // Paint: Paint[] authoring accepts only SOLID and GRADIENT_LINEAR/GRADIENT_RADIAL/GRADIENT_ANGULAR/GRADIENT_DIAMOND. SolidPaint: {type: "SOLID", color: Color, visible?: boolean, opacity?: number, blendMode?: BlendMode, boundVariables?: {color?: VariableAlias}}. GradientPaint authoring: {type: GRADIENT_*, gradientTransform: Transform, gradientStops: ColorStop[], visible?, opacity?, blendMode?}; bind variables on gradientStops[].boundVariables.color, not top-level gradient boundVariables. Do not pass IMAGE/VIDEO/PATTERN to create/update Paint[]; those may appear only in readback metadata from existing Figma content. Use imageUrl/images for image authoring. VIDEO/PATTERN authoring is not supported here. Do not use CSS gradients or REST gradientHandlePositions.`,
301
+ "commit": '# components.commit\nCommit a staged component \u2014 unwraps from [STAGED] container into the original target location.\n\nExample: components(method:"commit", id:"1:234")\n\nParams:\n id (string, required) \u2014 Staged node ID to commit\n\nResponse:\n { results: ({id} | {error})[] }',
302
+ "update": '# components.update\nAdd, edit, or delete component properties\n\nExample: components(method:"update", items:[{id:"1:23", propertyName:"Show Icon", action:"add", type:"BOOLEAN", defaultValue:true}])\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.\n\nResponse:\n { results: ("ok" | {error} | object)[] }',
303
+ "delete": '# components.delete\nDelete components or component sets\n\nParams:\n id (string, required) \u2014 Component or component set ID\n\nResponse:\n { results: ("ok" | {error})[] }'
258
304
  }
259
305
  },
260
306
  "connection": {
261
307
  "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.',
262
308
  "methods": {
263
- "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.",
264
- "get": "# connection.get\nVerify end-to-end connection to Figma\n\nNo params.",
265
- "list": "# connection.list\nInspect which clients (MCP, plugin) are connected to each channel\n\nNo params.",
266
- "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'."
309
+ "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.\n\nResponse:\n Confirmation message with channel and port\n string",
310
+ "get": "# connection.get\nVerify end-to-end connection to Figma\n\nNo params.\n\nResponse:\n status (string, required)\n documentName (string, required) \u2014 Active Figma document name\n currentPage (string, required) \u2014 Current page name\n timestamp (number, required) \u2014 Unix timestamp",
311
+ "list": "# connection.list\nInspect which clients (MCP, plugin) are connected to each channel\n\nNo params.\n\nResponse:\n Map of channel names to their connected clients\n object",
312
+ "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'.\n\nResponse:\n Confirmation of tunnel reset\n string"
267
313
  }
268
314
  },
269
315
  "document": {
270
316
  "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.',
271
317
  "methods": {
272
- "get": "# document.get\nGet current page with top-level children\n\nNo params.",
273
- "list": "# document.list\nGet document name and list all pages\n\nNo params.",
274
- "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)",
275
- "create": "# document.create\nCreate a new page\n\nParams:\n name (string, optional) \u2014 Page name (default: 'New Page')",
276
- "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)"
318
+ "get": '# document.get\nGet current page with top-level children\n\nNo params.\n\nResponse:\n id (string, required)\n name (string, required)\n backgroundColor (string, optional) \u2014 Canvas background hex color (e.g. "#F5F5F5")\n children (NodeStub[], required)\n// Shared types:\n// NodeStub: {id: string, name: string, type: string}',
319
+ "list": "# document.list\nGet document name and list all pages\n\nNo params.\n\nResponse:\n name (string, required) \u2014 Document name\n currentPageId (string, required)\n pages (array, required)\n id (string, required)\n name (string, required)",
320
+ "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)\n\nResponse:\n id (string, required)\n name (string, required)",
321
+ "create": "# document.create\nCreate a new page\n\nParams:\n name (string, optional) \u2014 Page name (default: 'New Page')\n\nResponse:\n id (string, required) \u2014 New page ID",
322
+ "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)\n\nResponse:\n string"
277
323
  }
278
324
  },
279
325
  "fonts": {
280
326
  "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.',
281
327
  "methods": {
282
- "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)'
328
+ "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)\n\nResponse:\n count (number, required) \u2014 Number of matching families\n fonts (array, required) \u2014 Array of {family} stubs, or {family, styles[]} when includeStyles:true\n family (string, required)\n styles (array, optional)'
283
329
  }
284
330
  },
285
331
  "frames": {
286
- "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 \u2014 produces a same-type copy (frame\u2192frame, instance\u2192instance, component\u2192component). Instance clones reference the same source component; they do not duplicate the component definition. [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 commit Commit a staged node \u2014 unwraps from [STAGED] container into the original target location. [edit]\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// Image fill: imageUrl accepts "pexel:<id>", a public URL, or a local file path. SVGs become vector nodes; raster images become IMAGE fills. imageScaleMode: FILL (default), FIT, CROP, TILE.\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.',
332
+ "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 \u2014 produces a same-type copy (frame\u2192frame, instance\u2192instance, component\u2192component). Instance clones reference the same source component; they do not duplicate the component definition. [create]\n scale Proportionally rescale a node subtree using Figma\'s visual Scale tool behavior. This is for visual/artifact scaling, not responsive layout resizing. [edit]\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 commit Commit a staged node \u2014 unwraps from [STAGED] container into the original target location. [edit]\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// clipsContent: clip children to the node bounds where supported (frames/components/instances). Set false for overflow-visible layouts.\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[]; // readback Paint[]; authoring supports SOLID + gradients via gradientTransform + gradientStops\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. Paint[] authoring supports SOLID + gradients only; IMAGE/VIDEO/PATTERN are readback-only metadata.\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: prefer fillVariableName/fillStyleName. Use fills:[{type:"SOLID", color:"#hex"}] or gradient Paint[] (GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND) with gradientTransform + gradientStops only for one-off values; [] for transparent. Shorthand: fillColor:"#3B82F6" (auto-binds single solids).\n// Also: fillVariableName:"bg/surface", fillStyleName:"Surface/Primary". Do not use CSS gradients, REST gradientHandlePositions, or top-level gradient boundVariables.\n// Image fill: use imageUrl/images for image authoring. imageUrl accepts "pexel:<id>", a public URL, or a local file path. SVGs become vector nodes; raster images become IMAGE fills. IMAGE/VIDEO/PATTERN may appear in readback metadata only; do not pass those objects in Paint[]. imageScaleMode: FILL (default), FIT, CROP, TILE.\n// Stroke: prefer strokeVariableName/strokeStyleName. Use strokes:[{type:"SOLID", color:"#hex"}] or gradient Paint[] (GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND) with gradientTransform + gradientStops only for one-off values; [] 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// Examples assume design tokens/styles already exist. Prefer token names (fillVariableName, strokeVariableName, padding:"space/16", cornerRadius:"radius/8") over raw values in production designs.\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.\n// Shared types:\n// Color: hex "#RGB"|"#RGBA"|"#RRGGBB"|"#RRGGBBAA" or {r: 0-1, g: 0-1, b: 0-1, a?: 0-1}\n// VariableAlias: {type: "VARIABLE_ALIAS", id: string}. The id must be a Figma VariableID; discover it via variables.get/list or variable_collections.get. Prefer colorVariableName/fillVariableName/strokeVariableName when available; Paint[] VariableAlias is mainly for precise Paint[] round-trips and gradient stop bindings.\n// Transform: [[number, number, number], [number, number, number]] (Figma Plugin API 2\xD73 matrix)\n// 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"\n// ColorStop: {position: 0-1, color: Color, boundVariables?: {color?: VariableAlias}}\n// GradientPaint: {type: "GRADIENT_LINEAR"|"GRADIENT_RADIAL"|"GRADIENT_ANGULAR"|"GRADIENT_DIAMOND", gradientTransform: Transform, gradientStops: ColorStop[], visible?: boolean, opacity?: number, blendMode?: BlendMode}. Use gradientTransform + gradientStops (basic left-to-right: [[1,0,0],[0,1,0]]); do not use CSS gradients or REST gradientHandlePositions.\n// Effect: {type: "DROP_SHADOW"|"INNER_SHADOW"|"LAYER_BLUR"|"BACKGROUND_BLUR", radius: number, color?: {r,g,b,a} (0-1), offset?: {x, y}, spread?: number, visible?: boolean}\n// Paint: Paint[] authoring accepts only SOLID and GRADIENT_LINEAR/GRADIENT_RADIAL/GRADIENT_ANGULAR/GRADIENT_DIAMOND. SolidPaint: {type: "SOLID", color: Color, visible?: boolean, opacity?: number, blendMode?: BlendMode, boundVariables?: {color?: VariableAlias}}. GradientPaint authoring: {type: GRADIENT_*, gradientTransform: Transform, gradientStops: ColorStop[], visible?, opacity?, blendMode?}; bind variables on gradientStops[].boundVariables.color, not top-level gradient boundVariables. Do not pass IMAGE/VIDEO/PATTERN to create/update Paint[]; those may appear only in readback metadata from existing Figma content. Use imageUrl/images for image authoring. VIDEO/PATTERN authoring is not supported here. Do not use CSS gradients or REST gradientHandlePositions.\n// NodeStub: {id: string, name: string, type: string}',
287
333
  "methods": {
288
- "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.',
289
- "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)',
334
+ "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.\n\nResponse:\n Serialized node tree. Shape depends on depth parameter.\n results (Node[], required) \u2014 Serialized node trees\n _truncated (boolean, optional) \u2014 True when node budget exceeded\n _notice (string, optional) \u2014 Human-readable truncation notice',
335
+ "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)\n\nResponse:\n Paginated node search results (uses `results` not `items`)\n totalCount (number, required) \u2014 Total matching nodes\n returned (number, required) \u2014 Nodes in this page\n offset (number, optional)\n limit (number, optional)\n results (array, required) \u2014 Matching node stubs\n id (string, required)\n name (string, required)\n type (string, required)\n parentId (string, required)\n parentName (string, optional)\n bounds (object, optional)',
290
336
  "update": `# frames.update
291
337
  Patch node properties
292
338
 
293
339
  Params:
294
- items (PatchItem[], required) \u2014 Array of {id, ...properties} to patch
295
- fills (array, optional) \u2014 Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills.
340
+ items (PatchItem[], required) \u2014 Array of {id, ...fields} to patch
341
+ fills (Paint[], optional) \u2014 Fill Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] for transparent. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables; use imageUrl/images for image authoring. IMAGE/VIDEO/PATTERN may appear in readback metadata only. Primary way to set non-image fills.
296
342
  fillColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)
297
343
  fillStyleName (string, optional) \u2014 Paint style name for fill
298
- fillVariableName (string, optional) \u2014 Color variable by name e.g. 'bg/primary'
299
- strokes (array, optional) \u2014 Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes.
344
+ fillVariableName (string, optional) \u2014 Color variable by name e.g. 'bg/surface'
345
+ strokes (Paint[], optional) \u2014 Stroke Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] to clear. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables. IMAGE/VIDEO/PATTERN may appear in readback metadata only. Primary way to set strokes.
300
346
  strokeColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)
301
347
  strokeStyleName (string, optional) \u2014 Paint style name for stroke
302
348
  strokeVariableName (string, optional) \u2014 Color variable by name for stroke
@@ -371,9 +417,35 @@ Params:
371
417
  explicitMode (object, optional) \u2014 Pin variable mode \u2014 use { collectionName, modeName } (preferred) or { collectionId, modeId }
372
418
  exportSettings (array, optional) \u2014 Export settings
373
419
  annotations (array, optional) \u2014 Set annotations \u2014 [{label?, labelMarkdown?, properties?, categoryId?}]. Properties are validated per node type.
374
- properties (object, optional) \u2014 Direct Figma API props (escape hatch)`,
375
- "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)",
376
- "clone": "# frames.clone\nDuplicate nodes \u2014 produces a same-type copy (frame\u2192frame, instance\u2192instance, component\u2192component). Instance clones reference the same source component; they do not duplicate the component definition.\n\nParams:\n id (string, optional) \u2014 Node ID\n name (string, optional) \u2014 Rename the clone (set before appending to parent \u2014 required when cloning a variant into its component set to avoid duplicate names)\n parentId (string, optional) \u2014 Parent node ID. Omit to place at current page root.\n x (number, optional) \u2014 X position (default: 0)\n y (number, optional) \u2014 Y position (default: 0)\n items (array, optional) \u2014 Batch: [{id, name?, parentId?, x?, y?}, ...]. Alternative to single-item params.\n id (string, required) \u2014 Node ID to clone\n name (string, optional) \u2014 Rename the clone\n parentId (string, optional) \u2014 Target parent\n x (number, optional)\n y (number, optional)\n depth (number, optional) \u2014 Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.",
420
+ clipsContent (boolean, optional) \u2014 Clip children to bounds where supported (frames/components/instances).
421
+
422
+ Response:
423
+ { results: ("ok" | {error} | object)[] }
424
+ // Shared types:
425
+ // Color: hex "#RGB"|"#RGBA"|"#RRGGBB"|"#RRGGBBAA" or {r: 0-1, g: 0-1, b: 0-1, a?: 0-1}
426
+ // VariableAlias: {type: "VARIABLE_ALIAS", id: string}. The id must be a Figma VariableID; discover it via variables.get/list or variable_collections.get. Prefer colorVariableName/fillVariableName/strokeVariableName when available; Paint[] VariableAlias is mainly for precise Paint[] round-trips and gradient stop bindings.
427
+ // Transform: [[number, number, number], [number, number, number]] (Figma Plugin API 2\xD73 matrix)
428
+ // 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"
429
+ // ColorStop: {position: 0-1, color: Color, boundVariables?: {color?: VariableAlias}}
430
+ // GradientPaint: {type: "GRADIENT_LINEAR"|"GRADIENT_RADIAL"|"GRADIENT_ANGULAR"|"GRADIENT_DIAMOND", gradientTransform: Transform, gradientStops: ColorStop[], visible?: boolean, opacity?: number, blendMode?: BlendMode}. Use gradientTransform + gradientStops (basic left-to-right: [[1,0,0],[0,1,0]]); do not use CSS gradients or REST gradientHandlePositions.
431
+ // Effect: {type: "DROP_SHADOW"|"INNER_SHADOW"|"LAYER_BLUR"|"BACKGROUND_BLUR", radius: number, color?: {r,g,b,a} (0-1), offset?: {x, y}, spread?: number, visible?: boolean}
432
+ // Paint: Paint[] authoring accepts only SOLID and GRADIENT_LINEAR/GRADIENT_RADIAL/GRADIENT_ANGULAR/GRADIENT_DIAMOND. SolidPaint: {type: "SOLID", color: Color, visible?: boolean, opacity?: number, blendMode?: BlendMode, boundVariables?: {color?: VariableAlias}}. GradientPaint authoring: {type: GRADIENT_*, gradientTransform: Transform, gradientStops: ColorStop[], visible?, opacity?, blendMode?}; bind variables on gradientStops[].boundVariables.color, not top-level gradient boundVariables. Do not pass IMAGE/VIDEO/PATTERN to create/update Paint[]; those may appear only in readback metadata from existing Figma content. Use imageUrl/images for image authoring. VIDEO/PATTERN authoring is not supported here. Do not use CSS gradients or REST gradientHandlePositions.`,
433
+ "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)\n\nResponse:\n { results: ("ok" | {error})[] }',
434
+ "clone": "# frames.clone\nDuplicate nodes \u2014 produces a same-type copy (frame\u2192frame, instance\u2192instance, component\u2192component). Instance clones reference the same source component; they do not duplicate the component definition.\n\nParams:\n id (string, optional) \u2014 Node ID\n name (string, optional) \u2014 Rename the clone (set before appending to parent \u2014 required when cloning a variant into its component set to avoid duplicate names)\n parentId (string, optional) \u2014 Parent node ID. Omit to place at current page root.\n x (number, optional) \u2014 X position (default: 0)\n y (number, optional) \u2014 Y position (default: 0)\n items (array, optional) \u2014 Batch: [{id, name?, parentId?, x?, y?}, ...]. Alternative to single-item params.\n id (string, required) \u2014 Node ID to clone\n name (string, optional) \u2014 Rename the clone\n parentId (string, optional) \u2014 Target parent\n x (number, optional)\n y (number, optional)\n depth (number, optional) \u2014 Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.\n\nResponse:\n { results: ({id} | {error})[] }",
435
+ "scale": `# frames.scale
436
+ Proportionally rescale a node subtree using Figma's visual Scale tool behavior. This is for visual/artifact scaling, not responsive layout resizing.
437
+
438
+ Example: frames(method:"scale", id:"1:23", factor:0.5)
439
+
440
+ Params:
441
+ id (string, optional) \u2014 Node ID to scale
442
+ factor (number, optional) \u2014 Scale factor, >= 0.01. 0.5 = 50%, 2 = 200%. Scales children, text, strokes, effects, and layout geometry from the node's top-left. On auto-layout or HUG/FILL nodes, Figma may resolve responsive sizing to fixed width/height.
443
+ items (array, optional) \u2014 Batch: [{id, factor}, ...]. Alternative to single-item params.
444
+ id (string, required) \u2014 Node ID to scale
445
+ factor (number, required) \u2014 Scale factor, >= 0.01. 0.5 = 50%, 2 = 200%.
446
+
447
+ Response:
448
+ { results: ("ok" | {error})[] }`,
377
449
  "audit": `# frames.audit
378
450
  Run lint on a node \u2014 returns severity-ranked findings
379
451
 
@@ -383,299 +455,346 @@ Params:
383
455
  maxDepth (number, optional) \u2014 Max tree depth (default: 10)
384
456
  maxFindings (number, optional) \u2014 Max findings (default: 50)
385
457
  minSeverity (error | unsafe | heuristic | style | verbose, optional) \u2014 Minimum severity to report (default: style). Set to 'verbose' to include AAA contrast and line-height checks.
386
- skipInstances (boolean, optional) \u2014 Skip instance internals \u2014 findings inside instances are owned by the component (default: true)`,
387
- "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)",
458
+ skipInstances (boolean, optional) \u2014 Skip instance internals \u2014 findings inside instances are owned by the component (default: true)
459
+
460
+ Response:
461
+ nodeId (string, optional)
462
+ nodeName (string, optional)
463
+ categories (array, optional) \u2014 Sorted by severity (error > unsafe > heuristic > style)`,
464
+ "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)\n\nResponse:\n { results: ("ok" | {error})[] }',
388
465
  "create": `# frames.create
389
466
  Create frame-like containers
390
467
 
391
- Example: frames(method:"create", type:"auto_layout", layoutMode:"VERTICAL", itemSpacing:16, padding:24)
468
+ Example: frames(method:"create", type:"rectangle", items:[{name:"Gradient Box", fills:[{type:"GRADIENT_LINEAR", gradientTransform:[[1,0,0],[0,1,0]], gradientStops:[{position:0,color:"#FF6B6B"},{position:1,color:"#FFD93D"}]}]}])
469
+
470
+ Call shape: frames(method:"create", type:"<type>", items:[{...type-specific fields...}])
471
+ Do not pass type-specific item fields at the top level; put them inside items[].
392
472
 
393
473
  Discriminant: type (frame | auto_layout | section | rectangle | ellipse | line | group | boolean_operation | svg | slot)
474
+ Top-level params:
475
+ type (frame | auto_layout | section | rectangle | ellipse | line | group | boolean_operation | svg | slot, required) \u2014 Selects which item shape to use
476
+ items (array, required) \u2014 One or more type-specific item objects
394
477
 
395
478
  ## frame \u2014 General-purpose frame \u2014 shrinks to content by default, static when width+height given
396
- name (string, optional) \u2014 Node name
397
- parentId (string, optional) \u2014 Parent node ID. Omit to place at current page root.
398
- x (number, optional) \u2014 X position (default: 0)
399
- y (number, optional) \u2014 Y position (default: 0)
400
- width (number, optional) \u2014 Width in px (omit to shrink-to-content via HUG)
401
- height (number, optional) \u2014 Height in px (omit to shrink-to-content via HUG)
402
- rotation (number, optional) \u2014 Rotation in degrees (0-360)
403
- visible (boolean, optional) \u2014 Show/hide (default true)
404
- locked (boolean, optional) \u2014 Lock/unlock (default false)
405
- opacity (string, optional) \u2014 Opacity (0-1) or variable name
406
- 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)
407
- effectStyleName (string, optional) \u2014 Effect style name (e.g. 'Shadow/Card') for shadows, blurs
408
- fills (array, optional) \u2014 Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills.
409
- fillColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)
410
- fillStyleName (string, optional) \u2014 Paint style name for fill
411
- fillVariableName (string, optional) \u2014 Color variable by name e.g. 'bg/primary'
412
- imageUrl (string, optional) \u2014 Image source \u2014 'pexel:<id>' for Pexels photos, a public URL, or a local file path. SVGs are inserted as vectors; raster images become IMAGE fills.
413
- imageScaleMode (FILL | FIT | CROP | TILE, optional) \u2014 How the image is scaled within the frame (default: FILL)
414
- strokes (array, optional) \u2014 Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes.
415
- strokeColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)
416
- strokeStyleName (string, optional) \u2014 Paint style name for stroke
417
- strokeVariableName (string, optional) \u2014 Color variable by name for stroke
418
- strokeWeight (string, optional) \u2014 All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight.
419
- strokeTopWeight (string, optional)
420
- strokeBottomWeight (string, optional)
421
- strokeLeftWeight (string, optional)
422
- strokeRightWeight (string, optional)
423
- strokeAlign (INSIDE | OUTSIDE | CENTER, optional) \u2014 Stroke position (default: INSIDE)
424
- cornerRadius (string, optional) \u2014 All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.
425
- topLeftRadius (string, optional)
426
- topRightRadius (string, optional)
427
- bottomRightRadius (string, optional)
428
- bottomLeftRadius (string, optional)
429
- layoutMode (NONE | HORIZONTAL | VERTICAL, optional) \u2014 Layout direction (default: auto \u2014 NONE when width+height set, otherwise inferred from layout props)
430
- layoutWrap (NO_WRAP | WRAP, optional) \u2014 Wrap children to new rows (HORIZONTAL layout only \u2014 Figma does not support WRAP on VERTICAL layouts). Use column frames inside a HORIZONTAL parent for vertical grid patterns.
431
- padding (string, optional) \u2014 All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft.
432
- paddingTop (string, optional)
433
- paddingRight (string, optional)
434
- paddingBottom (string, optional)
435
- paddingLeft (string, optional)
436
- primaryAxisAlignItems (MIN | MAX | CENTER | SPACE_BETWEEN, optional)
437
- counterAxisAlignItems (MIN | MAX | CENTER | BASELINE, optional)
438
- itemSpacing (string, optional) \u2014 Spacing between children (number or variable name string, default: 0)
439
- counterAxisSpacing (string, optional) \u2014 Gap between wrapped rows (requires layoutWrap: WRAP)
440
- strokesIncludedInLayout (boolean, optional) \u2014 Include stroke width in layout measurements (default: false)
441
- overflowDirection (NONE | HORIZONTAL | VERTICAL | BOTH, optional) \u2014 Scroll overflow in prototype (default: NONE)
442
- layoutPositioning (AUTO | ABSOLUTE, optional) \u2014 ABSOLUTE = floating inside auto-layout parent
443
- layoutSizingHorizontal (FIXED | HUG | FILL, optional)
444
- layoutSizingVertical (FIXED | HUG | FILL, optional)
445
- minWidth (number, optional) \u2014 Min width for responsive auto-layout
446
- maxWidth (number, optional) \u2014 Max width for responsive auto-layout
447
- minHeight (number, optional) \u2014 Min height for responsive auto-layout
448
- maxHeight (number, optional) \u2014 Max height for responsive auto-layout
449
- annotations (array, optional) \u2014 Set annotations \u2014 [{label?, labelMarkdown?, properties?, categoryId?}]. Properties validated per node type.
450
- clipsContent (boolean, optional)
451
- children (array, optional) \u2014 Inline child nodes \u2014 build nested trees in one call. Types: text: {type:"text", text, fontFamily?, fontSize?, fontWeight?, fontStyle?, fontColor?, layoutSizingHorizontal?}. frame: {type:"frame", name?, layoutMode?, fillColor?, width?, layoutSizingHorizontal?, children?}. instance: {type:"instance", componentId, variantProperties?, properties?}. component: {type:"component", name, children?}. All params from text/frame endpoints are supported on their respective types. Always set layoutSizingHorizontal + layoutSizingVertical on children inside auto-layout parents (FILL, HUG, or FIXED). Example: children:[{type:"text", text:"Title", fontSize:20, layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG"}, {type:"frame", name:"Row", layoutMode:"HORIZONTAL", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG", itemSpacing:8, children:[{type:"instance", componentId:"1:2", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG"}]}] Inside components: add componentPropertyName to auto-bind TEXT or INSTANCE_SWAP properties.
479
+ Example: frames(method:"create", type:"frame", items:[{name:"Dashboard Shell", x:0, y:0, width:1440, height:900, fillVariableName:"bg/canvas", children:[{type:"frame", name:"Content Area", x:80, y:80, width:640, height:360, layoutMode:"VERTICAL", padding:"space/24", itemSpacing:"space/12", fillVariableName:"bg/surface", cornerRadius:"radius/12", children:[{type:"text", name:"Dashboard overview", text:"Dashboard overview", textStyleName:"Heading/Medium", fontColorVariableName:"text/primary", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG"}]}]}])
480
+ Item fields for items[] when type:"frame":
481
+ name (string, optional) \u2014 Node name
482
+ parentId (string, optional) \u2014 Parent node ID. Omit to place at current page root.
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 (omit to shrink-to-content via HUG)
486
+ height (number, optional) \u2014 Height in px (omit to shrink-to-content via HUG)
487
+ rotation (number, optional) \u2014 Rotation in degrees (0-360)
488
+ visible (boolean, optional) \u2014 Show/hide (default true)
489
+ locked (boolean, optional) \u2014 Lock/unlock (default false)
490
+ opacity (string, optional) \u2014 Opacity (0-1) or variable name
491
+ 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)
492
+ effectStyleName (string, optional) \u2014 Effect style name (e.g. 'Shadow/Card') for shadows, blurs
493
+ fills (Paint[], optional) \u2014 Fill Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] for transparent. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables; use imageUrl/images for image authoring. IMAGE/VIDEO/PATTERN may appear in readback metadata only. Primary way to set non-image fills.
494
+ fillColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)
495
+ fillStyleName (string, optional) \u2014 Paint style name for fill
496
+ fillVariableName (string, optional) \u2014 Color variable by name e.g. 'bg/surface'
497
+ imageUrl (string, optional) \u2014 Image source \u2014 'pexel:<id>' for Pexels photos, a public URL, or a local file path. SVGs are inserted as vectors; raster images become IMAGE fills.
498
+ imageScaleMode (FILL | FIT | CROP | TILE, optional) \u2014 How the image is scaled within the frame (default: FILL)
499
+ strokes (Paint[], optional) \u2014 Stroke Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] to clear. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables. IMAGE/VIDEO/PATTERN may appear in readback metadata only. Primary way to set strokes.
500
+ strokeColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)
501
+ strokeStyleName (string, optional) \u2014 Paint style name for stroke
502
+ strokeVariableName (string, optional) \u2014 Color variable by name for stroke
503
+ strokeWeight (string, optional) \u2014 All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight.
504
+ strokeTopWeight (string, optional)
505
+ strokeBottomWeight (string, optional)
506
+ strokeLeftWeight (string, optional)
507
+ strokeRightWeight (string, optional)
508
+ strokeAlign (INSIDE | OUTSIDE | CENTER, optional) \u2014 Stroke position (default: INSIDE)
509
+ cornerRadius (string, optional) \u2014 All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.
510
+ topLeftRadius (string, optional)
511
+ topRightRadius (string, optional)
512
+ bottomRightRadius (string, optional)
513
+ bottomLeftRadius (string, optional)
514
+ layoutMode (NONE | HORIZONTAL | VERTICAL, optional) \u2014 Layout direction (default: auto \u2014 NONE when width+height set, otherwise inferred from layout props)
515
+ layoutWrap (NO_WRAP | WRAP, optional) \u2014 Wrap children to new rows (HORIZONTAL layout only \u2014 Figma does not support WRAP on VERTICAL layouts). Use column frames inside a HORIZONTAL parent for vertical grid patterns.
516
+ padding (string, optional) \u2014 All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft.
517
+ paddingTop (string, optional)
518
+ paddingRight (string, optional)
519
+ paddingBottom (string, optional)
520
+ paddingLeft (string, optional)
521
+ primaryAxisAlignItems (MIN | MAX | CENTER | SPACE_BETWEEN, optional)
522
+ counterAxisAlignItems (MIN | MAX | CENTER | BASELINE, optional)
523
+ itemSpacing (string, optional) \u2014 Spacing between children (number or variable name string, default: 0)
524
+ counterAxisSpacing (string, optional) \u2014 Gap between wrapped rows (requires layoutWrap: WRAP)
525
+ strokesIncludedInLayout (boolean, optional) \u2014 Include stroke width in layout measurements (default: false)
526
+ overflowDirection (NONE | HORIZONTAL | VERTICAL | BOTH, optional) \u2014 Scroll overflow in prototype (default: NONE)
527
+ layoutPositioning (AUTO | ABSOLUTE, optional) \u2014 ABSOLUTE = floating inside auto-layout parent
528
+ layoutSizingHorizontal (FIXED | HUG | FILL, optional)
529
+ layoutSizingVertical (FIXED | HUG | FILL, optional)
530
+ minWidth (number, optional) \u2014 Min width for responsive auto-layout
531
+ maxWidth (number, optional) \u2014 Max width for responsive auto-layout
532
+ minHeight (number, optional) \u2014 Min height for responsive auto-layout
533
+ maxHeight (number, optional) \u2014 Max height for responsive auto-layout
534
+ annotations (array, optional) \u2014 Set annotations \u2014 [{label?, labelMarkdown?, properties?, categoryId?}]. Properties validated per node type.
535
+ clipsContent (boolean, optional)
536
+ children (array, optional) \u2014 Inline child nodes \u2014 build nested trees in one call. Types: text: {type:"text", text, textStyleName?, fontColorVariableName?, layoutSizingHorizontal?}. frame: {type:"frame", name?, layoutMode?, fillVariableName?, itemSpacing?, layoutSizingHorizontal?, children?}. instance: {type:"instance", componentId, variantProperties?, properties?}. component: {type:"component", name, children?}. rectangle / ellipse / line: same params as the corresponding frames(method:"create", type:"rectangle"|"ellipse"|"line") branch. All params from text/frame endpoints are supported on their respective types. Inline fills/strokes accept Paint[] authoring input: SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. Do not use CSS gradients, REST gradientHandlePositions, or IMAGE/VIDEO/PATTERN in Paint[] authoring. Always set layoutSizingHorizontal + layoutSizingVertical on children inside auto-layout parents (FILL, HUG, or FIXED). Example: children:[{type:"ellipse", name:"Dot", width:6, height:6, fillVariableName:"status/active"}, {type:"text", name:"Title", text:"Title", textStyleName:"Heading/Medium", fontColorVariableName:"text/primary", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG"}, {type:"frame", name:"Row", layoutMode:"HORIZONTAL", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG", itemSpacing:"space/8", children:[{type:"instance", componentId:"1:2", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG"}]}] Inside components: add componentPropertyName to auto-bind TEXT or INSTANCE_SWAP properties.
452
537
 
453
538
 
454
539
  ## auto_layout \u2014 Auto-layout frame that arranges children automatically
455
- name (string, optional) \u2014 Node name
456
- parentId (string, optional) \u2014 Parent node ID. Omit to place at current page root.
457
- x (number, optional) \u2014 X position (default: 0)
458
- y (number, optional) \u2014 Y position (default: 0)
459
- width (number, optional) \u2014 Width in px (omit to shrink-to-content via HUG)
460
- height (number, optional) \u2014 Height in px (omit to shrink-to-content via HUG)
461
- rotation (number, optional) \u2014 Rotation in degrees (0-360)
462
- visible (boolean, optional) \u2014 Show/hide (default true)
463
- locked (boolean, optional) \u2014 Lock/unlock (default false)
464
- opacity (string, optional) \u2014 Opacity (0-1) or variable name
465
- 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)
466
- effectStyleName (string, optional) \u2014 Effect style name (e.g. 'Shadow/Card') for shadows, blurs
467
- fills (array, optional) \u2014 Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills.
468
- fillColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)
469
- fillStyleName (string, optional) \u2014 Paint style name for fill
470
- fillVariableName (string, optional) \u2014 Color variable by name e.g. 'bg/primary'
471
- imageUrl (string, optional) \u2014 Image source \u2014 'pexel:<id>' for Pexels photos, a public URL, or a local file path. SVGs are inserted as vectors; raster images become IMAGE fills.
472
- imageScaleMode (FILL | FIT | CROP | TILE, optional) \u2014 How the image is scaled within the frame (default: FILL)
473
- strokes (array, optional) \u2014 Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes.
474
- strokeColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)
475
- strokeStyleName (string, optional) \u2014 Paint style name for stroke
476
- strokeVariableName (string, optional) \u2014 Color variable by name for stroke
477
- strokeWeight (string, optional) \u2014 All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight.
478
- strokeTopWeight (string, optional)
479
- strokeBottomWeight (string, optional)
480
- strokeLeftWeight (string, optional)
481
- strokeRightWeight (string, optional)
482
- strokeAlign (INSIDE | OUTSIDE | CENTER, optional) \u2014 Stroke position (default: INSIDE)
483
- cornerRadius (string, optional) \u2014 All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.
484
- topLeftRadius (string, optional)
485
- topRightRadius (string, optional)
486
- bottomRightRadius (string, optional)
487
- bottomLeftRadius (string, optional)
488
- layoutMode (HORIZONTAL | VERTICAL, required) \u2014 Primary axis direction
489
- layoutWrap (NO_WRAP | WRAP, optional) \u2014 Wrap children to new rows (HORIZONTAL layout only \u2014 Figma does not support WRAP on VERTICAL layouts). Use column frames inside a HORIZONTAL parent for vertical grid patterns.
490
- padding (string, optional) \u2014 All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft.
491
- paddingTop (string, optional)
492
- paddingRight (string, optional)
493
- paddingBottom (string, optional)
494
- paddingLeft (string, optional)
495
- primaryAxisAlignItems (MIN | MAX | CENTER | SPACE_BETWEEN, optional)
496
- counterAxisAlignItems (MIN | MAX | CENTER | BASELINE, optional)
497
- itemSpacing (string, optional) \u2014 Spacing between children (number or variable name string, default: 0)
498
- counterAxisSpacing (string, optional) \u2014 Gap between wrapped rows (requires layoutWrap: WRAP)
499
- strokesIncludedInLayout (boolean, optional) \u2014 Include stroke width in layout measurements (default: false)
500
- overflowDirection (NONE | HORIZONTAL | VERTICAL | BOTH, optional) \u2014 Scroll overflow in prototype (default: NONE)
501
- layoutPositioning (AUTO | ABSOLUTE, optional) \u2014 ABSOLUTE = floating inside auto-layout parent
502
- layoutSizingHorizontal (FIXED | HUG | FILL, optional)
503
- layoutSizingVertical (FIXED | HUG | FILL, optional)
504
- minWidth (number, optional) \u2014 Min width for responsive auto-layout
505
- maxWidth (number, optional) \u2014 Max width for responsive auto-layout
506
- minHeight (number, optional) \u2014 Min height for responsive auto-layout
507
- maxHeight (number, optional) \u2014 Max height for responsive auto-layout
508
- annotations (array, optional) \u2014 Set annotations \u2014 [{label?, labelMarkdown?, properties?, categoryId?}]. Properties validated per node type.
509
- clipsContent (boolean, optional)
510
- nodeIds (string[], optional) \u2014 Existing node IDs to wrap into auto-layout
511
- children (array, optional) \u2014 Inline child nodes \u2014 build nested trees in one call. Types: text: {type:"text", text, fontFamily?, fontSize?, fontWeight?, fontStyle?, fontColor?, layoutSizingHorizontal?}. frame: {type:"frame", name?, layoutMode?, fillColor?, width?, layoutSizingHorizontal?, children?}. instance: {type:"instance", componentId, variantProperties?, properties?}. component: {type:"component", name, children?}. All params from text/frame endpoints are supported on their respective types. Always set layoutSizingHorizontal + layoutSizingVertical on children inside auto-layout parents (FILL, HUG, or FIXED). Example: children:[{type:"text", text:"Title", fontSize:20, layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG"}, {type:"frame", name:"Row", layoutMode:"HORIZONTAL", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG", itemSpacing:8, children:[{type:"instance", componentId:"1:2", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG"}]}] Inside components: add componentPropertyName to auto-bind TEXT or INSTANCE_SWAP properties.
540
+ Example: frames(method:"create", type:"auto_layout", items:[{name:"Settings Card", width:360, height:180, layoutMode:"VERTICAL", padding:"space/24", itemSpacing:"space/12", fillVariableName:"bg/surface", strokeVariableName:"border/subtle", strokeWeight:"stroke/1", cornerRadius:"radius/12", children:[{type:"text", name:"Team settings", text:"Team settings", textStyleName:"Heading/Medium", fontColorVariableName:"text/primary", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG"}, {type:"text", name:"Manage workspace preferences.", text:"Manage workspace preferences.", textStyleName:"Body/Regular", fontColorVariableName:"text/secondary", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG"}]}])
541
+ Item fields for items[] when type:"auto_layout":
542
+ name (string, optional) \u2014 Node name
543
+ parentId (string, optional) \u2014 Parent node ID. Omit to place at current page root.
544
+ x (number, optional) \u2014 X position (default: 0)
545
+ y (number, optional) \u2014 Y position (default: 0)
546
+ width (number, optional) \u2014 Width in px (omit to shrink-to-content via HUG)
547
+ height (number, optional) \u2014 Height in px (omit to shrink-to-content via HUG)
548
+ rotation (number, optional) \u2014 Rotation in degrees (0-360)
549
+ visible (boolean, optional) \u2014 Show/hide (default true)
550
+ locked (boolean, optional) \u2014 Lock/unlock (default false)
551
+ opacity (string, optional) \u2014 Opacity (0-1) or variable name
552
+ 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)
553
+ effectStyleName (string, optional) \u2014 Effect style name (e.g. 'Shadow/Card') for shadows, blurs
554
+ fills (Paint[], optional) \u2014 Fill Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] for transparent. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables; use imageUrl/images for image authoring. IMAGE/VIDEO/PATTERN may appear in readback metadata only. Primary way to set non-image fills.
555
+ fillColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)
556
+ fillStyleName (string, optional) \u2014 Paint style name for fill
557
+ fillVariableName (string, optional) \u2014 Color variable by name e.g. 'bg/surface'
558
+ imageUrl (string, optional) \u2014 Image source \u2014 'pexel:<id>' for Pexels photos, a public URL, or a local file path. SVGs are inserted as vectors; raster images become IMAGE fills.
559
+ imageScaleMode (FILL | FIT | CROP | TILE, optional) \u2014 How the image is scaled within the frame (default: FILL)
560
+ strokes (Paint[], optional) \u2014 Stroke Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] to clear. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables. IMAGE/VIDEO/PATTERN may appear in readback metadata only. Primary way to set strokes.
561
+ strokeColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)
562
+ strokeStyleName (string, optional) \u2014 Paint style name for stroke
563
+ strokeVariableName (string, optional) \u2014 Color variable by name for stroke
564
+ strokeWeight (string, optional) \u2014 All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight.
565
+ strokeTopWeight (string, optional)
566
+ strokeBottomWeight (string, optional)
567
+ strokeLeftWeight (string, optional)
568
+ strokeRightWeight (string, optional)
569
+ strokeAlign (INSIDE | OUTSIDE | CENTER, optional) \u2014 Stroke position (default: INSIDE)
570
+ cornerRadius (string, optional) \u2014 All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.
571
+ topLeftRadius (string, optional)
572
+ topRightRadius (string, optional)
573
+ bottomRightRadius (string, optional)
574
+ bottomLeftRadius (string, optional)
575
+ layoutMode (HORIZONTAL | VERTICAL, required) \u2014 Primary axis direction
576
+ layoutWrap (NO_WRAP | WRAP, optional) \u2014 Wrap children to new rows (HORIZONTAL layout only \u2014 Figma does not support WRAP on VERTICAL layouts). Use column frames inside a HORIZONTAL parent for vertical grid patterns.
577
+ padding (string, optional) \u2014 All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft.
578
+ paddingTop (string, optional)
579
+ paddingRight (string, optional)
580
+ paddingBottom (string, optional)
581
+ paddingLeft (string, optional)
582
+ primaryAxisAlignItems (MIN | MAX | CENTER | SPACE_BETWEEN, optional)
583
+ counterAxisAlignItems (MIN | MAX | CENTER | BASELINE, optional)
584
+ itemSpacing (string, optional) \u2014 Spacing between children (number or variable name string, default: 0)
585
+ counterAxisSpacing (string, optional) \u2014 Gap between wrapped rows (requires layoutWrap: WRAP)
586
+ strokesIncludedInLayout (boolean, optional) \u2014 Include stroke width in layout measurements (default: false)
587
+ overflowDirection (NONE | HORIZONTAL | VERTICAL | BOTH, optional) \u2014 Scroll overflow in prototype (default: NONE)
588
+ layoutPositioning (AUTO | ABSOLUTE, optional) \u2014 ABSOLUTE = floating inside auto-layout parent
589
+ layoutSizingHorizontal (FIXED | HUG | FILL, optional)
590
+ layoutSizingVertical (FIXED | HUG | FILL, optional)
591
+ minWidth (number, optional) \u2014 Min width for responsive auto-layout
592
+ maxWidth (number, optional) \u2014 Max width for responsive auto-layout
593
+ minHeight (number, optional) \u2014 Min height for responsive auto-layout
594
+ maxHeight (number, optional) \u2014 Max height for responsive auto-layout
595
+ annotations (array, optional) \u2014 Set annotations \u2014 [{label?, labelMarkdown?, properties?, categoryId?}]. Properties validated per node type.
596
+ clipsContent (boolean, optional)
597
+ nodeIds (string[], optional) \u2014 Existing node IDs to wrap into auto-layout
598
+ children (array, optional) \u2014 Inline child nodes \u2014 build nested trees in one call. Types: text: {type:"text", text, textStyleName?, fontColorVariableName?, layoutSizingHorizontal?}. frame: {type:"frame", name?, layoutMode?, fillVariableName?, itemSpacing?, layoutSizingHorizontal?, children?}. instance: {type:"instance", componentId, variantProperties?, properties?}. component: {type:"component", name, children?}. rectangle / ellipse / line: same params as the corresponding frames(method:"create", type:"rectangle"|"ellipse"|"line") branch. All params from text/frame endpoints are supported on their respective types. Inline fills/strokes accept Paint[] authoring input: SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. Do not use CSS gradients, REST gradientHandlePositions, or IMAGE/VIDEO/PATTERN in Paint[] authoring. Always set layoutSizingHorizontal + layoutSizingVertical on children inside auto-layout parents (FILL, HUG, or FIXED). Example: children:[{type:"ellipse", name:"Dot", width:6, height:6, fillVariableName:"status/active"}, {type:"text", name:"Title", text:"Title", textStyleName:"Heading/Medium", fontColorVariableName:"text/primary", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG"}, {type:"frame", name:"Row", layoutMode:"HORIZONTAL", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG", itemSpacing:"space/8", children:[{type:"instance", componentId:"1:2", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG"}]}] Inside components: add componentPropertyName to auto-bind TEXT or INSTANCE_SWAP properties.
512
599
 
513
600
 
514
601
  ## section \u2014 Figma section (top-level organizer)
515
- name (string, required) \u2014 Section name
516
- parentId (string, optional) \u2014 Parent node ID. Omit to place at current page root.
517
- x (number, optional) \u2014 X position (default: 0)
518
- y (number, optional) \u2014 Y position (default: 0)
519
- width (number, optional) \u2014 Width (default: 500)
520
- height (number, optional) \u2014 Height (default: 500)
521
- fills (array, optional) \u2014 Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent
522
- fillColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)
523
- fillStyleName (string, optional) \u2014 Paint style name for fill
524
- fillVariableName (string, optional) \u2014 Color variable by name e.g. 'bg/primary'
525
- imageUrl (string, optional) \u2014 Image source \u2014 'pexel:<id>', public URL, or local file path
526
- imageScaleMode (FILL | FIT | CROP | TILE, optional) \u2014 How the image is scaled (default: FILL)
602
+ Example: frames(method:"create", type:"section", items:[{name:"Components", x:0, y:0, width:1200, height:800, fillVariableName:"bg/canvas"}])
603
+ Item fields for items[] when type:"section":
604
+ name (string, required) \u2014 Section name
605
+ parentId (string, optional) \u2014 Parent node ID. Omit to place at current page root.
606
+ x (number, optional) \u2014 X position (default: 0)
607
+ y (number, optional) \u2014 Y position (default: 0)
608
+ width (number, optional) \u2014 Width (default: 500)
609
+ height (number, optional) \u2014 Height (default: 500)
610
+ fills (Paint[], optional) \u2014 Fill Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] for transparent. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables; use imageUrl/images for image authoring. IMAGE/VIDEO/PATTERN may appear in readback metadata only
611
+ fillColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)
612
+ fillStyleName (string, optional) \u2014 Paint style name for fill
613
+ fillVariableName (string, optional) \u2014 Color variable by name e.g. 'bg/surface'
614
+ imageUrl (string, optional) \u2014 Image source \u2014 'pexel:<id>', public URL, or local file path
615
+ imageScaleMode (FILL | FIT | CROP | TILE, optional) \u2014 How the image is scaled (default: FILL)
527
616
 
528
617
  ## rectangle \u2014 Rectangle shape node
529
- name (string, optional) \u2014 Layer name (default: 'Rectangle')
530
- parentId (string, optional) \u2014 Parent node ID. Omit to place at current page root.
531
- x (number, optional) \u2014 X position (default: 0)
532
- y (number, optional) \u2014 Y position (default: 0)
533
- width (number, optional) \u2014 Width in px (default: 100)
534
- height (number, optional) \u2014 Height in px (default: 100)
535
- fills (array, optional) \u2014 Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent
536
- fillColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)
537
- fillStyleName (string, optional) \u2014 Paint style name for fill
538
- fillVariableName (string, optional) \u2014 Color variable by name e.g. 'bg/primary'
539
- imageUrl (string, optional) \u2014 Image source \u2014 'pexel:<id>', public URL, or local file path
540
- imageScaleMode (FILL | FIT | CROP | TILE, optional) \u2014 How the image is scaled (default: FILL)
541
- strokes (array, optional) \u2014 Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear
542
- strokeColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)
543
- strokeVariableName (string, optional) \u2014 Color variable by name for stroke
544
- strokeWeight (string, optional)
545
- cornerRadius (string, optional) \u2014 All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.
546
- topLeftRadius (string, optional)
547
- topRightRadius (string, optional)
548
- bottomRightRadius (string, optional)
549
- bottomLeftRadius (string, optional)
550
- opacity (string, optional)
551
- layoutSizingHorizontal (FIXED | FILL, optional) \u2014 Horizontal sizing in auto-layout parent
552
- layoutSizingVertical (FIXED | FILL, optional) \u2014 Vertical sizing in auto-layout parent
553
- annotations (array, optional) \u2014 Annotations \u2014 [{label?, labelMarkdown?, properties?, categoryId?}]
618
+ Example: frames(method:"create", type:"rectangle", items:[{name:"Avatar Placeholder", width:64, height:64, cornerRadius:"radius/16", fillVariableName:"bg/muted"}])
619
+ Item fields for items[] when type:"rectangle":
620
+ name (string, optional) \u2014 Layer name (default: 'Rectangle')
621
+ parentId (string, optional) \u2014 Parent node ID. Omit to place at current page root.
622
+ x (number, optional) \u2014 X position (default: 0)
623
+ y (number, optional) \u2014 Y position (default: 0)
624
+ width (number, optional) \u2014 Width in px (default: 100)
625
+ height (number, optional) \u2014 Height in px (default: 100)
626
+ fills (Paint[], optional) \u2014 Fill Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] for transparent. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables; use imageUrl/images for image authoring. IMAGE/VIDEO/PATTERN may appear in readback metadata only
627
+ fillColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)
628
+ fillStyleName (string, optional) \u2014 Paint style name for fill
629
+ fillVariableName (string, optional) \u2014 Color variable by name e.g. 'bg/surface'
630
+ imageUrl (string, optional) \u2014 Image source \u2014 'pexel:<id>', public URL, or local file path
631
+ imageScaleMode (FILL | FIT | CROP | TILE, optional) \u2014 How the image is scaled (default: FILL)
632
+ strokes (Paint[], optional) \u2014 Stroke Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] to clear. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables. IMAGE/VIDEO/PATTERN may appear in readback metadata only
633
+ strokeColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)
634
+ strokeVariableName (string, optional) \u2014 Color variable by name for stroke
635
+ strokeWeight (string, optional)
636
+ cornerRadius (string, optional) \u2014 All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.
637
+ topLeftRadius (string, optional)
638
+ topRightRadius (string, optional)
639
+ bottomRightRadius (string, optional)
640
+ bottomLeftRadius (string, optional)
641
+ opacity (string, optional)
642
+ layoutSizingHorizontal (FIXED | FILL, optional) \u2014 Horizontal sizing in auto-layout parent
643
+ layoutSizingVertical (FIXED | FILL, optional) \u2014 Vertical sizing in auto-layout parent
644
+ annotations (array, optional) \u2014 Annotations \u2014 [{label?, labelMarkdown?, properties?, categoryId?}]
554
645
 
555
646
  ## ellipse \u2014 Ellipse/circle shape node
556
- name (string, optional) \u2014 Layer name (default: 'Ellipse')
557
- parentId (string, optional) \u2014 Parent node ID. Omit to place at current page root.
558
- x (number, optional) \u2014 X position (default: 0)
559
- y (number, optional) \u2014 Y position (default: 0)
560
- width (number, optional) \u2014 Width in px (default: 100)
561
- height (number, optional) \u2014 Height in px (default: 100, same as width for circle)
562
- fills (array, optional) \u2014 Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent
563
- fillColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)
564
- fillStyleName (string, optional) \u2014 Paint style name for fill
565
- fillVariableName (string, optional) \u2014 Color variable by name e.g. 'bg/primary'
566
- imageUrl (string, optional) \u2014 Image source \u2014 'pexel:<id>', public URL, or local file path
567
- imageScaleMode (FILL | FIT | CROP | TILE, optional) \u2014 How the image is scaled (default: FILL)
568
- strokes (array, optional) \u2014 Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear
569
- strokeColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)
570
- strokeVariableName (string, optional) \u2014 Color variable by name for stroke
571
- strokeWeight (string, optional)
572
- opacity (string, optional)
573
- layoutSizingHorizontal (FIXED | FILL, optional) \u2014 Horizontal sizing in auto-layout parent
574
- layoutSizingVertical (FIXED | FILL, optional) \u2014 Vertical sizing in auto-layout parent
575
- annotations (array, optional) \u2014 Annotations \u2014 [{label?, labelMarkdown?, properties?, categoryId?}]
647
+ Example: frames(method:"create", type:"ellipse", items:[{name:"Status Dot", width:12, height:12, fillVariableName:"status/success"}])
648
+ Item fields for items[] when type:"ellipse":
649
+ name (string, optional) \u2014 Layer name (default: 'Ellipse')
650
+ parentId (string, optional) \u2014 Parent node ID. Omit to place at current page root.
651
+ x (number, optional) \u2014 X position (default: 0)
652
+ y (number, optional) \u2014 Y position (default: 0)
653
+ width (number, optional) \u2014 Width in px (default: 100)
654
+ height (number, optional) \u2014 Height in px (default: 100, same as width for circle)
655
+ fills (Paint[], optional) \u2014 Fill Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] for transparent. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables; use imageUrl/images for image authoring. IMAGE/VIDEO/PATTERN may appear in readback metadata only
656
+ fillColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)
657
+ fillStyleName (string, optional) \u2014 Paint style name for fill
658
+ fillVariableName (string, optional) \u2014 Color variable by name e.g. 'bg/surface'
659
+ imageUrl (string, optional) \u2014 Image source \u2014 'pexel:<id>', public URL, or local file path
660
+ imageScaleMode (FILL | FIT | CROP | TILE, optional) \u2014 How the image is scaled (default: FILL)
661
+ strokes (Paint[], optional) \u2014 Stroke Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] to clear. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables. IMAGE/VIDEO/PATTERN may appear in readback metadata only
662
+ strokeColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)
663
+ strokeVariableName (string, optional) \u2014 Color variable by name for stroke
664
+ strokeWeight (string, optional)
665
+ opacity (string, optional)
666
+ layoutSizingHorizontal (FIXED | FILL, optional) \u2014 Horizontal sizing in auto-layout parent
667
+ layoutSizingVertical (FIXED | FILL, optional) \u2014 Vertical sizing in auto-layout parent
668
+ annotations (array, optional) \u2014 Annotations \u2014 [{label?, labelMarkdown?, properties?, categoryId?}]
576
669
 
577
670
  ## line \u2014 Line shape node
578
- name (string, optional) \u2014 Layer name (default: 'Line')
579
- parentId (string, optional) \u2014 Parent node ID. Omit to place at current page root.
580
- x (number, optional) \u2014 X position (default: 0)
581
- y (number, optional) \u2014 Y position (default: 0)
582
- length (number, optional) \u2014 Line length in px (default: 100)
583
- rotation (number, optional) \u2014 Rotation in degrees (default: 0 = horizontal)
584
- strokes (array, optional) \u2014 Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear
585
- strokeColor (Color, optional) \u2014 Line color (default: black, auto-binds to matching variable/style)
586
- strokeVariableName (string, optional) \u2014 Color variable by name for stroke
587
- strokeWeight (string, optional) \u2014 Line thickness (default: 1)
588
- opacity (string, optional)
589
- layoutSizingHorizontal (FIXED | FILL, optional) \u2014 Horizontal sizing in auto-layout parent (defaults to FILL in vertical auto-layout)
590
- annotations (array, optional) \u2014 Annotations \u2014 [{label?, labelMarkdown?, properties?, categoryId?}]
671
+ Example: frames(method:"create", type:"line", items:[{name:"Divider", length:320, strokeVariableName:"border/subtle", strokeWeight:"stroke/1"}])
672
+ Item fields for items[] when type:"line":
673
+ name (string, optional) \u2014 Layer name (default: 'Line')
674
+ parentId (string, optional) \u2014 Parent node ID. Omit to place at current page root.
675
+ x (number, optional) \u2014 X position (default: 0)
676
+ y (number, optional) \u2014 Y position (default: 0)
677
+ length (number, optional) \u2014 Line length in px (default: 100)
678
+ rotation (number, optional) \u2014 Rotation in degrees (default: 0 = horizontal)
679
+ strokes (Paint[], optional) \u2014 Stroke Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] to clear. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables. IMAGE/VIDEO/PATTERN may appear in readback metadata only
680
+ strokeColor (Color, optional) \u2014 Line color (default: black, auto-binds to matching variable/style)
681
+ strokeVariableName (string, optional) \u2014 Color variable by name for stroke
682
+ strokeWeight (string, optional) \u2014 Line thickness (default: 1)
683
+ opacity (string, optional)
684
+ layoutSizingHorizontal (FIXED | FILL, optional) \u2014 Horizontal sizing in auto-layout parent (defaults to FILL in vertical auto-layout)
685
+ annotations (array, optional) \u2014 Annotations \u2014 [{label?, labelMarkdown?, properties?, categoryId?}]
591
686
 
592
687
  ## group \u2014 Group existing nodes together
593
- nodeIds (string[], required) \u2014 Node IDs to group (min 1)
594
- name (string, optional) \u2014 Group name
595
- parentId (string, optional) \u2014 Parent node ID. Omit to place at current page root.
688
+ Example: frames(method:"create", type:"group", items:[{nodeIds:["1:2","1:3"], name:"Icon Group"}])
689
+ Item fields for items[] when type:"group":
690
+ nodeIds (string[], required) \u2014 Node IDs to group (min 1)
691
+ name (string, optional) \u2014 Group name
692
+ parentId (string, optional) \u2014 Parent node ID. Omit to place at current page root.
596
693
 
597
694
  ## boolean_operation \u2014 Combine shapes with boolean operations (union, subtract, intersect, exclude)
598
- operation (UNION | SUBTRACT | INTERSECT | EXCLUDE, required) \u2014 Boolean operation type
599
- nodeIds (string[], required) \u2014 Node IDs to combine (min 2, first node is the base for SUBTRACT)
600
- name (string, optional) \u2014 Result node name
601
- parentId (string, optional) \u2014 Parent node ID. Omit to place at current page root.
695
+ Example: frames(method:"create", type:"boolean_operation", items:[{operation:"UNION", nodeIds:["1:2","1:3"], name:"Combined Shape", fillVariableName:"bg/accent"}])
696
+ Item fields for items[] when type:"boolean_operation":
697
+ fillStyleName (string, optional) \u2014 Paint style to apply to vector fills
698
+ fillVariableName (string, optional) \u2014 Color variable by name for vector fills
699
+ strokeStyleName (string, optional) \u2014 Paint style to apply to vector strokes
700
+ strokeVariableName (string, optional) \u2014 Color variable by name for vector strokes
701
+ operation (UNION | SUBTRACT | INTERSECT | EXCLUDE, required) \u2014 Boolean operation type
702
+ nodeIds (string[], required) \u2014 Node IDs to combine (min 2, first node is the base for SUBTRACT)
703
+ name (string, optional) \u2014 Result node name
704
+ parentId (string, optional) \u2014 Parent node ID. Omit to place at current page root.
602
705
 
603
706
  ## svg \u2014 Create node from SVG markup
604
- fillStyleName (string, optional) \u2014 Paint style to apply to vector fills
605
- fillVariableName (string, optional) \u2014 Color variable by name for vector fills
606
- strokeStyleName (string, optional) \u2014 Paint style to apply to vector strokes
607
- strokeVariableName (string, optional) \u2014 Color variable by name for vector strokes
608
- svg (string, required) \u2014 SVG markup string
609
- name (string, optional) \u2014 Layer name (default: 'SVG')
610
- parentId (string, optional) \u2014 Parent node ID. Omit to place at current page root.
611
- x (number, optional) \u2014 X position (default: 0)
612
- y (number, optional) \u2014 Y position (default: 0)
707
+ Example: frames(method:"create", type:"svg", items:[{name:"Logo Mark", svg:"<svg width=\\"24\\" height=\\"24\\"><path d=\\"M4 4h16v16H4z\\" fill=\\"currentColor\\"/></svg>", fillVariableName:"icon/primary"}])
708
+ Item fields for items[] when type:"svg":
709
+ fillStyleName (string, optional) \u2014 Paint style to apply to vector fills
710
+ fillVariableName (string, optional) \u2014 Color variable by name for vector fills
711
+ strokeStyleName (string, optional) \u2014 Paint style to apply to vector strokes
712
+ strokeVariableName (string, optional) \u2014 Color variable by name for vector strokes
713
+ svg (string, required) \u2014 SVG markup string
714
+ name (string, optional) \u2014 Layer name (default: 'SVG')
715
+ parentId (string, optional) \u2014 Parent node ID. Omit to place at current page root.
716
+ x (number, optional) \u2014 X position (default: 0)
717
+ y (number, optional) \u2014 Y position (default: 0)
613
718
 
614
719
  ## slot \u2014 Create a slot inside a component. Slots are placeholder containers that instance users fill with content. Defaults to VERTICAL auto-layout with FILL/HUG sizing \u2014 ready to receive children. Accepts all frame layout properties.
615
- name (string, optional) \u2014 Node name
616
- parentId (string, optional) \u2014 Parent node ID inside the owning component. Required unless componentId is provided.
617
- x (number, optional) \u2014 X position (default: 0)
618
- y (number, optional) \u2014 Y position (default: 0)
619
- width (number, optional) \u2014 Width in px (omit to shrink-to-content via HUG)
620
- height (number, optional) \u2014 Height in px (omit to shrink-to-content via HUG)
621
- rotation (number, optional) \u2014 Rotation in degrees (0-360)
622
- visible (boolean, optional) \u2014 Show/hide (default true)
623
- locked (boolean, optional) \u2014 Lock/unlock (default false)
624
- opacity (string, optional) \u2014 Opacity (0-1) or variable name
625
- 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)
626
- effectStyleName (string, optional) \u2014 Effect style name (e.g. 'Shadow/Card') for shadows, blurs
627
- fills (array, optional) \u2014 Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills.
628
- fillColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)
629
- fillStyleName (string, optional) \u2014 Paint style name for fill
630
- fillVariableName (string, optional) \u2014 Color variable by name e.g. 'bg/primary'
631
- imageUrl (string, optional) \u2014 Image source \u2014 'pexel:<id>' for Pexels photos, a public URL, or a local file path. SVGs are inserted as vectors; raster images become IMAGE fills.
632
- imageScaleMode (FILL | FIT | CROP | TILE, optional) \u2014 How the image is scaled within the frame (default: FILL)
633
- strokes (array, optional) \u2014 Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes.
634
- strokeColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)
635
- strokeStyleName (string, optional) \u2014 Paint style name for stroke
636
- strokeVariableName (string, optional) \u2014 Color variable by name for stroke
637
- strokeWeight (string, optional) \u2014 All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight.
638
- strokeTopWeight (string, optional)
639
- strokeBottomWeight (string, optional)
640
- strokeLeftWeight (string, optional)
641
- strokeRightWeight (string, optional)
642
- strokeAlign (INSIDE | OUTSIDE | CENTER, optional) \u2014 Stroke position (default: INSIDE)
643
- cornerRadius (string, optional) \u2014 All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.
644
- topLeftRadius (string, optional)
645
- topRightRadius (string, optional)
646
- bottomRightRadius (string, optional)
647
- bottomLeftRadius (string, optional)
648
- layoutMode (NONE | HORIZONTAL | VERTICAL, optional) \u2014 Layout direction (default: auto \u2014 NONE when width+height set, otherwise inferred from layout props)
649
- layoutWrap (NO_WRAP | WRAP, optional) \u2014 Wrap children to new rows (HORIZONTAL layout only \u2014 Figma does not support WRAP on VERTICAL layouts). Use column frames inside a HORIZONTAL parent for vertical grid patterns.
650
- padding (string, optional) \u2014 All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft.
651
- paddingTop (string, optional)
652
- paddingRight (string, optional)
653
- paddingBottom (string, optional)
654
- paddingLeft (string, optional)
655
- primaryAxisAlignItems (MIN | MAX | CENTER | SPACE_BETWEEN, optional)
656
- counterAxisAlignItems (MIN | MAX | CENTER | BASELINE, optional)
657
- itemSpacing (string, optional) \u2014 Spacing between children (number or variable name string, default: 0)
658
- counterAxisSpacing (string, optional) \u2014 Gap between wrapped rows (requires layoutWrap: WRAP)
659
- strokesIncludedInLayout (boolean, optional) \u2014 Include stroke width in layout measurements (default: false)
660
- overflowDirection (NONE | HORIZONTAL | VERTICAL | BOTH, optional) \u2014 Scroll overflow in prototype (default: NONE)
661
- layoutPositioning (AUTO | ABSOLUTE, optional) \u2014 ABSOLUTE = floating inside auto-layout parent
662
- layoutSizingHorizontal (FIXED | HUG | FILL, optional)
663
- layoutSizingVertical (FIXED | HUG | FILL, optional)
664
- minWidth (number, optional) \u2014 Min width for responsive auto-layout
665
- maxWidth (number, optional) \u2014 Max width for responsive auto-layout
666
- minHeight (number, optional) \u2014 Min height for responsive auto-layout
667
- maxHeight (number, optional) \u2014 Max height for responsive auto-layout
668
- annotations (array, optional) \u2014 Set annotations \u2014 [{label?, labelMarkdown?, properties?, categoryId?}]. Properties validated per node type.
669
- componentId (string, optional) \u2014 Owning component ID. Optional \u2014 auto-resolved from parentId by walking up ancestors.`,
670
- "commit": '# frames.commit\nCommit a staged node \u2014 unwraps from [STAGED] container into the original target location.\n\nExample: frames(method:"commit", id:"1:234")\n\nParams:\n id (string, required) \u2014 Staged node ID to commit',
671
- "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)"
720
+ Example: frames(method:"create", type:"slot", items:[{componentId:"1:23", name:"Content Slot", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG"}])
721
+ Item fields for items[] when type:"slot":
722
+ name (string, optional) \u2014 Node name
723
+ parentId (string, optional) \u2014 Parent node ID inside the owning component. Required unless componentId is provided.
724
+ x (number, optional) \u2014 X position (default: 0)
725
+ y (number, optional) \u2014 Y position (default: 0)
726
+ width (number, optional) \u2014 Width in px (omit to shrink-to-content via HUG)
727
+ height (number, optional) \u2014 Height in px (omit to shrink-to-content via HUG)
728
+ rotation (number, optional) \u2014 Rotation in degrees (0-360)
729
+ visible (boolean, optional) \u2014 Show/hide (default true)
730
+ locked (boolean, optional) \u2014 Lock/unlock (default false)
731
+ opacity (string, optional) \u2014 Opacity (0-1) or variable name
732
+ 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)
733
+ effectStyleName (string, optional) \u2014 Effect style name (e.g. 'Shadow/Card') for shadows, blurs
734
+ fills (Paint[], optional) \u2014 Fill Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] for transparent. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables; use imageUrl/images for image authoring. IMAGE/VIDEO/PATTERN may appear in readback metadata only. Primary way to set non-image fills.
735
+ fillColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)
736
+ fillStyleName (string, optional) \u2014 Paint style name for fill
737
+ fillVariableName (string, optional) \u2014 Color variable by name e.g. 'bg/surface'
738
+ imageUrl (string, optional) \u2014 Image source \u2014 'pexel:<id>' for Pexels photos, a public URL, or a local file path. SVGs are inserted as vectors; raster images become IMAGE fills.
739
+ imageScaleMode (FILL | FIT | CROP | TILE, optional) \u2014 How the image is scaled within the frame (default: FILL)
740
+ strokes (Paint[], optional) \u2014 Stroke Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] to clear. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables. IMAGE/VIDEO/PATTERN may appear in readback metadata only. Primary way to set strokes.
741
+ strokeColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)
742
+ strokeStyleName (string, optional) \u2014 Paint style name for stroke
743
+ strokeVariableName (string, optional) \u2014 Color variable by name for stroke
744
+ strokeWeight (string, optional) \u2014 All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight.
745
+ strokeTopWeight (string, optional)
746
+ strokeBottomWeight (string, optional)
747
+ strokeLeftWeight (string, optional)
748
+ strokeRightWeight (string, optional)
749
+ strokeAlign (INSIDE | OUTSIDE | CENTER, optional) \u2014 Stroke position (default: INSIDE)
750
+ cornerRadius (string, optional) \u2014 All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.
751
+ topLeftRadius (string, optional)
752
+ topRightRadius (string, optional)
753
+ bottomRightRadius (string, optional)
754
+ bottomLeftRadius (string, optional)
755
+ layoutMode (NONE | HORIZONTAL | VERTICAL, optional) \u2014 Layout direction (default: auto \u2014 NONE when width+height set, otherwise inferred from layout props)
756
+ layoutWrap (NO_WRAP | WRAP, optional) \u2014 Wrap children to new rows (HORIZONTAL layout only \u2014 Figma does not support WRAP on VERTICAL layouts). Use column frames inside a HORIZONTAL parent for vertical grid patterns.
757
+ padding (string, optional) \u2014 All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft.
758
+ paddingTop (string, optional)
759
+ paddingRight (string, optional)
760
+ paddingBottom (string, optional)
761
+ paddingLeft (string, optional)
762
+ primaryAxisAlignItems (MIN | MAX | CENTER | SPACE_BETWEEN, optional)
763
+ counterAxisAlignItems (MIN | MAX | CENTER | BASELINE, optional)
764
+ itemSpacing (string, optional) \u2014 Spacing between children (number or variable name string, default: 0)
765
+ counterAxisSpacing (string, optional) \u2014 Gap between wrapped rows (requires layoutWrap: WRAP)
766
+ strokesIncludedInLayout (boolean, optional) \u2014 Include stroke width in layout measurements (default: false)
767
+ overflowDirection (NONE | HORIZONTAL | VERTICAL | BOTH, optional) \u2014 Scroll overflow in prototype (default: NONE)
768
+ layoutPositioning (AUTO | ABSOLUTE, optional) \u2014 ABSOLUTE = floating inside auto-layout parent
769
+ layoutSizingHorizontal (FIXED | HUG | FILL, optional)
770
+ layoutSizingVertical (FIXED | HUG | FILL, optional)
771
+ minWidth (number, optional) \u2014 Min width for responsive auto-layout
772
+ maxWidth (number, optional) \u2014 Max width for responsive auto-layout
773
+ minHeight (number, optional) \u2014 Min height for responsive auto-layout
774
+ maxHeight (number, optional) \u2014 Max height for responsive auto-layout
775
+ annotations (array, optional) \u2014 Set annotations \u2014 [{label?, labelMarkdown?, properties?, categoryId?}]. Properties validated per node type.
776
+ componentId (string, optional) \u2014 Owning component ID. Optional \u2014 auto-resolved from parentId by walking up ancestors.
777
+
778
+ Response:
779
+ { results: ({id} | {error})[] }
780
+ // Shared types:
781
+ // Color: hex "#RGB"|"#RGBA"|"#RRGGBB"|"#RRGGBBAA" or {r: 0-1, g: 0-1, b: 0-1, a?: 0-1}
782
+ // VariableAlias: {type: "VARIABLE_ALIAS", id: string}. The id must be a Figma VariableID; discover it via variables.get/list or variable_collections.get. Prefer colorVariableName/fillVariableName/strokeVariableName when available; Paint[] VariableAlias is mainly for precise Paint[] round-trips and gradient stop bindings.
783
+ // Transform: [[number, number, number], [number, number, number]] (Figma Plugin API 2\xD73 matrix)
784
+ // 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"
785
+ // ColorStop: {position: 0-1, color: Color, boundVariables?: {color?: VariableAlias}}
786
+ // GradientPaint: {type: "GRADIENT_LINEAR"|"GRADIENT_RADIAL"|"GRADIENT_ANGULAR"|"GRADIENT_DIAMOND", gradientTransform: Transform, gradientStops: ColorStop[], visible?: boolean, opacity?: number, blendMode?: BlendMode}. Use gradientTransform + gradientStops (basic left-to-right: [[1,0,0],[0,1,0]]); do not use CSS gradients or REST gradientHandlePositions.
787
+ // Effect: {type: "DROP_SHADOW"|"INNER_SHADOW"|"LAYER_BLUR"|"BACKGROUND_BLUR", radius: number, color?: {r,g,b,a} (0-1), offset?: {x, y}, spread?: number, visible?: boolean}
788
+ // Paint: Paint[] authoring accepts only SOLID and GRADIENT_LINEAR/GRADIENT_RADIAL/GRADIENT_ANGULAR/GRADIENT_DIAMOND. SolidPaint: {type: "SOLID", color: Color, visible?: boolean, opacity?: number, blendMode?: BlendMode, boundVariables?: {color?: VariableAlias}}. GradientPaint authoring: {type: GRADIENT_*, gradientTransform: Transform, gradientStops: ColorStop[], visible?, opacity?, blendMode?}; bind variables on gradientStops[].boundVariables.color, not top-level gradient boundVariables. Do not pass IMAGE/VIDEO/PATTERN to create/update Paint[]; those may appear only in readback metadata from existing Figma content. Use imageUrl/images for image authoring. VIDEO/PATTERN authoring is not supported here. Do not use CSS gradients or REST gradientHandlePositions.`,
789
+ "commit": '# frames.commit\nCommit a staged node \u2014 unwraps from [STAGED] container into the original target location.\n\nExample: frames(method:"commit", id:"1:234")\n\nParams:\n id (string, required) \u2014 Staged node ID to commit\n\nResponse:\n { results: ({id} | {error})[] }',
790
+ "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)\n\nResponse:\n Binary image data returned as MCP image content (SVG_STRING returns text)\n imageData (string, optional)\n mimeType (string, optional)"
672
791
  }
673
792
  },
674
793
  "icons": {
675
794
  "summary": '# icons\nSearch and create icons from 200k+ open-source icons via Iconify.\n\nMethods:\n search Search icons by keyword across all Iconify sets [read]\n collections List available Iconify icon sets [read]\n create Create an icon node in Figma from an Iconify icon name [create]\n\n// Icons are fetched from the Iconify API (iconify.design) and inserted as SVG vector nodes.\n// Icon names use "prefix:name" format. Common sets: lucide, mdi, tabler, heroicons, ph.\n// Examples: "lucide:home", "mdi:account-circle", "tabler:arrow-right", "ph:gear-bold"\n// Use search to discover icons by keyword. Use collections to list available icon sets.\n// create fetches the SVG and inserts it via frames.create \u2014 auto-detects fill vs stroke icons.\n// Use colorVariableName (not fillVariableName/strokeVariableName) \u2014 the handler applies to whichever channel has paint.\n// Fetched icons are cached in memory for the session (same icon+size is fetched once).\n// Powered by Iconify (iconify.design) \u2014 open-source icon framework.\n\nUse icons(method: "help", topic: "<method>") for method details.',
676
795
  "methods": {
677
- "search": '# icons.search\nSearch icons by keyword across all Iconify sets\n\nExample: icons(method:"search", query:"arrow right", prefix:"lucide")\n\nParams:\n query (string, required) \u2014 Search keyword (e.g. "home", "arrow", "user")\n prefix (string, optional) \u2014 Restrict to one icon set (e.g. "lucide", "mdi")\n limit (number, optional) \u2014 Max results (default 64)',
678
- "collections": '# icons.collections\nList available Iconify icon sets\n\nExample: icons(method:"collections", category:"UI 24px", limit:10)\n\nParams:\n query (string, optional) \u2014 Filter by name or prefix (e.g. "lucide", "material")\n category (string, optional) \u2014 Filter by category (e.g. "UI 24px", "Logos", "Emoji")\n limit (number, optional) \u2014 Max results (default: all)',
796
+ "search": '# icons.search\nSearch icons by keyword across all Iconify sets\n\nExample: icons(method:"search", query:"arrow right", prefix:"lucide")\n\nParams:\n query (string, required) \u2014 Search keyword (e.g. "home", "arrow", "user")\n prefix (string, optional) \u2014 Restrict to one icon set (e.g. "lucide", "mdi")\n limit (number, optional) \u2014 Max results (default 64)\n\nResponse:\n icons (string[], optional) \u2014 Icon names (e.g. ["lucide:home", "mdi:home"])\n total (number, optional) \u2014 Total matching icons',
797
+ "collections": '# icons.collections\nList available Iconify icon sets\n\nExample: icons(method:"collections", category:"UI 24px", limit:10)\n\nParams:\n query (string, optional) \u2014 Filter by name or prefix (e.g. "lucide", "material")\n category (string, optional) \u2014 Filter by category (e.g. "UI 24px", "Logos", "Emoji")\n limit (number, optional) \u2014 Max results (default: all)\n\nResponse:\n Array of icon set metadata\n collections (array, optional) \u2014 [{ prefix, name, total, category, license }]\n total (number, optional) \u2014 Total matching collections (before limit)',
679
798
  "create": `# icons.create
680
799
  Create an icon node in Figma from an Iconify icon name
681
800
 
@@ -689,7 +808,18 @@ Params:
689
808
  x (number, optional) \u2014 X position (default: 0)
690
809
  y (number, optional) \u2014 Y position (default: 0)
691
810
  colorVariableName (string, optional) \u2014 Color variable for the icon \u2014 auto-detects fill vs stroke (e.g. 'text/primary')
692
- colorStyleName (string, optional) \u2014 Paint style for the icon \u2014 auto-detects fill vs stroke (e.g. 'Icon/Primary')`
811
+ colorStyleName (string, optional) \u2014 Paint style for the icon \u2014 auto-detects fill vs stroke (e.g. 'Icon/Primary')
812
+
813
+ Response:
814
+ { results: ({id} | {error})[] }
815
+ // Shared types:
816
+ // Color: hex "#RGB"|"#RGBA"|"#RRGGBB"|"#RRGGBBAA" or {r: 0-1, g: 0-1, b: 0-1, a?: 0-1}
817
+ // VariableAlias: {type: "VARIABLE_ALIAS", id: string}. The id must be a Figma VariableID; discover it via variables.get/list or variable_collections.get. Prefer colorVariableName/fillVariableName/strokeVariableName when available; Paint[] VariableAlias is mainly for precise Paint[] round-trips and gradient stop bindings.
818
+ // Transform: [[number, number, number], [number, number, number]] (Figma Plugin API 2\xD73 matrix)
819
+ // 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"
820
+ // ColorStop: {position: 0-1, color: Color, boundVariables?: {color?: VariableAlias}}
821
+ // GradientPaint: {type: "GRADIENT_LINEAR"|"GRADIENT_RADIAL"|"GRADIENT_ANGULAR"|"GRADIENT_DIAMOND", gradientTransform: Transform, gradientStops: ColorStop[], visible?: boolean, opacity?: number, blendMode?: BlendMode}. Use gradientTransform + gradientStops (basic left-to-right: [[1,0,0],[0,1,0]]); do not use CSS gradients or REST gradientHandlePositions.
822
+ // Paint: Paint[] authoring accepts only SOLID and GRADIENT_LINEAR/GRADIENT_RADIAL/GRADIENT_ANGULAR/GRADIENT_DIAMOND. SolidPaint: {type: "SOLID", color: Color, visible?: boolean, opacity?: number, blendMode?: BlendMode, boundVariables?: {color?: VariableAlias}}. GradientPaint authoring: {type: GRADIENT_*, gradientTransform: Transform, gradientStops: ColorStop[], visible?, opacity?, blendMode?}; bind variables on gradientStops[].boundVariables.color, not top-level gradient boundVariables. Do not pass IMAGE/VIDEO/PATTERN to create/update Paint[]; those may appear only in readback metadata from existing Figma content. Use imageUrl/images for image authoring. VIDEO/PATTERN authoring is not supported here. Do not use CSS gradients or REST gradientHandlePositions.`
693
823
  }
694
824
  },
695
825
  "images": {
@@ -707,16 +837,36 @@ Params:
707
837
  color (string, optional) \u2014 Filter by color \u2014 hex (e.g. '#FF0000') or named: red, orange, yellow, green, turquoise, blue, violet, pink, brown, black, gray, white
708
838
  locale (string, optional) \u2014 Locale for search (e.g. 'en-US', 'ja-JP'). Default: en-US
709
839
  page (number, optional) \u2014 Page number for pagination (default: 1)
710
- per_page (number, optional) \u2014 Results per page (default: 15, max: 80)`,
711
- "preview": '# images.preview\nPreview a photo by ID \u2014 returns the image so you can see it before placing\n\nExample: images(method:"preview", id:12345)\n\nParams:\n id (number, required) \u2014 Photo ID from search results\n size (small | medium | large, optional) \u2014 Preview size (default: medium). small\u2248130px, medium\u2248350px, large\u2248940px height'
840
+ per_page (number, optional) \u2014 Results per page (default: 15, max: 80)
841
+
842
+ Response:
843
+ photos (array, optional) \u2014 [{ id, alt, avg_color, width, height }]
844
+ total_results (number, optional) \u2014 Total matching photos
845
+ page (number, optional)
846
+ per_page (number, optional)`,
847
+ "preview": '# images.preview\nPreview a photo by ID \u2014 returns the image so you can see it before placing\n\nExample: images(method:"preview", id:12345)\n\nParams:\n id (number, required) \u2014 Photo ID from search results\n size (small | medium | large, optional) \u2014 Preview size (default: medium). small\u2248130px, medium\u2248350px, large\u2248940px height\n\nResponse:\n The photo as a visual image preview\n image'
712
848
  }
713
849
  },
714
850
  "instances": {
715
- "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 \u2014 produces a same-type copy (frame\u2192frame, instance\u2192instance, component\u2192component). Instance clones reference the same source component; they do not duplicate the component definition. [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 (local components): components.list \u2192 instances.create with componentId + properties (one call).\n// Workflow (external/published libraries): library(method:"components", query:"...") \u2192 instances.create with componentName + properties. The MCP resolves componentName \u2192 key and imports via figma.importComponentByKeyAsync \u2014 the raw key never enters agent context.\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.',
851
+ "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 \u2014 produces a same-type copy (frame\u2192frame, instance\u2192instance, component\u2192component). Instance clones reference the same source component; they do not duplicate the component definition. [create]\n scale Proportionally rescale a node subtree using Figma\'s visual Scale tool behavior. This is for visual/artifact scaling, not responsive layout resizing. [edit]\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// clipsContent: clip children to the node bounds where supported (frames/components/instances). Set false for overflow-visible layouts.\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[]; // readback Paint[]; authoring supports SOLID + gradients via gradientTransform + gradientStops\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. Paint[] authoring supports SOLID + gradients only; IMAGE/VIDEO/PATTERN are readback-only metadata.\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 (local components): components.list \u2192 instances.create with componentId + properties (one call).\n// Workflow (external/published libraries): library(method:"components", query:"...") \u2192 instances.create with componentName + properties. The MCP resolves componentName \u2192 key and imports via figma.importComponentByKeyAsync \u2014 the raw key never enters agent context.\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.\n// Shared types:\n// Color: hex "#RGB"|"#RGBA"|"#RRGGBB"|"#RRGGBBAA" or {r: 0-1, g: 0-1, b: 0-1, a?: 0-1}\n// VariableAlias: {type: "VARIABLE_ALIAS", id: string}. The id must be a Figma VariableID; discover it via variables.get/list or variable_collections.get. Prefer colorVariableName/fillVariableName/strokeVariableName when available; Paint[] VariableAlias is mainly for precise Paint[] round-trips and gradient stop bindings.\n// Transform: [[number, number, number], [number, number, number]] (Figma Plugin API 2\xD73 matrix)\n// 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"\n// ColorStop: {position: 0-1, color: Color, boundVariables?: {color?: VariableAlias}}\n// GradientPaint: {type: "GRADIENT_LINEAR"|"GRADIENT_RADIAL"|"GRADIENT_ANGULAR"|"GRADIENT_DIAMOND", gradientTransform: Transform, gradientStops: ColorStop[], visible?: boolean, opacity?: number, blendMode?: BlendMode}. Use gradientTransform + gradientStops (basic left-to-right: [[1,0,0],[0,1,0]]); do not use CSS gradients or REST gradientHandlePositions.\n// Effect: {type: "DROP_SHADOW"|"INNER_SHADOW"|"LAYER_BLUR"|"BACKGROUND_BLUR", radius: number, color?: {r,g,b,a} (0-1), offset?: {x, y}, spread?: number, visible?: boolean}\n// Paint: Paint[] authoring accepts only SOLID and GRADIENT_LINEAR/GRADIENT_RADIAL/GRADIENT_ANGULAR/GRADIENT_DIAMOND. SolidPaint: {type: "SOLID", color: Color, visible?: boolean, opacity?: number, blendMode?: BlendMode, boundVariables?: {color?: VariableAlias}}. GradientPaint authoring: {type: GRADIENT_*, gradientTransform: Transform, gradientStops: ColorStop[], visible?, opacity?, blendMode?}; bind variables on gradientStops[].boundVariables.color, not top-level gradient boundVariables. Do not pass IMAGE/VIDEO/PATTERN to create/update Paint[]; those may appear only in readback metadata from existing Figma content. Use imageUrl/images for image authoring. VIDEO/PATTERN authoring is not supported here. Do not use CSS gradients or REST gradientHandlePositions.\n// NodeStub: {id: string, name: string, type: string}',
716
852
  "methods": {
717
- "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)',
718
- "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)",
719
- "clone": "# instances.clone\nDuplicate nodes \u2014 produces a same-type copy (frame\u2192frame, instance\u2192instance, component\u2192component). Instance clones reference the same source component; they do not duplicate the component definition.\n\nParams:\n id (string, optional) \u2014 Node ID\n name (string, optional) \u2014 Rename the clone (set before appending to parent \u2014 required when cloning a variant into its component set to avoid duplicate names)\n parentId (string, optional) \u2014 Parent node ID. Omit to place at current page root.\n x (number, optional) \u2014 X position (default: 0)\n y (number, optional) \u2014 Y position (default: 0)\n items (array, optional) \u2014 Batch: [{id, name?, parentId?, x?, y?}, ...]. Alternative to single-item params.\n id (string, required) \u2014 Node ID to clone\n name (string, optional) \u2014 Rename the clone\n parentId (string, optional) \u2014 Target parent\n x (number, optional)\n y (number, optional)\n depth (number, optional) \u2014 Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.",
853
+ "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)\n\nResponse:\n Paginated node search results (uses `results` not `items`)\n totalCount (number, required) \u2014 Total matching nodes\n returned (number, required) \u2014 Nodes in this page\n offset (number, optional)\n limit (number, optional)\n results (array, required) \u2014 Matching node stubs\n id (string, required)\n name (string, required)\n type (string, required)\n parentId (string, required)\n parentName (string, optional)\n bounds (object, optional)',
854
+ "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)\n\nResponse:\n { results: ("ok" | {error})[] }',
855
+ "clone": "# instances.clone\nDuplicate nodes \u2014 produces a same-type copy (frame\u2192frame, instance\u2192instance, component\u2192component). Instance clones reference the same source component; they do not duplicate the component definition.\n\nParams:\n id (string, optional) \u2014 Node ID\n name (string, optional) \u2014 Rename the clone (set before appending to parent \u2014 required when cloning a variant into its component set to avoid duplicate names)\n parentId (string, optional) \u2014 Parent node ID. Omit to place at current page root.\n x (number, optional) \u2014 X position (default: 0)\n y (number, optional) \u2014 Y position (default: 0)\n items (array, optional) \u2014 Batch: [{id, name?, parentId?, x?, y?}, ...]. Alternative to single-item params.\n id (string, required) \u2014 Node ID to clone\n name (string, optional) \u2014 Rename the clone\n parentId (string, optional) \u2014 Target parent\n x (number, optional)\n y (number, optional)\n depth (number, optional) \u2014 Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.\n\nResponse:\n { results: ({id} | {error})[] }",
856
+ "scale": `# instances.scale
857
+ Proportionally rescale a node subtree using Figma's visual Scale tool behavior. This is for visual/artifact scaling, not responsive layout resizing.
858
+
859
+ Example: instances(method:"scale", id:"1:23", factor:0.5)
860
+
861
+ Params:
862
+ id (string, optional) \u2014 Node ID to scale
863
+ factor (number, optional) \u2014 Scale factor, >= 0.01. 0.5 = 50%, 2 = 200%. Scales children, text, strokes, effects, and layout geometry from the node's top-left. On auto-layout or HUG/FILL nodes, Figma may resolve responsive sizing to fixed width/height.
864
+ items (array, optional) \u2014 Batch: [{id, factor}, ...]. Alternative to single-item params.
865
+ id (string, required) \u2014 Node ID to scale
866
+ factor (number, required) \u2014 Scale factor, >= 0.01. 0.5 = 50%, 2 = 200%.
867
+
868
+ Response:
869
+ { results: ("ok" | {error})[] }`,
720
870
  "audit": `# instances.audit
721
871
  Run lint on a node \u2014 returns severity-ranked findings
722
872
 
@@ -726,13 +876,18 @@ Params:
726
876
  maxDepth (number, optional) \u2014 Max tree depth (default: 10)
727
877
  maxFindings (number, optional) \u2014 Max findings (default: 50)
728
878
  minSeverity (error | unsafe | heuristic | style | verbose, optional) \u2014 Minimum severity to report (default: style). Set to 'verbose' to include AAA contrast and line-height checks.
729
- skipInstances (boolean, optional) \u2014 Skip instance internals \u2014 findings inside instances are owned by the component (default: true)`,
730
- "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)",
731
- "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.',
879
+ skipInstances (boolean, optional) \u2014 Skip instance internals \u2014 findings inside instances are owned by the component (default: true)
880
+
881
+ Response:
882
+ nodeId (string, optional)
883
+ nodeName (string, optional)
884
+ categories (array, optional) \u2014 Sorted by severity (error > unsafe > heuristic > style)`,
885
+ "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)\n\nResponse:\n { results: ("ok" | {error})[] }',
886
+ "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.\n\nResponse:\n results (array, required) \u2014 Serialized node(s) with componentProperties, overrides\n _truncated (boolean, optional)',
732
887
  "create": `# instances.create
733
888
  Create component instances
734
889
 
735
- Example: instances(method:"create", items:[{componentName:"Button", variantProperties:{"Size":"Large"}, properties:{"Label":"Click me"}, parentId:"2:45", layoutSizingHorizontal:"FILL"}]) // or componentId:"1:23" for a local component
890
+ Example: instances(method:"create", items:[{componentId:"1:23", variantProperties:{"Style":"Primary"}, properties:{"Button":"Click me"}, x:320, y:0}])
736
891
 
737
892
  Params:
738
893
  items (InstanceCreateItem[], required) \u2014 Array of {componentId, variantProperties?, x?, y?, parentId?, layoutSizingHorizontal?, ...}
@@ -761,19 +916,25 @@ Params:
761
916
  height (number, optional) \u2014 Override height (resize)
762
917
  explicitMode (object, optional) \u2014 Pin variable mode at creation \u2014 use { collectionName, modeName } (preferred) or { collectionId, modeId }. Useful for library components with Light/Dark modes.
763
918
  parentId (string, optional) \u2014 Parent node ID. Omit to place at current page root.
764
- depth (number, optional) \u2014 Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.`,
919
+ depth (number, optional) \u2014 Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.
920
+
921
+ Response:
922
+ { results: ({id} | {error})[] }
923
+ // Shared types:
924
+ // Color: hex "#RGB"|"#RGBA"|"#RRGGBB"|"#RRGGBBAA" or {r: 0-1, g: 0-1, b: 0-1, a?: 0-1}
925
+ // Effect: {type: "DROP_SHADOW"|"INNER_SHADOW"|"LAYER_BLUR"|"BACKGROUND_BLUR", radius: number, color?: {r,g,b,a} (0-1), offset?: {x, y}, spread?: number, visible?: boolean}`,
765
926
  "update": `# instances.update
766
927
  Set instance properties
767
928
 
768
- Example: instances(method:"update", items:[{id:"1:23", properties:{"Label#4:0":"Submit"}, fillColor:"#3B82F6", layoutSizingHorizontal:"FILL"}])
929
+ Example: instances(method:"update", items:[{id:"1:23", properties:{"Button#4:0":"Submit"}, fillVariableName:"bg/accent"}])
769
930
 
770
931
  Params:
771
- items (InstanceUpdateItem[], required) \u2014 Array of {id, properties: {"Label#1:0":"text"}, fillColor?: ...}
772
- fills (array, optional) \u2014 Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills.
932
+ items (InstanceUpdateItem[], required) \u2014 Array of {id, properties: {"Property#1:0":"text"}, fillVariableName?: ...}. Use components.get on the source component to discover exact property keys.
933
+ fills (Paint[], optional) \u2014 Fill Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] for transparent. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables; use imageUrl/images for image authoring. IMAGE/VIDEO/PATTERN may appear in readback metadata only. Primary way to set non-image fills.
773
934
  fillColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)
774
935
  fillStyleName (string, optional) \u2014 Paint style name for fill
775
- fillVariableName (string, optional) \u2014 Color variable by name e.g. 'bg/primary'
776
- strokes (array, optional) \u2014 Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes.
936
+ fillVariableName (string, optional) \u2014 Color variable by name e.g. 'bg/surface'
937
+ strokes (Paint[], optional) \u2014 Stroke Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] to clear. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables. IMAGE/VIDEO/PATTERN may appear in readback metadata only. Primary way to set strokes.
777
938
  strokeColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)
778
939
  strokeStyleName (string, optional) \u2014 Paint style name for stroke
779
940
  strokeVariableName (string, optional) \u2014 Color variable by name for stroke
@@ -845,10 +1006,22 @@ Params:
845
1006
  variableName (string, optional)
846
1007
  variableId (string, optional)
847
1008
  explicitMode (object, optional) \u2014 Pin variable mode \u2014 use { collectionName, modeName } (preferred) or { collectionId, modeId }
848
- exportSettings (array, optional) \u2014 Export settings`,
849
- "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",
850
- "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",
851
- "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"
1009
+ exportSettings (array, optional) \u2014 Export settings
1010
+
1011
+ Response:
1012
+ { results: ("ok" | {error} | object)[] }
1013
+ // Shared types:
1014
+ // Color: hex "#RGB"|"#RGBA"|"#RRGGBB"|"#RRGGBBAA" or {r: 0-1, g: 0-1, b: 0-1, a?: 0-1}
1015
+ // VariableAlias: {type: "VARIABLE_ALIAS", id: string}. The id must be a Figma VariableID; discover it via variables.get/list or variable_collections.get. Prefer colorVariableName/fillVariableName/strokeVariableName when available; Paint[] VariableAlias is mainly for precise Paint[] round-trips and gradient stop bindings.
1016
+ // Transform: [[number, number, number], [number, number, number]] (Figma Plugin API 2\xD73 matrix)
1017
+ // 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"
1018
+ // ColorStop: {position: 0-1, color: Color, boundVariables?: {color?: VariableAlias}}
1019
+ // GradientPaint: {type: "GRADIENT_LINEAR"|"GRADIENT_RADIAL"|"GRADIENT_ANGULAR"|"GRADIENT_DIAMOND", gradientTransform: Transform, gradientStops: ColorStop[], visible?: boolean, opacity?: number, blendMode?: BlendMode}. Use gradientTransform + gradientStops (basic left-to-right: [[1,0,0],[0,1,0]]); do not use CSS gradients or REST gradientHandlePositions.
1020
+ // Effect: {type: "DROP_SHADOW"|"INNER_SHADOW"|"LAYER_BLUR"|"BACKGROUND_BLUR", radius: number, color?: {r,g,b,a} (0-1), offset?: {x, y}, spread?: number, visible?: boolean}
1021
+ // Paint: Paint[] authoring accepts only SOLID and GRADIENT_LINEAR/GRADIENT_RADIAL/GRADIENT_ANGULAR/GRADIENT_DIAMOND. SolidPaint: {type: "SOLID", color: Color, visible?: boolean, opacity?: number, blendMode?: BlendMode, boundVariables?: {color?: VariableAlias}}. GradientPaint authoring: {type: GRADIENT_*, gradientTransform: Transform, gradientStops: ColorStop[], visible?, opacity?, blendMode?}; bind variables on gradientStops[].boundVariables.color, not top-level gradient boundVariables. Do not pass IMAGE/VIDEO/PATTERN to create/update Paint[]; those may appear only in readback metadata from existing Figma content. Use imageUrl/images for image authoring. VIDEO/PATTERN authoring is not supported here. Do not use CSS gradients or REST gradientHandlePositions.`,
1022
+ "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\n\nResponse:\n { results: ("ok" | {error} | object)[] }',
1023
+ "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\n\nResponse:\n { results: ({id} | {error})[] }",
1024
+ "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\n\nResponse:\n { results: ("ok" | {error} | object)[] }'
852
1025
  }
853
1026
  },
854
1027
  "library": {
@@ -898,7 +1071,16 @@ Example: library(method:"list") // uses FIGMA_TEAM_ID env var; or pass file/tea
898
1071
 
899
1072
  Params:
900
1073
  file (string, optional) \u2014 File URL or file key \u2014 e.g. 'https://www.figma.com/design/abc123/MyDS' or 'abc123'
901
- team (string, optional) \u2014 Team URL or team ID. Falls back to FIGMA_TEAM_ID env var if omitted.`,
1074
+ team (string, optional) \u2014 Team URL or team ID. Falls back to FIGMA_TEAM_ID env var if omitted.
1075
+
1076
+ Response:
1077
+ libraries (array, optional) \u2014 Components, sets, and styles grouped by source Figma file (library) and then by section \u2014 the same hierarchy designers see in Figma's Libraries browser. Use the library name to pick the intended kit when multiple libraries expose overlapping names (e.g. two files both defining 'Item' or 'Header'), and use section names to locate components semantically (e.g. the 'Sidebars' section contains the proper sidebar Item and Section Header, distinct from a List 'Item' row).
1078
+ name (string, optional) \u2014 Display name of the source Figma file.
1079
+ sections (array, optional) \u2014 Sections within the library, mirroring the headings designers see in Figma's Libraries panel. Usually correspond to containing frames or pages in the source file.
1080
+ name (string, optional) \u2014 Section heading \u2014 e.g. 'Sidebars', 'Windows', 'Buttons'. '(unsectioned)' when the source component is not inside a named frame.
1081
+ components (array, optional) \u2014 Non-variant component names in this section. Reference by name in instances.create via componentName.
1082
+ componentSets (array, optional) \u2014 Variant set names in this section. Use with variantProperties in instances.create.
1083
+ styles (object, optional) \u2014 Published styles in this section, grouped by type.`,
902
1084
  "get": `# library.get
903
1085
  Get rich details for components matching one or more queries. Returns nested libraries \u2192 sections \u2192 entries (same hierarchy as list) with properties, variant options, defaults, and a copy-pasteable usage hint at each leaf.
904
1086
 
@@ -909,7 +1091,16 @@ Params:
909
1091
  library (string, optional) \u2014 Optional source library (Figma file) name filter \u2014 case-insensitive substring. Use when multiple imported libraries expose overlapping component names (e.g. two files both defining 'Item'). Match the name returned under list \u2192 libraries[].name.
910
1092
  section (string, optional) \u2014 Optional section name filter \u2014 case-insensitive substring. Matches the containing frame / section headers returned under list \u2192 libraries[].sections[].name (e.g. 'Sidebars', 'Windows', 'List'). Combine with library for maximum precision.
911
1093
  file (string, optional) \u2014 Only used if the registry is empty \u2014 convenience to run list+get in one step.
912
- team (string, optional) \u2014 Only used if the registry is empty \u2014 convenience to run list+get in one step.`
1094
+ team (string, optional) \u2014 Only used if the registry is empty \u2014 convenience to run list+get in one step.
1095
+
1096
+ Response:
1097
+ libraries (array, optional) \u2014 Matching entries nested by source library and section \u2014 same hierarchy as list, but each leaf is a full detail object (properties, variant options, defaults, usage hint) instead of a bare name.
1098
+ name (string, optional) \u2014 Source Figma file name.
1099
+ sections (array, optional)
1100
+ name (string, optional) \u2014 Section heading (containing frame). '(unsectioned)' when absent.
1101
+ components (array, optional) \u2014 Non-variant components in this section with full detail. Each entry: { name, kind, description?, properties?, usage? } \u2014 properties is { [propName]: { type: VARIANT|TEXT|BOOLEAN|INSTANCE_SWAP, defaultValue?, options? } } matching components.get. usage is a copy-pasteable instances.create snippet.
1102
+ componentSets (array, optional) \u2014 Variant component sets in this section with full detail, same shape as components above. VARIANT properties carry options; pair with TEXT/BOOLEAN properties via instances.create.
1103
+ styles (object, optional) \u2014 Published styles in this section, grouped by type. Each entry: { name, kind: 'style', styleType, description? } (no properties/usage \u2014 styles have no variants).`
913
1104
  }
914
1105
  },
915
1106
  "lint": {
@@ -948,6 +1139,7 @@ Methods:
948
1139
  // "shape-instead-of-frame" \u2014 shapes used as containers [style]
949
1140
  // "fixed-in-autolayout" \u2014 FIXED-size children in auto-layout parents [heuristic]
950
1141
  // "unbounded-hug" \u2014 HUG on both axes [unsafe; short leaf text\u2192style]
1142
+ // "fill-in-hug" \u2014 collapsed FILL on the same axis inside a HUG parent (existing anchored states may be valid) [unsafe]
951
1143
  // "hug-cross-axis" \u2014 HUG on cross-axis of constrained parent [heuristic; leaf nodes\u2192style]
952
1144
  // "empty-container" \u2014 empty frames, excludes SLOT nodes [style]
953
1145
  // Token rules [token]:
@@ -981,51 +1173,90 @@ Params:
981
1173
  maxDepth (number, optional) \u2014 Max tree depth (default: 10)
982
1174
  maxFindings (number, optional) \u2014 Max findings (default: 50)
983
1175
  minSeverity (error | unsafe | heuristic | style | verbose, optional) \u2014 Minimum severity to report (default: style). Set to 'verbose' to include AAA contrast and line-height checks.
984
- skipInstances (boolean, optional) \u2014 Skip instance internals \u2014 findings inside instances are owned by the component (default: true)`,
985
- "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"
1176
+ skipInstances (boolean, optional) \u2014 Skip instance internals \u2014 findings inside instances are owned by the component (default: true)
1177
+
1178
+ Response:
1179
+ nodeId (string, required)
1180
+ nodeName (string, required)
1181
+ categories (array, required) \u2014 Sorted by severity (error > unsafe > heuristic > style)
1182
+ rule (string, required)
1183
+ severity (string, required) \u2014 error | unsafe | heuristic | style
1184
+ category (string, required) \u2014 component | composition | token | accessibility | naming
1185
+ count (number, required)
1186
+ fix (string, required)
1187
+ nodes (array, required)
1188
+ id (string, required)
1189
+ name (string, required)
1190
+ severity (string, optional) \u2014 Per-finding override when context changes the default
1191
+ warning (string, optional)`,
1192
+ "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\n\nResponse:\n { results: ("ok" | {error} | object)[] }'
986
1193
  }
987
1194
  },
988
1195
  "prototyping": {
989
1196
  "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// IMPORTANT: destination rules depend on navigation type:\n// NAVIGATE/SWAP/OVERLAY/SCROLL_TO \u2192 destination must be a top-level frame (direct child of a page). Nested frames are rejected.\n// CHANGE_TO \u2192 destination must be a variant (COMPONENT inside a COMPONENT_SET). Used for hover/state swaps within the same component.\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.',
990
1197
  "methods": {
991
- "get": "# prototyping.get\nGet reactions and overflow direction on a node\n\nParams:\n id (string, required) \u2014 Node ID",
992
- "add": '# prototyping.add\nAdd a prototype reaction to a node\n\nExample: prototyping(method:"add", items:[{id:"btn-1", trigger:"ON_CLICK", destination:"frame-2", navigation:"NAVIGATE", transition:"SMART_ANIMATE"}, {id:"btn-2", trigger:"ON_CLICK", destination:"frame-3"}])\n\nParams:\n id (string, optional) \u2014 Node ID\n trigger (ON_CLICK | ON_HOVER | ON_PRESS | ON_DRAG | AFTER_TIMEOUT | MOUSE_ENTER | MOUSE_LEAVE | ON_KEY_DOWN, optional) \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). NAVIGATE/SWAP/OVERLAY: must be a top-level frame. CHANGE_TO: must be a variant (component inside a component set).\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.\n items (array, optional) \u2014 Batch: array of {id, trigger, destination?, ...} reaction items\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 destination (string, optional) \u2014 Target node ID\n navigation (NAVIGATE | SWAP | OVERLAY | SCROLL_TO | CHANGE_TO, optional)\n transition (DISSOLVE | SMART_ANIMATE | MOVE_IN | MOVE_OUT | PUSH | SLIDE_IN | SLIDE_OUT | INSTANT, optional)\n transitionDirection (LEFT | RIGHT | TOP | BOTTOM, optional)\n duration (number, optional)\n easing (EASE_IN | EASE_OUT | EASE_IN_AND_OUT | LINEAR | GENTLE | QUICK | BOUNCY | SLOW, optional)\n actionType (NODE | BACK | CLOSE | URL | SET_VARIABLE_MODE, optional)\n triggerDelay (number, optional)\n url (string, optional)\n collectionName (string, optional)\n modeName (string, optional)\n resetScrollPosition (boolean, optional)\n actions (array, optional)',
993
- "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}]}]",
994
- "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)"
1198
+ "get": "# prototyping.get\nGet reactions and overflow direction on a node\n\nParams:\n id (string, required) \u2014 Node ID\n\nResponse:\n reactions (array, optional) \u2014 Reactions on this node\n overflowDirection (string, optional) \u2014 Overflow scroll direction (NONE, HORIZONTAL, VERTICAL, BOTH)",
1199
+ "add": '# prototyping.add\nAdd a prototype reaction to a node\n\nExample: prototyping(method:"add", items:[{id:"btn-1", trigger:"ON_CLICK", destination:"frame-2", navigation:"NAVIGATE", transition:"SMART_ANIMATE"}, {id:"btn-2", trigger:"ON_CLICK", destination:"frame-3"}])\n\nParams:\n id (string, optional) \u2014 Node ID\n trigger (ON_CLICK | ON_HOVER | ON_PRESS | ON_DRAG | AFTER_TIMEOUT | MOUSE_ENTER | MOUSE_LEAVE | ON_KEY_DOWN, optional) \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). NAVIGATE/SWAP/OVERLAY: must be a top-level frame. CHANGE_TO: must be a variant (component inside a component set).\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.\n items (array, optional) \u2014 Batch: array of {id, trigger, destination?, ...} reaction items\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 destination (string, optional) \u2014 Target node ID\n navigation (NAVIGATE | SWAP | OVERLAY | SCROLL_TO | CHANGE_TO, optional)\n transition (DISSOLVE | SMART_ANIMATE | MOVE_IN | MOVE_OUT | PUSH | SLIDE_IN | SLIDE_OUT | INSTANT, optional)\n transitionDirection (LEFT | RIGHT | TOP | BOTTOM, optional)\n duration (number, optional)\n easing (EASE_IN | EASE_OUT | EASE_IN_AND_OUT | LINEAR | GENTLE | QUICK | BOUNCY | SLOW, optional)\n actionType (NODE | BACK | CLOSE | URL | SET_VARIABLE_MODE, optional)\n triggerDelay (number, optional)\n url (string, optional)\n collectionName (string, optional)\n modeName (string, optional)\n resetScrollPosition (boolean, optional)\n actions (array, optional)\n\nResponse:\n { results: ("ok" | {error})[] }',
1200
+ "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}]}]\n\nResponse:\n { results: ("ok" | {error})[] }',
1201
+ "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)\n\nResponse:\n { results: ("ok" | {error})[] }'
995
1202
  }
996
1203
  },
997
1204
  "selection": {
998
1205
  "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.',
999
1206
  "methods": {
1000
- "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.",
1001
- "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"]'
1207
+ "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.\n\nResponse:\n results (array, required)\n id (string, required)\n name (string, required)\n type (string, required)\n _truncated (boolean, optional)\n _notice (string, optional)",
1208
+ "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"]\n\nResponse:\n count (number, required) \u2014 Number of nodes selected\n selectedNodes (array, required)\n name (string, required)\n id (string, required)\n notFoundIds (array, optional) \u2014 IDs that could not be found'
1002
1209
  }
1003
1210
  },
1004
1211
  "styles": {
1005
- "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.',
1212
+ "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: named PaintStyle.paints (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// Paint styles: create/update paints: Paint[] authoring accepts only SOLID and gradients (GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND).\n// Use gradientTransform + gradientStops; for a basic left-to-right gradient use gradientTransform:[[1,0,0],[0,1,0]]. Do not use CSS gradients, REST gradientHandlePositions, or top-level gradient boundVariables.\n// styles.get/list readback may include IMAGE/VIDEO/PATTERN metadata from existing Figma content, but those are readback-only and cannot be passed back to create/update Paint[] authoring. Use imageUrl/images for image authoring on nodes; VIDEO/PATTERN authoring is not supported here.\n// For VariableAlias ids in Paint[] (SOLID boundVariables.color or gradientStops[].boundVariables.color), inspect variables.get/list or variable_collections.get. Prefer colorVariableName/fillVariableName where available.\n// Backward-compatible color/colorVariableName create/update shorthands still create a single SOLID paint.\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) follows Figma Plugin API conditional shapes:\n// Grid: { pattern:"GRID", sectionSize:number, visible?:boolean, color?:Color }\n// Rows/Columns: { pattern:"ROWS"|"COLUMNS", alignment?:"MIN"|"MAX"|"STRETCH"|"CENTER", gutterSize?:number, count?:number, offset?:number, sectionSize?:number, visible?:boolean, color?:Color }\n// Important: alignment:"STRETCH" must omit sectionSize because Figma computes stretched row/column sizes. Use sectionSize only with fixed rows/columns (MIN/MAX/CENTER) or GRID.\n// Examples: stretch columns {pattern:"COLUMNS", alignment:"STRETCH", count:12, gutterSize:24, offset:80}; fixed columns {pattern:"COLUMNS", alignment:"MIN", count:12, gutterSize:24, offset:80, sectionSize:72}; square grid {pattern:"GRID", sectionSize:8}.\n\nUse styles(method: "help", topic: "<method>") for method details.\n// Shared types:\n// Color: hex "#RGB"|"#RGBA"|"#RRGGBB"|"#RRGGBBAA" or {r: 0-1, g: 0-1, b: 0-1, a?: 0-1}\n// VariableAlias: {type: "VARIABLE_ALIAS", id: string}. The id must be a Figma VariableID; discover it via variables.get/list or variable_collections.get. Prefer colorVariableName/fillVariableName/strokeVariableName when available; Paint[] VariableAlias is mainly for precise Paint[] round-trips and gradient stop bindings.\n// Transform: [[number, number, number], [number, number, number]] (Figma Plugin API 2\xD73 matrix)\n// 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"\n// ColorStop: {position: 0-1, color: Color, boundVariables?: {color?: VariableAlias}}\n// GradientPaint: {type: "GRADIENT_LINEAR"|"GRADIENT_RADIAL"|"GRADIENT_ANGULAR"|"GRADIENT_DIAMOND", gradientTransform: Transform, gradientStops: ColorStop[], visible?: boolean, opacity?: number, blendMode?: BlendMode}. Use gradientTransform + gradientStops (basic left-to-right: [[1,0,0],[0,1,0]]); do not use CSS gradients or REST gradientHandlePositions.\n// Effect: {type: "DROP_SHADOW"|"INNER_SHADOW"|"LAYER_BLUR"|"BACKGROUND_BLUR", radius: number, color?: {r,g,b,a} (0-1), offset?: {x, y}, spread?: number, visible?: boolean}\n// Paint: Paint[] authoring accepts only SOLID and GRADIENT_LINEAR/GRADIENT_RADIAL/GRADIENT_ANGULAR/GRADIENT_DIAMOND. SolidPaint: {type: "SOLID", color: Color, visible?: boolean, opacity?: number, blendMode?: BlendMode, boundVariables?: {color?: VariableAlias}}. GradientPaint authoring: {type: GRADIENT_*, gradientTransform: Transform, gradientStops: ColorStop[], visible?, opacity?, blendMode?}; bind variables on gradientStops[].boundVariables.color, not top-level gradient boundVariables. Do not pass IMAGE/VIDEO/PATTERN to create/update Paint[]; those may appear only in readback metadata from existing Figma content. Use imageUrl/images for image authoring. VIDEO/PATTERN authoring is not supported here. Do not use CSS gradients or REST gradientHandlePositions.\n// LayoutGrid is conditional: GridLayoutGrid {pattern:"GRID", sectionSize:number, visible?:boolean, color?:Color}; RowsColsLayoutGrid {pattern:"ROWS"|"COLUMNS", alignment?:"MIN"|"MAX"|"CENTER"|"STRETCH", gutterSize?:number, count?:number, offset?:number, sectionSize?:number, visible?:boolean, color?:Color}. For alignment:"STRETCH", omit sectionSize; Figma computes stretched row/column sizes. Use sectionSize only with fixed rows/columns (MIN/MAX/CENTER) or GRID.',
1006
1213
  "methods": {
1007
- "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)',
1008
- "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.',
1009
- "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, optional) \u2014 Color value. Optional when colorVariableName is provided.\n colorVariableName (string, optional) \u2014 Bind to a COLOR variable by name (style tracks the variable). Can be used alone \u2014 color is resolved from 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 (number | {value, unit: "PIXELS"|"PERCENT"|"AUTO"}, optional)\n letterSpacing (number | {value, unit: "PIXELS"|"PERCENT"}, 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',
1010
- "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 (number | {value, unit: "PIXELS"|"PERCENT"|"AUTO"}, optional)\n letterSpacing (number | {value, unit: "PIXELS"|"PERCENT"}, 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)',
1011
- "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"
1214
+ "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)\n\nResponse:\n totalCount (number, required)\n returned (number, optional)\n offset (number, optional)\n limit (number, optional)\n items (array, required)\n id (string, required)\n name (string, required)\n type (string, required)',
1215
+ "get": `# styles.get
1216
+ Get full style detail by ID
1217
+
1218
+ Params:
1219
+ id (string, required) \u2014 Style ID or name
1220
+ fields (string[], optional) \u2014 Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass ["*"] for all.
1221
+
1222
+ Response:
1223
+ id (string, required)
1224
+ name (string, required)
1225
+ type (string, required) \u2014 PAINT | TEXT | EFFECT | GRID
1226
+ paints (Paint[], optional) \u2014 PaintStyle.paints for PAINT styles. Readback returns Figma Plugin API Paint[]; gradients include gradientTransform, gradientStops, opacity/blendMode, and stop boundVariables. Existing Figma content may return IMAGE/VIDEO/PATTERN metadata, but those are readback-only and cannot be passed to create/update Paint[] authoring, which accepts only SOLID and gradients.
1227
+ boundVariables (object, optional) \u2014 PaintStyle.boundVariables, e.g. {paints:[{type:'VARIABLE_ALIAS', id:'...'}]}
1228
+ fontFamily (string, optional) \u2014 Font family (TEXT styles)
1229
+ fontSize (number, optional) \u2014 Font size (TEXT styles)
1230
+ effects (array, optional) \u2014 Effects array (EFFECT styles)
1231
+ layoutGrids (array, optional) \u2014 Layout grids (GRID styles)
1232
+ // Shared types:
1233
+ // Color: hex "#RGB"|"#RGBA"|"#RRGGBB"|"#RRGGBBAA" or {r: 0-1, g: 0-1, b: 0-1, a?: 0-1}
1234
+ // VariableAlias: {type: "VARIABLE_ALIAS", id: string}. The id must be a Figma VariableID; discover it via variables.get/list or variable_collections.get. Prefer colorVariableName/fillVariableName/strokeVariableName when available; Paint[] VariableAlias is mainly for precise Paint[] round-trips and gradient stop bindings.
1235
+ // Transform: [[number, number, number], [number, number, number]] (Figma Plugin API 2\xD73 matrix)
1236
+ // 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"
1237
+ // ColorStop: {position: 0-1, color: Color, boundVariables?: {color?: VariableAlias}}
1238
+ // GradientPaint: {type: "GRADIENT_LINEAR"|"GRADIENT_RADIAL"|"GRADIENT_ANGULAR"|"GRADIENT_DIAMOND", gradientTransform: Transform, gradientStops: ColorStop[], visible?: boolean, opacity?: number, blendMode?: BlendMode}. Use gradientTransform + gradientStops (basic left-to-right: [[1,0,0],[0,1,0]]); do not use CSS gradients or REST gradientHandlePositions.
1239
+ // Paint: Paint[] authoring accepts only SOLID and GRADIENT_LINEAR/GRADIENT_RADIAL/GRADIENT_ANGULAR/GRADIENT_DIAMOND. SolidPaint: {type: "SOLID", color: Color, visible?: boolean, opacity?: number, blendMode?: BlendMode, boundVariables?: {color?: VariableAlias}}. GradientPaint authoring: {type: GRADIENT_*, gradientTransform: Transform, gradientStops: ColorStop[], visible?, opacity?, blendMode?}; bind variables on gradientStops[].boundVariables.color, not top-level gradient boundVariables. Do not pass IMAGE/VIDEO/PATTERN to create/update Paint[]; those may appear only in readback metadata from existing Figma content. Use imageUrl/images for image authoring. VIDEO/PATTERN authoring is not supported here. Do not use CSS gradients or REST gradientHandlePositions.`,
1240
+ "create": '# styles.create\nCreate local styles\n\nExample: styles(method:"create", type:"paint", items:[{name:"Gradient/Primary", paints:[{type:"GRADIENT_LINEAR", gradientTransform:[[1,0,0],[0,1,0]], gradientStops:[{position:0,color:"#7D58ED"},{position:1,color:"#207CE5"}]}]}])\n\nCall shape: styles(method:"create", type:"<type>", items:[{...type-specific fields...}])\nDo not pass type-specific item fields at the top level; put them inside items[].\n\nDiscriminant: type (paint | text | effect | grid)\nTop-level params:\n type (paint | text | effect | grid, required) \u2014 Selects which item shape to use\n items (array, required) \u2014 One or more type-specific item objects\n\n ## paint \u2014 Paint/color style\n Example: styles(method:"create", type:"paint", items:[{name:"Surface/Primary", colorVariableName:"bg/surface"}])\n Item fields for items[] when type:"paint":\n name (string, required) \u2014 Style name\n paints (Paint[], optional) \u2014 PaintStyle.paints authoring array. Accepts only SOLID and GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND, using gradientTransform + gradientStops, opacity/blendMode, and gradientStops[].boundVariables.color. Mutually exclusive with color/colorVariableName shorthands. Do not pass IMAGE/VIDEO/PATTERN, CSS gradients, REST gradientHandlePositions, or top-level gradient boundVariables. Use imageUrl/images for image authoring on nodes; VIDEO/PATTERN authoring is not supported here. For examples call styles(method:"help", topic:"create").\n color (Color, optional) \u2014 Single-solid shorthand color. Optional when colorVariableName or paints is provided.\n colorVariableName (string, optional) \u2014 Single-solid shorthand: bind to a COLOR variable by name (style tracks the variable). Can be used alone \u2014 color is resolved from the variable.\n description (string, optional) \u2014 Style description\n\n ## text \u2014 Text style\n Example: styles(method:"create", type:"text", items:[{name:"Heading/Medium", fontFamily:"Inter", fontStyle:"Medium", fontSize:20, lineHeight:{value:28, unit:"PIXELS"}}, {name:"Body/Regular", fontFamily:"Inter", fontSize:14, lineHeight:{value:20, unit:"PIXELS"}}, {name:"Body/Medium", fontFamily:"Inter", fontStyle:"Medium", fontSize:14, lineHeight:{value:20, unit:"PIXELS"}}])\n Item fields for items[] when type:"text":\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 (number | {value, unit: "PIXELS"|"PERCENT"|"AUTO"}, optional)\n letterSpacing (number | {value, unit: "PIXELS"|"PERCENT"}, 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 Example: styles(method:"create", type:"effect", items:[{name:"Shadow/Medium", effects:[{type:"DROP_SHADOW", color:"#00000040", offset:{x:0,y:4}, radius:8}]}])\n Item fields for items[] when type:"effect":\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 Example: styles(method:"create", type:"grid", items:[{name:"Grid/Desktop 12", layoutGrids:[{pattern:"COLUMNS", alignment:"STRETCH", count:12, gutterSize:24, offset:80}]}])\n Item fields for items[] when type:"grid":\n name (string, required) \u2014 Style name\n layoutGrids (array, required) \u2014 Array of LayoutGrid objects. Conditional shapes: GRID requires sectionSize and does not use alignment/count/gutterSize/offset; ROWS/COLUMNS use alignment/count/gutterSize/offset, and sectionSize only for fixed alignments MIN/MAX/CENTER. For alignment:STRETCH, omit sectionSize.\n description (string, optional) \u2014 Style description\n\nResponse:\n { results: ({id} | {error})[] }\n// Shared types:\n// Color: hex "#RGB"|"#RGBA"|"#RRGGBB"|"#RRGGBBAA" or {r: 0-1, g: 0-1, b: 0-1, a?: 0-1}\n// VariableAlias: {type: "VARIABLE_ALIAS", id: string}. The id must be a Figma VariableID; discover it via variables.get/list or variable_collections.get. Prefer colorVariableName/fillVariableName/strokeVariableName when available; Paint[] VariableAlias is mainly for precise Paint[] round-trips and gradient stop bindings.\n// Transform: [[number, number, number], [number, number, number]] (Figma Plugin API 2\xD73 matrix)\n// 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"\n// ColorStop: {position: 0-1, color: Color, boundVariables?: {color?: VariableAlias}}\n// GradientPaint: {type: "GRADIENT_LINEAR"|"GRADIENT_RADIAL"|"GRADIENT_ANGULAR"|"GRADIENT_DIAMOND", gradientTransform: Transform, gradientStops: ColorStop[], visible?: boolean, opacity?: number, blendMode?: BlendMode}. Use gradientTransform + gradientStops (basic left-to-right: [[1,0,0],[0,1,0]]); do not use CSS gradients or REST gradientHandlePositions.\n// Effect: {type: "DROP_SHADOW"|"INNER_SHADOW"|"LAYER_BLUR"|"BACKGROUND_BLUR", radius: number, color?: {r,g,b,a} (0-1), offset?: {x, y}, spread?: number, visible?: boolean}\n// Paint: Paint[] authoring accepts only SOLID and GRADIENT_LINEAR/GRADIENT_RADIAL/GRADIENT_ANGULAR/GRADIENT_DIAMOND. SolidPaint: {type: "SOLID", color: Color, visible?: boolean, opacity?: number, blendMode?: BlendMode, boundVariables?: {color?: VariableAlias}}. GradientPaint authoring: {type: GRADIENT_*, gradientTransform: Transform, gradientStops: ColorStop[], visible?, opacity?, blendMode?}; bind variables on gradientStops[].boundVariables.color, not top-level gradient boundVariables. Do not pass IMAGE/VIDEO/PATTERN to create/update Paint[]; those may appear only in readback metadata from existing Figma content. Use imageUrl/images for image authoring. VIDEO/PATTERN authoring is not supported here. Do not use CSS gradients or REST gradientHandlePositions.\n// LayoutGrid is conditional: GridLayoutGrid {pattern:"GRID", sectionSize:number, visible?:boolean, color?:Color}; RowsColsLayoutGrid {pattern:"ROWS"|"COLUMNS", alignment?:"MIN"|"MAX"|"CENTER"|"STRETCH", gutterSize?:number, count?:number, offset?:number, sectionSize?:number, visible?:boolean, color?:Color}. For alignment:"STRETCH", omit sectionSize; Figma computes stretched row/column sizes. Use sectionSize only with fixed rows/columns (MIN/MAX/CENTER) or GRID.',
1241
+ "update": '# styles.update\nUpdate styles by ID or name\n\nExample: styles(method:"update", items:[{id:"Gradient/Primary", paints:[{type:"GRADIENT_LINEAR", gradientTransform:[[1,0,0],[0,1,0]], gradientStops:[{position:0,color:"#7D58ED"},{position:1,color:"#207CE5"}]}]}])\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 paints (Paint[], optional) \u2014 Replace PaintStyle.paints. Accepts only SOLID and GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND, using gradientTransform + gradientStops, opacity/blendMode, and gradientStops[].boundVariables.color. Mutually exclusive with color/colorVariableName. Do not pass IMAGE/VIDEO/PATTERN, CSS gradients, REST gradientHandlePositions, or top-level gradient boundVariables. Use imageUrl/images for image authoring on nodes; VIDEO/PATTERN authoring is not supported here. For examples call styles(method:"help", topic:"update").\n color (Color, optional) \u2014 New single-solid color shorthand (paint styles)\n colorVariableName (string, optional) \u2014 Bind to a COLOR variable by name using single-solid shorthand (paint styles)\n fontFamily (string, optional)\n fontStyle (string, optional)\n fontSize (number, optional)\n lineHeight (number | {value, unit: "PIXELS"|"PERCENT"|"AUTO"}, optional)\n letterSpacing (number | {value, unit: "PIXELS"|"PERCENT"}, 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). Conditional shapes: GRID requires sectionSize and does not use alignment/count/gutterSize/offset; ROWS/COLUMNS use alignment/count/gutterSize/offset, and sectionSize only for fixed alignments MIN/MAX/CENTER. For alignment:STRETCH, omit sectionSize.\n\nResponse:\n { results: ("ok" | {error} | object)[] }\n// Shared types:\n// Color: hex "#RGB"|"#RGBA"|"#RRGGBB"|"#RRGGBBAA" or {r: 0-1, g: 0-1, b: 0-1, a?: 0-1}\n// VariableAlias: {type: "VARIABLE_ALIAS", id: string}. The id must be a Figma VariableID; discover it via variables.get/list or variable_collections.get. Prefer colorVariableName/fillVariableName/strokeVariableName when available; Paint[] VariableAlias is mainly for precise Paint[] round-trips and gradient stop bindings.\n// Transform: [[number, number, number], [number, number, number]] (Figma Plugin API 2\xD73 matrix)\n// 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"\n// ColorStop: {position: 0-1, color: Color, boundVariables?: {color?: VariableAlias}}\n// GradientPaint: {type: "GRADIENT_LINEAR"|"GRADIENT_RADIAL"|"GRADIENT_ANGULAR"|"GRADIENT_DIAMOND", gradientTransform: Transform, gradientStops: ColorStop[], visible?: boolean, opacity?: number, blendMode?: BlendMode}. Use gradientTransform + gradientStops (basic left-to-right: [[1,0,0],[0,1,0]]); do not use CSS gradients or REST gradientHandlePositions.\n// Effect: {type: "DROP_SHADOW"|"INNER_SHADOW"|"LAYER_BLUR"|"BACKGROUND_BLUR", radius: number, color?: {r,g,b,a} (0-1), offset?: {x, y}, spread?: number, visible?: boolean}\n// Paint: Paint[] authoring accepts only SOLID and GRADIENT_LINEAR/GRADIENT_RADIAL/GRADIENT_ANGULAR/GRADIENT_DIAMOND. SolidPaint: {type: "SOLID", color: Color, visible?: boolean, opacity?: number, blendMode?: BlendMode, boundVariables?: {color?: VariableAlias}}. GradientPaint authoring: {type: GRADIENT_*, gradientTransform: Transform, gradientStops: ColorStop[], visible?, opacity?, blendMode?}; bind variables on gradientStops[].boundVariables.color, not top-level gradient boundVariables. Do not pass IMAGE/VIDEO/PATTERN to create/update Paint[]; those may appear only in readback metadata from existing Figma content. Use imageUrl/images for image authoring. VIDEO/PATTERN authoring is not supported here. Do not use CSS gradients or REST gradientHandlePositions.\n// LayoutGrid is conditional: GridLayoutGrid {pattern:"GRID", sectionSize:number, visible?:boolean, color?:Color}; RowsColsLayoutGrid {pattern:"ROWS"|"COLUMNS", alignment?:"MIN"|"MAX"|"CENTER"|"STRETCH", gutterSize?:number, count?:number, offset?:number, sectionSize?:number, visible?:boolean, color?:Color}. For alignment:"STRETCH", omit sectionSize; Figma computes stretched row/column sizes. Use sectionSize only with fixed rows/columns (MIN/MAX/CENTER) or GRID.',
1242
+ "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\n\nResponse:\n { results: ("ok" | {error})[] }'
1012
1243
  }
1013
1244
  },
1014
1245
  "text": {
1015
- "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 \u2014 produces a same-type copy (frame\u2192frame, instance\u2192instance, component\u2192component). Instance clones reference the same source component; they do not duplicate the component definition. [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.',
1246
+ "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 \u2014 produces a same-type copy (frame\u2192frame, instance\u2192instance, component\u2192component). Instance clones reference the same source component; they do not duplicate the component definition. [create]\n scale Proportionally rescale a node subtree using Figma\'s visual Scale tool behavior. This is for visual/artifact scaling, not responsive layout resizing. [edit]\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// clipsContent: clip children to the node bounds where supported (frames/components/instances). Set false for overflow-visible layouts.\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[]; // readback Paint[]; authoring supports SOLID + gradients via gradientTransform + gradientStops\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. Paint[] authoring supports SOLID + gradients only; IMAGE/VIDEO/PATTERN are readback-only metadata.\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.\n// Shared types:\n// Color: hex "#RGB"|"#RGBA"|"#RRGGBB"|"#RRGGBBAA" or {r: 0-1, g: 0-1, b: 0-1, a?: 0-1}\n// VariableAlias: {type: "VARIABLE_ALIAS", id: string}. The id must be a Figma VariableID; discover it via variables.get/list or variable_collections.get. Prefer colorVariableName/fillVariableName/strokeVariableName when available; Paint[] VariableAlias is mainly for precise Paint[] round-trips and gradient stop bindings.\n// Transform: [[number, number, number], [number, number, number]] (Figma Plugin API 2\xD73 matrix)\n// 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"\n// ColorStop: {position: 0-1, color: Color, boundVariables?: {color?: VariableAlias}}\n// GradientPaint: {type: "GRADIENT_LINEAR"|"GRADIENT_RADIAL"|"GRADIENT_ANGULAR"|"GRADIENT_DIAMOND", gradientTransform: Transform, gradientStops: ColorStop[], visible?: boolean, opacity?: number, blendMode?: BlendMode}. Use gradientTransform + gradientStops (basic left-to-right: [[1,0,0],[0,1,0]]); do not use CSS gradients or REST gradientHandlePositions.\n// Effect: {type: "DROP_SHADOW"|"INNER_SHADOW"|"LAYER_BLUR"|"BACKGROUND_BLUR", radius: number, color?: {r,g,b,a} (0-1), offset?: {x, y}, spread?: number, visible?: boolean}\n// Paint: Paint[] authoring accepts only SOLID and GRADIENT_LINEAR/GRADIENT_RADIAL/GRADIENT_ANGULAR/GRADIENT_DIAMOND. SolidPaint: {type: "SOLID", color: Color, visible?: boolean, opacity?: number, blendMode?: BlendMode, boundVariables?: {color?: VariableAlias}}. GradientPaint authoring: {type: GRADIENT_*, gradientTransform: Transform, gradientStops: ColorStop[], visible?, opacity?, blendMode?}; bind variables on gradientStops[].boundVariables.color, not top-level gradient boundVariables. Do not pass IMAGE/VIDEO/PATTERN to create/update Paint[]; those may appear only in readback metadata from existing Figma content. Use imageUrl/images for image authoring. VIDEO/PATTERN authoring is not supported here. Do not use CSS gradients or REST gradientHandlePositions.\n// NodeStub: {id: string, name: string, type: string}',
1016
1247
  "methods": {
1017
- "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.',
1018
- "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)',
1248
+ "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.\n\nResponse:\n Serialized node tree. Shape depends on depth parameter.\n results (Node[], required) \u2014 Serialized node trees\n _truncated (boolean, optional) \u2014 True when node budget exceeded\n _notice (string, optional) \u2014 Human-readable truncation notice',
1249
+ "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)\n\nResponse:\n Paginated node search results (uses `results` not `items`)\n totalCount (number, required) \u2014 Total matching nodes\n returned (number, required) \u2014 Nodes in this page\n offset (number, optional)\n limit (number, optional)\n results (array, required) \u2014 Matching node stubs\n id (string, required)\n name (string, required)\n type (string, required)\n parentId (string, required)\n parentName (string, optional)\n bounds (object, optional)',
1019
1250
  "update": `# text.update
1020
1251
  Patch node properties
1021
1252
 
1022
1253
  Params:
1023
- items (PatchItem[], required) \u2014 Array of {id, ...properties} to patch
1024
- fills (array, optional) \u2014 Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills.
1254
+ items (PatchItem[], required) \u2014 Array of {id, ...fields} to patch
1255
+ fills (Paint[], optional) \u2014 Fill Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] for transparent. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables; use imageUrl/images for image authoring. IMAGE/VIDEO/PATTERN may appear in readback metadata only. Primary way to set non-image fills.
1025
1256
  fillColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)
1026
1257
  fillStyleName (string, optional) \u2014 Paint style name for fill
1027
- fillVariableName (string, optional) \u2014 Color variable by name e.g. 'bg/primary'
1028
- strokes (array, optional) \u2014 Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes.
1258
+ fillVariableName (string, optional) \u2014 Color variable by name e.g. 'bg/surface'
1259
+ strokes (Paint[], optional) \u2014 Stroke Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] to clear. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables. IMAGE/VIDEO/PATTERN may appear in readback metadata only. Primary way to set strokes.
1029
1260
  strokeColor (Color, optional) \u2014 Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)
1030
1261
  strokeStyleName (string, optional) \u2014 Paint style name for stroke
1031
1262
  strokeVariableName (string, optional) \u2014 Color variable by name for stroke
@@ -1100,9 +1331,35 @@ Params:
1100
1331
  explicitMode (object, optional) \u2014 Pin variable mode \u2014 use { collectionName, modeName } (preferred) or { collectionId, modeId }
1101
1332
  exportSettings (array, optional) \u2014 Export settings
1102
1333
  annotations (array, optional) \u2014 Set annotations \u2014 [{label?, labelMarkdown?, properties?, categoryId?}]. Properties are validated per node type.
1103
- properties (object, optional) \u2014 Direct Figma API props (escape hatch)`,
1104
- "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)",
1105
- "clone": "# text.clone\nDuplicate nodes \u2014 produces a same-type copy (frame\u2192frame, instance\u2192instance, component\u2192component). Instance clones reference the same source component; they do not duplicate the component definition.\n\nParams:\n id (string, optional) \u2014 Node ID\n name (string, optional) \u2014 Rename the clone (set before appending to parent \u2014 required when cloning a variant into its component set to avoid duplicate names)\n parentId (string, optional) \u2014 Parent node ID. Omit to place at current page root.\n x (number, optional) \u2014 X position (default: 0)\n y (number, optional) \u2014 Y position (default: 0)\n items (array, optional) \u2014 Batch: [{id, name?, parentId?, x?, y?}, ...]. Alternative to single-item params.\n id (string, required) \u2014 Node ID to clone\n name (string, optional) \u2014 Rename the clone\n parentId (string, optional) \u2014 Target parent\n x (number, optional)\n y (number, optional)\n depth (number, optional) \u2014 Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.",
1334
+ clipsContent (boolean, optional) \u2014 Clip children to bounds where supported (frames/components/instances).
1335
+
1336
+ Response:
1337
+ { results: ("ok" | {error} | object)[] }
1338
+ // Shared types:
1339
+ // Color: hex "#RGB"|"#RGBA"|"#RRGGBB"|"#RRGGBBAA" or {r: 0-1, g: 0-1, b: 0-1, a?: 0-1}
1340
+ // VariableAlias: {type: "VARIABLE_ALIAS", id: string}. The id must be a Figma VariableID; discover it via variables.get/list or variable_collections.get. Prefer colorVariableName/fillVariableName/strokeVariableName when available; Paint[] VariableAlias is mainly for precise Paint[] round-trips and gradient stop bindings.
1341
+ // Transform: [[number, number, number], [number, number, number]] (Figma Plugin API 2\xD73 matrix)
1342
+ // 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"
1343
+ // ColorStop: {position: 0-1, color: Color, boundVariables?: {color?: VariableAlias}}
1344
+ // GradientPaint: {type: "GRADIENT_LINEAR"|"GRADIENT_RADIAL"|"GRADIENT_ANGULAR"|"GRADIENT_DIAMOND", gradientTransform: Transform, gradientStops: ColorStop[], visible?: boolean, opacity?: number, blendMode?: BlendMode}. Use gradientTransform + gradientStops (basic left-to-right: [[1,0,0],[0,1,0]]); do not use CSS gradients or REST gradientHandlePositions.
1345
+ // Effect: {type: "DROP_SHADOW"|"INNER_SHADOW"|"LAYER_BLUR"|"BACKGROUND_BLUR", radius: number, color?: {r,g,b,a} (0-1), offset?: {x, y}, spread?: number, visible?: boolean}
1346
+ // Paint: Paint[] authoring accepts only SOLID and GRADIENT_LINEAR/GRADIENT_RADIAL/GRADIENT_ANGULAR/GRADIENT_DIAMOND. SolidPaint: {type: "SOLID", color: Color, visible?: boolean, opacity?: number, blendMode?: BlendMode, boundVariables?: {color?: VariableAlias}}. GradientPaint authoring: {type: GRADIENT_*, gradientTransform: Transform, gradientStops: ColorStop[], visible?, opacity?, blendMode?}; bind variables on gradientStops[].boundVariables.color, not top-level gradient boundVariables. Do not pass IMAGE/VIDEO/PATTERN to create/update Paint[]; those may appear only in readback metadata from existing Figma content. Use imageUrl/images for image authoring. VIDEO/PATTERN authoring is not supported here. Do not use CSS gradients or REST gradientHandlePositions.`,
1347
+ "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)\n\nResponse:\n { results: ("ok" | {error})[] }',
1348
+ "clone": "# text.clone\nDuplicate nodes \u2014 produces a same-type copy (frame\u2192frame, instance\u2192instance, component\u2192component). Instance clones reference the same source component; they do not duplicate the component definition.\n\nParams:\n id (string, optional) \u2014 Node ID\n name (string, optional) \u2014 Rename the clone (set before appending to parent \u2014 required when cloning a variant into its component set to avoid duplicate names)\n parentId (string, optional) \u2014 Parent node ID. Omit to place at current page root.\n x (number, optional) \u2014 X position (default: 0)\n y (number, optional) \u2014 Y position (default: 0)\n items (array, optional) \u2014 Batch: [{id, name?, parentId?, x?, y?}, ...]. Alternative to single-item params.\n id (string, required) \u2014 Node ID to clone\n name (string, optional) \u2014 Rename the clone\n parentId (string, optional) \u2014 Target parent\n x (number, optional)\n y (number, optional)\n depth (number, optional) \u2014 Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.\n\nResponse:\n { results: ({id} | {error})[] }",
1349
+ "scale": `# text.scale
1350
+ Proportionally rescale a node subtree using Figma's visual Scale tool behavior. This is for visual/artifact scaling, not responsive layout resizing.
1351
+
1352
+ Example: text(method:"scale", id:"1:23", factor:0.5)
1353
+
1354
+ Params:
1355
+ id (string, optional) \u2014 Node ID to scale
1356
+ factor (number, optional) \u2014 Scale factor, >= 0.01. 0.5 = 50%, 2 = 200%. Scales children, text, strokes, effects, and layout geometry from the node's top-left. On auto-layout or HUG/FILL nodes, Figma may resolve responsive sizing to fixed width/height.
1357
+ items (array, optional) \u2014 Batch: [{id, factor}, ...]. Alternative to single-item params.
1358
+ id (string, required) \u2014 Node ID to scale
1359
+ factor (number, required) \u2014 Scale factor, >= 0.01. 0.5 = 50%, 2 = 200%.
1360
+
1361
+ Response:
1362
+ { results: ("ok" | {error})[] }`,
1106
1363
  "audit": `# text.audit
1107
1364
  Run lint on a node \u2014 returns severity-ranked findings
1108
1365
 
@@ -1112,12 +1369,17 @@ Params:
1112
1369
  maxDepth (number, optional) \u2014 Max tree depth (default: 10)
1113
1370
  maxFindings (number, optional) \u2014 Max findings (default: 50)
1114
1371
  minSeverity (error | unsafe | heuristic | style | verbose, optional) \u2014 Minimum severity to report (default: style). Set to 'verbose' to include AAA contrast and line-height checks.
1115
- skipInstances (boolean, optional) \u2014 Skip instance internals \u2014 findings inside instances are owned by the component (default: true)`,
1116
- "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)",
1372
+ skipInstances (boolean, optional) \u2014 Skip instance internals \u2014 findings inside instances are owned by the component (default: true)
1373
+
1374
+ Response:
1375
+ nodeId (string, optional)
1376
+ nodeName (string, optional)
1377
+ categories (array, optional) \u2014 Sorted by severity (error > unsafe > heuristic > style)`,
1378
+ "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)\n\nResponse:\n { results: ("ok" | {error})[] }',
1117
1379
  "create": `# text.create
1118
1380
  Create text nodes
1119
1381
 
1120
- Example: text(method:"create", items:[{text:"Hello", fontFamily:"Inter", fontSize:16, textStyleName:"body/medium"}])
1382
+ Example: text(method:"create", items:[{text:"Hello", textStyleName:"Body/Regular", fontColorVariableName:"text/primary"}])
1121
1383
 
1122
1384
  Params:
1123
1385
  items (TextItem[], required) \u2014 Array of text items to create
@@ -1135,7 +1397,7 @@ Params:
1135
1397
  letterSpacing (number | {value, unit: "PIXELS"|"PERCENT"}, optional)
1136
1398
  textCase (ORIGINAL | UPPER | LOWER | TITLE | SMALL_CAPS | SMALL_CAPS_FORCED, optional)
1137
1399
  textDecoration (NONE | UNDERLINE | STRIKETHROUGH, optional)
1138
- fills (array, optional) \u2014 Text color paints \u2014 e.g. [{type: 'SOLID', color: '#hex'}]. Same as node fills.
1400
+ fills (Paint[], optional) \u2014 Text Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. Same as node fills. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables. IMAGE/VIDEO/PATTERN may appear in readback metadata only.
1139
1401
  fontColor (Color, optional) \u2014 Shorthand \u2014 sets text color (auto-binds to matching variable/style)
1140
1402
  fontColorVariableName (string, optional) \u2014 Bind color variable by name e.g. 'text/primary'
1141
1403
  fontColorStyleName (string, optional) \u2014 Apply paint style \u2014 overrides fontColor
@@ -1149,20 +1411,56 @@ Params:
1149
1411
  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.
1150
1412
  componentId (string, optional) \u2014 Target component ID for componentPropertyName binding. When omitted, walks up ancestors to find the nearest COMPONENT or COMPONENT_SET.
1151
1413
  annotations (array, optional) \u2014 Annotations \u2014 [{label?, labelMarkdown?, properties?, categoryId?}]
1152
- depth (number, optional) \u2014 Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.`,
1153
- "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.",
1154
- "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"
1414
+ depth (number, optional) \u2014 Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.
1415
+
1416
+ Response:
1417
+ { results: ({id} | {error})[] }
1418
+ // Shared types:
1419
+ // Color: hex "#RGB"|"#RGBA"|"#RRGGBB"|"#RRGGBBAA" or {r: 0-1, g: 0-1, b: 0-1, a?: 0-1}
1420
+ // VariableAlias: {type: "VARIABLE_ALIAS", id: string}. The id must be a Figma VariableID; discover it via variables.get/list or variable_collections.get. Prefer colorVariableName/fillVariableName/strokeVariableName when available; Paint[] VariableAlias is mainly for precise Paint[] round-trips and gradient stop bindings.
1421
+ // Transform: [[number, number, number], [number, number, number]] (Figma Plugin API 2\xD73 matrix)
1422
+ // 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"
1423
+ // ColorStop: {position: 0-1, color: Color, boundVariables?: {color?: VariableAlias}}
1424
+ // GradientPaint: {type: "GRADIENT_LINEAR"|"GRADIENT_RADIAL"|"GRADIENT_ANGULAR"|"GRADIENT_DIAMOND", gradientTransform: Transform, gradientStops: ColorStop[], visible?: boolean, opacity?: number, blendMode?: BlendMode}. Use gradientTransform + gradientStops (basic left-to-right: [[1,0,0],[0,1,0]]); do not use CSS gradients or REST gradientHandlePositions.
1425
+ // Paint: Paint[] authoring accepts only SOLID and GRADIENT_LINEAR/GRADIENT_RADIAL/GRADIENT_ANGULAR/GRADIENT_DIAMOND. SolidPaint: {type: "SOLID", color: Color, visible?: boolean, opacity?: number, blendMode?: BlendMode, boundVariables?: {color?: VariableAlias}}. GradientPaint authoring: {type: GRADIENT_*, gradientTransform: Transform, gradientStops: ColorStop[], visible?, opacity?, blendMode?}; bind variables on gradientStops[].boundVariables.color, not top-level gradient boundVariables. Do not pass IMAGE/VIDEO/PATTERN to create/update Paint[]; those may appear only in readback metadata from existing Figma content. Use imageUrl/images for image authoring. VIDEO/PATTERN authoring is not supported here. Do not use CSS gradients or REST gradientHandlePositions.`,
1426
+ "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.\n\nResponse:\n { results: ("ok" | {error})[] }',
1427
+ "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\n\nResponse:\n { results: ("ok" | {error} | object)[] }'
1155
1428
  }
1156
1429
  },
1157
1430
  "variable_collections": {
1158
- "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.',
1431
+ "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 in variable values use {type: "VARIABLE_ALIAS", name: "other/variable"}.\n// Paint[] VariableAlias uses {type:"VARIABLE_ALIAS", id:"<VariableID>"}; variable_collections.get includes each variable id. Prefer *VariableName helpers when available.\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.\n// Shared types:\n// Color: hex "#RGB"|"#RGBA"|"#RRGGBB"|"#RRGGBBAA" or {r: 0-1, g: 0-1, b: 0-1, a?: 0-1}\n// VariableAlias: {type: "VARIABLE_ALIAS", id: string}. The id must be a Figma VariableID; discover it via variables.get/list or variable_collections.get. Prefer colorVariableName/fillVariableName/strokeVariableName when available; Paint[] VariableAlias is mainly for precise Paint[] round-trips and gradient stop bindings.\n// Transform: [[number, number, number], [number, number, number]] (Figma Plugin API 2\xD73 matrix)\n// 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"\n// ColorStop: {position: 0-1, color: Color, boundVariables?: {color?: VariableAlias}}\n// GradientPaint: {type: "GRADIENT_LINEAR"|"GRADIENT_RADIAL"|"GRADIENT_ANGULAR"|"GRADIENT_DIAMOND", gradientTransform: Transform, gradientStops: ColorStop[], visible?: boolean, opacity?: number, blendMode?: BlendMode}. Use gradientTransform + gradientStops (basic left-to-right: [[1,0,0],[0,1,0]]); do not use CSS gradients or REST gradientHandlePositions.\n// Paint: Paint[] authoring accepts only SOLID and GRADIENT_LINEAR/GRADIENT_RADIAL/GRADIENT_ANGULAR/GRADIENT_DIAMOND. SolidPaint: {type: "SOLID", color: Color, visible?: boolean, opacity?: number, blendMode?: BlendMode, boundVariables?: {color?: VariableAlias}}. GradientPaint authoring: {type: GRADIENT_*, gradientTransform: Transform, gradientStops: ColorStop[], visible?, opacity?, blendMode?}; bind variables on gradientStops[].boundVariables.color, not top-level gradient boundVariables. Do not pass IMAGE/VIDEO/PATTERN to create/update Paint[]; those may appear only in readback metadata from existing Figma content. Use imageUrl/images for image authoring. VIDEO/PATTERN authoring is not supported here. Do not use CSS gradients or REST gradientHandlePositions.',
1159
1432
  "methods": {
1160
- "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)',
1161
- "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.',
1433
+ "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)\n\nResponse:\n totalCount (number, required)\n returned (number, optional)\n offset (number, optional)\n limit (number, optional)\n items (array, required)\n id (string, required)\n name (string, required)\n modes (string[], optional) \u2014 Mode names\n variableCount (number, optional) \u2014 Number of variables',
1434
+ "get": `# variable_collections.get
1435
+ Get collection with all variables and values (full document)
1436
+
1437
+ Params:
1438
+ id (string, required) \u2014 Collection ID or name
1439
+ fields (string[], optional) \u2014 Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass ["*"] for all.
1440
+
1441
+ Response:
1442
+ id (string, required)
1443
+ name (string, required)
1444
+ modes (string[], required) \u2014 Mode names (e.g. ['Light', 'Dark'])
1445
+ variables (array, required) \u2014 All variables in this collection
1446
+ id (string, required) \u2014 Figma VariableID. Use as VariableAlias.id in Paint[] when needed.
1447
+ name (string, required)
1448
+ type (string, required) \u2014 COLOR | FLOAT | STRING | BOOLEAN
1449
+ valuesByMode (object, required) \u2014 Values keyed by mode name
1450
+ scopes (string[], optional)
1451
+ description (string, optional)
1452
+ // Shared types:
1453
+ // Color: hex "#RGB"|"#RGBA"|"#RRGGBB"|"#RRGGBBAA" or {r: 0-1, g: 0-1, b: 0-1, a?: 0-1}
1454
+ // VariableAlias: {type: "VARIABLE_ALIAS", id: string}. The id must be a Figma VariableID; discover it via variables.get/list or variable_collections.get. Prefer colorVariableName/fillVariableName/strokeVariableName when available; Paint[] VariableAlias is mainly for precise Paint[] round-trips and gradient stop bindings.
1455
+ // Transform: [[number, number, number], [number, number, number]] (Figma Plugin API 2\xD73 matrix)
1456
+ // 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"
1457
+ // ColorStop: {position: 0-1, color: Color, boundVariables?: {color?: VariableAlias}}
1458
+ // GradientPaint: {type: "GRADIENT_LINEAR"|"GRADIENT_RADIAL"|"GRADIENT_ANGULAR"|"GRADIENT_DIAMOND", gradientTransform: Transform, gradientStops: ColorStop[], visible?: boolean, opacity?: number, blendMode?: BlendMode}. Use gradientTransform + gradientStops (basic left-to-right: [[1,0,0],[0,1,0]]); do not use CSS gradients or REST gradientHandlePositions.
1459
+ // Paint: Paint[] authoring accepts only SOLID and GRADIENT_LINEAR/GRADIENT_RADIAL/GRADIENT_ANGULAR/GRADIENT_DIAMOND. SolidPaint: {type: "SOLID", color: Color, visible?: boolean, opacity?: number, blendMode?: BlendMode, boundVariables?: {color?: VariableAlias}}. GradientPaint authoring: {type: GRADIENT_*, gradientTransform: Transform, gradientStops: ColorStop[], visible?, opacity?, blendMode?}; bind variables on gradientStops[].boundVariables.color, not top-level gradient boundVariables. Do not pass IMAGE/VIDEO/PATTERN to create/update Paint[]; those may appear only in readback metadata from existing Figma content. Use imageUrl/images for image authoring. VIDEO/PATTERN authoring is not supported here. Do not use CSS gradients or REST gradientHandlePositions.`,
1162
1460
  "create": `# variable_collections.create
1163
1461
  Create a collection with modes and variables in one call
1164
1462
 
1165
- 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"]}]}])
1463
+ Example: variable_collections(method:"create", items:[{name:"Tokens", variables:[{name:"bg/canvas", type:"COLOR", value:"#F7F8FA", scopes:["ALL_FILLS"]}, {name:"bg/surface", type:"COLOR", value:"#FFFFFF", scopes:["ALL_FILLS"]}, {name:"bg/accent", type:"COLOR", value:"#2563EB", scopes:["ALL_FILLS"]}, {name:"bg/muted", type:"COLOR", value:"#E5E7EB", scopes:["ALL_FILLS"]}, {name:"text/primary", type:"COLOR", value:"#111827", scopes:["TEXT_FILL"]}, {name:"text/secondary", type:"COLOR", value:"#4B5563", scopes:["TEXT_FILL"]}, {name:"text/inverse", type:"COLOR", value:"#FFFFFF", scopes:["TEXT_FILL"]}, {name:"border/subtle", type:"COLOR", value:"#D1D5DB", scopes:["STROKE_COLOR"]}, {name:"icon/primary", type:"COLOR", value:{type:"VARIABLE_ALIAS", name:"text/primary"}, scopes:["ALL_FILLS","STROKE_COLOR"]}, {name:"status/success", type:"COLOR", value:"#16A34A", scopes:["ALL_FILLS"]}, {name:"space/8", type:"FLOAT", value:8, scopes:["GAP"]}, {name:"space/12", type:"FLOAT", value:12, scopes:["GAP"]}, {name:"space/16", type:"FLOAT", value:16, scopes:["GAP"]}, {name:"space/24", type:"FLOAT", value:24, scopes:["GAP"]}, {name:"radius/8", type:"FLOAT", value:8, scopes:["CORNER_RADIUS"]}, {name:"radius/12", type:"FLOAT", value:12, scopes:["CORNER_RADIUS"]}, {name:"radius/16", type:"FLOAT", value:16, scopes:["CORNER_RADIUS"]}, {name:"stroke/1", type:"FLOAT", value:1, scopes:["STROKE_FLOAT"]}]}])
1166
1464
 
1167
1465
  Params:
1168
1466
  items (array, required) \u2014 Array of collection documents
@@ -1174,22 +1472,25 @@ Params:
1174
1472
  value (variable_value, optional) \u2014 Sets all modes to this value. Use valuesByMode for per-mode control.
1175
1473
  valuesByMode (object, optional) \u2014 Values keyed by mode name (e.g. {"Light": "#FFF", "Dark": "#111"})
1176
1474
  description (string, optional)
1177
- scopes (string[], optional) \u2014 Restrict where variable can be applied (default: ALL_SCOPES)`,
1178
- "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",
1179
- "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)",
1180
- "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",
1181
- "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',
1182
- "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")'
1475
+ scopes (string[], optional) \u2014 Restrict where variable can be applied (default: ALL_SCOPES)
1476
+
1477
+ Response:
1478
+ { results: ({id} | {error})[] }`,
1479
+ "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\n\nResponse:\n { results: ("ok" | {error} | object)[] }',
1480
+ "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)\n\nResponse:\n { results: ("ok" | {error})[] }',
1481
+ "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\n\nResponse:\n { results: ({id} | {error})[] }",
1482
+ "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\n\nResponse:\n { results: ("ok" | {error} | object)[] }',
1483
+ "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")\n\nResponse:\n { results: ("ok" | {error})[] }'
1183
1484
  }
1184
1485
  },
1185
1486
  "variables": {
1186
- "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 per-mode control, or value to set all modes at once. [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. On create, value sets all modes; on update, value sets the default mode only.\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.',
1487
+ "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 per-mode control, or value to set all modes at once. [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. On create, value sets all modes; on update, value sets the default mode only.\n// Aliases in variable values use {type: "VARIABLE_ALIAS", name: "other/variable"}.\n// Paint[] VariableAlias uses {type:"VARIABLE_ALIAS", id:"<VariableID>"}; get IDs from variables.get/list or variable_collections.get. Prefer *VariableName helpers when available.\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.\n// Shared types:\n// Color: hex "#RGB"|"#RGBA"|"#RRGGBB"|"#RRGGBBAA" or {r: 0-1, g: 0-1, b: 0-1, a?: 0-1}\n// VariableAlias: {type: "VARIABLE_ALIAS", id: string}. The id must be a Figma VariableID; discover it via variables.get/list or variable_collections.get. Prefer colorVariableName/fillVariableName/strokeVariableName when available; Paint[] VariableAlias is mainly for precise Paint[] round-trips and gradient stop bindings.\n// Transform: [[number, number, number], [number, number, number]] (Figma Plugin API 2\xD73 matrix)\n// 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"\n// ColorStop: {position: 0-1, color: Color, boundVariables?: {color?: VariableAlias}}\n// GradientPaint: {type: "GRADIENT_LINEAR"|"GRADIENT_RADIAL"|"GRADIENT_ANGULAR"|"GRADIENT_DIAMOND", gradientTransform: Transform, gradientStops: ColorStop[], visible?: boolean, opacity?: number, blendMode?: BlendMode}. Use gradientTransform + gradientStops (basic left-to-right: [[1,0,0],[0,1,0]]); do not use CSS gradients or REST gradientHandlePositions.\n// Paint: Paint[] authoring accepts only SOLID and GRADIENT_LINEAR/GRADIENT_RADIAL/GRADIENT_ANGULAR/GRADIENT_DIAMOND. SolidPaint: {type: "SOLID", color: Color, visible?: boolean, opacity?: number, blendMode?: BlendMode, boundVariables?: {color?: VariableAlias}}. GradientPaint authoring: {type: GRADIENT_*, gradientTransform: Transform, gradientStops: ColorStop[], visible?, opacity?, blendMode?}; bind variables on gradientStops[].boundVariables.color, not top-level gradient boundVariables. Do not pass IMAGE/VIDEO/PATTERN to create/update Paint[]; those may appear only in readback metadata from existing Figma content. Use imageUrl/images for image authoring. VIDEO/PATTERN authoring is not supported here. Do not use CSS gradients or REST gradientHandlePositions.',
1187
1488
  "methods": {
1188
- "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)',
1189
- "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.',
1190
- "create": '# variables.create\nCreate variables in a collection. Use valuesByMode for per-mode control, or value to set all modes at once.\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 Sets all modes to this value. Use valuesByMode for per-mode control.\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)',
1191
- "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.',
1192
- "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)"
1489
+ "list": '# variables.list\nSearch variables within a collection\n\nExample: variables(method:"list", collectionId:"Tokens", 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)\n\nResponse:\n totalCount (number, required)\n returned (number, optional)\n offset (number, optional)\n limit (number, optional)\n items (array, required)\n id (string, required) \u2014 Figma VariableID. Use as VariableAlias.id in Paint[] when needed.\n name (string, required)\n type (string, optional) \u2014 COLOR | FLOAT | STRING | BOOLEAN\n valuesByMode (object, optional) \u2014 Values keyed by mode name\n scopes (string[], optional)\n description (string, optional)\n// Shared types:\n// Color: hex "#RGB"|"#RGBA"|"#RRGGBB"|"#RRGGBBAA" or {r: 0-1, g: 0-1, b: 0-1, a?: 0-1}\n// VariableAlias: {type: "VARIABLE_ALIAS", id: string}. The id must be a Figma VariableID; discover it via variables.get/list or variable_collections.get. Prefer colorVariableName/fillVariableName/strokeVariableName when available; Paint[] VariableAlias is mainly for precise Paint[] round-trips and gradient stop bindings.\n// Transform: [[number, number, number], [number, number, number]] (Figma Plugin API 2\xD73 matrix)\n// 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"\n// ColorStop: {position: 0-1, color: Color, boundVariables?: {color?: VariableAlias}}\n// GradientPaint: {type: "GRADIENT_LINEAR"|"GRADIENT_RADIAL"|"GRADIENT_ANGULAR"|"GRADIENT_DIAMOND", gradientTransform: Transform, gradientStops: ColorStop[], visible?: boolean, opacity?: number, blendMode?: BlendMode}. Use gradientTransform + gradientStops (basic left-to-right: [[1,0,0],[0,1,0]]); do not use CSS gradients or REST gradientHandlePositions.\n// Paint: Paint[] authoring accepts only SOLID and GRADIENT_LINEAR/GRADIENT_RADIAL/GRADIENT_ANGULAR/GRADIENT_DIAMOND. SolidPaint: {type: "SOLID", color: Color, visible?: boolean, opacity?: number, blendMode?: BlendMode, boundVariables?: {color?: VariableAlias}}. GradientPaint authoring: {type: GRADIENT_*, gradientTransform: Transform, gradientStops: ColorStop[], visible?, opacity?, blendMode?}; bind variables on gradientStops[].boundVariables.color, not top-level gradient boundVariables. Do not pass IMAGE/VIDEO/PATTERN to create/update Paint[]; those may appear only in readback metadata from existing Figma content. Use imageUrl/images for image authoring. VIDEO/PATTERN authoring is not supported here. Do not use CSS gradients or REST gradientHandlePositions.',
1490
+ "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.\n\nResponse:\n id (string, required) \u2014 Figma VariableID. Use as VariableAlias.id in Paint[] when needed.\n name (string, required)\n type (COLOR | FLOAT | STRING | BOOLEAN, required)\n collectionId (string, required) \u2014 Collection display name\n valuesByMode (Record<string, number | boolean | string | Color | {type: "VARIABLE_ALIAS", name: string}>, required) \u2014 Values keyed by mode name (e.g. "Light", "Dark")\n description (string, optional) \u2014 Variable description\n scopes (string[], optional) \u2014 Where this variable can be applied\n// Shared types:\n// Color: hex "#RGB"|"#RGBA"|"#RRGGBB"|"#RRGGBBAA" or {r: 0-1, g: 0-1, b: 0-1, a?: 0-1}\n// VariableAlias: {type: "VARIABLE_ALIAS", id: string}. The id must be a Figma VariableID; discover it via variables.get/list or variable_collections.get. Prefer colorVariableName/fillVariableName/strokeVariableName when available; Paint[] VariableAlias is mainly for precise Paint[] round-trips and gradient stop bindings.\n// Transform: [[number, number, number], [number, number, number]] (Figma Plugin API 2\xD73 matrix)\n// 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"\n// ColorStop: {position: 0-1, color: Color, boundVariables?: {color?: VariableAlias}}\n// GradientPaint: {type: "GRADIENT_LINEAR"|"GRADIENT_RADIAL"|"GRADIENT_ANGULAR"|"GRADIENT_DIAMOND", gradientTransform: Transform, gradientStops: ColorStop[], visible?: boolean, opacity?: number, blendMode?: BlendMode}. Use gradientTransform + gradientStops (basic left-to-right: [[1,0,0],[0,1,0]]); do not use CSS gradients or REST gradientHandlePositions.\n// Paint: Paint[] authoring accepts only SOLID and GRADIENT_LINEAR/GRADIENT_RADIAL/GRADIENT_ANGULAR/GRADIENT_DIAMOND. SolidPaint: {type: "SOLID", color: Color, visible?: boolean, opacity?: number, blendMode?: BlendMode, boundVariables?: {color?: VariableAlias}}. GradientPaint authoring: {type: GRADIENT_*, gradientTransform: Transform, gradientStops: ColorStop[], visible?, opacity?, blendMode?}; bind variables on gradientStops[].boundVariables.color, not top-level gradient boundVariables. Do not pass IMAGE/VIDEO/PATTERN to create/update Paint[]; those may appear only in readback metadata from existing Figma content. Use imageUrl/images for image authoring. VIDEO/PATTERN authoring is not supported here. Do not use CSS gradients or REST gradientHandlePositions.',
1491
+ "create": '# variables.create\nCreate variables in a collection. Use valuesByMode for per-mode control, or value to set all modes at once.\n\nExample: variables(method:"create", collectionId:"Tokens", items:[{name:"bg/warning", type:"COLOR", value:"#F59E0B", 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 Sets all modes to this value. Use valuesByMode for per-mode control.\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)\n\nResponse:\n { results: ({id} | {error})[] }',
1492
+ "update": '# variables.update\nUpdate variable metadata and/or set values\n\nExample: variables(method:"update", collectionId:"Tokens", items:[{name:"bg/accent", value:"#1D4ED8"}])\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.\n\nResponse:\n { results: ("ok" | {error} | object)[] }',
1493
+ "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)\n\nResponse:\n { results: ("ok" | {error})[] }'
1193
1494
  }
1194
1495
  },
1195
1496
  "version_history": {
@@ -1210,7 +1511,10 @@ Save a named version to the file's version history
1210
1511
 
1211
1512
  Params:
1212
1513
  title (string, required) \u2014 Version title (e.g., "Added hero sections with website copy")
1213
- description (string, optional) \u2014 Optional longer description of what changed`
1514
+ description (string, optional) \u2014 Optional longer description of what changed
1515
+
1516
+ Response:
1517
+ id (string, required) \u2014 Version ID returned by Figma`
1214
1518
  }
1215
1519
  }
1216
1520
  };
@@ -1361,6 +1665,113 @@ var colorRgba = z2.preprocess((v) => {
1361
1665
  z2.string()
1362
1666
  // Non-hex strings pass through for handler-level style/variable resolution
1363
1667
  ])).describe('Hex "#FF0000", {r,g,b,a?} 0-1, or style/variable name.');
1668
+ var variableAlias = z2.object({
1669
+ type: z2.literal("VARIABLE_ALIAS"),
1670
+ id: z2.string()
1671
+ }).strict().describe('{type:"VARIABLE_ALIAS", id:string}. Discover VariableIDs via variables.get/list or variable_collections.get; prefer *VariableName helpers when available.');
1672
+ var transform = z2.tuple([
1673
+ z2.tuple([z2.coerce.number(), z2.coerce.number(), z2.coerce.number()]),
1674
+ z2.tuple([z2.coerce.number(), z2.coerce.number(), z2.coerce.number()])
1675
+ ]).describe("Figma Plugin API Transform: [[number,number,number],[number,number,number]]");
1676
+ var blendMode = z2.enum([
1677
+ "PASS_THROUGH",
1678
+ "NORMAL",
1679
+ "DARKEN",
1680
+ "MULTIPLY",
1681
+ "LINEAR_BURN",
1682
+ "COLOR_BURN",
1683
+ "LIGHTEN",
1684
+ "SCREEN",
1685
+ "LINEAR_DODGE",
1686
+ "COLOR_DODGE",
1687
+ "OVERLAY",
1688
+ "SOFT_LIGHT",
1689
+ "HARD_LIGHT",
1690
+ "DIFFERENCE",
1691
+ "EXCLUSION",
1692
+ "HUE",
1693
+ "SATURATION",
1694
+ "COLOR",
1695
+ "LUMINOSITY"
1696
+ ]);
1697
+ var paintColor = z2.preprocess((v) => {
1698
+ if (typeof v === "string") return parseHex(v) ?? v;
1699
+ return v;
1700
+ }, z2.object({
1701
+ r: z2.coerce.number().min(0).max(1),
1702
+ g: z2.coerce.number().min(0).max(1),
1703
+ b: z2.coerce.number().min(0).max(1),
1704
+ a: z2.coerce.number().min(0).max(1).optional()
1705
+ }).strict()).describe('Paint color: hex "#FF0000"/"#FF000080" or {r,g,b,a?} 0-1. Non-hex strings are not valid inside Paint[].');
1706
+ var paintBoundVariables = z2.object({
1707
+ color: variableAlias.optional()
1708
+ }).strict();
1709
+ var commonPaintFields = {
1710
+ visible: flexBool(z2.boolean()).optional(),
1711
+ opacity: z2.coerce.number().min(0).max(1).optional(),
1712
+ blendMode: blendMode.optional()
1713
+ };
1714
+ var colorStop = z2.object({
1715
+ position: z2.coerce.number().min(0).max(1),
1716
+ color: paintColor,
1717
+ boundVariables: paintBoundVariables.optional()
1718
+ }).strict().describe("ColorStop: {position:0..1, color: Color, boundVariables?: {color: VariableAlias}}");
1719
+ var solidPaint = z2.object({
1720
+ type: z2.literal("SOLID"),
1721
+ color: paintColor,
1722
+ boundVariables: paintBoundVariables.optional(),
1723
+ ...commonPaintFields
1724
+ }).strict();
1725
+ var gradientPaint = z2.object({
1726
+ type: z2.enum(["GRADIENT_LINEAR", "GRADIENT_RADIAL", "GRADIENT_ANGULAR", "GRADIENT_DIAMOND"]),
1727
+ gradientTransform: transform,
1728
+ gradientStops: z2.array(colorStop),
1729
+ ...commonPaintFields
1730
+ }).strict().describe("GradientPaint: use gradientTransform + gradientStops. Do not use REST gradientHandlePositions.");
1731
+ var imageFilters = z2.object({
1732
+ exposure: z2.coerce.number().optional(),
1733
+ contrast: z2.coerce.number().optional(),
1734
+ saturation: z2.coerce.number().optional(),
1735
+ temperature: z2.coerce.number().optional(),
1736
+ tint: z2.coerce.number().optional(),
1737
+ highlights: z2.coerce.number().optional(),
1738
+ shadows: z2.coerce.number().optional()
1739
+ }).strict();
1740
+ var imagePaint = z2.object({
1741
+ type: z2.literal("IMAGE"),
1742
+ scaleMode: z2.enum(["FILL", "FIT", "CROP", "TILE"]),
1743
+ imageHash: z2.string().nullable(),
1744
+ imageTransform: transform.optional(),
1745
+ scalingFactor: z2.coerce.number().optional(),
1746
+ rotation: z2.coerce.number().optional(),
1747
+ filters: imageFilters.optional(),
1748
+ ...commonPaintFields
1749
+ }).strict();
1750
+ var videoPaint = z2.object({
1751
+ type: z2.literal("VIDEO"),
1752
+ scaleMode: z2.enum(["FILL", "FIT", "CROP", "TILE"]),
1753
+ videoHash: z2.string().nullable(),
1754
+ videoTransform: transform.optional(),
1755
+ scalingFactor: z2.coerce.number().optional(),
1756
+ rotation: z2.coerce.number().optional(),
1757
+ filters: imageFilters.optional(),
1758
+ ...commonPaintFields
1759
+ }).strict();
1760
+ var patternPaint = z2.object({
1761
+ type: z2.literal("PATTERN"),
1762
+ sourceNodeId: z2.string(),
1763
+ tileType: z2.enum(["RECTANGULAR", "HORIZONTAL_HEXAGONAL", "VERTICAL_HEXAGONAL"]),
1764
+ scalingFactor: z2.coerce.number(),
1765
+ spacing: z2.object({ x: z2.coerce.number(), y: z2.coerce.number() }).strict(),
1766
+ horizontalAlignment: z2.enum(["START", "CENTER", "END"]),
1767
+ ...commonPaintFields
1768
+ }).strict();
1769
+ var paintInput = z2.union([solidPaint, gradientPaint], {
1770
+ error: "Invalid Paint[] payload. Supported Paint[] authoring types: SOLID, GRADIENT_LINEAR, GRADIENT_RADIAL, GRADIENT_ANGULAR, GRADIENT_DIAMOND. Use gradientTransform + gradientStops; do not use CSS gradients, REST gradientHandlePositions, IMAGE, VIDEO, or PATTERN."
1771
+ }).describe("Paint[] authoring input supports SOLID and Figma gradient paints only. Images use imageUrl/images endpoint; VIDEO and PATTERN authoring are not supported here.");
1772
+ var paint = paintInput.describe("Paint[] authoring input. Supports SOLID and gradients: GRADIENT_LINEAR, GRADIENT_RADIAL, GRADIENT_ANGULAR, GRADIENT_DIAMOND. Use gradientTransform + gradientStops; REST gradientHandlePositions is not accepted. IMAGE/VIDEO/PATTERN are readback-only metadata, not authoring input.");
1773
+ var paintArray = flexJson(z2.array(paintInput)).describe("Paint[] input array. Authoring accepts only SOLID and gradients: GRADIENT_LINEAR, GRADIENT_RADIAL, GRADIENT_ANGULAR, GRADIENT_DIAMOND. Use imageUrl/images for images; VIDEO/PATTERN authoring is not supported here.");
1774
+ var paintArrayLoose = flexJson(z2.array(z2.unknown())).describe("Paint[] input array. Authoring accepts only SOLID and gradients. Adapter validates details and returns guidance; CSS gradients, REST gradientHandlePositions, IMAGE, VIDEO, and PATTERN are not supported as authoring input. Use imageUrl/images for images.");
1364
1775
  var variableValue = z2.preprocess((v) => {
1365
1776
  if (typeof v === "string") return parseHex(v) ?? v;
1366
1777
  return v;
@@ -1438,6 +1849,7 @@ var tools = [
1438
1849
  if (params.id === void 0) throw new Error('delete_category requires "id"');
1439
1850
  }
1440
1851
  if (!params.items) return;
1852
+ if (Array.isArray(params.items) && params.items.length === 0) throw new Error('items: [] is a no-op. Batch calls need at least one item. Omit items to use single-item params, or pass one or more item objects. Use annotations(method: "help", topic: "' + m + '") to see valid item shapes.');
1441
1853
  if (m === "get") {
1442
1854
  const itemSchema = z3.object({
1443
1855
  id: z3.string(),
@@ -1450,8 +1862,11 @@ var tools = [
1450
1862
  throw new Error(e.issues.map((i) => {
1451
1863
  const path = i.path.join(".");
1452
1864
  const shape = itemSchema instanceof z3.ZodObject ? itemSchema.shape : null;
1453
- const desc = shape?.[i.path[1]]?.description;
1454
- return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
1865
+ const field = String(i.path[1] ?? i.path[0] ?? "");
1866
+ const desc = shape?.[field]?.description;
1867
+ const paintField = field === "paints" || field === "fills" || field === "strokes";
1868
+ const paintHelp = paintField ? ' Invalid Paint[] payload. Supported Paint[] authoring types: SOLID, GRADIENT_LINEAR, GRADIENT_RADIAL, GRADIENT_ANGULAR, GRADIENT_DIAMOND. Use gradientTransform + gradientStops; do not use CSS gradients or REST gradientHandlePositions. IMAGE/VIDEO/PATTERN are readback-only metadata, not Paint[] authoring input; use imageUrl/images for images. For examples call annotations(method:"help", topic:"get").' : "";
1869
+ return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "") + paintHelp;
1455
1870
  }).join("; "));
1456
1871
  }
1457
1872
  throw e;
@@ -1469,8 +1884,11 @@ var tools = [
1469
1884
  throw new Error(e.issues.map((i) => {
1470
1885
  const path = i.path.join(".");
1471
1886
  const shape = itemSchema instanceof z3.ZodObject ? itemSchema.shape : null;
1472
- const desc = shape?.[i.path[1]]?.description;
1473
- return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
1887
+ const field = String(i.path[1] ?? i.path[0] ?? "");
1888
+ const desc = shape?.[field]?.description;
1889
+ const paintField = field === "paints" || field === "fills" || field === "strokes";
1890
+ const paintHelp = paintField ? ' Invalid Paint[] payload. Supported Paint[] authoring types: SOLID, GRADIENT_LINEAR, GRADIENT_RADIAL, GRADIENT_ANGULAR, GRADIENT_DIAMOND. Use gradientTransform + gradientStops; do not use CSS gradients or REST gradientHandlePositions. IMAGE/VIDEO/PATTERN are readback-only metadata, not Paint[] authoring input; use imageUrl/images for images. For examples call annotations(method:"help", topic:"set").' : "";
1891
+ return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "") + paintHelp;
1474
1892
  }).join("; "));
1475
1893
  }
1476
1894
  throw e;
@@ -1491,8 +1909,11 @@ var tools = [
1491
1909
  throw new Error(e.issues.map((i) => {
1492
1910
  const path = i.path.join(".");
1493
1911
  const shape = itemSchema instanceof z3.ZodObject ? itemSchema.shape : null;
1494
- const desc = shape?.[i.path[1]]?.description;
1495
- return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
1912
+ const field = String(i.path[1] ?? i.path[0] ?? "");
1913
+ const desc = shape?.[field]?.description;
1914
+ const paintField = field === "paints" || field === "fills" || field === "strokes";
1915
+ const paintHelp = paintField ? ' Invalid Paint[] payload. Supported Paint[] authoring types: SOLID, GRADIENT_LINEAR, GRADIENT_RADIAL, GRADIENT_ANGULAR, GRADIENT_DIAMOND. Use gradientTransform + gradientStops; do not use CSS gradients or REST gradientHandlePositions. IMAGE/VIDEO/PATTERN are readback-only metadata, not Paint[] authoring input; use imageUrl/images for images. For examples call annotations(method:"help", topic:"add").' : "";
1916
+ return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "") + paintHelp;
1496
1917
  }).join("; "));
1497
1918
  }
1498
1919
  throw e;
@@ -1510,8 +1931,11 @@ var tools = [
1510
1931
  throw new Error(e.issues.map((i) => {
1511
1932
  const path = i.path.join(".");
1512
1933
  const shape = itemSchema instanceof z3.ZodObject ? itemSchema.shape : null;
1513
- const desc = shape?.[i.path[1]]?.description;
1514
- return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
1934
+ const field = String(i.path[1] ?? i.path[0] ?? "");
1935
+ const desc = shape?.[field]?.description;
1936
+ const paintField = field === "paints" || field === "fills" || field === "strokes";
1937
+ const paintHelp = paintField ? ' Invalid Paint[] payload. Supported Paint[] authoring types: SOLID, GRADIENT_LINEAR, GRADIENT_RADIAL, GRADIENT_ANGULAR, GRADIENT_DIAMOND. Use gradientTransform + gradientStops; do not use CSS gradients or REST gradientHandlePositions. IMAGE/VIDEO/PATTERN are readback-only metadata, not Paint[] authoring input; use imageUrl/images for images. For examples call annotations(method:"help", topic:"remove").' : "";
1938
+ return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "") + paintHelp;
1515
1939
  }).join("; "));
1516
1940
  }
1517
1941
  throw e;
@@ -1522,16 +1946,17 @@ var tools = [
1522
1946
  },
1523
1947
  {
1524
1948
  name: "components",
1525
- description: '/** Create and manage reusable components and variant sets. Use method "help" for detailed parameter docs. */\n clone (id?, name?, parentId?, x?, y?, items?: { id: string; name?: string; parentId?: string; x?: number; y?: number }[], depth?) \u2192 { results: {id}[] } // Duplicate nodes \u2014 produces a same-type copy (frame\u2192frame, instance\u2192instance, component\u2192component). Instance clones reference the same source component; they do not duplicate the component definition.\n audit (id, rules?, maxDepth?, maxFindings?, minSeverity?: error|unsafe|heuristic|style|verbose, skipInstances?) \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?, depth?, verbose?) \u2192 { results, _truncated? } // Get component detail \u2014 property definitions + optional node tree for structural inspection\n create (type: component|from_node|variant_set, items: (ComponentItem | FromNodeItem | VariantSetItem)[]) \u2192 { results: {id}[] } // Create components\n commit (id) \u2192 { results: {id}[] } // Commit a staged component \u2014 unwraps from [STAGED] container into the original target location.\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).',
1949
+ description: '/** Create and manage reusable components and variant sets. Use method "help" for detailed parameter docs. */\n clone (id?, name?, parentId?, x?, y?, items?: { id: string; name?: string; parentId?: string; x?: number; y?: number }[], depth?) \u2192 { results: {id}[] } // Duplicate nodes \u2014 produces a same-type copy (frame\u2192frame, instance\u2192instance, component\u2192component). Instance clones reference the same source component; they do not duplicate the component definition.\n scale (id?, factor?, items?: { id: string; factor: number }[]) \u2192 { results: "ok"[] } // Proportionally rescale a node subtree using Figma\'s visual Scale tool behavior. This is for visual/artifact scaling, not responsive layout resizing.\n audit (id, rules?, maxDepth?, maxFindings?, minSeverity?: error|unsafe|heuristic|style|verbose, skipInstances?) \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?, depth?, verbose?) \u2192 { results, _truncated? } // Get component detail \u2014 property definitions + optional node tree for structural inspection\n create (type: component|from_node|variant_set, items: (ComponentItem | FromNodeItem | VariantSetItem)[]) \u2192 { results: {id}[] } // Create components\n commit (id) \u2192 { results: {id}[] } // Commit a staged component \u2014 unwraps from [STAGED] container into the original target location.\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).',
1526
1950
  schema: (caps2) => filterMethodsByTier({
1527
- method: z3.enum(["clone", "audit", "reparent", "list", "get", "create", "commit", "update", "delete", "help"]),
1951
+ method: z3.enum(["clone", "scale", "audit", "reparent", "list", "get", "create", "commit", "update", "delete", "help"]),
1528
1952
  id: z3.string().optional().describe("Node ID"),
1529
1953
  name: z3.string().optional().describe("Rename the clone (set before appending to parent \u2014 required when cloning a variant into its component set to avoid duplicate names)"),
1530
1954
  parentId: z3.string().optional().describe("Parent node ID. Omit to place at current page root."),
1531
1955
  x: z3.coerce.number().optional().describe("X position (default: 0)"),
1532
1956
  y: z3.coerce.number().optional().describe("Y position (default: 0)"),
1533
- items: flexJson(z3.array(z3.record(z3.string(), z3.unknown()))).optional().describe("Array of {id, ...properties} to clone/reparent/update"),
1957
+ items: flexJson(z3.array(z3.record(z3.string(), z3.unknown()))).optional().describe("Array of {id, ...properties} to clone/scale/reparent/update"),
1534
1958
  depth: z3.coerce.number().optional().describe("Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited."),
1959
+ factor: z3.coerce.number().optional().describe("Scale factor, >= 0.01. 0.5 = 50%, 2 = 200%. Scales children, text, strokes, effects, and layout geometry from the node's top-left. On auto-layout or HUG/FILL nodes, Figma may resolve responsive sizing to fixed width/height."),
1535
1960
  rules: flexStringList(z3.array(z3.string())).optional().describe('Rules to check. Default: ["all"]. Categories: "component", "composition", "token", "naming", "wcag".'),
1536
1961
  maxDepth: z3.coerce.number().optional().describe("Max tree depth (default: 10)"),
1537
1962
  maxFindings: z3.coerce.number().optional().describe("Max findings (default: 50)"),
@@ -1544,10 +1969,16 @@ var tools = [
1544
1969
  verbose: z3.boolean().optional().describe("Include all properties (bounding box, constraints, text style details). Default false \u2014 returns slim, actionable output."),
1545
1970
  type: z3.enum(["component", "from_node", "variant_set"]).optional().describe("Discriminant for create method"),
1546
1971
  topic: z3.string().optional().describe('Help topic \u2014 method name for endpoint help, e.g. "create"')
1547
- }, caps2, { "clone": "create", "audit": "read", "reparent": "edit", "list": "read", "get": "read", "create": "create", "commit": "edit", "update": "edit", "delete": "edit", "help": "read" }),
1972
+ }, caps2, { "clone": "create", "scale": "edit", "audit": "read", "reparent": "edit", "list": "read", "get": "read", "create": "create", "commit": "edit", "update": "edit", "delete": "edit", "help": "read" }),
1548
1973
  tier: "read",
1549
1974
  validate: (params) => {
1550
1975
  const m = params.method;
1976
+ if (m === "create") {
1977
+ const itemDiscriminant = Array.isArray(params.items) ? params.items.find((it) => it && typeof it === "object" && typeof it.type === "string")?.type : void 0;
1978
+ if (params.type === void 0) {
1979
+ throw new Error(itemDiscriminant ? 'components.create uses top-level "type", not "type" inside items. Move the item value to the top level and use help for valid item shapes.' : 'components.create requires top-level "type" (component, from_node, variant_set). Use components(method: "help", topic: "create") for valid item shapes.');
1980
+ }
1981
+ }
1551
1982
  if (m === "commit") {
1552
1983
  if (params.id === void 0) throw new Error('commit requires "id"');
1553
1984
  }
@@ -1555,6 +1986,7 @@ var tools = [
1555
1986
  if (params.id === void 0) throw new Error('delete requires "id"');
1556
1987
  }
1557
1988
  if (!params.items) return;
1989
+ if (Array.isArray(params.items) && params.items.length === 0) throw new Error('items: [] is a no-op. Batch calls need at least one item. Omit items to use single-item params, or pass one or more item objects. Use components(method: "help", topic: "' + m + '") to see valid item shapes.');
1558
1990
  if (m === "create") {
1559
1991
  if (params.items) {
1560
1992
  if (params.type === "variant_set") for (const it of params.items) {
@@ -1578,13 +2010,13 @@ var tools = [
1578
2010
  opacity: token.optional().describe("Opacity (0-1) or variable name"),
1579
2011
  blendMode: z3.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(),
1580
2012
  effectStyleName: z3.string().optional().describe("Effect style name (e.g. 'Shadow/Card') for shadows, blurs"),
1581
- fills: z3.array(z3.record(z3.string(), z3.unknown())).optional().describe("Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills."),
2013
+ fills: paintArrayLoose.optional().describe("Fill Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] for transparent. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables; use imageUrl/images for image authoring. IMAGE/VIDEO/PATTERN may appear in readback metadata only. Primary way to set non-image fills."),
1582
2014
  fillColor: colorRgba.optional().describe("Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)"),
1583
2015
  fillStyleName: z3.string().optional().describe("Paint style name for fill"),
1584
- fillVariableName: z3.string().optional().describe("Color variable by name e.g. 'bg/primary'"),
2016
+ fillVariableName: z3.string().optional().describe("Color variable by name e.g. 'bg/surface'"),
1585
2017
  imageUrl: z3.string().optional().describe("Image source \u2014 'pexel:<id>' for Pexels photos, a public URL, or a local file path. SVGs are inserted as vectors; raster images become IMAGE fills."),
1586
2018
  imageScaleMode: z3.enum(["FILL", "FIT", "CROP", "TILE"]).optional().describe("How the image is scaled within the frame (default: FILL)"),
1587
- strokes: z3.array(z3.record(z3.string(), z3.unknown())).optional().describe("Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes."),
2019
+ strokes: paintArrayLoose.optional().describe("Stroke Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] to clear. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables. IMAGE/VIDEO/PATTERN may appear in readback metadata only. Primary way to set strokes."),
1588
2020
  strokeColor: colorRgba.optional().describe("Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)"),
1589
2021
  strokeStyleName: z3.string().optional().describe("Paint style name for stroke"),
1590
2022
  strokeVariableName: z3.string().optional().describe("Color variable by name for stroke"),
@@ -1621,7 +2053,7 @@ var tools = [
1621
2053
  maxHeight: z3.coerce.number().optional().describe("Max height for responsive auto-layout"),
1622
2054
  annotations: flexJson(z3.array(z3.record(z3.string(), z3.unknown()))).optional().describe("Set annotations \u2014 [{label?, labelMarkdown?, properties?, categoryId?}]. Properties validated per node type."),
1623
2055
  description: z3.string().optional().describe("Component description (shown in Figma's component panel)"),
1624
- children: flexJson(z3.array(z3.record(z3.string(), z3.unknown()))).optional().describe('Inline child nodes \u2014 build nested trees in one call. Types: text: {type:"text", text, componentPropertyName?, fontFamily?, fontSize?, fontWeight?, fontStyle?, fontColor?, layoutSizingHorizontal?}. frame: {type:"frame", name?, layoutMode?, fillColor?, width?, layoutSizingHorizontal?, children?}. instance: {type:"instance", componentId, componentPropertyName?, variantProperties?, properties?}. component: {type:"component", name, children?}. All params from text/frame endpoints are supported on their respective types. componentPropertyName auto-creates and binds a TEXT (text) or INSTANCE_SWAP (instance) property. Always set layoutSizingHorizontal + layoutSizingVertical on children inside auto-layout parents (FILL, HUG, or FIXED). Example: children:[{type:"text", text:"Label", componentPropertyName:"Label", fontSize:14, fontColorVariableName:"text/primary", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG"}, {type:"frame", name:"Actions", layoutMode:"HORIZONTAL", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG", itemSpacing:8, children:[{type:"instance", componentId:"1:2", componentPropertyName:"Action", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG"}]}]\n'),
2056
+ children: flexJson(z3.array(z3.record(z3.string(), z3.unknown()))).optional().describe('Inline child nodes \u2014 build nested trees in one call. Types: text: {type:"text", text, componentPropertyName?, textStyleName?, fontColorVariableName?, layoutSizingHorizontal?}. frame: {type:"frame", name?, layoutMode?, fillVariableName?, itemSpacing?, layoutSizingHorizontal?, children?}. instance: {type:"instance", componentId, componentPropertyName?, variantProperties?, properties?}. component: {type:"component", name, children?}. rectangle / ellipse / line: same params as the corresponding frames(method:"create", type:"rectangle"|"ellipse"|"line") branch. All params from text/frame endpoints are supported on their respective types. Inline fills/strokes accept Paint[] authoring input: SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. Do not use CSS gradients, REST gradientHandlePositions, or IMAGE/VIDEO/PATTERN in Paint[] authoring. componentPropertyName auto-creates and binds a TEXT (text) or INSTANCE_SWAP (instance) property. Always set layoutSizingHorizontal + layoutSizingVertical on children inside auto-layout parents (FILL, HUG, or FIXED). Example: children:[{type:"ellipse", name:"Dot", width:6, height:6, fillVariableName:"status/active"}, {type:"text", name:"Label", text:"Button", componentPropertyName:"Label", textStyleName:"Body/Medium", fontColorVariableName:"text/primary", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG"}, {type:"frame", name:"Actions", layoutMode:"HORIZONTAL", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG", itemSpacing:"space/8", children:[{type:"instance", componentId:"1:2", componentPropertyName:"Action", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG"}]}]\n'),
1625
2057
  properties: flexJson(z3.array(z3.record(z3.string(), z3.unknown()))).optional().describe("Component properties to define at creation: [{propertyName, type, defaultValue}]. TEXT properties for inline children with componentPropertyName are created automatically.")
1626
2058
  }).passthrough(),
1627
2059
  "from_node": z3.object({
@@ -1642,13 +2074,13 @@ var tools = [
1642
2074
  opacity: token.optional().describe("Opacity (0-1) or variable name"),
1643
2075
  blendMode: z3.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(),
1644
2076
  effectStyleName: z3.string().optional().describe("Effect style name (e.g. 'Shadow/Card') for shadows, blurs"),
1645
- fills: z3.array(z3.record(z3.string(), z3.unknown())).optional().describe("Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills."),
2077
+ fills: paintArrayLoose.optional().describe("Fill Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] for transparent. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables; use imageUrl/images for image authoring. IMAGE/VIDEO/PATTERN may appear in readback metadata only. Primary way to set non-image fills."),
1646
2078
  fillColor: colorRgba.optional().describe("Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)"),
1647
2079
  fillStyleName: z3.string().optional().describe("Paint style name for fill"),
1648
- fillVariableName: z3.string().optional().describe("Color variable by name e.g. 'bg/primary'"),
2080
+ fillVariableName: z3.string().optional().describe("Color variable by name e.g. 'bg/surface'"),
1649
2081
  imageUrl: z3.string().optional().describe("Image source \u2014 'pexel:<id>' for Pexels photos, a public URL, or a local file path. SVGs are inserted as vectors; raster images become IMAGE fills."),
1650
2082
  imageScaleMode: z3.enum(["FILL", "FIT", "CROP", "TILE"]).optional().describe("How the image is scaled within the frame (default: FILL)"),
1651
- strokes: z3.array(z3.record(z3.string(), z3.unknown())).optional().describe("Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes."),
2083
+ strokes: paintArrayLoose.optional().describe("Stroke Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] to clear. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables. IMAGE/VIDEO/PATTERN may appear in readback metadata only. Primary way to set strokes."),
1652
2084
  strokeColor: colorRgba.optional().describe("Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)"),
1653
2085
  strokeStyleName: z3.string().optional().describe("Paint style name for stroke"),
1654
2086
  strokeVariableName: z3.string().optional().describe("Color variable by name for stroke"),
@@ -1686,24 +2118,26 @@ var tools = [
1686
2118
  annotations: flexJson(z3.array(z3.record(z3.string(), z3.unknown()))).optional().describe("Set annotations \u2014 [{label?, labelMarkdown?, properties?, categoryId?}]. Properties validated per node type."),
1687
2119
  componentIds: flexStringList(z3.array(z3.string())).optional().describe("Existing component IDs to combine (min 2). Alternative to children."),
1688
2120
  variantPropertyName: z3.string().optional().describe("Rename the auto-generated variant property (default: 'Property 1')"),
1689
- children: flexJson(z3.array(z3.record(z3.string(), z3.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.')
2121
+ children: flexJson(z3.array(z3.record(z3.string(), z3.unknown()))).optional().describe('Inline variant components. Each must be {type:"component", name, children?, ...frame_params}. Variant children use the same inline child types as components.create, including rectangle / ellipse / line. All variants must share the same child structure. Alternative to componentIds \u2014 do not combine both.')
1690
2122
  }).passthrough()
1691
2123
  };
1692
2124
  const s = params.type && schemas[params.type];
1693
- if (s) {
1694
- try {
1695
- params.items = z3.array(s).parse(params.items);
1696
- } catch (e) {
1697
- if (e instanceof z3.ZodError) {
1698
- throw new Error(e.issues.map((i) => {
1699
- const path = i.path.join(".");
1700
- const shape = s instanceof z3.ZodObject ? s.shape : null;
1701
- const desc = shape?.[i.path[1]]?.description;
1702
- return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
1703
- }).join("; "));
1704
- }
1705
- throw e;
2125
+ if (!s) throw new Error('components.create: unknown type. Use components(method: "help", topic: "create") for valid types and item shapes.');
2126
+ try {
2127
+ params.items = z3.array(s).parse(params.items);
2128
+ } catch (e) {
2129
+ if (e instanceof z3.ZodError) {
2130
+ throw new Error(e.issues.map((i) => {
2131
+ const path = i.path.join(".");
2132
+ const shape = s instanceof z3.ZodObject ? s.shape : null;
2133
+ const field = String(i.path[1] ?? i.path[0] ?? "");
2134
+ const desc = shape?.[field]?.description;
2135
+ const paintField = field === "paints" || field === "fills" || field === "strokes";
2136
+ const paintHelp = paintField ? ' Invalid Paint[] payload. Supported Paint[] authoring types: SOLID, GRADIENT_LINEAR, GRADIENT_RADIAL, GRADIENT_ANGULAR, GRADIENT_DIAMOND. Use gradientTransform + gradientStops; do not use CSS gradients or REST gradientHandlePositions. IMAGE/VIDEO/PATTERN are readback-only metadata, not Paint[] authoring input; use imageUrl/images for images. For examples call components(method:"help", topic:"create").' : "";
2137
+ return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "") + paintHelp;
2138
+ }).join("; "));
1706
2139
  }
2140
+ throw e;
1707
2141
  }
1708
2142
  }
1709
2143
  if (m === "update") {
@@ -1723,15 +2157,18 @@ var tools = [
1723
2157
  throw new Error(e.issues.map((i) => {
1724
2158
  const path = i.path.join(".");
1725
2159
  const shape = itemSchema instanceof z3.ZodObject ? itemSchema.shape : null;
1726
- const desc = shape?.[i.path[1]]?.description;
1727
- return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
2160
+ const field = String(i.path[1] ?? i.path[0] ?? "");
2161
+ const desc = shape?.[field]?.description;
2162
+ const paintField = field === "paints" || field === "fills" || field === "strokes";
2163
+ const paintHelp = paintField ? ' Invalid Paint[] payload. Supported Paint[] authoring types: SOLID, GRADIENT_LINEAR, GRADIENT_RADIAL, GRADIENT_ANGULAR, GRADIENT_DIAMOND. Use gradientTransform + gradientStops; do not use CSS gradients or REST gradientHandlePositions. IMAGE/VIDEO/PATTERN are readback-only metadata, not Paint[] authoring input; use imageUrl/images for images. For examples call components(method:"help", topic:"update").' : "";
2164
+ return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "") + paintHelp;
1728
2165
  }).join("; "));
1729
2166
  }
1730
2167
  throw e;
1731
2168
  }
1732
2169
  }
1733
2170
  },
1734
- commandMap: { "clone": "components.clone", "audit": "components.audit", "reparent": "components.reparent", "list": "components.list", "get": "components.get", "create": "components.create", "commit": "components.commit", "update": "components.update", "delete": "components.delete" }
2171
+ commandMap: { "clone": "components.clone", "scale": "components.scale", "audit": "components.audit", "reparent": "components.reparent", "list": "components.list", "get": "components.get", "create": "components.create", "commit": "components.commit", "update": "components.update", "delete": "components.delete" }
1735
2172
  },
1736
2173
  {
1737
2174
  name: "connection",
@@ -1781,9 +2218,9 @@ var tools = [
1781
2218
  },
1782
2219
  {
1783
2220
  name: "frames",
1784
- 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?, name?, parentId?, x?, y?, items?: { id: string; name?: string; parentId?: string; x?: number; y?: number }[], depth?) \u2192 { results: {id}[] } // Duplicate nodes \u2014 produces a same-type copy (frame\u2192frame, instance\u2192instance, component\u2192component). Instance clones reference the same source component; they do not duplicate the component definition.\n audit (id, rules?, maxDepth?, maxFindings?, minSeverity?: error|unsafe|heuristic|style|verbose, skipInstances?) \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|slot, items: (FrameItem | AutoLayoutItem | SectionItem | RectangleItem | EllipseItem | LineItem | GroupItem | BooleanOperationItem | SvgItem | SlotItem)[]) \u2192 { results: {id}[] } // Create frame-like containers\n commit (id) \u2192 { results: {id}[] } // Commit a staged node \u2014 unwraps from [STAGED] container into the original target location.\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).',
2221
+ 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?, name?, parentId?, x?, y?, items?: { id: string; name?: string; parentId?: string; x?: number; y?: number }[], depth?) \u2192 { results: {id}[] } // Duplicate nodes \u2014 produces a same-type copy (frame\u2192frame, instance\u2192instance, component\u2192component). Instance clones reference the same source component; they do not duplicate the component definition.\n scale (id?, factor?, items?: { id: string; factor: number }[]) \u2192 { results: "ok"[] } // Proportionally rescale a node subtree using Figma\'s visual Scale tool behavior. This is for visual/artifact scaling, not responsive layout resizing.\n audit (id, rules?, maxDepth?, maxFindings?, minSeverity?: error|unsafe|heuristic|style|verbose, skipInstances?) \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|slot, items: (FrameItem | AutoLayoutItem | SectionItem | RectangleItem | EllipseItem | LineItem | GroupItem | BooleanOperationItem | SvgItem | SlotItem)[]) \u2192 { results: {id}[] } // Create frame-like containers\n commit (id) \u2192 { results: {id}[] } // Commit a staged node \u2014 unwraps from [STAGED] container into the original target location.\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).',
1785
2222
  schema: (caps2) => filterMethodsByTier({
1786
- method: z3.enum(["get", "list", "update", "delete", "clone", "audit", "reparent", "create", "commit", "export", "help"]),
2223
+ method: z3.enum(["get", "list", "update", "delete", "clone", "scale", "audit", "reparent", "create", "commit", "export", "help"]),
1787
2224
  id: z3.string().optional().describe("Node ID"),
1788
2225
  fields: flexStringList(z3.array(z3.string())).optional().describe('Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass ["*"] for all.'),
1789
2226
  depth: z3.coerce.number().optional().describe("Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited."),
@@ -1793,10 +2230,11 @@ var tools = [
1793
2230
  parentId: z3.string().optional().describe("Search only within this subtree"),
1794
2231
  offset: z3.coerce.number().optional().default(0).describe("Skip N items for pagination (default 0)"),
1795
2232
  limit: z3.coerce.number().optional().default(100).describe("Max items per page (default 100)"),
1796
- items: flexJson(z3.array(z3.record(z3.string(), z3.unknown()))).optional().describe("Array of {id, ...properties} to update/delete/clone/reparent"),
2233
+ items: flexJson(z3.array(z3.record(z3.string(), z3.unknown()))).optional().describe("Array of {id, ...properties} to update/delete/clone/scale/reparent"),
1797
2234
  name: z3.string().optional().describe("Rename the clone (set before appending to parent \u2014 required when cloning a variant into its component set to avoid duplicate names)"),
1798
2235
  x: z3.coerce.number().optional().describe("X position (default: 0)"),
1799
2236
  y: z3.coerce.number().optional().describe("Y position (default: 0)"),
2237
+ factor: z3.coerce.number().optional().describe("Scale factor, >= 0.01. 0.5 = 50%, 2 = 200%. Scales children, text, strokes, effects, and layout geometry from the node's top-left. On auto-layout or HUG/FILL nodes, Figma may resolve responsive sizing to fixed width/height."),
1800
2238
  rules: flexStringList(z3.array(z3.string())).optional().describe('Rules to check. Default: ["all"]. Categories: "component", "composition", "token", "naming", "wcag".'),
1801
2239
  maxDepth: z3.coerce.number().optional().describe("Max tree depth (default: 10)"),
1802
2240
  maxFindings: z3.coerce.number().optional().describe("Max findings (default: 50)"),
@@ -1806,10 +2244,16 @@ var tools = [
1806
2244
  format: z3.enum(["PNG", "JPG", "SVG", "SVG_STRING", "PDF"]).optional().describe("Export format (default: PNG). SVG_STRING returns raw SVG text."),
1807
2245
  scale: z3.coerce.number().optional().describe("Export scale (default: 1, only for PNG/JPG)"),
1808
2246
  topic: z3.string().optional().describe('Help topic \u2014 method name for endpoint help, e.g. "create"')
1809
- }, caps2, { "get": "read", "list": "read", "update": "edit", "delete": "edit", "clone": "create", "audit": "read", "reparent": "edit", "create": "create", "commit": "edit", "export": "read", "help": "read" }),
2247
+ }, caps2, { "get": "read", "list": "read", "update": "edit", "delete": "edit", "clone": "create", "scale": "edit", "audit": "read", "reparent": "edit", "create": "create", "commit": "edit", "export": "read", "help": "read" }),
1810
2248
  tier: "read",
1811
2249
  validate: (params) => {
1812
2250
  const m = params.method;
2251
+ if (m === "create") {
2252
+ const itemDiscriminant = Array.isArray(params.items) ? params.items.find((it) => it && typeof it === "object" && typeof it.type === "string")?.type : void 0;
2253
+ if (params.type === void 0) {
2254
+ throw new Error(itemDiscriminant ? 'frames.create uses top-level "type", not "type" inside items. Move the item value to the top level and use help for valid item shapes.' : 'frames.create requires top-level "type" (frame, auto_layout, section, rectangle, ellipse, line, group, boolean_operation, svg, slot). Use frames(method: "help", topic: "create") for valid item shapes.');
2255
+ }
2256
+ }
1813
2257
  if (m === "commit") {
1814
2258
  if (params.id === void 0) throw new Error('commit requires "id"');
1815
2259
  }
@@ -1817,6 +2261,7 @@ var tools = [
1817
2261
  if (params.id === void 0) throw new Error('export requires "id"');
1818
2262
  }
1819
2263
  if (!params.items) return;
2264
+ if (Array.isArray(params.items) && params.items.length === 0) throw new Error('items: [] is a no-op. Batch calls need at least one item. Omit items to use single-item params, or pass one or more item objects. Use frames(method: "help", topic: "' + m + '") to see valid item shapes.');
1820
2265
  if (m === "create") {
1821
2266
  const schemas = {
1822
2267
  "frame": z3.object({
@@ -1832,13 +2277,13 @@ var tools = [
1832
2277
  opacity: token.optional().describe("Opacity (0-1) or variable name"),
1833
2278
  blendMode: z3.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(),
1834
2279
  effectStyleName: z3.string().optional().describe("Effect style name (e.g. 'Shadow/Card') for shadows, blurs"),
1835
- fills: z3.array(z3.record(z3.string(), z3.unknown())).optional().describe("Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills."),
2280
+ fills: paintArrayLoose.optional().describe("Fill Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] for transparent. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables; use imageUrl/images for image authoring. IMAGE/VIDEO/PATTERN may appear in readback metadata only. Primary way to set non-image fills."),
1836
2281
  fillColor: colorRgba.optional().describe("Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)"),
1837
2282
  fillStyleName: z3.string().optional().describe("Paint style name for fill"),
1838
- fillVariableName: z3.string().optional().describe("Color variable by name e.g. 'bg/primary'"),
2283
+ fillVariableName: z3.string().optional().describe("Color variable by name e.g. 'bg/surface'"),
1839
2284
  imageUrl: z3.string().optional().describe("Image source \u2014 'pexel:<id>' for Pexels photos, a public URL, or a local file path. SVGs are inserted as vectors; raster images become IMAGE fills."),
1840
2285
  imageScaleMode: z3.enum(["FILL", "FIT", "CROP", "TILE"]).optional().describe("How the image is scaled within the frame (default: FILL)"),
1841
- strokes: z3.array(z3.record(z3.string(), z3.unknown())).optional().describe("Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes."),
2286
+ strokes: paintArrayLoose.optional().describe("Stroke Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] to clear. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables. IMAGE/VIDEO/PATTERN may appear in readback metadata only. Primary way to set strokes."),
1842
2287
  strokeColor: colorRgba.optional().describe("Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)"),
1843
2288
  strokeStyleName: z3.string().optional().describe("Paint style name for stroke"),
1844
2289
  strokeVariableName: z3.string().optional().describe("Color variable by name for stroke"),
@@ -1875,7 +2320,7 @@ var tools = [
1875
2320
  maxHeight: z3.coerce.number().optional().describe("Max height for responsive auto-layout"),
1876
2321
  annotations: flexJson(z3.array(z3.record(z3.string(), z3.unknown()))).optional().describe("Set annotations \u2014 [{label?, labelMarkdown?, properties?, categoryId?}]. Properties validated per node type."),
1877
2322
  clipsContent: flexBool(z3.boolean()).optional(),
1878
- children: flexJson(z3.array(z3.record(z3.string(), z3.unknown()))).optional().describe('Inline child nodes \u2014 build nested trees in one call. Types: text: {type:"text", text, fontFamily?, fontSize?, fontWeight?, fontStyle?, fontColor?, layoutSizingHorizontal?}. frame: {type:"frame", name?, layoutMode?, fillColor?, width?, layoutSizingHorizontal?, children?}. instance: {type:"instance", componentId, variantProperties?, properties?}. component: {type:"component", name, children?}. All params from text/frame endpoints are supported on their respective types. Always set layoutSizingHorizontal + layoutSizingVertical on children inside auto-layout parents (FILL, HUG, or FIXED). Example: children:[{type:"text", text:"Title", fontSize:20, layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG"}, {type:"frame", name:"Row", layoutMode:"HORIZONTAL", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG", itemSpacing:8, children:[{type:"instance", componentId:"1:2", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG"}]}] Inside components: add componentPropertyName to auto-bind TEXT or INSTANCE_SWAP properties.\n')
2323
+ children: flexJson(z3.array(z3.record(z3.string(), z3.unknown()))).optional().describe('Inline child nodes \u2014 build nested trees in one call. Types: text: {type:"text", text, textStyleName?, fontColorVariableName?, layoutSizingHorizontal?}. frame: {type:"frame", name?, layoutMode?, fillVariableName?, itemSpacing?, layoutSizingHorizontal?, children?}. instance: {type:"instance", componentId, variantProperties?, properties?}. component: {type:"component", name, children?}. rectangle / ellipse / line: same params as the corresponding frames(method:"create", type:"rectangle"|"ellipse"|"line") branch. All params from text/frame endpoints are supported on their respective types. Inline fills/strokes accept Paint[] authoring input: SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. Do not use CSS gradients, REST gradientHandlePositions, or IMAGE/VIDEO/PATTERN in Paint[] authoring. Always set layoutSizingHorizontal + layoutSizingVertical on children inside auto-layout parents (FILL, HUG, or FIXED). Example: children:[{type:"ellipse", name:"Dot", width:6, height:6, fillVariableName:"status/active"}, {type:"text", name:"Title", text:"Title", textStyleName:"Heading/Medium", fontColorVariableName:"text/primary", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG"}, {type:"frame", name:"Row", layoutMode:"HORIZONTAL", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG", itemSpacing:"space/8", children:[{type:"instance", componentId:"1:2", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG"}]}] Inside components: add componentPropertyName to auto-bind TEXT or INSTANCE_SWAP properties.\n')
1879
2324
  }).passthrough(),
1880
2325
  "auto_layout": z3.object({
1881
2326
  name: z3.string().optional().describe("Node name"),
@@ -1890,13 +2335,13 @@ var tools = [
1890
2335
  opacity: token.optional().describe("Opacity (0-1) or variable name"),
1891
2336
  blendMode: z3.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(),
1892
2337
  effectStyleName: z3.string().optional().describe("Effect style name (e.g. 'Shadow/Card') for shadows, blurs"),
1893
- fills: z3.array(z3.record(z3.string(), z3.unknown())).optional().describe("Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills."),
2338
+ fills: paintArrayLoose.optional().describe("Fill Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] for transparent. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables; use imageUrl/images for image authoring. IMAGE/VIDEO/PATTERN may appear in readback metadata only. Primary way to set non-image fills."),
1894
2339
  fillColor: colorRgba.optional().describe("Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)"),
1895
2340
  fillStyleName: z3.string().optional().describe("Paint style name for fill"),
1896
- fillVariableName: z3.string().optional().describe("Color variable by name e.g. 'bg/primary'"),
2341
+ fillVariableName: z3.string().optional().describe("Color variable by name e.g. 'bg/surface'"),
1897
2342
  imageUrl: z3.string().optional().describe("Image source \u2014 'pexel:<id>' for Pexels photos, a public URL, or a local file path. SVGs are inserted as vectors; raster images become IMAGE fills."),
1898
2343
  imageScaleMode: z3.enum(["FILL", "FIT", "CROP", "TILE"]).optional().describe("How the image is scaled within the frame (default: FILL)"),
1899
- strokes: z3.array(z3.record(z3.string(), z3.unknown())).optional().describe("Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes."),
2344
+ strokes: paintArrayLoose.optional().describe("Stroke Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] to clear. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables. IMAGE/VIDEO/PATTERN may appear in readback metadata only. Primary way to set strokes."),
1900
2345
  strokeColor: colorRgba.optional().describe("Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)"),
1901
2346
  strokeStyleName: z3.string().optional().describe("Paint style name for stroke"),
1902
2347
  strokeVariableName: z3.string().optional().describe("Color variable by name for stroke"),
@@ -1934,7 +2379,7 @@ var tools = [
1934
2379
  annotations: flexJson(z3.array(z3.record(z3.string(), z3.unknown()))).optional().describe("Set annotations \u2014 [{label?, labelMarkdown?, properties?, categoryId?}]. Properties validated per node type."),
1935
2380
  clipsContent: flexBool(z3.boolean()).optional(),
1936
2381
  nodeIds: flexStringList(z3.array(z3.string())).optional().describe("Existing node IDs to wrap into auto-layout"),
1937
- children: flexJson(z3.array(z3.record(z3.string(), z3.unknown()))).optional().describe('Inline child nodes \u2014 build nested trees in one call. Types: text: {type:"text", text, fontFamily?, fontSize?, fontWeight?, fontStyle?, fontColor?, layoutSizingHorizontal?}. frame: {type:"frame", name?, layoutMode?, fillColor?, width?, layoutSizingHorizontal?, children?}. instance: {type:"instance", componentId, variantProperties?, properties?}. component: {type:"component", name, children?}. All params from text/frame endpoints are supported on their respective types. Always set layoutSizingHorizontal + layoutSizingVertical on children inside auto-layout parents (FILL, HUG, or FIXED). Example: children:[{type:"text", text:"Title", fontSize:20, layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG"}, {type:"frame", name:"Row", layoutMode:"HORIZONTAL", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG", itemSpacing:8, children:[{type:"instance", componentId:"1:2", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG"}]}] Inside components: add componentPropertyName to auto-bind TEXT or INSTANCE_SWAP properties.\n')
2382
+ children: flexJson(z3.array(z3.record(z3.string(), z3.unknown()))).optional().describe('Inline child nodes \u2014 build nested trees in one call. Types: text: {type:"text", text, textStyleName?, fontColorVariableName?, layoutSizingHorizontal?}. frame: {type:"frame", name?, layoutMode?, fillVariableName?, itemSpacing?, layoutSizingHorizontal?, children?}. instance: {type:"instance", componentId, variantProperties?, properties?}. component: {type:"component", name, children?}. rectangle / ellipse / line: same params as the corresponding frames(method:"create", type:"rectangle"|"ellipse"|"line") branch. All params from text/frame endpoints are supported on their respective types. Inline fills/strokes accept Paint[] authoring input: SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. Do not use CSS gradients, REST gradientHandlePositions, or IMAGE/VIDEO/PATTERN in Paint[] authoring. Always set layoutSizingHorizontal + layoutSizingVertical on children inside auto-layout parents (FILL, HUG, or FIXED). Example: children:[{type:"ellipse", name:"Dot", width:6, height:6, fillVariableName:"status/active"}, {type:"text", name:"Title", text:"Title", textStyleName:"Heading/Medium", fontColorVariableName:"text/primary", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG"}, {type:"frame", name:"Row", layoutMode:"HORIZONTAL", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG", itemSpacing:"space/8", children:[{type:"instance", componentId:"1:2", layoutSizingHorizontal:"FILL", layoutSizingVertical:"HUG"}]}] Inside components: add componentPropertyName to auto-bind TEXT or INSTANCE_SWAP properties.\n')
1938
2383
  }).passthrough(),
1939
2384
  "section": z3.object({
1940
2385
  name: z3.string().describe("Section name"),
@@ -1943,10 +2388,10 @@ var tools = [
1943
2388
  y: z3.coerce.number().optional().describe("Y position (default: 0)"),
1944
2389
  width: z3.coerce.number().optional().describe("Width (default: 500)"),
1945
2390
  height: z3.coerce.number().optional().describe("Height (default: 500)"),
1946
- fills: z3.array(z3.record(z3.string(), z3.unknown())).optional().describe("Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent"),
2391
+ fills: paintArrayLoose.optional().describe("Fill Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] for transparent. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables; use imageUrl/images for image authoring. IMAGE/VIDEO/PATTERN may appear in readback metadata only"),
1947
2392
  fillColor: colorRgba.optional().describe("Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)"),
1948
2393
  fillStyleName: z3.string().optional().describe("Paint style name for fill"),
1949
- fillVariableName: z3.string().optional().describe("Color variable by name e.g. 'bg/primary'"),
2394
+ fillVariableName: z3.string().optional().describe("Color variable by name e.g. 'bg/surface'"),
1950
2395
  imageUrl: z3.string().optional().describe("Image source \u2014 'pexel:<id>', public URL, or local file path"),
1951
2396
  imageScaleMode: z3.enum(["FILL", "FIT", "CROP", "TILE"]).optional().describe("How the image is scaled (default: FILL)")
1952
2397
  }).passthrough(),
@@ -1957,13 +2402,13 @@ var tools = [
1957
2402
  y: z3.coerce.number().optional().describe("Y position (default: 0)"),
1958
2403
  width: z3.coerce.number().optional().describe("Width in px (default: 100)"),
1959
2404
  height: z3.coerce.number().optional().describe("Height in px (default: 100)"),
1960
- fills: z3.array(z3.record(z3.string(), z3.unknown())).optional().describe("Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent"),
2405
+ fills: paintArrayLoose.optional().describe("Fill Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] for transparent. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables; use imageUrl/images for image authoring. IMAGE/VIDEO/PATTERN may appear in readback metadata only"),
1961
2406
  fillColor: colorRgba.optional().describe("Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)"),
1962
2407
  fillStyleName: z3.string().optional().describe("Paint style name for fill"),
1963
- fillVariableName: z3.string().optional().describe("Color variable by name e.g. 'bg/primary'"),
2408
+ fillVariableName: z3.string().optional().describe("Color variable by name e.g. 'bg/surface'"),
1964
2409
  imageUrl: z3.string().optional().describe("Image source \u2014 'pexel:<id>', public URL, or local file path"),
1965
2410
  imageScaleMode: z3.enum(["FILL", "FIT", "CROP", "TILE"]).optional().describe("How the image is scaled (default: FILL)"),
1966
- strokes: z3.array(z3.record(z3.string(), z3.unknown())).optional().describe("Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear"),
2411
+ strokes: paintArrayLoose.optional().describe("Stroke Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] to clear. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables. IMAGE/VIDEO/PATTERN may appear in readback metadata only"),
1967
2412
  strokeColor: colorRgba.optional().describe("Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)"),
1968
2413
  strokeVariableName: z3.string().optional().describe("Color variable by name for stroke"),
1969
2414
  strokeWeight: token.optional(),
@@ -1984,13 +2429,13 @@ var tools = [
1984
2429
  y: z3.coerce.number().optional().describe("Y position (default: 0)"),
1985
2430
  width: z3.coerce.number().optional().describe("Width in px (default: 100)"),
1986
2431
  height: z3.coerce.number().optional().describe("Height in px (default: 100, same as width for circle)"),
1987
- fills: z3.array(z3.record(z3.string(), z3.unknown())).optional().describe("Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent"),
2432
+ fills: paintArrayLoose.optional().describe("Fill Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] for transparent. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables; use imageUrl/images for image authoring. IMAGE/VIDEO/PATTERN may appear in readback metadata only"),
1988
2433
  fillColor: colorRgba.optional().describe("Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)"),
1989
2434
  fillStyleName: z3.string().optional().describe("Paint style name for fill"),
1990
- fillVariableName: z3.string().optional().describe("Color variable by name e.g. 'bg/primary'"),
2435
+ fillVariableName: z3.string().optional().describe("Color variable by name e.g. 'bg/surface'"),
1991
2436
  imageUrl: z3.string().optional().describe("Image source \u2014 'pexel:<id>', public URL, or local file path"),
1992
2437
  imageScaleMode: z3.enum(["FILL", "FIT", "CROP", "TILE"]).optional().describe("How the image is scaled (default: FILL)"),
1993
- strokes: z3.array(z3.record(z3.string(), z3.unknown())).optional().describe("Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear"),
2438
+ strokes: paintArrayLoose.optional().describe("Stroke Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] to clear. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables. IMAGE/VIDEO/PATTERN may appear in readback metadata only"),
1994
2439
  strokeColor: colorRgba.optional().describe("Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)"),
1995
2440
  strokeVariableName: z3.string().optional().describe("Color variable by name for stroke"),
1996
2441
  strokeWeight: token.optional(),
@@ -2006,7 +2451,7 @@ var tools = [
2006
2451
  y: z3.coerce.number().optional().describe("Y position (default: 0)"),
2007
2452
  length: z3.coerce.number().optional().describe("Line length in px (default: 100)"),
2008
2453
  rotation: z3.coerce.number().optional().describe("Rotation in degrees (default: 0 = horizontal)"),
2009
- strokes: z3.array(z3.record(z3.string(), z3.unknown())).optional().describe("Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear"),
2454
+ strokes: paintArrayLoose.optional().describe("Stroke Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] to clear. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables. IMAGE/VIDEO/PATTERN may appear in readback metadata only"),
2010
2455
  strokeColor: colorRgba.optional().describe("Line color (default: black, auto-binds to matching variable/style)"),
2011
2456
  strokeVariableName: z3.string().optional().describe("Color variable by name for stroke"),
2012
2457
  strokeWeight: token.optional().describe("Line thickness (default: 1)"),
@@ -2020,6 +2465,10 @@ var tools = [
2020
2465
  parentId: z3.string().optional().describe("Parent node ID. Omit to place at current page root.")
2021
2466
  }).passthrough(),
2022
2467
  "boolean_operation": z3.object({
2468
+ fillStyleName: z3.string().optional().describe("Paint style to apply to vector fills"),
2469
+ fillVariableName: z3.string().optional().describe("Color variable by name for vector fills"),
2470
+ strokeStyleName: z3.string().optional().describe("Paint style to apply to vector strokes"),
2471
+ strokeVariableName: z3.string().optional().describe("Color variable by name for vector strokes"),
2023
2472
  operation: z3.enum(["UNION", "SUBTRACT", "INTERSECT", "EXCLUDE"]).describe("Boolean operation type"),
2024
2473
  nodeIds: z3.array(z3.string()).describe("Node IDs to combine (min 2, first node is the base for SUBTRACT)"),
2025
2474
  name: z3.string().optional().describe("Result node name"),
@@ -2049,13 +2498,13 @@ var tools = [
2049
2498
  opacity: token.optional().describe("Opacity (0-1) or variable name"),
2050
2499
  blendMode: z3.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(),
2051
2500
  effectStyleName: z3.string().optional().describe("Effect style name (e.g. 'Shadow/Card') for shadows, blurs"),
2052
- fills: z3.array(z3.record(z3.string(), z3.unknown())).optional().describe("Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills."),
2501
+ fills: paintArrayLoose.optional().describe("Fill Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] for transparent. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables; use imageUrl/images for image authoring. IMAGE/VIDEO/PATTERN may appear in readback metadata only. Primary way to set non-image fills."),
2053
2502
  fillColor: colorRgba.optional().describe("Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)"),
2054
2503
  fillStyleName: z3.string().optional().describe("Paint style name for fill"),
2055
- fillVariableName: z3.string().optional().describe("Color variable by name e.g. 'bg/primary'"),
2504
+ fillVariableName: z3.string().optional().describe("Color variable by name e.g. 'bg/surface'"),
2056
2505
  imageUrl: z3.string().optional().describe("Image source \u2014 'pexel:<id>' for Pexels photos, a public URL, or a local file path. SVGs are inserted as vectors; raster images become IMAGE fills."),
2057
2506
  imageScaleMode: z3.enum(["FILL", "FIT", "CROP", "TILE"]).optional().describe("How the image is scaled within the frame (default: FILL)"),
2058
- strokes: z3.array(z3.record(z3.string(), z3.unknown())).optional().describe("Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes."),
2507
+ strokes: paintArrayLoose.optional().describe("Stroke Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] to clear. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables. IMAGE/VIDEO/PATTERN may appear in readback metadata only. Primary way to set strokes."),
2059
2508
  strokeColor: colorRgba.optional().describe("Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)"),
2060
2509
  strokeStyleName: z3.string().optional().describe("Paint style name for stroke"),
2061
2510
  strokeVariableName: z3.string().optional().describe("Color variable by name for stroke"),
@@ -2095,24 +2544,26 @@ var tools = [
2095
2544
  }).passthrough()
2096
2545
  };
2097
2546
  const s = params.type && schemas[params.type];
2098
- if (s) {
2099
- try {
2100
- params.items = z3.array(s).parse(params.items);
2101
- } catch (e) {
2102
- if (e instanceof z3.ZodError) {
2103
- throw new Error(e.issues.map((i) => {
2104
- const path = i.path.join(".");
2105
- const shape = s instanceof z3.ZodObject ? s.shape : null;
2106
- const desc = shape?.[i.path[1]]?.description;
2107
- return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
2108
- }).join("; "));
2109
- }
2110
- throw e;
2547
+ if (!s) throw new Error('frames.create: unknown type. Use frames(method: "help", topic: "create") for valid types and item shapes.');
2548
+ try {
2549
+ params.items = z3.array(s).parse(params.items);
2550
+ } catch (e) {
2551
+ if (e instanceof z3.ZodError) {
2552
+ throw new Error(e.issues.map((i) => {
2553
+ const path = i.path.join(".");
2554
+ const shape = s instanceof z3.ZodObject ? s.shape : null;
2555
+ const field = String(i.path[1] ?? i.path[0] ?? "");
2556
+ const desc = shape?.[field]?.description;
2557
+ const paintField = field === "paints" || field === "fills" || field === "strokes";
2558
+ const paintHelp = paintField ? ' Invalid Paint[] payload. Supported Paint[] authoring types: SOLID, GRADIENT_LINEAR, GRADIENT_RADIAL, GRADIENT_ANGULAR, GRADIENT_DIAMOND. Use gradientTransform + gradientStops; do not use CSS gradients or REST gradientHandlePositions. IMAGE/VIDEO/PATTERN are readback-only metadata, not Paint[] authoring input; use imageUrl/images for images. For examples call frames(method:"help", topic:"create").' : "";
2559
+ return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "") + paintHelp;
2560
+ }).join("; "));
2111
2561
  }
2562
+ throw e;
2112
2563
  }
2113
2564
  }
2114
2565
  },
2115
- 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", "commit": "frames.commit", "export": "frames.export" }
2566
+ commandMap: { "get": "frames.get", "list": "frames.list", "update": "frames.update", "delete": "frames.delete", "clone": "frames.clone", "scale": "frames.scale", "audit": "frames.audit", "reparent": "frames.reparent", "create": "frames.create", "commit": "frames.commit", "export": "frames.export" }
2116
2567
  },
2117
2568
  {
2118
2569
  name: "icons",
@@ -2174,9 +2625,9 @@ var tools = [
2174
2625
  },
2175
2626
  {
2176
2627
  name: "instances",
2177
- 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?, name?, parentId?, x?, y?, items?: { id: string; name?: string; parentId?: string; x?: number; y?: number }[], depth?) \u2192 { results: {id}[] } // Duplicate nodes \u2014 produces a same-type copy (frame\u2192frame, instance\u2192instance, component\u2192component). Instance clones reference the same source component; they do not duplicate the component definition.\n audit (id, rules?, maxDepth?, maxFindings?, minSeverity?: error|unsafe|heuristic|style|verbose, skipInstances?) \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).',
2628
+ 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?, name?, parentId?, x?, y?, items?: { id: string; name?: string; parentId?: string; x?: number; y?: number }[], depth?) \u2192 { results: {id}[] } // Duplicate nodes \u2014 produces a same-type copy (frame\u2192frame, instance\u2192instance, component\u2192component). Instance clones reference the same source component; they do not duplicate the component definition.\n scale (id?, factor?, items?: { id: string; factor: number }[]) \u2192 { results: "ok"[] } // Proportionally rescale a node subtree using Figma\'s visual Scale tool behavior. This is for visual/artifact scaling, not responsive layout resizing.\n audit (id, rules?, maxDepth?, maxFindings?, minSeverity?: error|unsafe|heuristic|style|verbose, skipInstances?) \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).',
2178
2629
  schema: (caps2) => filterMethodsByTier({
2179
- method: z3.enum(["list", "delete", "clone", "audit", "reparent", "get", "create", "update", "swap", "detach", "reset_overrides", "help"]),
2630
+ method: z3.enum(["list", "delete", "clone", "scale", "audit", "reparent", "get", "create", "update", "swap", "detach", "reset_overrides", "help"]),
2180
2631
  query: z3.string().optional().describe("Name search query (case-insensitive substring match)"),
2181
2632
  types: flexStringList(z3.array(z3.string())).optional().describe('Filter by node types (e.g. ["FRAME", "TEXT"])'),
2182
2633
  parentId: z3.string().optional().describe("Search only within this subtree"),
@@ -2184,11 +2635,12 @@ var tools = [
2184
2635
  offset: z3.coerce.number().optional().default(0).describe("Skip N items for pagination (default 0)"),
2185
2636
  limit: z3.coerce.number().optional().default(100).describe("Max items per page (default 100)"),
2186
2637
  id: z3.string().optional().describe("Single node ID"),
2187
- items: flexJson(z3.array(z3.record(z3.string(), z3.unknown()))).optional().describe("Array of {id, ...properties} to delete/clone/reparent/create/update/swap/detach/reset_overrides"),
2638
+ items: flexJson(z3.array(z3.record(z3.string(), z3.unknown()))).optional().describe("Array of {id, ...properties} to delete/clone/scale/reparent/create/update/swap/detach/reset_overrides"),
2188
2639
  name: z3.string().optional().describe("Rename the clone (set before appending to parent \u2014 required when cloning a variant into its component set to avoid duplicate names)"),
2189
2640
  x: z3.coerce.number().optional().describe("X position (default: 0)"),
2190
2641
  y: z3.coerce.number().optional().describe("Y position (default: 0)"),
2191
2642
  depth: z3.coerce.number().optional().describe("Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited."),
2643
+ factor: z3.coerce.number().optional().describe("Scale factor, >= 0.01. 0.5 = 50%, 2 = 200%. Scales children, text, strokes, effects, and layout geometry from the node's top-left. On auto-layout or HUG/FILL nodes, Figma may resolve responsive sizing to fixed width/height."),
2192
2644
  rules: flexStringList(z3.array(z3.string())).optional().describe('Rules to check. Default: ["all"]. Categories: "component", "composition", "token", "naming", "wcag".'),
2193
2645
  maxDepth: z3.coerce.number().optional().describe("Max tree depth (default: 10)"),
2194
2646
  maxFindings: z3.coerce.number().optional().describe("Max findings (default: 50)"),
@@ -2196,7 +2648,7 @@ var tools = [
2196
2648
  skipInstances: flexBool(z3.boolean()).optional().describe("Skip instance internals \u2014 findings inside instances are owned by the component (default: true)"),
2197
2649
  verbose: z3.boolean().optional().describe("Include all properties (bounding box, constraints, text style details). Default false \u2014 returns slim, actionable output."),
2198
2650
  topic: z3.string().optional().describe('Help topic \u2014 method name for endpoint help, e.g. "create"')
2199
- }, 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" }),
2651
+ }, caps2, { "list": "read", "delete": "edit", "clone": "create", "scale": "edit", "audit": "read", "reparent": "edit", "get": "read", "create": "create", "update": "edit", "swap": "edit", "detach": "edit", "reset_overrides": "edit", "help": "read" }),
2200
2652
  tier: "read",
2201
2653
  validate: (params) => {
2202
2654
  const m = params.method;
@@ -2204,6 +2656,7 @@ var tools = [
2204
2656
  if (params.id === void 0) throw new Error('get requires "id"');
2205
2657
  }
2206
2658
  if (!params.items) return;
2659
+ if (Array.isArray(params.items) && params.items.length === 0) throw new Error('items: [] is a no-op. Batch calls need at least one item. Omit items to use single-item params, or pass one or more item objects. Use instances(method: "help", topic: "' + m + '") to see valid item shapes.');
2207
2660
  if (m === "create") {
2208
2661
  for (const it of params.items) {
2209
2662
  if (it.id !== void 0 && it.componentId === void 0) {
@@ -2245,8 +2698,11 @@ var tools = [
2245
2698
  throw new Error(e.issues.map((i) => {
2246
2699
  const path = i.path.join(".");
2247
2700
  const shape = itemSchema instanceof z3.ZodObject ? itemSchema.shape : null;
2248
- const desc = shape?.[i.path[1]]?.description;
2249
- return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
2701
+ const field = String(i.path[1] ?? i.path[0] ?? "");
2702
+ const desc = shape?.[field]?.description;
2703
+ const paintField = field === "paints" || field === "fills" || field === "strokes";
2704
+ const paintHelp = paintField ? ' Invalid Paint[] payload. Supported Paint[] authoring types: SOLID, GRADIENT_LINEAR, GRADIENT_RADIAL, GRADIENT_ANGULAR, GRADIENT_DIAMOND. Use gradientTransform + gradientStops; do not use CSS gradients or REST gradientHandlePositions. IMAGE/VIDEO/PATTERN are readback-only metadata, not Paint[] authoring input; use imageUrl/images for images. For examples call instances(method:"help", topic:"create").' : "";
2705
+ return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "") + paintHelp;
2250
2706
  }).join("; "));
2251
2707
  }
2252
2708
  throw e;
@@ -2254,11 +2710,11 @@ var tools = [
2254
2710
  }
2255
2711
  if (m === "update") {
2256
2712
  const itemSchema = z3.object({
2257
- fills: z3.array(z3.record(z3.string(), z3.unknown())).optional().describe("Fill paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills."),
2713
+ fills: paintArrayLoose.optional().describe("Fill Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] for transparent. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables; use imageUrl/images for image authoring. IMAGE/VIDEO/PATTERN may appear in readback metadata only. Primary way to set non-image fills."),
2258
2714
  fillColor: colorRgba.optional().describe("Shorthand \u2014 sets a single solid fill (auto-binds to matching variable/style)"),
2259
2715
  fillStyleName: z3.string().optional().describe("Paint style name for fill"),
2260
- fillVariableName: z3.string().optional().describe("Color variable by name e.g. 'bg/primary'"),
2261
- strokes: z3.array(z3.record(z3.string(), z3.unknown())).optional().describe("Stroke paints array \u2014 e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes."),
2716
+ fillVariableName: z3.string().optional().describe("Color variable by name e.g. 'bg/surface'"),
2717
+ strokes: paintArrayLoose.optional().describe("Stroke Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. [] to clear. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables. IMAGE/VIDEO/PATTERN may appear in readback metadata only. Primary way to set strokes."),
2262
2718
  strokeColor: colorRgba.optional().describe("Shorthand \u2014 sets a single solid stroke (auto-binds to matching variable/style)"),
2263
2719
  strokeStyleName: z3.string().optional().describe("Paint style name for stroke"),
2264
2720
  strokeVariableName: z3.string().optional().describe("Color variable by name for stroke"),
@@ -2339,8 +2795,11 @@ var tools = [
2339
2795
  throw new Error(e.issues.map((i) => {
2340
2796
  const path = i.path.join(".");
2341
2797
  const shape = itemSchema instanceof z3.ZodObject ? itemSchema.shape : null;
2342
- const desc = shape?.[i.path[1]]?.description;
2343
- return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
2798
+ const field = String(i.path[1] ?? i.path[0] ?? "");
2799
+ const desc = shape?.[field]?.description;
2800
+ const paintField = field === "paints" || field === "fills" || field === "strokes";
2801
+ const paintHelp = paintField ? ' Invalid Paint[] payload. Supported Paint[] authoring types: SOLID, GRADIENT_LINEAR, GRADIENT_RADIAL, GRADIENT_ANGULAR, GRADIENT_DIAMOND. Use gradientTransform + gradientStops; do not use CSS gradients or REST gradientHandlePositions. IMAGE/VIDEO/PATTERN are readback-only metadata, not Paint[] authoring input; use imageUrl/images for images. For examples call instances(method:"help", topic:"update").' : "";
2802
+ return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "") + paintHelp;
2344
2803
  }).join("; "));
2345
2804
  }
2346
2805
  throw e;
@@ -2358,8 +2817,11 @@ var tools = [
2358
2817
  throw new Error(e.issues.map((i) => {
2359
2818
  const path = i.path.join(".");
2360
2819
  const shape = itemSchema instanceof z3.ZodObject ? itemSchema.shape : null;
2361
- const desc = shape?.[i.path[1]]?.description;
2362
- return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
2820
+ const field = String(i.path[1] ?? i.path[0] ?? "");
2821
+ const desc = shape?.[field]?.description;
2822
+ const paintField = field === "paints" || field === "fills" || field === "strokes";
2823
+ const paintHelp = paintField ? ' Invalid Paint[] payload. Supported Paint[] authoring types: SOLID, GRADIENT_LINEAR, GRADIENT_RADIAL, GRADIENT_ANGULAR, GRADIENT_DIAMOND. Use gradientTransform + gradientStops; do not use CSS gradients or REST gradientHandlePositions. IMAGE/VIDEO/PATTERN are readback-only metadata, not Paint[] authoring input; use imageUrl/images for images. For examples call instances(method:"help", topic:"swap").' : "";
2824
+ return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "") + paintHelp;
2363
2825
  }).join("; "));
2364
2826
  }
2365
2827
  throw e;
@@ -2376,8 +2838,11 @@ var tools = [
2376
2838
  throw new Error(e.issues.map((i) => {
2377
2839
  const path = i.path.join(".");
2378
2840
  const shape = itemSchema instanceof z3.ZodObject ? itemSchema.shape : null;
2379
- const desc = shape?.[i.path[1]]?.description;
2380
- return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
2841
+ const field = String(i.path[1] ?? i.path[0] ?? "");
2842
+ const desc = shape?.[field]?.description;
2843
+ const paintField = field === "paints" || field === "fills" || field === "strokes";
2844
+ const paintHelp = paintField ? ' Invalid Paint[] payload. Supported Paint[] authoring types: SOLID, GRADIENT_LINEAR, GRADIENT_RADIAL, GRADIENT_ANGULAR, GRADIENT_DIAMOND. Use gradientTransform + gradientStops; do not use CSS gradients or REST gradientHandlePositions. IMAGE/VIDEO/PATTERN are readback-only metadata, not Paint[] authoring input; use imageUrl/images for images. For examples call instances(method:"help", topic:"detach").' : "";
2845
+ return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "") + paintHelp;
2381
2846
  }).join("; "));
2382
2847
  }
2383
2848
  throw e;
@@ -2394,15 +2859,18 @@ var tools = [
2394
2859
  throw new Error(e.issues.map((i) => {
2395
2860
  const path = i.path.join(".");
2396
2861
  const shape = itemSchema instanceof z3.ZodObject ? itemSchema.shape : null;
2397
- const desc = shape?.[i.path[1]]?.description;
2398
- return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
2862
+ const field = String(i.path[1] ?? i.path[0] ?? "");
2863
+ const desc = shape?.[field]?.description;
2864
+ const paintField = field === "paints" || field === "fills" || field === "strokes";
2865
+ const paintHelp = paintField ? ' Invalid Paint[] payload. Supported Paint[] authoring types: SOLID, GRADIENT_LINEAR, GRADIENT_RADIAL, GRADIENT_ANGULAR, GRADIENT_DIAMOND. Use gradientTransform + gradientStops; do not use CSS gradients or REST gradientHandlePositions. IMAGE/VIDEO/PATTERN are readback-only metadata, not Paint[] authoring input; use imageUrl/images for images. For examples call instances(method:"help", topic:"reset_overrides").' : "";
2866
+ return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "") + paintHelp;
2399
2867
  }).join("; "));
2400
2868
  }
2401
2869
  throw e;
2402
2870
  }
2403
2871
  }
2404
2872
  },
2405
- 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" }
2873
+ commandMap: { "list": "instances.list", "delete": "instances.delete", "clone": "instances.clone", "scale": "instances.scale", "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" }
2406
2874
  },
2407
2875
  {
2408
2876
  name: "library",
@@ -2475,6 +2943,7 @@ var tools = [
2475
2943
  validate: (params) => {
2476
2944
  const m = params.method;
2477
2945
  if (!params.items) return;
2946
+ if (Array.isArray(params.items) && params.items.length === 0) throw new Error('items: [] is a no-op. Batch calls need at least one item. Omit items to use single-item params, or pass one or more item objects. Use lint(method: "help", topic: "' + m + '") to see valid item shapes.');
2478
2947
  if (m === "fix") {
2479
2948
  for (const it of params.items) {
2480
2949
  if (it.id !== void 0 && it.nodeId === void 0) {
@@ -2494,8 +2963,11 @@ var tools = [
2494
2963
  throw new Error(e.issues.map((i) => {
2495
2964
  const path = i.path.join(".");
2496
2965
  const shape = itemSchema instanceof z3.ZodObject ? itemSchema.shape : null;
2497
- const desc = shape?.[i.path[1]]?.description;
2498
- return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
2966
+ const field = String(i.path[1] ?? i.path[0] ?? "");
2967
+ const desc = shape?.[field]?.description;
2968
+ const paintField = field === "paints" || field === "fills" || field === "strokes";
2969
+ const paintHelp = paintField ? ' Invalid Paint[] payload. Supported Paint[] authoring types: SOLID, GRADIENT_LINEAR, GRADIENT_RADIAL, GRADIENT_ANGULAR, GRADIENT_DIAMOND. Use gradientTransform + gradientStops; do not use CSS gradients or REST gradientHandlePositions. IMAGE/VIDEO/PATTERN are readback-only metadata, not Paint[] authoring input; use imageUrl/images for images. For examples call lint(method:"help", topic:"fix").' : "";
2970
+ return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "") + paintHelp;
2499
2971
  }).join("; "));
2500
2972
  }
2501
2973
  throw e;
@@ -2546,6 +3018,7 @@ var tools = [
2546
3018
  if (params.index === void 0) throw new Error('remove requires "index"');
2547
3019
  }
2548
3020
  if (!params.items) return;
3021
+ if (Array.isArray(params.items) && params.items.length === 0) throw new Error('items: [] is a no-op. Batch calls need at least one item. Omit items to use single-item params, or pass one or more item objects. Use prototyping(method: "help", topic: "' + m + '") to see valid item shapes.');
2549
3022
  if (m === "add") {
2550
3023
  const itemSchema = z3.object({
2551
3024
  id: z3.string().describe("Node ID"),
@@ -2571,8 +3044,11 @@ var tools = [
2571
3044
  throw new Error(e.issues.map((i) => {
2572
3045
  const path = i.path.join(".");
2573
3046
  const shape = itemSchema instanceof z3.ZodObject ? itemSchema.shape : null;
2574
- const desc = shape?.[i.path[1]]?.description;
2575
- return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
3047
+ const field = String(i.path[1] ?? i.path[0] ?? "");
3048
+ const desc = shape?.[field]?.description;
3049
+ const paintField = field === "paints" || field === "fills" || field === "strokes";
3050
+ const paintHelp = paintField ? ' Invalid Paint[] payload. Supported Paint[] authoring types: SOLID, GRADIENT_LINEAR, GRADIENT_RADIAL, GRADIENT_ANGULAR, GRADIENT_DIAMOND. Use gradientTransform + gradientStops; do not use CSS gradients or REST gradientHandlePositions. IMAGE/VIDEO/PATTERN are readback-only metadata, not Paint[] authoring input; use imageUrl/images for images. For examples call prototyping(method:"help", topic:"add").' : "";
3051
+ return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "") + paintHelp;
2576
3052
  }).join("; "));
2577
3053
  }
2578
3054
  throw e;
@@ -2602,7 +3078,7 @@ var tools = [
2602
3078
  },
2603
3079
  {
2604
3080
  name: "styles",
2605
- 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.',
3081
+ 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?: Paint[], boundVariables?, 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: named PaintStyle.paints (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// Shared types:\n// Color: hex "#RGB"|"#RGBA"|"#RRGGBB"|"#RRGGBBAA" or {r: 0-1, g: 0-1, b: 0-1, a?: 0-1}\n// VariableAlias: {type: "VARIABLE_ALIAS", id: string}. The id must be a Figma VariableID; discover it via variables.get/list or variable_collections.get. Prefer colorVariableName/fillVariableName/strokeVariableName when available; Paint[] VariableAlias is mainly for precise Paint[] round-trips and gradient stop bindings.\n// Transform: [[number, number, number], [number, number, number]] (Figma Plugin API 2\xD73 matrix)\n// 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"\n// ColorStop: {position: 0-1, color: Color, boundVariables?: {color?: VariableAlias}}\n// GradientPaint: {type: "GRADIENT_LINEAR"|"GRADIENT_RADIAL"|"GRADIENT_ANGULAR"|"GRADIENT_DIAMOND", gradientTransform: Transform, gradientStops: ColorStop[], visible?: boolean, opacity?: number, blendMode?: BlendMode}. Use gradientTransform + gradientStops (basic left-to-right: [[1,0,0],[0,1,0]]); do not use CSS gradients or REST gradientHandlePositions.\n// Paint: Paint[] authoring accepts only SOLID and GRADIENT_LINEAR/GRADIENT_RADIAL/GRADIENT_ANGULAR/GRADIENT_DIAMOND. SolidPaint: {type: "SOLID", color: Color, visible?: boolean, opacity?: number, blendMode?: BlendMode, boundVariables?: {color?: VariableAlias}}. GradientPaint authoring: {type: GRADIENT_*, gradientTransform: Transform, gradientStops: ColorStop[], visible?, opacity?, blendMode?}; bind variables on gradientStops[].boundVariables.color, not top-level gradient boundVariables. Do not pass IMAGE/VIDEO/PATTERN to create/update Paint[]; those may appear only in readback metadata from existing Figma content. Use imageUrl/images for image authoring. VIDEO/PATTERN authoring is not supported here. Do not use CSS gradients or REST gradientHandlePositions.',
2606
3082
  schema: (caps2) => filterMethodsByTier({
2607
3083
  method: z3.enum(["list", "get", "create", "update", "delete", "help"]),
2608
3084
  type: z3.enum(["paint", "text", "effect", "grid"]).optional().describe("Filter by style type"),
@@ -2619,13 +3095,21 @@ var tools = [
2619
3095
  if (m === "get") {
2620
3096
  if (params.id === void 0) throw new Error('get requires "id"');
2621
3097
  }
3098
+ if (m === "create") {
3099
+ const itemDiscriminant = Array.isArray(params.items) ? params.items.find((it) => it && typeof it === "object" && typeof it.type === "string")?.type : void 0;
3100
+ if (params.type === void 0) {
3101
+ throw new Error(itemDiscriminant ? 'styles.create uses top-level "type", not "type" inside items. Move the item value to the top level and use help for valid item shapes.' : 'styles.create requires top-level "type" (paint, text, effect, grid). Use styles(method: "help", topic: "create") for valid item shapes.');
3102
+ }
3103
+ }
2622
3104
  if (!params.items) return;
3105
+ if (Array.isArray(params.items) && params.items.length === 0) throw new Error('items: [] is a no-op. Batch calls need at least one item. Omit items to use single-item params, or pass one or more item objects. Use styles(method: "help", topic: "' + m + '") to see valid item shapes.');
2623
3106
  if (m === "create") {
2624
3107
  const schemas = {
2625
3108
  "paint": z3.object({
2626
3109
  name: z3.string().describe("Style name"),
2627
- color: colorRgba.optional().describe("Color value. Optional when colorVariableName is provided."),
2628
- colorVariableName: z3.string().optional().describe("Bind to a COLOR variable by name (style tracks the variable). Can be used alone \u2014 color is resolved from the variable."),
3110
+ paints: paintArrayLoose.optional().describe('PaintStyle.paints authoring array. Accepts only SOLID and GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND, using gradientTransform + gradientStops, opacity/blendMode, and gradientStops[].boundVariables.color. Mutually exclusive with color/colorVariableName shorthands. Do not pass IMAGE/VIDEO/PATTERN, CSS gradients, REST gradientHandlePositions, or top-level gradient boundVariables. Use imageUrl/images for image authoring on nodes; VIDEO/PATTERN authoring is not supported here. For examples call styles(method:"help", topic:"create").'),
3111
+ color: colorRgba.optional().describe("Single-solid shorthand color. Optional when colorVariableName or paints is provided."),
3112
+ colorVariableName: z3.string().optional().describe("Single-solid shorthand: bind to a COLOR variable by name (style tracks the variable). Can be used alone \u2014 color is resolved from the variable."),
2629
3113
  description: z3.string().optional().describe("Style description")
2630
3114
  }).passthrough(),
2631
3115
  "text": z3.object({
@@ -2649,25 +3133,27 @@ var tools = [
2649
3133
  }).passthrough(),
2650
3134
  "grid": z3.object({
2651
3135
  name: z3.string().describe("Style name"),
2652
- layoutGrids: flexJson(z3.array(z3.record(z3.string(), z3.unknown()))).describe("Array of LayoutGrid objects"),
3136
+ layoutGrids: flexJson(z3.array(z3.record(z3.string(), z3.unknown()))).describe("Array of LayoutGrid objects. Conditional shapes: GRID requires sectionSize and does not use alignment/count/gutterSize/offset; ROWS/COLUMNS use alignment/count/gutterSize/offset, and sectionSize only for fixed alignments MIN/MAX/CENTER. For alignment:STRETCH, omit sectionSize."),
2653
3137
  description: z3.string().optional().describe("Style description")
2654
3138
  }).passthrough()
2655
3139
  };
2656
3140
  const s = params.type && schemas[params.type];
2657
- if (s) {
2658
- try {
2659
- params.items = z3.array(s).parse(params.items);
2660
- } catch (e) {
2661
- if (e instanceof z3.ZodError) {
2662
- throw new Error(e.issues.map((i) => {
2663
- const path = i.path.join(".");
2664
- const shape = s instanceof z3.ZodObject ? s.shape : null;
2665
- const desc = shape?.[i.path[1]]?.description;
2666
- return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
2667
- }).join("; "));
2668
- }
2669
- throw e;
3141
+ if (!s) throw new Error('styles.create: unknown type. Use styles(method: "help", topic: "create") for valid types and item shapes.');
3142
+ try {
3143
+ params.items = z3.array(s).parse(params.items);
3144
+ } catch (e) {
3145
+ if (e instanceof z3.ZodError) {
3146
+ throw new Error(e.issues.map((i) => {
3147
+ const path = i.path.join(".");
3148
+ const shape = s instanceof z3.ZodObject ? s.shape : null;
3149
+ const field = String(i.path[1] ?? i.path[0] ?? "");
3150
+ const desc = shape?.[field]?.description;
3151
+ const paintField = field === "paints" || field === "fills" || field === "strokes";
3152
+ const paintHelp = paintField ? ' Invalid Paint[] payload. Supported Paint[] authoring types: SOLID, GRADIENT_LINEAR, GRADIENT_RADIAL, GRADIENT_ANGULAR, GRADIENT_DIAMOND. Use gradientTransform + gradientStops; do not use CSS gradients or REST gradientHandlePositions. IMAGE/VIDEO/PATTERN are readback-only metadata, not Paint[] authoring input; use imageUrl/images for images. For examples call styles(method:"help", topic:"create").' : "";
3153
+ return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "") + paintHelp;
3154
+ }).join("; "));
2670
3155
  }
3156
+ throw e;
2671
3157
  }
2672
3158
  }
2673
3159
  if (m === "update") {
@@ -2675,8 +3161,9 @@ var tools = [
2675
3161
  id: z3.string().describe("Style ID or name"),
2676
3162
  name: z3.string().optional().describe("Rename the style"),
2677
3163
  description: z3.string().optional().describe("Style description"),
2678
- color: colorRgba.optional().describe("New color (paint styles)"),
2679
- colorVariableName: z3.string().optional().describe("Bind to a COLOR variable by name (paint styles)"),
3164
+ paints: paintArrayLoose.optional().describe('Replace PaintStyle.paints. Accepts only SOLID and GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND, using gradientTransform + gradientStops, opacity/blendMode, and gradientStops[].boundVariables.color. Mutually exclusive with color/colorVariableName. Do not pass IMAGE/VIDEO/PATTERN, CSS gradients, REST gradientHandlePositions, or top-level gradient boundVariables. Use imageUrl/images for image authoring on nodes; VIDEO/PATTERN authoring is not supported here. For examples call styles(method:"help", topic:"update").'),
3165
+ color: colorRgba.optional().describe("New single-solid color shorthand (paint styles)"),
3166
+ colorVariableName: z3.string().optional().describe("Bind to a COLOR variable by name using single-solid shorthand (paint styles)"),
2680
3167
  fontFamily: z3.string().optional(),
2681
3168
  fontStyle: z3.string().optional(),
2682
3169
  fontSize: z3.coerce.number().optional(),
@@ -2688,7 +3175,7 @@ var tools = [
2688
3175
  paragraphSpacing: z3.coerce.number().optional().describe("Paragraph spacing (px)"),
2689
3176
  leadingTrim: z3.enum(["CAP_HEIGHT", "NONE"]).optional(),
2690
3177
  effects: flexJson(z3.array(z3.record(z3.string(), z3.unknown()))).optional().describe("Array of Effect objects"),
2691
- layoutGrids: flexJson(z3.array(z3.record(z3.string(), z3.unknown()))).optional().describe("Array of LayoutGrid objects (grid styles)")
3178
+ layoutGrids: flexJson(z3.array(z3.record(z3.string(), z3.unknown()))).optional().describe("Array of LayoutGrid objects (grid styles). Conditional shapes: GRID requires sectionSize and does not use alignment/count/gutterSize/offset; ROWS/COLUMNS use alignment/count/gutterSize/offset, and sectionSize only for fixed alignments MIN/MAX/CENTER. For alignment:STRETCH, omit sectionSize.")
2692
3179
  }).passthrough();
2693
3180
  try {
2694
3181
  params.items = z3.array(itemSchema).parse(params.items);
@@ -2697,8 +3184,11 @@ var tools = [
2697
3184
  throw new Error(e.issues.map((i) => {
2698
3185
  const path = i.path.join(".");
2699
3186
  const shape = itemSchema instanceof z3.ZodObject ? itemSchema.shape : null;
2700
- const desc = shape?.[i.path[1]]?.description;
2701
- return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
3187
+ const field = String(i.path[1] ?? i.path[0] ?? "");
3188
+ const desc = shape?.[field]?.description;
3189
+ const paintField = field === "paints" || field === "fills" || field === "strokes";
3190
+ const paintHelp = paintField ? ' Invalid Paint[] payload. Supported Paint[] authoring types: SOLID, GRADIENT_LINEAR, GRADIENT_RADIAL, GRADIENT_ANGULAR, GRADIENT_DIAMOND. Use gradientTransform + gradientStops; do not use CSS gradients or REST gradientHandlePositions. IMAGE/VIDEO/PATTERN are readback-only metadata, not Paint[] authoring input; use imageUrl/images for images. For examples call styles(method:"help", topic:"update").' : "";
3191
+ return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "") + paintHelp;
2702
3192
  }).join("; "));
2703
3193
  }
2704
3194
  throw e;
@@ -2715,8 +3205,11 @@ var tools = [
2715
3205
  throw new Error(e.issues.map((i) => {
2716
3206
  const path = i.path.join(".");
2717
3207
  const shape = itemSchema instanceof z3.ZodObject ? itemSchema.shape : null;
2718
- const desc = shape?.[i.path[1]]?.description;
2719
- return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
3208
+ const field = String(i.path[1] ?? i.path[0] ?? "");
3209
+ const desc = shape?.[field]?.description;
3210
+ const paintField = field === "paints" || field === "fills" || field === "strokes";
3211
+ const paintHelp = paintField ? ' Invalid Paint[] payload. Supported Paint[] authoring types: SOLID, GRADIENT_LINEAR, GRADIENT_RADIAL, GRADIENT_ANGULAR, GRADIENT_DIAMOND. Use gradientTransform + gradientStops; do not use CSS gradients or REST gradientHandlePositions. IMAGE/VIDEO/PATTERN are readback-only metadata, not Paint[] authoring input; use imageUrl/images for images. For examples call styles(method:"help", topic:"delete").' : "";
3212
+ return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "") + paintHelp;
2720
3213
  }).join("; "));
2721
3214
  }
2722
3215
  throw e;
@@ -2727,9 +3220,9 @@ var tools = [
2727
3220
  },
2728
3221
  {
2729
3222
  name: "text",
2730
- 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?, name?, parentId?, x?, y?, items?: { id: string; name?: string; parentId?: string; x?: number; y?: number }[], depth?) \u2192 { results: {id}[] } // Duplicate nodes \u2014 produces a same-type copy (frame\u2192frame, instance\u2192instance, component\u2192component). Instance clones reference the same source component; they do not duplicate the component definition.\n audit (id, rules?, maxDepth?, maxFindings?, minSeverity?: error|unsafe|heuristic|style|verbose, skipInstances?) \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).',
3223
+ 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?, name?, parentId?, x?, y?, items?: { id: string; name?: string; parentId?: string; x?: number; y?: number }[], depth?) \u2192 { results: {id}[] } // Duplicate nodes \u2014 produces a same-type copy (frame\u2192frame, instance\u2192instance, component\u2192component). Instance clones reference the same source component; they do not duplicate the component definition.\n scale (id?, factor?, items?: { id: string; factor: number }[]) \u2192 { results: "ok"[] } // Proportionally rescale a node subtree using Figma\'s visual Scale tool behavior. This is for visual/artifact scaling, not responsive layout resizing.\n audit (id, rules?, maxDepth?, maxFindings?, minSeverity?: error|unsafe|heuristic|style|verbose, skipInstances?) \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).',
2731
3224
  schema: (caps2) => filterMethodsByTier({
2732
- method: z3.enum(["get", "list", "update", "delete", "clone", "audit", "reparent", "create", "set_content", "scan", "help"]),
3225
+ method: z3.enum(["get", "list", "update", "delete", "clone", "scale", "audit", "reparent", "create", "set_content", "scan", "help"]),
2733
3226
  id: z3.string().optional().describe("Node ID"),
2734
3227
  fields: flexStringList(z3.array(z3.string())).optional().describe('Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass ["*"] for all.'),
2735
3228
  depth: z3.coerce.number().optional().describe("Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited."),
@@ -2739,21 +3232,23 @@ var tools = [
2739
3232
  parentId: z3.string().optional().describe("Search only within this subtree"),
2740
3233
  offset: z3.coerce.number().optional().default(0).describe("Skip N items for pagination (default 0)"),
2741
3234
  limit: z3.coerce.number().optional().default(100).describe("Max items per page (default 100)"),
2742
- items: flexJson(z3.array(z3.record(z3.string(), z3.unknown()))).optional().describe("Array of {id, ...properties} to update/delete/clone/reparent/create/set_content/scan"),
3235
+ items: flexJson(z3.array(z3.record(z3.string(), z3.unknown()))).optional().describe("Array of {id, ...properties} to update/delete/clone/scale/reparent/create/set_content/scan"),
2743
3236
  name: z3.string().optional().describe("Rename the clone (set before appending to parent \u2014 required when cloning a variant into its component set to avoid duplicate names)"),
2744
3237
  x: z3.coerce.number().optional().describe("X position (default: 0)"),
2745
3238
  y: z3.coerce.number().optional().describe("Y position (default: 0)"),
3239
+ factor: z3.coerce.number().optional().describe("Scale factor, >= 0.01. 0.5 = 50%, 2 = 200%. Scales children, text, strokes, effects, and layout geometry from the node's top-left. On auto-layout or HUG/FILL nodes, Figma may resolve responsive sizing to fixed width/height."),
2746
3240
  rules: flexStringList(z3.array(z3.string())).optional().describe('Rules to check. Default: ["all"]. Categories: "component", "composition", "token", "naming", "wcag".'),
2747
3241
  maxDepth: z3.coerce.number().optional().describe("Max tree depth (default: 10)"),
2748
3242
  maxFindings: z3.coerce.number().optional().describe("Max findings (default: 50)"),
2749
3243
  minSeverity: z3.enum(["error", "unsafe", "heuristic", "style", "verbose"]).optional().describe("Minimum severity to report (default: style). Set to 'verbose' to include AAA contrast and line-height checks."),
2750
3244
  skipInstances: flexBool(z3.boolean()).optional().describe("Skip instance internals \u2014 findings inside instances are owned by the component (default: true)"),
2751
3245
  topic: z3.string().optional().describe('Help topic \u2014 method name for endpoint help, e.g. "create"')
2752
- }, caps2, { "get": "read", "list": "read", "update": "edit", "delete": "edit", "clone": "create", "audit": "read", "reparent": "edit", "create": "create", "set_content": "edit", "scan": "read", "help": "read" }),
3246
+ }, caps2, { "get": "read", "list": "read", "update": "edit", "delete": "edit", "clone": "create", "scale": "edit", "audit": "read", "reparent": "edit", "create": "create", "set_content": "edit", "scan": "read", "help": "read" }),
2753
3247
  tier: "read",
2754
3248
  validate: (params) => {
2755
3249
  const m = params.method;
2756
3250
  if (!params.items) return;
3251
+ if (Array.isArray(params.items) && params.items.length === 0) throw new Error('items: [] is a no-op. Batch calls need at least one item. Omit items to use single-item params, or pass one or more item objects. Use text(method: "help", topic: "' + m + '") to see valid item shapes.');
2757
3252
  if (m === "create") {
2758
3253
  for (const it of params.items) {
2759
3254
  if (it.characters !== void 0 && it.text === void 0) {
@@ -2776,7 +3271,7 @@ var tools = [
2776
3271
  letterSpacing: letterSpacing.optional(),
2777
3272
  textCase: z3.enum(["ORIGINAL", "UPPER", "LOWER", "TITLE", "SMALL_CAPS", "SMALL_CAPS_FORCED"]).optional(),
2778
3273
  textDecoration: z3.enum(["NONE", "UNDERLINE", "STRIKETHROUGH"]).optional(),
2779
- fills: z3.array(z3.record(z3.string(), z3.unknown())).optional().describe("Text color paints \u2014 e.g. [{type: 'SOLID', color: '#hex'}]. Same as node fills."),
3274
+ fills: paintArrayLoose.optional().describe("Text Paint[] authoring \u2014 accepts only SOLID or GRADIENT_LINEAR/RADIAL/ANGULAR/DIAMOND with gradientTransform + gradientStops. Same as node fills. Do not use CSS gradients, REST gradientHandlePositions, IMAGE/VIDEO/PATTERN, or top-level gradient boundVariables. IMAGE/VIDEO/PATTERN may appear in readback metadata only."),
2780
3275
  fontColor: colorRgba.optional().describe("Shorthand \u2014 sets text color (auto-binds to matching variable/style)"),
2781
3276
  fontColorVariableName: z3.string().optional().describe("Bind color variable by name e.g. 'text/primary'"),
2782
3277
  fontColorStyleName: z3.string().optional().describe("Apply paint style \u2014 overrides fontColor"),
@@ -2798,8 +3293,11 @@ var tools = [
2798
3293
  throw new Error(e.issues.map((i) => {
2799
3294
  const path = i.path.join(".");
2800
3295
  const shape = itemSchema instanceof z3.ZodObject ? itemSchema.shape : null;
2801
- const desc = shape?.[i.path[1]]?.description;
2802
- return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
3296
+ const field = String(i.path[1] ?? i.path[0] ?? "");
3297
+ const desc = shape?.[field]?.description;
3298
+ const paintField = field === "paints" || field === "fills" || field === "strokes";
3299
+ const paintHelp = paintField ? ' Invalid Paint[] payload. Supported Paint[] authoring types: SOLID, GRADIENT_LINEAR, GRADIENT_RADIAL, GRADIENT_ANGULAR, GRADIENT_DIAMOND. Use gradientTransform + gradientStops; do not use CSS gradients or REST gradientHandlePositions. IMAGE/VIDEO/PATTERN are readback-only metadata, not Paint[] authoring input; use imageUrl/images for images. For examples call text(method:"help", topic:"create").' : "";
3300
+ return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "") + paintHelp;
2803
3301
  }).join("; "));
2804
3302
  }
2805
3303
  throw e;
@@ -2827,19 +3325,22 @@ var tools = [
2827
3325
  throw new Error(e.issues.map((i) => {
2828
3326
  const path = i.path.join(".");
2829
3327
  const shape = itemSchema instanceof z3.ZodObject ? itemSchema.shape : null;
2830
- const desc = shape?.[i.path[1]]?.description;
2831
- return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
3328
+ const field = String(i.path[1] ?? i.path[0] ?? "");
3329
+ const desc = shape?.[field]?.description;
3330
+ const paintField = field === "paints" || field === "fills" || field === "strokes";
3331
+ const paintHelp = paintField ? ' Invalid Paint[] payload. Supported Paint[] authoring types: SOLID, GRADIENT_LINEAR, GRADIENT_RADIAL, GRADIENT_ANGULAR, GRADIENT_DIAMOND. Use gradientTransform + gradientStops; do not use CSS gradients or REST gradientHandlePositions. IMAGE/VIDEO/PATTERN are readback-only metadata, not Paint[] authoring input; use imageUrl/images for images. For examples call text(method:"help", topic:"set_content").' : "";
3332
+ return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "") + paintHelp;
2832
3333
  }).join("; "));
2833
3334
  }
2834
3335
  throw e;
2835
3336
  }
2836
3337
  }
2837
3338
  },
2838
- 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" }
3339
+ commandMap: { "get": "text.get", "list": "text.list", "update": "text.update", "delete": "text.delete", "clone": "text.clone", "scale": "text.scale", "audit": "text.audit", "reparent": "text.reparent", "create": "text.create", "set_content": "text.set_content", "scan": "text.scan" }
2839
3340
  },
2840
3341
  {
2841
3342
  name: "variable_collections",
2842
- 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}',
3343
+ 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 "#RGB"|"#RGBA"|"#RRGGBB"|"#RRGGBBAA" or {r: 0-1, g: 0-1, b: 0-1, a?: 0-1}',
2843
3344
  schema: (caps2) => filterMethodsByTier({
2844
3345
  method: z3.enum(["list", "get", "create", "update", "delete", "add_mode", "rename_mode", "remove_mode", "help"]),
2845
3346
  fields: flexStringList(z3.array(z3.string())).optional().describe('Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass ["*"] for all.'),
@@ -2856,6 +3357,7 @@ var tools = [
2856
3357
  if (params.id === void 0) throw new Error('get requires "id"');
2857
3358
  }
2858
3359
  if (!params.items) return;
3360
+ if (Array.isArray(params.items) && params.items.length === 0) throw new Error('items: [] is a no-op. Batch calls need at least one item. Omit items to use single-item params, or pass one or more item objects. Use variable_collections(method: "help", topic: "' + m + '") to see valid item shapes.');
2859
3361
  if (m === "create") {
2860
3362
  const itemSchema = z3.object({
2861
3363
  name: z3.string().describe("Collection name"),
@@ -2869,8 +3371,11 @@ var tools = [
2869
3371
  throw new Error(e.issues.map((i) => {
2870
3372
  const path = i.path.join(".");
2871
3373
  const shape = itemSchema instanceof z3.ZodObject ? itemSchema.shape : null;
2872
- const desc = shape?.[i.path[1]]?.description;
2873
- return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
3374
+ const field = String(i.path[1] ?? i.path[0] ?? "");
3375
+ const desc = shape?.[field]?.description;
3376
+ const paintField = field === "paints" || field === "fills" || field === "strokes";
3377
+ const paintHelp = paintField ? ' Invalid Paint[] payload. Supported Paint[] authoring types: SOLID, GRADIENT_LINEAR, GRADIENT_RADIAL, GRADIENT_ANGULAR, GRADIENT_DIAMOND. Use gradientTransform + gradientStops; do not use CSS gradients or REST gradientHandlePositions. IMAGE/VIDEO/PATTERN are readback-only metadata, not Paint[] authoring input; use imageUrl/images for images. For examples call variable_collections(method:"help", topic:"create").' : "";
3378
+ return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "") + paintHelp;
2874
3379
  }).join("; "));
2875
3380
  }
2876
3381
  throw e;
@@ -2888,8 +3393,11 @@ var tools = [
2888
3393
  throw new Error(e.issues.map((i) => {
2889
3394
  const path = i.path.join(".");
2890
3395
  const shape = itemSchema instanceof z3.ZodObject ? itemSchema.shape : null;
2891
- const desc = shape?.[i.path[1]]?.description;
2892
- return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
3396
+ const field = String(i.path[1] ?? i.path[0] ?? "");
3397
+ const desc = shape?.[field]?.description;
3398
+ const paintField = field === "paints" || field === "fills" || field === "strokes";
3399
+ const paintHelp = paintField ? ' Invalid Paint[] payload. Supported Paint[] authoring types: SOLID, GRADIENT_LINEAR, GRADIENT_RADIAL, GRADIENT_ANGULAR, GRADIENT_DIAMOND. Use gradientTransform + gradientStops; do not use CSS gradients or REST gradientHandlePositions. IMAGE/VIDEO/PATTERN are readback-only metadata, not Paint[] authoring input; use imageUrl/images for images. For examples call variable_collections(method:"help", topic:"update").' : "";
3400
+ return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "") + paintHelp;
2893
3401
  }).join("; "));
2894
3402
  }
2895
3403
  throw e;
@@ -2906,8 +3414,11 @@ var tools = [
2906
3414
  throw new Error(e.issues.map((i) => {
2907
3415
  const path = i.path.join(".");
2908
3416
  const shape = itemSchema instanceof z3.ZodObject ? itemSchema.shape : null;
2909
- const desc = shape?.[i.path[1]]?.description;
2910
- return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
3417
+ const field = String(i.path[1] ?? i.path[0] ?? "");
3418
+ const desc = shape?.[field]?.description;
3419
+ const paintField = field === "paints" || field === "fills" || field === "strokes";
3420
+ const paintHelp = paintField ? ' Invalid Paint[] payload. Supported Paint[] authoring types: SOLID, GRADIENT_LINEAR, GRADIENT_RADIAL, GRADIENT_ANGULAR, GRADIENT_DIAMOND. Use gradientTransform + gradientStops; do not use CSS gradients or REST gradientHandlePositions. IMAGE/VIDEO/PATTERN are readback-only metadata, not Paint[] authoring input; use imageUrl/images for images. For examples call variable_collections(method:"help", topic:"delete").' : "";
3421
+ return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "") + paintHelp;
2911
3422
  }).join("; "));
2912
3423
  }
2913
3424
  throw e;
@@ -2925,8 +3436,11 @@ var tools = [
2925
3436
  throw new Error(e.issues.map((i) => {
2926
3437
  const path = i.path.join(".");
2927
3438
  const shape = itemSchema instanceof z3.ZodObject ? itemSchema.shape : null;
2928
- const desc = shape?.[i.path[1]]?.description;
2929
- return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
3439
+ const field = String(i.path[1] ?? i.path[0] ?? "");
3440
+ const desc = shape?.[field]?.description;
3441
+ const paintField = field === "paints" || field === "fills" || field === "strokes";
3442
+ const paintHelp = paintField ? ' Invalid Paint[] payload. Supported Paint[] authoring types: SOLID, GRADIENT_LINEAR, GRADIENT_RADIAL, GRADIENT_ANGULAR, GRADIENT_DIAMOND. Use gradientTransform + gradientStops; do not use CSS gradients or REST gradientHandlePositions. IMAGE/VIDEO/PATTERN are readback-only metadata, not Paint[] authoring input; use imageUrl/images for images. For examples call variable_collections(method:"help", topic:"add_mode").' : "";
3443
+ return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "") + paintHelp;
2930
3444
  }).join("; "));
2931
3445
  }
2932
3446
  throw e;
@@ -2945,8 +3459,11 @@ var tools = [
2945
3459
  throw new Error(e.issues.map((i) => {
2946
3460
  const path = i.path.join(".");
2947
3461
  const shape = itemSchema instanceof z3.ZodObject ? itemSchema.shape : null;
2948
- const desc = shape?.[i.path[1]]?.description;
2949
- return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
3462
+ const field = String(i.path[1] ?? i.path[0] ?? "");
3463
+ const desc = shape?.[field]?.description;
3464
+ const paintField = field === "paints" || field === "fills" || field === "strokes";
3465
+ const paintHelp = paintField ? ' Invalid Paint[] payload. Supported Paint[] authoring types: SOLID, GRADIENT_LINEAR, GRADIENT_RADIAL, GRADIENT_ANGULAR, GRADIENT_DIAMOND. Use gradientTransform + gradientStops; do not use CSS gradients or REST gradientHandlePositions. IMAGE/VIDEO/PATTERN are readback-only metadata, not Paint[] authoring input; use imageUrl/images for images. For examples call variable_collections(method:"help", topic:"rename_mode").' : "";
3466
+ return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "") + paintHelp;
2950
3467
  }).join("; "));
2951
3468
  }
2952
3469
  throw e;
@@ -2964,8 +3481,11 @@ var tools = [
2964
3481
  throw new Error(e.issues.map((i) => {
2965
3482
  const path = i.path.join(".");
2966
3483
  const shape = itemSchema instanceof z3.ZodObject ? itemSchema.shape : null;
2967
- const desc = shape?.[i.path[1]]?.description;
2968
- return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
3484
+ const field = String(i.path[1] ?? i.path[0] ?? "");
3485
+ const desc = shape?.[field]?.description;
3486
+ const paintField = field === "paints" || field === "fills" || field === "strokes";
3487
+ const paintHelp = paintField ? ' Invalid Paint[] payload. Supported Paint[] authoring types: SOLID, GRADIENT_LINEAR, GRADIENT_RADIAL, GRADIENT_ANGULAR, GRADIENT_DIAMOND. Use gradientTransform + gradientStops; do not use CSS gradients or REST gradientHandlePositions. IMAGE/VIDEO/PATTERN are readback-only metadata, not Paint[] authoring input; use imageUrl/images for images. For examples call variable_collections(method:"help", topic:"remove_mode").' : "";
3488
+ return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "") + paintHelp;
2969
3489
  }).join("; "));
2970
3490
  }
2971
3491
  throw e;
@@ -2976,7 +3496,7 @@ var tools = [
2976
3496
  },
2977
3497
  {
2978
3498
  name: "variables",
2979
- 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 per-mode control, or value to set all modes at once.\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}',
3499
+ 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 { id, 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: {id, name}[] } // Create variables in a collection. Use valuesByMode for per-mode control, or value to set all modes at once.\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 "#RGB"|"#RGBA"|"#RRGGBB"|"#RRGGBBAA" or {r: 0-1, g: 0-1, b: 0-1, a?: 0-1}',
2980
3500
  schema: (caps2) => filterMethodsByTier({
2981
3501
  method: z3.enum(["list", "get", "create", "update", "delete", "help"]),
2982
3502
  collectionId: z3.string().optional().describe("Collection ID or name"),
@@ -3009,6 +3529,7 @@ var tools = [
3009
3529
  if (params.collectionId === void 0) throw new Error('delete requires "collectionId"');
3010
3530
  }
3011
3531
  if (!params.items) return;
3532
+ if (Array.isArray(params.items) && params.items.length === 0) throw new Error('items: [] is a no-op. Batch calls need at least one item. Omit items to use single-item params, or pass one or more item objects. Use variables(method: "help", topic: "' + m + '") to see valid item shapes.');
3012
3533
  if (m === "create") {
3013
3534
  const itemSchema = z3.object({
3014
3535
  name: z3.string().describe("Variable name (must be unique within collection)"),
@@ -3025,8 +3546,11 @@ var tools = [
3025
3546
  throw new Error(e.issues.map((i) => {
3026
3547
  const path = i.path.join(".");
3027
3548
  const shape = itemSchema instanceof z3.ZodObject ? itemSchema.shape : null;
3028
- const desc = shape?.[i.path[1]]?.description;
3029
- return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
3549
+ const field = String(i.path[1] ?? i.path[0] ?? "");
3550
+ const desc = shape?.[field]?.description;
3551
+ const paintField = field === "paints" || field === "fills" || field === "strokes";
3552
+ const paintHelp = paintField ? ' Invalid Paint[] payload. Supported Paint[] authoring types: SOLID, GRADIENT_LINEAR, GRADIENT_RADIAL, GRADIENT_ANGULAR, GRADIENT_DIAMOND. Use gradientTransform + gradientStops; do not use CSS gradients or REST gradientHandlePositions. IMAGE/VIDEO/PATTERN are readback-only metadata, not Paint[] authoring input; use imageUrl/images for images. For examples call variables(method:"help", topic:"create").' : "";
3553
+ return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "") + paintHelp;
3030
3554
  }).join("; "));
3031
3555
  }
3032
3556
  throw e;
@@ -3048,8 +3572,11 @@ var tools = [
3048
3572
  throw new Error(e.issues.map((i) => {
3049
3573
  const path = i.path.join(".");
3050
3574
  const shape = itemSchema instanceof z3.ZodObject ? itemSchema.shape : null;
3051
- const desc = shape?.[i.path[1]]?.description;
3052
- return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
3575
+ const field = String(i.path[1] ?? i.path[0] ?? "");
3576
+ const desc = shape?.[field]?.description;
3577
+ const paintField = field === "paints" || field === "fills" || field === "strokes";
3578
+ const paintHelp = paintField ? ' Invalid Paint[] payload. Supported Paint[] authoring types: SOLID, GRADIENT_LINEAR, GRADIENT_RADIAL, GRADIENT_ANGULAR, GRADIENT_DIAMOND. Use gradientTransform + gradientStops; do not use CSS gradients or REST gradientHandlePositions. IMAGE/VIDEO/PATTERN are readback-only metadata, not Paint[] authoring input; use imageUrl/images for images. For examples call variables(method:"help", topic:"update").' : "";
3579
+ return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "") + paintHelp;
3053
3580
  }).join("; "));
3054
3581
  }
3055
3582
  throw e;
@@ -3066,8 +3593,11 @@ var tools = [
3066
3593
  throw new Error(e.issues.map((i) => {
3067
3594
  const path = i.path.join(".");
3068
3595
  const shape = itemSchema instanceof z3.ZodObject ? itemSchema.shape : null;
3069
- const desc = shape?.[i.path[1]]?.description;
3070
- return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "");
3596
+ const field = String(i.path[1] ?? i.path[0] ?? "");
3597
+ const desc = shape?.[field]?.description;
3598
+ const paintField = field === "paints" || field === "fills" || field === "strokes";
3599
+ const paintHelp = paintField ? ' Invalid Paint[] payload. Supported Paint[] authoring types: SOLID, GRADIENT_LINEAR, GRADIENT_RADIAL, GRADIENT_ANGULAR, GRADIENT_DIAMOND. Use gradientTransform + gradientStops; do not use CSS gradients or REST gradientHandlePositions. IMAGE/VIDEO/PATTERN are readback-only metadata, not Paint[] authoring input; use imageUrl/images for images. For examples call variables(method:"help", topic:"delete").' : "";
3600
+ return path + ": " + i.message + (desc ? " (expected: " + desc + ")" : "") + paintHelp;
3071
3601
  }).join("; "));
3072
3602
  }
3073
3603
  throw e;
@@ -3124,10 +3654,10 @@ var guidelinesList = [
3124
3654
  }
3125
3655
  ];
3126
3656
  var guidelinesContent = {
3127
- "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- 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### Adding Variants to an Existing Set\n\nClone an existing variant into the same set with a new name. The `name` param is required \u2014 without it, the duplicate name corrupts the set.\n\n**Add a new value to an existing dimension** (e.g. State=Hover):\n```\ncomponents(method:"clone", id:"<variant_id>", name:"Style=Primary, State=Hover", parentId:"<set_id>")\n```\nClone one variant per combination. For a Style\xD7State set, adding State=Hover requires two clones (one per Style). Use batch `items` for efficiency:\n```\ncomponents(method:"clone", items:[\n {id:"<Primary/Default>", name:"Style=Primary, State=Hover", parentId:"<set_id>"},\n {id:"<Secondary/Default>", name:"Style=Secondary, State=Hover", parentId:"<set_id>"}\n])\n```\nThen patch the new variants: `frames(method:"update", items:[{id:"<new>", fillVariableName:"color/hover"}])`\n\n**Add a new dimension** (e.g. Size=sm to a Style\xD7State set):\n1. Batch rename existing variants to include the new dimension: `frames(method:"update", items:[{id:"<each>", name:"..., Size=md"}])`\n2. Batch clone all variants with the new value: `components(method:"clone", items:[{id:"<each>", name:"..., Size=sm", parentId:"<set_id>"}])`\n3. Batch patch the new variants: `frames(method:"update", items:[{id:"<each>", padding:8, minHeight:32}])`\n\nProperty bindings (TEXT, INSTANCE_SWAP) are preserved on cloned variants.\n\n## Slots\n\nSlots are placeholder containers inside components that instance users can fill with custom content.\n\n- Create at component root: `frames(method:"create", type:"slot", items:[{parentId:"<comp_id>", name:"Content"}])`\n- Create nested inside a frame within a component: `frames(method:"create", type:"slot", items:[{parentId:"<frame_id>", name:"Content"}])`\n- In instances, add content by using the slot\'s ID as `parentId` on any create/reparent call\n- Empty slots are normal \u2014 they don\'t trigger lint warnings\n\n## Checking\n\nRun `components(method:"audit", id)` \u2014 checks both lint rules and property bindings in one call.',
3657
+ "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- 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### Adding Variants to an Existing Set\n\nClone an existing variant into the same set with a new name. The `name` param is required \u2014 without it, the duplicate name corrupts the set.\n\n**Add a new value to an existing dimension** (e.g. State=Hover):\n```\ncomponents(method:"clone", id:"<variant_id>", name:"Style=Primary, State=Hover", parentId:"<set_id>")\n```\nClone one variant per combination. For a Style\xD7State set, adding State=Hover requires two clones (one per Style). Use batch `items` for efficiency:\n```\ncomponents(method:"clone", items:[\n {id:"<Primary/Default>", name:"Style=Primary, State=Hover", parentId:"<set_id>"},\n {id:"<Secondary/Default>", name:"Style=Secondary, State=Hover", parentId:"<set_id>"}\n])\n```\nThen patch the new variants: `frames(method:"update", items:[{id:"<new>", fillVariableName:"color/hover"}])`\n\n**Add a new dimension** (e.g. Size=sm to a Style\xD7State set):\n1. Batch rename existing variants to include the new dimension: `frames(method:"update", items:[{id:"<each>", name:"..., Size=md"}])`\n2. Batch clone all variants with the new value: `components(method:"clone", items:[{id:"<each>", name:"..., Size=sm", parentId:"<set_id>"}])`\n3. Batch patch the new variants: `frames(method:"update", items:[{id:"<each>", padding:"space/8"}])`\n\nProperty bindings (TEXT, INSTANCE_SWAP) are preserved on cloned variants.\n\n## Slots\n\nSlots are placeholder containers inside components that instance users can fill with custom content.\n\n- Create at component root: `frames(method:"create", type:"slot", items:[{parentId:"<comp_id>", name:"Content"}])`\n- Create nested inside a frame within a component: `frames(method:"create", type:"slot", items:[{parentId:"<frame_id>", name:"Content"}])`\n- In instances, add content by using the slot\'s ID as `parentId` on any create/reparent call\n- Empty slots are normal \u2014 they don\'t trigger lint warnings\n\n## Checking\n\nRun `components(method:"audit", id)` \u2014 checks both lint rules and property bindings in one call.',
3128
3658
  "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).',
3129
3659
  "responsive-designs": '# Responsive Sizing\n\n## Workflow: Top-Down Sizing\n\nBuild layouts from the outside in:\n\n1. **Set the container first.** Every container needs an explicit width \u2014 either `width` + `layoutSizingHorizontal:"FIXED"` for shells and bounded panels, or `layoutSizingHorizontal:"FILL"` inside an auto-layout parent. Set `layoutMode` (VERTICAL or HORIZONTAL) and spacing/padding.\n2. **Children fill the container.** Use `layoutSizingHorizontal:"FILL"` on children so they stretch to the available space. Use `layoutSizingVertical:"HUG"` so height follows content.\n3. **Only leaves use HUG on both axes.** Buttons, badges, icons \u2014 elements with short, predictable content that should shrink-wrap.\n\nThis ensures every level of the tree has a clear width constraint. Text wraps, FILL children stretch, and the layout adapts when the container resizes.\n\nAlways set BOTH axes explicitly on every node. Omitting sizing leads to unintended defaults.\n\n## FIXED / FILL / HUG\n\n- **FIXED** \u2014 explicit bounded widths: page shell, sidebar, modal max-width, specimen frames\n- **FILL** \u2014 children that adapt to parent: cards, rows, panels, nav stacks, text that should wrap. Use `minWidth`/`maxWidth` for responsive constraints.\n- **HUG** \u2014 content-sized leaves only: icons, badges, pills, button labels\n\n## Anti-patterns: HUG/HUG\n\nHUG on both axes is the most common cause of broken layouts. It means "shrink to fit my content on both axes" \u2014 the container has no opinion about its own size and collapses to whatever its children measure.\n\n**Why HUG/HUG breaks designs:**\n\n1. **Text never wraps.** A HUG-width container grows to fit the longest text line. Body text becomes a single very long line instead of wrapping at a readable width. The design looks correct with short placeholder text but breaks with real content.\n\n2. **Layouts don\'t adapt.** HUG/HUG containers ignore their parent\'s width. A card inside a responsive column won\'t stretch to fill available space \u2014 it stays at its content width, leaving gaps or overflowing.\n\n3. **FILL children become under-constrained.** A child with `layoutSizingHorizontal:"FILL"` inside a HUG-width parent has no space to fill \u2014 the parent defers its width to its children, but the FILL child defers its width to the parent. The result is under-constrained sizing that produces unpredictable or collapsed layouts.\n\n4. **Cascading failures.** One HUG/HUG container at the top of a tree forces every child to resolve its own width. The entire layout becomes rigid and content-dependent instead of responsive.\n\n**HUG/HUG is only correct for:**\n- Buttons, pills, badges, chips \u2014 intrinsically-sized leaf elements with short, predictable content\n- Icon containers with fixed-size children\n- Inline tags and status indicators\n\n**For everything else, set at least one axis to FIXED or FILL:**\n- Cards, panels, list rows \u2192 `layoutSizingHorizontal:"FILL"`, vertical `HUG`. Add `minWidth`/`maxWidth` for responsive bounds.\n- Shells, sidebars, modals \u2192 `width` + `layoutSizingHorizontal:"FIXED"`, vertical `FILL` or `HUG`\n- Full-width sections \u2192 `layoutSizingHorizontal:"FILL"`, `layoutSizingVertical:"HUG"`\n\n## Wrapping Layouts (layoutWrap)\n\n`layoutWrap: WRAP` enables children to flow into new rows when they exceed the container width \u2014 like CSS `flex-wrap`. This only works with **HORIZONTAL** auto-layout. Figma does not support wrap on VERTICAL layouts.\n\n**When to use wrap:**\n- Card grids with a fixed number of columns at a known width\n- Tag/chip collections where items flow into multiple rows\n- Any layout where items should reflow based on available width\n\n**Horizontal wrap pattern:**\n```\nframes.create(type: "auto_layout", layoutMode: "HORIZONTAL", layoutWrap: "WRAP",\n itemSpacing: "space/16", counterAxisSpacing: "space/16")\n```\nChildren use FIXED width to control column count. `counterAxisSpacing` sets the gap between wrapped rows.\n\n**Vertical grid alternative:**\nSince VERTICAL layouts cannot wrap, build column-based grids by nesting VERTICAL columns inside a HORIZONTAL parent:\n```\nouter (HORIZONTAL, itemSpacing: 20, FILL width)\n col-1 (VERTICAL, FILL width, HUG height, itemSpacing: 20)\n col-2 (VERTICAL, FILL width, HUG height, itemSpacing: 20)\n col-3 (VERTICAL, FILL width, HUG height, itemSpacing: 20)\n```\nEach column gets equal width via FILL. Reparent items into columns for column-first ordering. This handles variable card heights per column independently.\n\n## Component Sizing\n\nComponent roots use `FILL` when placed in a parent \u2014 they adapt to context, not a fixed specimen width. Use `FIXED` only for the specimen (the component definition itself when it needs a specific preview 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: prefer `FILL` width, `HUG` height (auto-wraps)\n- Single-line labels: prefer `FILL` horizontal (truncates if needed)\n- Standalone headings: `HUG` is fine\n\nInside auto-layout parents, target `layoutSizingHorizontal:"FILL"` + `layoutSizingVertical:"HUG"` + `textAutoResize:"HEIGHT"` for text that should wrap. These are not auto-applied \u2014 set them explicitly on text.create or text.update.\n\n## Checklist\n\nBefore finalizing a layout, verify:\n1. No container with text has HUG on the horizontal axis (unless it\'s a button/badge)\n2. Children use FILL on the axis that should absorb available space \u2014 not blindly on both axes. Compact controls in horizontal rows often stay HUG vertically.\n3. Top-level containers have an explicit width (FIXED) or stretch to their parent (FILL)\n4. Run `lint(method:"check", nodeId:"<rootId>", rules:["composition"])` to catch overflow-parent, unbounded-hug, and fixed-in-autolayout issues',
3130
- "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.',
3660
+ "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/surface"` or `fillStyleName:"Surface/Primary"`\n- Stroke: `strokeVariableName:"border/subtle"`\n- Text color: `fontColorVariableName:"text/primary"`\n\nIf no matching variable exists, create one first:\n```\nvariables(method:"create", collectionId:"Tokens", items:[{name:"bg/warning", type:"COLOR", value:"#F59E0B", 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:"Tokens", items:[{name:"space/32", type:"FLOAT", value:32, scopes:["GAP"]}])\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.',
3131
3661
  "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.'
3132
3662
  };
3133
3663
  function resolveGuideline(topic) {
@@ -4064,7 +4594,8 @@ async function registerAllTools(server2, sendCommand, caps2) {
4064
4594
  return { content: [{ type: "text", text }] };
4065
4595
  }
4066
4596
  const teamFromEnv = process.env.FIGMA_TEAM_ID;
4067
- let { file, team } = params;
4597
+ const { file } = params;
4598
+ let { team } = params;
4068
4599
  const needsTarget = (m) => m === "list" || m === "get" && filterRegistryByQuery("").length === 0;
4069
4600
  if (!file && !team && needsTarget(method) && teamFromEnv) team = teamFromEnv;
4070
4601
  if (method === "list") {
@@ -4494,9 +5025,9 @@ See "Version mismatch" in CARRYME.md or DRAGME.md for update steps.`;
4494
5025
  type: "text",
4495
5026
  text: connected ? `Tunnel reset: ${body.message}. Reconnected on port ${activePort}.
4496
5027
 
4497
- 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.
5028
+ IMPORTANT: The Figma plugin was also disconnected from the tunnel. Ask the user to use the existing Vibma plugin window and click Connect again if needed, then call connection(method: "create") followed by connection(method: "get").` : `Tunnel reset: ${body.message}. Reconnection in progress.
4498
5029
 
4499
- IMPORTANT: The Figma plugin was also disconnected. Ask the user to reopen the Vibma plugin, then call connection(method: "create") to retry.`
5030
+ IMPORTANT: The Figma plugin was also disconnected from the tunnel. Ask the user to use the existing Vibma plugin window and click Connect again if needed, then call connection(method: "create") to retry.`
4500
5031
  }]
4501
5032
  };
4502
5033
  }