add_workspace_node
Add a node to the ComfyUI canvas with specified type, values, and connections, all validated before applying as a single undoable edit.
Instructions
Add a node to the workflow open in the browser, wired up and configured.
Inserting a node is one edit, so it is one call and one Ctrl+Z: the widgets and links go in with it. Doing it in three calls would take three presses to undo one intention, and a failure partway would leave a stray node behind.
Nothing is added unless every value and link validates. Link types are checked against the slots before anything is written, because litegraph refuses a mismatched connection by doing nothing and reporting nothing.
Args:
type: the registered node type, e.g. "ImageScale" or "VAEEncodeTiled".
find_node_types looks one up, by slot type when the name is not
known; an unknown one comes back with near matches rather than a
bare refusal.
title: the label on the node. Defaults to the type's own.
pos: [x, y] on the canvas. Defaults to the middle of the current view,
so the user can see what arrived.
values: widget values for the new node, {"<widget>": value} - no node
id, since it does not have one yet.
connect: links to make at the same time, [{"from": ..., "to": ...}] with
both ends written "<node_id>.<slot>". The new node is "this", as
in {"from": "this.IMAGE", "to": "9.images"}. A slot can be named or
given by index.
scope: "root" for the whole workflow, "active" for the subgraph on screen.
client_id: which tab to edit; defaults to the most recently focused one.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pos | No | ||
| type | Yes | ||
| scope | No | root | |
| title | No | ||
| values | No | ||
| connect | No | ||
| client_id | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||