remove_node
Remove a node from a ComfyUI workflow to streamline automation processes. This tool modifies workflow structure by deleting specified nodes.
Instructions
Remove a node from a workflow.
Args:
workflow: Workflow dict to modify
node_id: ID of node to remove
Warning: This doesn't update connections from other nodes.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workflow | Yes | Workflow dict to modify | |
| node_id | Yes | Node ID to remove |
Implementation Reference
- The handler function for the 'remove_node' MCP tool. It is decorated with @mcp.tool() for automatic registration and schema inference via Pydantic Fields. The function removes the specified node_id from the workflow dictionary if it exists and returns the modified workflow. Note that it does not update references/connections in other nodes.def remove_node( workflow: dict = Field(description="Workflow dict to modify"), node_id: str = Field(description="Node ID to remove"), ctx: Context = None, ) -> dict: """Remove a node from a workflow. Args: workflow: Workflow dict to modify node_id: ID of node to remove Warning: This doesn't update connections from other nodes. """ if ctx: ctx.info(f"Removing node: {node_id}") if node_id in workflow: del workflow[node_id] return workflow
- src/comfy_mcp_server/tools/__init__.py:27-27 (registration)Invocation of register_workflow_tools(mcp) within register_all_tools, which registers the remove_node tool (along with other workflow tools) to the MCP server.register_workflow_tools(mcp)