update_node_input
Modify specific inputs on nodes within ComfyUI workflows to adjust parameters and values during automation processes.
Instructions
Update a specific input on a node.
Args:
workflow: Workflow dict to modify
node_id: Node ID to update
input_name: Name of the input to update
value: New value (use JSON string for lists/dicts)
Returns the modified workflow dict.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workflow | Yes | Workflow dict to modify | |
| node_id | Yes | Node ID to update | |
| input_name | Yes | Input name to update | |
| value | Yes | New value (or JSON for complex values) |
Implementation Reference
- The @mcp.tool()-decorated function that defines and implements the 'update_node_input' tool. It updates a specific input on a node in the workflow dictionary, parsing the value as JSON if possible.@mcp.tool() def update_node_input( workflow: dict = Field(description="Workflow dict to modify"), node_id: str = Field(description="Node ID to update"), input_name: str = Field(description="Input name to update"), value: str = Field(description="New value (or JSON for complex values)"), ctx: Context = None, ) -> dict: """Update a specific input on a node. Args: workflow: Workflow dict to modify node_id: Node ID to update input_name: Name of the input to update value: New value (use JSON string for lists/dicts) Returns the modified workflow dict. """ if ctx: ctx.info(f"Updating {node_id}.{input_name}") if node_id not in workflow: return workflow # Try to parse as JSON for complex values try: parsed_value = json.loads(value) except json.JSONDecodeError: parsed_value = value workflow[node_id]["inputs"][input_name] = parsed_value return workflow
- src/comfy_mcp_server/tools/__init__.py:27-27 (registration)Calls register_workflow_tools(mcp) which in turn registers the update_node_input tool among others.register_workflow_tools(mcp)
- src/comfy_mcp_server/tools/workflow.py:217-217 (registration)The function that registers all workflow tools, including update_node_input via @mcp.tool() decorators.def register_workflow_tools(mcp):