set_workspace_layout
Set node layout on the ComfyUI canvas by specifying positions, sizes, and fold states, automatically refitting groups around moved nodes.
Instructions
Move, resize, fold and unfold nodes on the canvas open in the browser.
None of this changes what a workflow does - it runs the same however it is laid out - so this is purely about making a graph readable. The whole batch is one undo step and nothing is written unless every id exists.
Groups follow the nodes they were holding. A group is only a rectangle, and what is "inside" it is whatever falls within it, so moving nodes out from under one would silently empty it; membership is read before anything moves and each affected group is refitted around those same nodes afterwards.
arrange_workspace computes positions rather than taking them, and its answer can be passed straight in here.
Args:
positions: {"<node_id>": [x, y]}. Canvas coordinates, y downwards.
A pinned node is skipped rather than moved, and reported in
skipped - pinning is the author saying "not this one".
sizes: {"<node_id>": [width, height]}. A size below what the node needs
to draw its widgets is raised to that minimum and reported.
collapsed: {"<node_id>": true} to fold a node down to its title bar,
false to unfold it. The desired state, not a toggle, so asking for
what a node already is does nothing. get_workspace_graph reports the
current state per node.
refit_groups: refit every group that held one of the changed nodes.
Turning this off leaves the boxes where they were, which is what you
want when moving a node deliberately out of a group.
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 |
|---|---|---|---|
| scope | No | root | |
| sizes | No | ||
| client_id | No | ||
| collapsed | No | ||
| positions | No | ||
| refit_groups | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||