{
  "schemaVersion": 1,
  "snapshotDate": "2026-10-23",
  "slug": "tool-onf-patch-graph",
  "title": "onf_patch_graph",
  "section": "MCP tool reference",
  "description": "Apply a batch of graph operations to one cloned draft and commit once with expectedRevision. Supports add/update/remove node, connect/disconnect, upgrade node. Node removal also removes incident wires. Config/inputs maps replace existing ma",
  "kind": "mcp",
  "url": "/wiki/tool-onf-patch-graph/",
  "markdown": "/wiki/tool-onf-patch-graph/index.md",
  "json": "/wiki/tool-onf-patch-graph/index.json",
  "headings": [
    {
      "id": "inputs",
      "title": "Inputs",
      "depth": 2
    },
    {
      "id": "exact-input-schema",
      "title": "Exact input schema",
      "depth": 2
    },
    {
      "id": "mcp-annotations",
      "title": "MCP annotations",
      "depth": 2
    },
    {
      "id": "calling-this-tool",
      "title": "Calling this tool",
      "depth": 2
    }
  ],
  "sources": [
    "server/mcp-tools.ts"
  ],
  "contract": {
    "name": "onf_patch_graph",
    "description": "Apply a batch of graph operations to one cloned draft and commit once with expectedRevision. Supports add/update/remove node, connect/disconnect, upgrade_node. Node removal also removes incident wires. Config/inputs maps replace existing maps. dryRun returns issues and preview without saving. Read relevant workspace/workflow/frame context first; after a material edit, update concise purpose/wiring/operating notes with onf_update_context_documentation using its independent revision.",
    "inputSchema": {
      "type": "object",
      "properties": {
        "workflowId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120,
          "pattern": "^[A-Za-z0-9_.-]+$"
        },
        "expectedRevision": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991,
          "description": "Revision returned by get_workflow/get_graph. Stale revisions fail without overwriting."
        },
        "dryRun": {
          "default": false,
          "type": "boolean"
        },
        "allowInvalid": {
          "default": false,
          "description": "Allow saving an incomplete graph. Enabled nonmanual workflows still must validate.",
          "type": "boolean"
        },
        "operations": {
          "minItems": 1,
          "maxItems": 1000,
          "type": "array",
          "items": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "op": {
                    "type": "string",
                    "const": "set_frames"
                  },
                  "frames": {
                    "maxItems": 500,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120,
                          "pattern": "^[A-Za-z0-9_.-]+$"
                        },
                        "label": {
                          "type": "string",
                          "maxLength": 200
                        },
                        "position": {
                          "type": "object",
                          "properties": {
                            "x": {
                              "type": "number"
                            },
                            "y": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "x",
                            "y"
                          ]
                        },
                        "width": {
                          "type": "number",
                          "minimum": 160,
                          "maximum": 100000
                        },
                        "height": {
                          "type": "number",
                          "minimum": 96,
                          "maximum": 100000
                        },
                        "color": {
                          "type": "string",
                          "maxLength": 30
                        },
                        "nodeIds": {
                          "maxItems": 500,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120,
                            "pattern": "^[A-Za-z0-9_.-]+$"
                          }
                        },
                        "lockAutoArrange": {
                          "description": "True excludes this frame and all member positions from UI/MCP Arrange. Omitted/false allows arrangement; manual edits remain available.",
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "id",
                        "label",
                        "position",
                        "width",
                        "height",
                        "nodeIds"
                      ]
                    }
                  }
                },
                "required": [
                  "op",
                  "frames"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "op": {
                    "type": "string",
                    "const": "add_node"
                  },
                  "node": {
                    "type": "object",
                    "properties": {
                      "variableBinding": {
                        "type": "object",
                        "properties": {
                          "variableId": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120,
                            "pattern": "^[A-Za-z0-9_.-]+$"
                          },
                          "workspaceId": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120,
                            "pattern": "^[A-Za-z0-9_.-]+$"
                          },
                          "name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "type": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120,
                            "pattern": "^[A-Za-z0-9_.-]+$"
                          },
                          "typeVersion": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "variableId",
                          "workspaceId",
                          "name",
                          "type"
                        ],
                        "additionalProperties": false
                      },
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120,
                        "pattern": "^[A-Za-z0-9_.-]+$"
                      },
                      "definitionId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120,
                        "pattern": "^[A-Za-z0-9_.-]+$"
                      },
                      "definitionVersion": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      "label": {
                        "type": "string",
                        "maxLength": 120
                      },
                      "hiddenInputs": {
                        "maxItems": 1000,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        }
                      },
                      "hiddenOutputs": {
                        "maxItems": 1000,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        }
                      },
                      "hiddenInputWires": {
                        "maxItems": 1000,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        }
                      },
                      "position": {
                        "type": "object",
                        "properties": {
                          "x": {
                            "type": "number"
                          },
                          "y": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "x",
                          "y"
                        ]
                      },
                      "config": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      },
                      "inputs": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      },
                      "trigger": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "manual",
                              "webhook",
                              "schedule",
                              "poll",
                              "websocket"
                            ]
                          },
                          "websocket": {
                            "type": "object",
                            "properties": {
                              "url": {
                                "type": "string",
                                "maxLength": 8192
                              },
                              "urlSecret": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120,
                                "pattern": "^[A-Za-z0-9_.-]+$"
                              },
                              "protocols": {
                                "maxItems": 10,
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                }
                              },
                              "subscribeSecret": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120,
                                "pattern": "^[A-Za-z0-9_.-]+$"
                              },
                              "heartbeatSecret": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120,
                                "pattern": "^[A-Za-z0-9_.-]+$"
                              },
                              "heartbeatIntervalSeconds": {
                                "type": "integer",
                                "minimum": 5,
                                "maximum": 3600
                              },
                              "idleTimeoutSeconds": {
                                "type": "integer",
                                "minimum": 5,
                                "maximum": 86400
                              },
                              "connectTimeoutMs": {
                                "type": "integer",
                                "minimum": 100,
                                "maximum": 30000
                              },
                              "maxMessageBytes": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 1048576
                              },
                              "maxQueueMessages": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 100
                              },
                              "maxQueueBytes": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 4194304
                              },
                              "maxPendingRuns": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 100
                              },
                              "reconnectMinMs": {
                                "type": "integer",
                                "minimum": 100,
                                "maximum": 30000
                              },
                              "reconnectMaxMs": {
                                "type": "integer",
                                "minimum": 100,
                                "maximum": 300000
                              }
                            }
                          },
                          "intervalSeconds": {
                            "type": "integer",
                            "minimum": 5,
                            "maximum": 31536000
                          },
                          "cron": {
                            "type": "string",
                            "maxLength": 200
                          },
                          "enabled": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "kind",
                          "enabled"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "definitionId",
                      "definitionVersion",
                      "position",
                      "config",
                      "inputs"
                    ]
                  }
                },
                "required": [
                  "op",
                  "node"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "op": {
                    "type": "string",
                    "const": "update_node"
                  },
                  "nodeId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "^[A-Za-z0-9_.-]+$"
                  },
                  "patch": {
                    "type": "object",
                    "properties": {
                      "variableBinding": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "variableId": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120,
                                "pattern": "^[A-Za-z0-9_.-]+$"
                              },
                              "workspaceId": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120,
                                "pattern": "^[A-Za-z0-9_.-]+$"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              },
                              "type": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120,
                                "pattern": "^[A-Za-z0-9_.-]+$"
                              },
                              "typeVersion": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "variableId",
                              "workspaceId",
                              "name",
                              "type"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "label": {
                        "type": "string",
                        "maxLength": 120
                      },
                      "hiddenInputs": {
                        "maxItems": 1000,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        }
                      },
                      "hiddenOutputs": {
                        "maxItems": 1000,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        }
                      },
                      "hiddenInputWires": {
                        "maxItems": 1000,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        }
                      },
                      "position": {
                        "type": "object",
                        "properties": {
                          "x": {
                            "type": "number"
                          },
                          "y": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "x",
                          "y"
                        ]
                      },
                      "config": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      },
                      "inputs": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      },
                      "trigger": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "manual",
                              "webhook",
                              "schedule",
                              "poll",
                              "websocket"
                            ]
                          },
                          "websocket": {
                            "type": "object",
                            "properties": {
                              "url": {
                                "type": "string",
                                "maxLength": 8192
                              },
                              "urlSecret": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120,
                                "pattern": "^[A-Za-z0-9_.-]+$"
                              },
                              "protocols": {
                                "maxItems": 10,
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                }
                              },
                              "subscribeSecret": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120,
                                "pattern": "^[A-Za-z0-9_.-]+$"
                              },
                              "heartbeatSecret": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120,
                                "pattern": "^[A-Za-z0-9_.-]+$"
                              },
                              "heartbeatIntervalSeconds": {
                                "type": "integer",
                                "minimum": 5,
                                "maximum": 3600
                              },
                              "idleTimeoutSeconds": {
                                "type": "integer",
                                "minimum": 5,
                                "maximum": 86400
                              },
                              "connectTimeoutMs": {
                                "type": "integer",
                                "minimum": 100,
                                "maximum": 30000
                              },
                              "maxMessageBytes": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 1048576
                              },
                              "maxQueueMessages": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 100
                              },
                              "maxQueueBytes": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 4194304
                              },
                              "maxPendingRuns": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 100
                              },
                              "reconnectMinMs": {
                                "type": "integer",
                                "minimum": 100,
                                "maximum": 30000
                              },
                              "reconnectMaxMs": {
                                "type": "integer",
                                "minimum": 100,
                                "maximum": 300000
                              }
                            }
                          },
                          "intervalSeconds": {
                            "type": "integer",
                            "minimum": 5,
                            "maximum": 31536000
                          },
                          "cron": {
                            "type": "string",
                            "maxLength": 200
                          },
                          "enabled": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "kind",
                          "enabled"
                        ]
                      }
                    }
                  }
                },
                "required": [
                  "op",
                  "nodeId",
                  "patch"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "op": {
                    "type": "string",
                    "const": "remove_node"
                  },
                  "nodeId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "^[A-Za-z0-9_.-]+$"
                  }
                },
                "required": [
                  "op",
                  "nodeId"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "op": {
                    "type": "string",
                    "const": "connect"
                  },
                  "edge": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120,
                        "pattern": "^[A-Za-z0-9_.-]+$"
                      },
                      "source": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120,
                        "pattern": "^[A-Za-z0-9_.-]+$"
                      },
                      "sourceHandle": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120,
                        "pattern": "^[A-Za-z0-9_.-]+$"
                      },
                      "target": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120,
                        "pattern": "^[A-Za-z0-9_.-]+$"
                      },
                      "targetHandle": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120,
                        "pattern": "^[A-Za-z0-9_.-]+$"
                      },
                      "reroutePoints": {
                        "maxItems": 100,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "x": {
                              "type": "number"
                            },
                            "y": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "x",
                            "y"
                          ]
                        }
                      },
                      "label": {
                        "type": "string",
                        "maxLength": 80
                      }
                    },
                    "required": [
                      "id",
                      "source",
                      "sourceHandle",
                      "target",
                      "targetHandle"
                    ]
                  }
                },
                "required": [
                  "op",
                  "edge"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "op": {
                    "type": "string",
                    "const": "disconnect"
                  },
                  "edgeId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "^[A-Za-z0-9_.-]+$"
                  }
                },
                "required": [
                  "op",
                  "edgeId"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "op": {
                    "type": "string",
                    "const": "upgrade_node"
                  },
                  "nodeId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "^[A-Za-z0-9_.-]+$"
                  },
                  "definitionVersion": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "op",
                  "nodeId",
                  "definitionVersion"
                ]
              }
            ]
          }
        }
      },
      "required": [
        "workflowId",
        "expectedRevision",
        "operations"
      ]
    },
    "annotations": {
      "readOnlyHint": false,
      "destructiveHint": true,
      "idempotentHint": false,
      "openWorldHint": true
    },
    "source": {
      "file": "server/mcp-tools.ts",
      "line": 928
    }
  }
}
