Skip to main content
Glama

edit_workflow

Apply batched edits to ComfyUI workflows: add or remove nodes, connect inputs, update widget values, titles, modes, and groups in a single operation.

Instructions

Apply batched edits. Each op is a dict with 'op' plus:

  • {"op": "add_node", "class_type": str, "title"?: str, "widgets"?: {name: value}}

  • {"op": "remove_node", "node_id": int}

  • {"op": "connect", "from_node": int, "from_output": str|int, "to_node": int, "to_input": str}

  • {"op": "set_widget", "node_id": int, "input": str, "value": any}

  • {"op": "set_title", "node_id": int, "title": str}

  • {"op": "set_mode", "node_id": int, "mode": int} # 0 normal, 2 mute, 4 bypass

All six have a definition-scoped twin taking an extra "definition_id", for editing inside a subgraph definition: add_node_to_definition, remove_node_from_definition, and connect/set_widget/set_title/ set_mode_in_definition. A malformed op reports its own required keys.

Layout/group ops (no definition twin): set_pos {node_id, pos:[x,y], size?:[w,h]}; add_group {title, node_ids:[int,...], color?}; set_group {group_id, title?, node_ids?, color?}; remove_group {group_id}. Groups are addressed by member node_ids - bounding comes from their own extents. organize_workflow re-lays out and re-groups everything, so run these AFTER it, not before.

Slot/widget names come from get_node_info. Virtual classes: Note/MarkdownNote take one widget 'text'; Reroute/PrimitiveNode take none at add - connect a PrimitiveNode to a widget input to mirror its type, then set_widget 'value' (+ 'control_after_generate' for number/combo, to advance each run).

Ops apply in order; a failing op stops the batch (graph unchanged past that point). Widget values and link types are checked live - "force": true on set_widget/add_node/connect overrides; on connect it also lets a frontend-only input (no /object_info entry - rgthree switches, dynamic collectors) be wired by creating the socket.

Result is a compact delta (applied ops + changed nodes); pass summary=true or call inspect_workflow for the full graph.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
summaryNo
operationsYes
workflow_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Changed4 schema fields changedv0.15.1
    • removedInput schema / properties / operations / title
      Removed value: -"Operations"
    • addedInput schema / properties / summary
      Added value: +{
      +  "default": false,
      +  "type": "boolean"
      +}
    • removedInput schema / properties / workflow_id / title
      Removed value: -"Workflow Id"
    • removedInput schema / title
      Removed value: -"edit_workflowArguments"
  2. First observedv0.2.0

TDQS

A5/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description discloses behavior well beyond the annotations: operations apply in order, a failing operation stops the batch with the graph unchanged past that point, and widget values and link types are checked live with a 'force' override. It also states the result shape as a compact delta versus the full graph via summary, so the agent knows what to expect.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is dense but well structured, using a literal list for operation shapes and clearly separated notes for ordering, virtual classes, force behavior, failure semantics, and result. It contains no filler and every sentence adds a load-bearing detail for calling the tool correctly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex editing tool with an output schema, this description covers operation formats, failure atomicity, override behavior, ordering relative to sibling tools, naming sources, virtual node requirements, and return options. Nothing needed to invoke the tool correctly is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With no schema-level parameter descriptions, the description carries the full semantic burden and compensates strongly: it documents each operation dict, the definition_id variants, set_group and position fields, mode codes, virtual node classes, and summary behavior. The only parameter left implicit is workflow_id, but its name and required type make its purpose self-evident.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description immediately states a clear action and resource: 'Apply batched edits' to a workflow, then enumerates every supported operation type. It also distinguishes definition-scoped operations from top-level edits by naming the definition twins, so an agent can tell exactly what the tool does and how its variants relate.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives concrete routing and ordering guidance: layout/group ops should run 'AFTER' organize_workflow, slot/widget names come from get_node_info, and full-graph queries belong to inspect_workflow. It also explains the difference between top-level and definition-scoped operations, which tells the agent which variant to choose in which context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/EnragedAntelope/comfy-draftsman'

If you have feedback or need assistance with the MCP directory API, please join our Discord server