CodePic
AI agent draws editable hand-drawn diagrams (flowchart, ER, architecture) via MCP, not static images
我該用這個嗎
品質與安全性
根據工具定義與協定合規性的自動化分析。
上下文成本
這是每次將伺服器的工具載入模型上下文時所消耗的約略 token 數量。數量越高,可用於其他工作的注意力就越少。
安裝
一鍵安裝
將以下內容加入你的 `claude_desktop_config.json` 檔案:
{
"mcpServers": {
"codepic": {
"url": "https://codepic.cc/api/mcp/mcp"
}
}
}遠端端點
https://codepic.cc/api/mcp/mcpstreamable-http它能做什麼
工具清單
工具(7)
🟢get_shape_docs
Return the full CodePic shape reference — all element types, their fields, data payloads, and JSON examples. Call get_shape_catalog first for concise shape selection and container capabilities; use this tool when you need complete fields or type-specific data (e.g. select options, triangle direction, callout tail). No authentication required.
輸入結構描述
{
"type": "object",
"properties": {},
"$schema": "http://json-schema.org/draft-07/schema#"
}🟡get_shape_catalog(category, tag, containerMode)
Return compact machine-readable shape metadata for planning a diagram: semantic tags, geometry family, container support, recommended padding, default size, and MCP availability. Use this before create_diagram when choosing shapes or containers. Unlike get_shape_docs, this tool is concise and filterable.
輸入結構描述
{
"type": "object",
"properties": {
"category": {
"type": "string",
"enum": [
"basic",
"flow",
"container",
"ui",
"architecture",
"misc"
],
"description": "Filter by the shape category."
},
"tag": {
"type": "string",
"description": "Filter by one exact AI tag, e.g. container-capable, decision, database, or architecture."
},
"containerMode": {
"type": "string",
"enum": [
"native",
"adaptive",
"none"
],
"description": "Filter by container support. adaptive shapes become containers when they receive children."
}
},
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}🟢list_templates(category)
List all available CodePic diagram templates. Use this ONLY when the user has explicitly asked to browse, list, or pick from templates (e.g. "show me templates", "列出模板"). Do NOT call this as a preparatory step when the user just described a diagram they want — in that case go straight to `create_diagram`. Discovering slugs here is only meaningful before a user-confirmed `create_from_template` call.
輸入結構描述
{
"type": "object",
"properties": {
"category": {
"type": "string",
"enum": [
"planning",
"design",
"flowchart",
"collaboration",
"engineering"
],
"description": "Filter by category"
}
},
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}🟡create_from_template(slug, name, locale)
Create a new CodePic diagram from a predefined template. Requires API Key authentication. Returns a public view URL and edit URL. **STRICT USAGE RULE — READ BEFORE CALLING:** Only call this tool when the user has **explicitly** asked to use a template. Explicit signals include phrases like: "use a template", "from template", "用模板", "从模板创建", "list templates and pick one", or the user directly naming/selecting a template slug. If the user merely describes a diagram they want (e.g. "draw an A/B test flowchart", "帮我画一个登录流程", "给我做一个系统架构图"), **DO NOT** call this tool. Call `create_diagram` instead and build the diagram from the user's description. Never silently substitute a template for a described diagram — the user will get a generic result that does not match what they asked for. When responding to the user, present the returned URL as a clickable markdown link (e.g. `[Open in CodePic →](URL)`) so the user can click it directly in their AI client (Cursor / Claude / etc.).
輸入結構描述
{
"type": "object",
"properties": {
"slug": {
"type": "string",
"description": "Template slug (e.g. 'flowchart', 'erd', 'kanban'). Call list_templates to see all."
},
"name": {
"type": "string",
"description": "Document name (defaults to template name)"
},
"locale": {
"type": "string",
"enum": [
"en",
"zh"
],
"description": "Language for template content (default: en)"
}
},
"required": [
"slug"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}🟡create_diagram(name, nodes, edges, backgroundColor)
Create a custom CodePic hand-drawn style diagram by specifying nodes and edges. Requires API Key authentication. Returns a public view URL. **THIS IS THE DEFAULT TOOL FOR ANY USER-DESCRIBED DIAGRAM.** Whenever the user describes a diagram they want ("draw an A/B test flowchart", "帮我画一个登录流程", "a system architecture with a load balancer and 3 servers", etc.), build it here from their description. Do NOT fall back to `create_from_template` / `list_templates` unless the user explicitly asked for a template. When responding to the user, present the returned URL as a clickable markdown link (e.g. `[Open in CodePic →](URL)`) so the user can click it directly in their AI client (Cursor / Claude / etc.). **Container nesting (IMPORTANT — use whenever possible):** - Set `parentId` on a node to nest it inside another node. ANY node type can be a container. - The parent automatically becomes draggable-as-a-group and users can keep dropping elements into it. - Call `get_shape_catalog` with tag `container-capable` to choose among native structural containers and adaptive semantic shapes such as rectangles, circles, ellipses, diamonds, cylinders, and hexagons. - Parent bounds are expanded automatically using the selected shape's title and outline safe area. - Use absolute canvas coordinates for all nodes — child coordinates are auto-converted to parent-relative. - Set node `name`, `description`, and `tags` when later MCP/Agent reads need stable business semantics beyond visible text. - **Rule**: whenever 2+ nodes logically belong to the same module / component / region, create a container node first and set `parentId` on each child. **Design tips for beautiful diagrams:** - Use semantic types: `button-primary` for CTA buttons (auto blue), `diamond` for decisions - Pick a color palette and apply it consistently — light fill + darker stroke of the same hue: • Blue: fillColor #e3f2fd / #bbdefb, strokeColor #1565c0, fontColor #1565c0 (or #ffffff on dark fill) • Green: fillColor #e8f5e9 / #c8e6c9, strokeColor #2e7d32, fontColor #1b5e20 • Purple: fillColor #f3e5f5 / #e1bee7, strokeColor #6a1b9a, fontColor #4a148c • Neutral: fillColor #f8fafc / #f1f5f9, strokeColor #475569, fontColor #1e293b - Each semantic group (decisions, processes, I/O) should share a fill color to create visual hierarchy - Dark fill (e.g. #1565c0, #ef4444) → fontColor #ffffff; light fill → fontColor #111827
輸入結構描述
{
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Document name"
},
"nodes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Unique node ID"
},
"type": {
"type": "string",
"enum": [
"rect",
"ellipse",
"circle",
"diamond",
"parallelogram",
"document",
"cylinder",
"hexagon",
"triangle",
"callout",
"cloud",
"terminator",
"cross",
"off-page-connector",
"actor",
"note",
"component",
"end-node",
"start-node",
"fork-bar",
"predefined-process",
"delay",
"manual-input",
"stored-data",
"text",
"textarea",
"link",
"icon",
"image",
"frame",
"package",
"swimlane",
"rounded-rect",
"table",
"button",
"button-primary",
"button-secondary",
"button-destructive",
"button-ghost",
"input",
"select",
"checkbox",
"radio",
"switch",
"slider",
"progress",
"server",
"load-balancer",
"firewall",
"container",
"msg-queue",
"queue",
"router",
"lambda",
"cache",
"pod",
"browser-frame",
"mobile-frame",
"code"
],
"description": "Shape type (default: rect). Call get_shape_docs for full per-type field reference. Common: rect/rounded-rect=card, diamond=decision, parallelogram=I/O, cylinder=database, hexagon=service, actor=user, frame=container group, button-primary=blue CTA, button-destructive=danger action. Architecture: server, load-balancer, firewall, container, msg-queue, router, lambda, cache, pod. UI wireframe: input, select, checkbox, radio, switch, slider. Mockups: browser-frame, mobile-frame. Code: code (syntax-highlighted code block, set data.language and data.theme; calculate width/height from text content: charW=fontSize*0.6, width=lineNumW+32+maxLineChars*charW, height=24+lineCount*fontSize*lineHeight)."
},
"text": {
"anyOf": [
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "rich-text"
},
"version": {
"type": "number",
"const": 1
},
"blocks": {
"type": "array",
"items": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "paragraph"
},
"textAlign": {
"type": "string",
"enum": [
"left",
"center",
"right"
]
},
"runs": {
"type": "array",
"items": {
"type": "object",
"properties": {
"text": {
"type": "string"
},
"style": {
"type": "object",
"properties": {
"fontSize": {
"type": "number",
"exclusiveMinimum": 0
},
"fontFamily": {
"type": "string",
"minLength": 1
},
"fontColor": {
"type": "string",
"minLength": 1
},
"fontWeight": {
"type": "string",
"minLength": 1
},
"fontStyle": {
"type": "string",
"minLength": 1
},
"textDecoration": {
"type": "string",
"enum": [
"none",
"underline",
"line-through"
]
}
},
"additionalProperties": false
},
"href": {
"type": "string",
"format": "uri"
}
},
"required": [
"text"
],
"additionalProperties": false
},
"minItems": 1
}
},
"required": [
"type",
"runs"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "list-item"
},
"listType": {
"type": "string",
"enum": [
"ordered",
"unordered"
]
},
"level": {
"type": "integer",
"minimum": 0,
"maximum": 5
},
"textAlign": {
"type": "string",
"enum": [
"left",
"center",
"right"
]
},
"runs": {
"type": "array",
"items": {
"$ref": "#/properties/nodes/items/properties/text/anyOf/0/properties/blocks/items/anyOf/0/properties/runs/items"
},
"minItems": 1
}
},
"required": [
"type",
"listType",
"runs"
],
"additionalProperties": false
}
]
},
"minItems": 1
}
},
"required": [
"kind",
"version",
"blocks"
],
"additionalProperties": false
},
{
"type": "string"
}
],
"description": "Text content. Use RichTextContent for normal shapes; code/input use a raw string; frame uses a string title."
},
"name": {
"type": "string",
"maxLength": 80,
"description": "Stable semantic name for MCP/Agent understanding, e.g. 'payment-service'."
},
"description": {
"type": "string",
"maxLength": 500,
"description": "Concise semantic purpose of this node, independent of its visible text."
},
"tags": {
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 48
},
"maxItems": 12,
"description": "Instance-level semantic tags for future MCP/Agent reads, e.g. ['backend','critical','pii']. Use get_shape_catalog tags for shape selection; use this field for the node's role in this diagram."
},
"x": {
"type": "number",
"description": "X position"
},
"y": {
"type": "number",
"description": "Y position"
},
"width": {
"type": "number",
"description": "Width (default: 200)"
},
"height": {
"type": "number",
"description": "Height (default: 80)"
},
"rotation": {
"type": "number",
"description": "Rotation angle in radians (default: 0)"
},
"fillColor": {
"type": "string",
"description": "Fill color, e.g. '#e3f2fd'"
},
"fillStyle": {
"type": "string",
"enum": [
"none",
"solid",
"hachure",
"cross-hatch"
],
"description": "Fill style (default: solid)"
},
"strokeColor": {
"type": "string",
"description": "Stroke color, e.g. '#1565c0'"
},
"strokeWidth": {
"type": "number",
"description": "Stroke width in px (default: 2)"
},
"opacity": {
"type": "number",
"minimum": 0,
"maximum": 1,
"description": "Opacity 0-1 (default: 1)"
},
"roughness": {
"type": "number",
"minimum": 0,
"maximum": 3,
"description": "Hand-drawn roughness 0-3, 0=smooth, 3=very rough (default: 1)"
},
"corners": {
"type": "array",
"minItems": 4,
"maxItems": 4,
"items": [
{
"type": "number"
},
{
"type": "number"
},
{
"type": "number"
},
{
"type": "number"
}
],
"description": "Border radius [topLeft, topRight, bottomRight, bottomLeft] (default: [0,0,0,0]). Applies to ALL shape types — use to round corners for a more polished look. Rect/frame/input/select/button: [8,8,8,8]–[16,16,16,16]. Rough style (roughness≥1): small corners (4–8). Smooth (roughness:0): larger corners (12–20). Other shapes (diamond, hexagon, etc.) can also use corners for subtle rounding."
},
"fontColor": {
"type": "string",
"description": "Text color (default: '#333333')"
},
"fontSize": {
"type": "number",
"description": "Font size (default: 16)"
},
"fontFamily": {
"type": "string",
"description": "Font family (default: 'Inter, sans-serif')"
},
"fontWeight": {
"type": "string",
"enum": [
"normal",
"bold"
],
"description": "Font weight (default: 'bold')"
},
"fontStyle": {
"type": "string",
"enum": [
"normal",
"italic"
],
"description": "Font style (default: 'normal')"
},
"textAlign": {
"type": "string",
"enum": [
"left",
"center",
"right"
],
"description": "Horizontal text alignment (default: 'center')"
},
"verticalAlign": {
"type": "string",
"enum": [
"top",
"center",
"bottom"
],
"description": "Vertical text alignment (default: 'center')"
},
"lineHeight": {
"type": "number",
"description": "Line height multiplier (default: 1.2)"
},
"data": {
"type": "object",
"additionalProperties": {},
"description": "Type-specific state data. Call get_shape_docs for the full field list. Examples: select→{options:[{id,label}],selectedId,open}, checkbox/radio→{checked}, switch→{on}, slider→{min,max,value}, input/textarea→{placeholder}, link→{href}, icon→{iconName}, triangle→{triangleDirection:'up'|'down'|'left'|'right'}, callout→{calloutTailX,calloutBodyRatio}."
},
"parentId": {
"type": "string",
"description": "Parent container node ID. Nest this node inside another node (any type can be a container). The parent automatically becomes containable=true so users can keep dragging elements into it. Call get_shape_catalog with tag='container-capable' to choose a suitable parent shape. Provide x/y as absolute canvas coordinates — they are auto-converted to parent-relative coordinates. WHEN TO USE: whenever multiple nodes logically belong to the same module, region, or component, wrap them in a shared container and set parentId on each child. This lets users reposition the whole group and drag additional elements into it."
}
},
"required": [
"id",
"text",
"x",
"y"
],
"additionalProperties": false
},
"description": "Array of shape nodes to place on the canvas"
},
"edges": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Unique edge ID"
},
"sourceId": {
"type": "string",
"description": "Source node ID"
},
"targetId": {
"type": "string",
"description": "Target node ID"
},
"label": {
"type": "string",
"description": "Edge label text"
}
},
"required": [
"id",
"sourceId",
"targetId"
],
"additionalProperties": false
},
"description": "Array of connector edges between nodes"
},
"backgroundColor": {
"type": "string",
"description": "Canvas background color (default: '#f8f9fa')"
}
},
"required": [
"name",
"nodes"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}🟡get_diagram(documentId)
Fetch the current state of an existing CodePic diagram. Returns a compact summary of all elements with their IDs, types, positions, and parent-child relationships. Use this before update_diagram when you need to: add nested children to existing containers, make targeted edits to specific elements, or understand the current structure. Requires API Key authentication.
輸入結構描述
{
"type": "object",
"properties": {
"documentId": {
"type": "string",
"description": "Document ID to fetch"
}
},
"required": [
"documentId"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}🟡update_diagram(documentId, name, nodes, edges, addNodes, ...)
Update an existing CodePic diagram. You can rename it, replace all nodes/edges, or add/remove individual nodes and edges. Requires API Key authentication. When responding to the user, present the returned URL as a clickable markdown link (e.g. `[Open in CodePic →](URL)`) so the user can click it directly in their AI client (Cursor / Claude / etc.).
輸入結構描述
{
"type": "object",
"properties": {
"documentId": {
"type": "string",
"description": "Document ID to update (from a previous create call)"
},
"name": {
"type": "string",
"description": "New document name"
},
"nodes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Unique node ID"
},
"type": {
"type": "string",
"enum": [
"rect",
"ellipse",
"circle",
"diamond",
"parallelogram",
"document",
"cylinder",
"hexagon",
"triangle",
"callout",
"cloud",
"terminator",
"cross",
"off-page-connector",
"actor",
"note",
"component",
"end-node",
"start-node",
"fork-bar",
"predefined-process",
"delay",
"manual-input",
"stored-data",
"text",
"textarea",
"link",
"icon",
"image",
"frame",
"package",
"swimlane",
"rounded-rect",
"table",
"button",
"button-primary",
"button-secondary",
"button-destructive",
"button-ghost",
"input",
"select",
"checkbox",
"radio",
"switch",
"slider",
"progress",
"server",
"load-balancer",
"firewall",
"container",
"msg-queue",
"queue",
"router",
"lambda",
"cache",
"pod",
"browser-frame",
"mobile-frame",
"code"
],
"description": "Shape type (default: rect). Call get_shape_docs for full per-type field reference. Common: rect/rounded-rect=card, diamond=decision, parallelogram=I/O, cylinder=database, hexagon=service, actor=user, frame=container group, button-primary=blue CTA, button-destructive=danger action. Architecture: server, load-balancer, firewall, container, msg-queue, router, lambda, cache, pod. UI wireframe: input, select, checkbox, radio, switch, slider. Mockups: browser-frame, mobile-frame. Code: code (syntax-highlighted code block, set data.language and data.theme; calculate width/height from text content: charW=fontSize*0.6, width=lineNumW+32+maxLineChars*charW, height=24+lineCount*fontSize*lineHeight)."
},
"text": {
"anyOf": [
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "rich-text"
},
"version": {
"type": "number",
"const": 1
},
"blocks": {
"type": "array",
"items": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "paragraph"
},
"textAlign": {
"type": "string",
"enum": [
"left",
"center",
"right"
]
},
"runs": {
"type": "array",
"items": {
"type": "object",
"properties": {
"text": {
"type": "string"
},
"style": {
"type": "object",
"properties": {
"fontSize": {
"type": "number",
"exclusiveMinimum": 0
},
"fontFamily": {
"type": "string",
"minLength": 1
},
"fontColor": {
"type": "string",
"minLength": 1
},
"fontWeight": {
"type": "string",
"minLength": 1
},
"fontStyle": {
"type": "string",
"minLength": 1
},
"textDecoration": {
"type": "string",
"enum": [
"none",
"underline",
"line-through"
]
}
},
"additionalProperties": false
},
"href": {
"type": "string",
"format": "uri"
}
},
"required": [
"text"
],
"additionalProperties": false
},
"minItems": 1
}
},
"required": [
"type",
"runs"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "list-item"
},
"listType": {
"type": "string",
"enum": [
"ordered",
"unordered"
]
},
"level": {
"type": "integer",
"minimum": 0,
"maximum": 5
},
"textAlign": {
"type": "string",
"enum": [
"left",
"center",
"right"
]
},
"runs": {
"type": "array",
"items": {
"$ref": "#/properties/nodes/items/properties/text/anyOf/0/properties/blocks/items/anyOf/0/properties/runs/items"
},
"minItems": 1
}
},
"required": [
"type",
"listType",
"runs"
],
"additionalProperties": false
}
]
},
"minItems": 1
}
},
"required": [
"kind",
"version",
"blocks"
],
"additionalProperties": false
},
{
"type": "string"
}
],
"description": "Text content. Use RichTextContent for normal shapes; code/input use a raw string; frame uses a string title."
},
"name": {
"type": "string",
"maxLength": 80,
"description": "Stable semantic name for MCP/Agent understanding, e.g. 'payment-service'."
},
"description": {
"type": "string",
"maxLength": 500,
"description": "Concise semantic purpose of this node, independent of its visible text."
},
"tags": {
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 48
},
"maxItems": 12,
"description": "Instance-level semantic tags for future MCP/Agent reads, e.g. ['backend','critical','pii']. Use get_shape_catalog tags for shape selection; use this field for the node's role in this diagram."
},
"x": {
"type": "number",
"description": "X position"
},
"y": {
"type": "number",
"description": "Y position"
},
"width": {
"type": "number",
"description": "Width (default: 200)"
},
"height": {
"type": "number",
"description": "Height (default: 80)"
},
"rotation": {
"type": "number",
"description": "Rotation angle in radians (default: 0)"
},
"fillColor": {
"type": "string",
"description": "Fill color, e.g. '#e3f2fd'"
},
"fillStyle": {
"type": "string",
"enum": [
"none",
"solid",
"hachure",
"cross-hatch"
],
"description": "Fill style (default: solid)"
},
"strokeColor": {
"type": "string",
"description": "Stroke color, e.g. '#1565c0'"
},
"strokeWidth": {
"type": "number",
"description": "Stroke width in px (default: 2)"
},
"opacity": {
"type": "number",
"minimum": 0,
"maximum": 1,
"description": "Opacity 0-1 (default: 1)"
},
"roughness": {
"type": "number",
"minimum": 0,
"maximum": 3,
"description": "Hand-drawn roughness 0-3, 0=smooth, 3=very rough (default: 1)"
},
"corners": {
"type": "array",
"minItems": 4,
"maxItems": 4,
"items": [
{
"type": "number"
},
{
"type": "number"
},
{
"type": "number"
},
{
"type": "number"
}
],
"description": "Border radius [topLeft, topRight, bottomRight, bottomLeft] (default: [0,0,0,0]). Applies to ALL shape types — use to round corners for a more polished look. Rect/frame/input/select/button: [8,8,8,8]–[16,16,16,16]. Rough style (roughness≥1): small corners (4–8). Smooth (roughness:0): larger corners (12–20). Other shapes (diamond, hexagon, etc.) can also use corners for subtle rounding."
},
"fontColor": {
"type": "string",
"description": "Text color (default: '#333333')"
},
"fontSize": {
"type": "number",
"description": "Font size (default: 16)"
},
"fontFamily": {
"type": "string",
"description": "Font family (default: 'Inter, sans-serif')"
},
"fontWeight": {
"type": "string",
"enum": [
"normal",
"bold"
],
"description": "Font weight (default: 'bold')"
},
"fontStyle": {
"type": "string",
"enum": [
"normal",
"italic"
],
"description": "Font style (default: 'normal')"
},
"textAlign": {
"type": "string",
"enum": [
"left",
"center",
"right"
],
"description": "Horizontal text alignment (default: 'center')"
},
"verticalAlign": {
"type": "string",
"enum": [
"top",
"center",
"bottom"
],
"description": "Vertical text alignment (default: 'center')"
},
"lineHeight": {
"type": "number",
"description": "Line height multiplier (default: 1.2)"
},
"data": {
"type": "object",
"additionalProperties": {},
"description": "Type-specific state data. Call get_shape_docs for the full field list. Examples: select→{options:[{id,label}],selectedId,open}, checkbox/radio→{checked}, switch→{on}, slider→{min,max,value}, input/textarea→{placeholder}, link→{href}, icon→{iconName}, triangle→{triangleDirection:'up'|'down'|'left'|'right'}, callout→{calloutTailX,calloutBodyRatio}."
},
"parentId": {
"type": "string",
"description": "Parent container node ID. Nest this node inside another node (any type can be a container). The parent automatically becomes containable=true so users can keep dragging elements into it. Call get_shape_catalog with tag='container-capable' to choose a suitable parent shape. Provide x/y as absolute canvas coordinates — they are auto-converted to parent-relative coordinates. WHEN TO USE: whenever multiple nodes logically belong to the same module, region, or component, wrap them in a shared container and set parentId on each child. This lets users reposition the whole group and drag additional elements into it."
}
},
"required": [
"id",
"text",
"x",
"y"
],
"additionalProperties": false
},
"description": "Full replacement of all nodes. If provided, replaces the entire canvas content."
},
"edges": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Unique edge ID"
},
"sourceId": {
"type": "string",
"description": "Source node ID"
},
"targetId": {
"type": "string",
"description": "Target node ID"
},
"label": {
"type": "string",
"description": "Edge label text"
}
},
"required": [
"id",
"sourceId",
"targetId"
],
"additionalProperties": false
},
"description": "Full replacement of all edges"
},
"addNodes": {
"type": "array",
"items": {
"$ref": "#/properties/nodes/items"
},
"description": "Nodes to add (without replacing existing ones)"
},
"addEdges": {
"type": "array",
"items": {
"$ref": "#/properties/edges/items"
},
"description": "Edges to add"
},
"removeNodeIds": {
"type": "array",
"items": {
"type": "string"
},
"description": "IDs of nodes to remove"
},
"removeEdgeIds": {
"type": "array",
"items": {
"type": "string"
},
"description": "IDs of edges to remove"
},
"backgroundColor": {
"type": "string",
"description": "New canvas background color"
}
},
"required": [
"documentId"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}社群
證據