Modification
用于修补、删除、克隆和重新排列节点的工具
此分类共 4 个工具。
patch_nodes
Section titled “patch_nodes” edit
Patch properties on nodes. Combines geometry (x/y/width/height), appearance (fill, stroke, cornerRadius, opacity, effects, constraints, exportSettings), layout (auto-layout), text (font props), and arbitrary properties in one call. Prefer styleName over hardcoded colors. Batch: pass multiple items.
| Parameter | Type | Required | Description |
|---|---|---|---|
items | object[] | ✓ | Array of nodes to patch |
↳ nodeId | string | ✓ | Node ID |
↳ x | number | ✗ | X position |
↳ y | number | ✗ | Y position |
↳ width | number | ✗ | Width (must provide height too) |
↳ height | number | ✗ | Height (must provide width too) |
↳ fill | object | ✗ | Fill color, style, or clear |
↳ color | object | ✗ | Hex "#FF0000" or {r,g,b,a?} with values 0-1. |
↳ r | number | ✓ | |
↳ g | number | ✓ | |
↳ b | number | ✓ | |
↳ a | number | ✗ | |
↳ styleName | string | ✗ | Paint style name (preferred over color) |
↳ clear | boolean | ✗ | Set true to remove all fills |
↳ stroke | object | ✗ | Stroke color/weight or style |
↳ color | object | ✗ | Hex "#FF0000" or {r,g,b,a?} with values 0-1. |
↳ r | number | ✓ | |
↳ g | number | ✓ | |
↳ b | number | ✓ | |
↳ a | number | ✗ | |
↳ weight | number | ✗ | Stroke weight |
↳ styleName | string | ✗ | Paint style name (preferred over color) |
↳ cornerRadius | object | ✗ | Corner radius |
↳ radius | number | ✓ | Corner radius |
↳ corners | boolean[] | ✗ | Which corners [topLeft, topRight, bottomRight, bottomLeft]. Default: all. |
↳ opacity | number | ✗ | Opacity (0-1) |
↳ effects | object | ✗ | Effects or effect style |
↳ effects | object[] | ✗ | Effect objects |
↳ type | "DROP_SHADOW" | "INNER_SHADOW" | "LAYER_BLUR" | "BACKGROUND_BLUR" | ✓ | |
↳ color | object | ✗ | Hex "#FF0000" or {r,g,b,a?} with values 0-1. |
↳ r | number | ✓ | |
↳ g | number | ✓ | |
↳ b | number | ✓ | |
↳ a | number | ✗ | |
↳ offset | object | ✗ | |
↳ x | number | ✓ | |
↳ y | number | ✓ | |
↳ radius | number | ✓ | |
↳ spread | number | ✗ | |
↳ visible | boolean | ✗ | |
↳ blendMode | string | ✗ | |
↳ styleName | string | ✗ | Effect style name (preferred over raw effects) |
↳ constraints | object | ✗ | Layout constraints |
↳ horizontal | "MIN" | "CENTER" | "MAX" | "STRETCH" | "SCALE" | ✓ | |
↳ vertical | "MIN" | "CENTER" | "MAX" | "STRETCH" | "SCALE" | ✓ | |
↳ exportSettings | object[] | ✗ | Export settings |
↳ format | "PNG" | "JPG" | "SVG" | "PDF" | ✓ | |
↳ suffix | string | ✗ | |
↳ contentsOnly | boolean | ✗ | |
↳ constraint | object | ✗ | |
↳ type | "SCALE" | "WIDTH" | "HEIGHT" | ✓ | |
↳ value | number | ✓ | |
↳ layout | object | ✗ | Auto-layout properties |
↳ layoutMode | "NONE" | "HORIZONTAL" | "VERTICAL" | ✗ | |
↳ layoutWrap | "NO_WRAP" | "WRAP" | ✗ | |
↳ paddingTop | number | ✗ | |
↳ paddingRight | number | ✗ | |
↳ paddingBottom | number | ✗ | |
↳ paddingLeft | number | ✗ | |
↳ primaryAxisAlignItems | "MIN" | "MAX" | "CENTER" | "SPACE_BETWEEN" | ✗ | |
↳ counterAxisAlignItems | "MIN" | "MAX" | "CENTER" | "BASELINE" | ✗ | |
↳ layoutSizingHorizontal | "FIXED" | "HUG" | "FILL" | ✗ | |
↳ layoutSizingVertical | "FIXED" | "HUG" | "FILL" | ✗ | |
↳ itemSpacing | number | ✗ | |
↳ counterAxisSpacing | number | ✗ | |
↳ text | object | ✗ | Text properties (font, alignment, sizing) |
↳ fontSize | number | ✗ | |
↳ fontWeight | number | ✗ | |
↳ fontColor | object | ✗ | Hex "#FF0000" or {r,g,b,a?} with values 0-1. |
↳ r | number | ✓ | |
↳ g | number | ✓ | |
↳ b | number | ✓ | |
↳ a | number | ✗ | |
↳ textStyleId | string | ✗ | |
↳ textStyleName | string | ✗ | |
↳ textAlignHorizontal | "LEFT" | "CENTER" | "RIGHT" | "JUSTIFIED" | ✗ | |
↳ textAlignVertical | "TOP" | "CENTER" | "BOTTOM" | ✗ | |
↳ textAutoResize | "NONE" | "WIDTH_AND_HEIGHT" | "HEIGHT" | "TRUNCATE" | ✗ | |
↳ layoutSizingHorizontal | "FIXED" | "HUG" | "FILL" | ✗ | |
↳ layoutSizingVertical | "FIXED" | "HUG" | "FILL" | ✗ | |
↳ properties | object | ✗ | Arbitrary key-value properties to set directly on the node |
depth | number | ✗ | Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited. |
JSON Schema
{
"type": "object",
"properties": {
"items": {
"description": "Array of nodes to patch",
"type": "array",
"items": {
"type": "object",
"properties": {
"nodeId": {
"type": "string",
"description": "Node ID"
},
"x": {
"description": "X position",
"type": "number"
},
"y": {
"description": "Y position",
"type": "number"
},
"width": {
"description": "Width (must provide height too)",
"type": "number",
"exclusiveMinimum": 0
},
"height": {
"description": "Height (must provide width too)",
"type": "number",
"exclusiveMinimum": 0
},
"fill": {
"description": "Fill color, style, or clear",
"type": "object",
"properties": {
"color": {
"description": "Hex \"#FF0000\" or {r,g,b,a?} with values 0-1.",
"type": "object",
"properties": {
"r": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"g": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"b": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"a": {
"type": "number",
"minimum": 0,
"maximum": 1
}
},
"required": [
"r",
"g",
"b"
]
},
"styleName": {
"description": "Paint style name (preferred over color)",
"type": "string"
},
"clear": {
"description": "Set true to remove all fills",
"type": "boolean"
}
}
},
"stroke": {
"description": "Stroke color/weight or style",
"type": "object",
"properties": {
"color": {
"description": "Hex \"#FF0000\" or {r,g,b,a?} with values 0-1.",
"type": "object",
"properties": {
"r": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"g": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"b": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"a": {
"type": "number",
"minimum": 0,
"maximum": 1
}
},
"required": [
"r",
"g",
"b"
]
},
"weight": {
"description": "Stroke weight",
"type": "number",
"exclusiveMinimum": 0
},
"styleName": {
"description": "Paint style name (preferred over color)",
"type": "string"
}
}
},
"cornerRadius": {
"description": "Corner radius",
"type": "object",
"properties": {
"radius": {
"type": "number",
"minimum": 0,
"description": "Corner radius"
},
"corners": {
"description": "Which corners [topLeft, topRight, bottomRight, bottomLeft]. Default: all.",
"minItems": 4,
"maxItems": 4,
"type": "array",
"items": {
"type": "boolean"
}
}
},
"required": [
"radius"
]
},
"opacity": {
"description": "Opacity (0-1)",
"type": "number",
"minimum": 0,
"maximum": 1
},
"effects": {
"description": "Effects or effect style",
"type": "object",
"properties": {
"effects": {
"description": "Effect objects",
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"DROP_SHADOW",
"INNER_SHADOW",
"LAYER_BLUR",
"BACKGROUND_BLUR"
]
},
"color": {
"description": "Hex \"#FF0000\" or {r,g,b,a?} with values 0-1.",
"type": "object",
"properties": {
"r": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"g": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"b": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"a": {
"type": "number",
"minimum": 0,
"maximum": 1
}
},
"required": [
"r",
"g",
"b"
]
},
"offset": {
"type": "object",
"properties": {
"x": {
"type": "number"
},
"y": {
"type": "number"
}
},
"required": [
"x",
"y"
]
},
"radius": {
"type": "number"
},
"spread": {
"type": "number"
},
"visible": {
"type": "boolean"
},
"blendMode": {
"type": "string"
}
},
"required": [
"type",
"radius"
]
}
},
"styleName": {
"description": "Effect style name (preferred over raw effects)",
"type": "string"
}
}
},
"constraints": {
"description": "Layout constraints",
"type": "object",
"properties": {
"horizontal": {
"type": "string",
"enum": [
"MIN",
"CENTER",
"MAX",
"STRETCH",
"SCALE"
]
},
"vertical": {
"type": "string",
"enum": [
"MIN",
"CENTER",
"MAX",
"STRETCH",
"SCALE"
]
}
},
"required": [
"horizontal",
"vertical"
]
},
"exportSettings": {
"description": "Export settings",
"type": "array",
"items": {
"type": "object",
"properties": {
"format": {
"type": "string",
"enum": [
"PNG",
"JPG",
"SVG",
"PDF"
]
},
"suffix": {
"type": "string"
},
"contentsOnly": {
"type": "boolean"
},
"constraint": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"SCALE",
"WIDTH",
"HEIGHT"
]
},
"value": {
"type": "number"
}
},
"required": [
"type",
"value"
]
}
},
"required": [
"format"
]
}
},
"layout": {
"description": "Auto-layout properties",
"type": "object",
"properties": {
"layoutMode": {
"type": "string",
"enum": [
"NONE",
"HORIZONTAL",
"VERTICAL"
]
},
"layoutWrap": {
"type": "string",
"enum": [
"NO_WRAP",
"WRAP"
]
},
"paddingTop": {
"type": "number"
},
"paddingRight": {
"type": "number"
},
"paddingBottom": {
"type": "number"
},
"paddingLeft": {
"type": "number"
},
"primaryAxisAlignItems": {
"type": "string",
"enum": [
"MIN",
"MAX",
"CENTER",
"SPACE_BETWEEN"
]
},
"counterAxisAlignItems": {
"type": "string",
"enum": [
"MIN",
"MAX",
"CENTER",
"BASELINE"
]
},
"layoutSizingHorizontal": {
"type": "string",
"enum": [
"FIXED",
"HUG",
"FILL"
]
},
"layoutSizingVertical": {
"type": "string",
"enum": [
"FIXED",
"HUG",
"FILL"
]
},
"itemSpacing": {
"type": "number"
},
"counterAxisSpacing": {
"type": "number"
}
}
},
"text": {
"description": "Text properties (font, alignment, sizing)",
"type": "object",
"properties": {
"fontSize": {
"type": "number"
},
"fontWeight": {
"type": "number"
},
"fontColor": {
"description": "Hex \"#FF0000\" or {r,g,b,a?} with values 0-1.",
"type": "object",
"properties": {
"r": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"g": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"b": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"a": {
"type": "number",
"minimum": 0,
"maximum": 1
}
},
"required": [
"r",
"g",
"b"
]
},
"textStyleId": {
"type": "string"
},
"textStyleName": {
"type": "string"
},
"textAlignHorizontal": {
"type": "string",
"enum": [
"LEFT",
"CENTER",
"RIGHT",
"JUSTIFIED"
]
},
"textAlignVertical": {
"type": "string",
"enum": [
"TOP",
"CENTER",
"BOTTOM"
]
},
"textAutoResize": {
"type": "string",
"enum": [
"NONE",
"WIDTH_AND_HEIGHT",
"HEIGHT",
"TRUNCATE"
]
},
"layoutSizingHorizontal": {
"type": "string",
"enum": [
"FIXED",
"HUG",
"FILL"
]
},
"layoutSizingVertical": {
"type": "string",
"enum": [
"FIXED",
"HUG",
"FILL"
]
}
}
},
"properties": {
"description": "Arbitrary key-value properties to set directly on the node",
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
}
},
"required": [
"nodeId"
]
}
},
"depth": {
"description": "Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.",
"type": "number"
}
},
"required": [
"items"
]
} 返回值 仅供参考 — 不包含在工具定义中
| Field | Type | Description |
|---|---|---|
results | ("ok" | success | error)[] | Per-item results. |
↳ matchedFillStyle | string | Matched fill paint style name |
↳ matchedStrokeStyle | string | Matched stroke paint style name |
↳ matchedEffectStyle | string | Matched effect style name |
↳ error | string | Error message for this item |
warnings | string[] | Deduplicated warnings hoisted from individual results |
示例返回
{
"results": [
"ok",
{
"matchedFillStyle": "Primary/Blue"
}
],
"warnings": [
"Hardcoded color #ff0000 has no matching paint style or color variable."
]
} 返回值 JSON Schema
{
"type": "object",
"description": "Per-item is 'ok' (no style matches) or object with matched style names.",
"properties": {
"results": {
"type": "array",
"description": "Per-item results.",
"items": {
"oneOf": [
{
"type": "string",
"const": "ok"
},
{
"title": "success",
"type": "object",
"properties": {
"matchedFillStyle": {
"type": "string",
"description": "Matched fill paint style name"
},
"matchedStrokeStyle": {
"type": "string",
"description": "Matched stroke paint style name"
},
"matchedEffectStyle": {
"type": "string",
"description": "Matched effect style name"
}
}
},
{
"title": "error",
"type": "object",
"properties": {
"error": {
"type": "string",
"description": "Error message for this item"
}
},
"required": [
"error"
]
}
]
}
},
"warnings": {
"type": "array",
"description": "Deduplicated warnings hoisted from individual results",
"items": {
"type": "string"
}
}
},
"required": [
"results"
]
} delete_node
Section titled “delete_node” edit
Delete nodes. Batch: pass multiple items.
| Parameter | Type | Required | Description |
|---|---|---|---|
items | object[] | ✓ | Array of {nodeId} |
↳ nodeId | string | ✓ | Node ID to delete |
JSON Schema
{
"type": "object",
"properties": {
"items": {
"description": "Array of {nodeId}",
"type": "array",
"items": {
"type": "object",
"properties": {
"nodeId": {
"type": "string",
"description": "Node ID to delete"
}
},
"required": [
"nodeId"
]
}
}
},
"required": [
"items"
]
} 返回值 仅供参考 — 不包含在工具定义中
| Field | Type | Description |
|---|---|---|
results | ("ok" | error)[] | Per-item results. |
↳ error | string | Error message for this item |
warnings | string[] | Deduplicated warnings hoisted from individual results |
示例返回
{
"results": [
"ok",
"ok"
]
} 返回值 JSON Schema
{
"type": "object",
"properties": {
"results": {
"type": "array",
"description": "Per-item results.",
"items": {
"oneOf": [
{
"type": "string",
"const": "ok"
},
{
"title": "error",
"type": "object",
"properties": {
"error": {
"type": "string",
"description": "Error message for this item"
}
},
"required": [
"error"
]
}
]
}
},
"warnings": {
"type": "array",
"description": "Deduplicated warnings hoisted from individual results",
"items": {
"type": "string"
}
}
},
"required": [
"results"
]
} clone_node
Section titled “clone_node” create
Clone nodes. Batch: pass multiple items.
| Parameter | Type | Required | Description |
|---|---|---|---|
items | object[] | ✓ | Array of {nodeId, x?, y?} |
↳ nodeId | string | ✓ | Node ID to clone |
↳ parentId | string | ✗ | Parent for the clone (e.g. a page ID). Defaults to same parent as original. |
↳ x | number | ✗ | New X for clone. Omit to keep original position. |
↳ y | number | ✗ | New Y for clone. Omit to keep original position. |
depth | number | ✗ | Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited. |
JSON Schema
{
"type": "object",
"properties": {
"items": {
"description": "Array of {nodeId, x?, y?}",
"type": "array",
"items": {
"type": "object",
"properties": {
"nodeId": {
"type": "string",
"description": "Node ID to clone"
},
"parentId": {
"description": "Parent for the clone (e.g. a page ID). Defaults to same parent as original.",
"type": "string"
},
"x": {
"description": "New X for clone. Omit to keep original position.",
"type": "number"
},
"y": {
"description": "New Y for clone. Omit to keep original position.",
"type": "number"
}
},
"required": [
"nodeId"
]
}
},
"depth": {
"description": "Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.",
"type": "number"
}
},
"required": [
"items"
]
} 返回值 仅供参考 — 不包含在工具定义中
| Field | Type | Description |
|---|---|---|
results | (success | error)[] | Per-item results. |
↳ id | string | Cloned node ID |
↳ error | string | Error message for this item |
warnings | string[] | Deduplicated warnings hoisted from individual results |
示例返回
{
"results": [
{
"id": "11:1"
}
]
} 返回值 JSON Schema
{
"type": "object",
"properties": {
"results": {
"type": "array",
"description": "Per-item results.",
"items": {
"oneOf": [
{
"title": "success",
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Cloned node ID"
}
}
},
{
"title": "error",
"type": "object",
"properties": {
"error": {
"type": "string",
"description": "Error message for this item"
}
},
"required": [
"error"
]
}
]
}
},
"warnings": {
"type": "array",
"description": "Deduplicated warnings hoisted from individual results",
"items": {
"type": "string"
}
}
},
"required": [
"results"
]
} insert_child
Section titled “insert_child” edit
Move nodes into a parent at a specific index (reorder/reparent). Batch: pass multiple items.
| Parameter | Type | Required | Description |
|---|---|---|---|
items | object[] | ✓ | Array of {parentId, childId, index?} |
↳ parentId | string | ✓ | Parent node ID |
↳ childId | string | ✓ | Child node ID to move |
↳ index | number | ✗ | Index to insert at (0=first). Omit to append. |
depth | number | ✗ | Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited. |
JSON Schema
{
"type": "object",
"properties": {
"items": {
"description": "Array of {parentId, childId, index?}",
"type": "array",
"items": {
"type": "object",
"properties": {
"parentId": {
"type": "string",
"description": "Parent node ID"
},
"childId": {
"type": "string",
"description": "Child node ID to move"
},
"index": {
"description": "Index to insert at (0=first). Omit to append.",
"type": "number"
}
},
"required": [
"parentId",
"childId"
]
}
},
"depth": {
"description": "Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.",
"type": "number"
}
},
"required": [
"items"
]
} 返回值 仅供参考 — 不包含在工具定义中
| Field | Type | Description |
|---|---|---|
results | ("ok" | error)[] | Per-item results. |
↳ error | string | Error message for this item |
warnings | string[] | Deduplicated warnings hoisted from individual results |
示例返回
{
"results": [
"ok"
]
} 返回值 JSON Schema
{
"type": "object",
"properties": {
"results": {
"type": "array",
"description": "Per-item results.",
"items": {
"oneOf": [
{
"type": "string",
"const": "ok"
},
{
"title": "error",
"type": "object",
"properties": {
"error": {
"type": "string",
"description": "Error message for this item"
}
},
"required": [
"error"
]
}
]
}
},
"warnings": {
"type": "array",
"description": "Deduplicated warnings hoisted from individual results",
"items": {
"type": "string"
}
}
},
"required": [
"results"
]
}