Skip to main content
Glama

comfyui_modify_workflow

Read-onlyIdempotent

Apply batch modifications to a ComfyUI workflow: add or remove nodes, set inputs, and connect or disconnect outputs. Operations run sequentially and atomically.

Instructions

Apply batch operations to a ComfyUI workflow.

    Operations execute sequentially in array order. If any operation fails,
    the call raises ``ValueError`` and the input workflow is left
    unmodified (atomic — operations are applied to a deep copy).

    Args:
        workflow (required): JSON string of the workflow to modify.
        operations (required): JSON string of an array of operation objects.

    Operation reference:

    - ``add_node`` — append a new node. Fields:
      ``{"op": "add_node", "class_type": "<NodeType>",
         "node_id": "<id>" (optional, auto-assigned if omitted),
         "inputs": {...} (optional default inputs)}``
    - ``remove_node`` — drop a node. Fields:
      ``{"op": "remove_node", "node_id": "<id>"}``
    - ``set_input`` — set or replace a single input value. Fields:
      ``{"op": "set_input", "node_id": "<id>",
         "input_name": "<key>", "value": <any>}``
    - ``connect`` — wire one node's output into another's input. Fields:
      ``{"op": "connect", "from_node": "<id>", "from_output": <int>,
         "to_node": "<id>", "to_input": "<key>"}``
    - ``disconnect`` — clear an existing input connection. Fields:
      ``{"op": "disconnect", "node_id": "<id>", "input_name": "<key>"}``

    Example:
        ``operations='[{"op": "set_input", "node_id": "3",
        "input_name": "steps", "value": 50},
        {"op": "add_node", "class_type": "LoraLoader"}]'``
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workflowYes
operationsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

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

Beyond the annotations (readOnlyHint=true, idempotentHint=true, destructiveHint=false), the description discloses key behaviors: operations execute sequentially, any failure raises ValueError, the input workflow is left unmodified because operations are applied to a deep copy (atomic). This significantly adds context and aligns with the annotations without contradiction.

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 well-organized with a summary, behavior notes, parameter definitions, an operation reference, and an example. Every section earns its place; it is long but appropriately detailed for the complexity, and the main purpose is front-loaded.

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?

The tool is complex due to the operation format, but the description covers all operations, error handling, atomicity, and includes a concrete example. An output schema exists, so return semantics need not be explained. The description is fully self-contained for correct invocation.

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?

Schema coverage is 0%, so the description fully compensates by explaining both parameters: workflow is a JSON string and operations is a JSON string of an array of operation objects. It also details each operation type with fields and provides an example, making the parameter semantics exceptionally clear.

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 clearly states 'Apply batch operations to a ComfyUI workflow', specifying the action (apply), the resource (workflow), and the scope (batch operations). It also distinguishes this tool from siblings like comfyui_create_workflow, comfyui_run_workflow, and comfyui_validate_workflow by focusing on modification.

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

Usage Guidelines4/5

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

The description provides clear context for when to use the tool (modifying workflows via batch operations) and detailed operational guidance, but it does not explicitly mention when not to use it or name alternative tools. The sequential/atomic behavior informs how operations are applied, but no exclusions or alternatives are stated.

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

Install Server

Other Tools

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/hybridindie/comfyui_mcp'

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