MD: YAML Utils (Architect)
Edit YAML configs from inside ComfyUI with MD YAML Utils
- value_input
- yaml_output
- value_output
- is_valid
A lot of advanced ComfyUI nodes take their configuration as a YAML string - MD's own PingPong samplers accept a yaml_settings_str override, and any custom node can read a config blob. The problem is that editing a multiline YAML blob by hand, mid-graph, every time you want to tweak one value, is miserable. MD YAML Utils is the "edit a config programmatically" node: it reads YAML, changes it, and hands back a fresh YAML string.
How it works
The mode dropdown picks the operation, and the code is refreshingly direct about what each does:
- Merge (A + B) - deep-merges
yaml_secondaryintoyaml_input, so keys from B override A but existing nested structure survives. - Patch Key - the workhorse.
target_keytakes dot notation likemodels.0.nameor justseed, andvalue_inputgets injected there. The value port is typed*, and it auto-converts strings like"[1,2]"into a real Python list, so you can patch in arrays without hand-writing YAML. - Template Substitute - for text that isn't strict YAML. It replaces
{target_key}placeholders inyaml_inputwith the stringified value. - Get Key - pulls a value out of a config and hands it to you on the
*-typedvalue_output. - Validate - checks the syntax and reports structure stats through
is_valid.
The inputs and outputs that matter
You'll set yaml_input (the base document, must be valid YAML except in Template mode), mode, and then the pair target_key + value_input for patching. The outputs are yaml_output (your new YAML string - wire it straight into a node's YAML config port), value_output (the extracted/injected value), and is_valid (a BOOLEAN you can use to gate the next step in the graph).
Installing it
Part of the MD Nodes pack:
cd path/to/ComfyUI/custom_nodes
git clone https://github.com/MDMAchine/ComfyUI_MD_Nodes.git
cd ComfyUI_MD_Nodes
pip install -r requirements.txt
Or search MD_Nodes in ComfyUI Manager and restart. One less-obvious dependency note: PyYAML isn't in the pack's requirements.txt, but ComfyUI itself requires it, so it's virtually always present. If it ever isn't, the node degrades gracefully - it returns your input unchanged with is_valid False rather than crashing.
Where you'd actually use it
The killer pattern is dynamic sampler config: have one node compute a value (a seed, a strength, a step count), patch it into a YAML template, and feed the result to PingPong's yaml_settings_str. That turns a static config blob into something your graph can adapt at runtime - which is exactly the kind of thing that separates a demo workflow from a production one.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| yaml_input | STRING | BASE YAML INPUT • Purpose: The primary YAML string to be processed. • Requirement: Must be a valid YAML structure (except for Template mode). | |
| mode | COMBO | Patch Key | EXECUTION MODE • Merge: Combines Base YAML with Secondary YAML. • Patch: Injects value at target_key (supports 'list.0.item'). • Template: Replaces {target_key} placeholders in text. • Validate: Checks syntax & outputs structure stats. ⭐ Recommended: Patch Key for dynamic workflows. |
| yaml_secondaryopt | STRING | SECONDARY YAML • Purpose: The data to merge into the Base YAML. • Note: Only used in 'Merge (A + B)' mode. | |
| target_keyopt | STRING | TARGET KEY / PATH • Purpose: Dot-notation path to modify (e.g. 'models.0.name' or 'seed'). • Template Mode: The exact string to replace (without brackets). | |
| value_inputopt | * | VALUE TO INJECT • Purpose: The data to insert at the target key. • Note: Automatically converts strings like '[1,2]' to real Python lists. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| yaml_output | STRING | — |
| value_output | * | — |
| is_valid | BOOLEAN | — |