Nodes/MD Nodes/MD: YAML Utils (Architect)
ComfyUI Node

MD: YAML Utils (Architect)

Edit YAML configs from inside ComfyUI with MD YAML Utils

By MDMAchine·Created about a year ago·Updated 3 months ago· 15
MD: YAML Utils (Architect)
  • value_input
  • yaml_output
  • value_output
  • is_valid
yaml_input
modePatch Key
yaml_secondary
target_key

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_secondary into yaml_input, so keys from B override A but existing nested structure survives.
  • Patch Key - the workhorse. target_key takes dot notation like models.0.name or just seed, and value_input gets 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 in yaml_input with the stringified value.
  • Get Key - pulls a value out of a config and hands it to you on the *-typed value_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.

CategoryMD_Nodes/Utility

Inputs (5)

NameTypeDefaultDescription
yaml_inputSTRINGBASE YAML INPUT • Purpose: The primary YAML string to be processed. • Requirement: Must be a valid YAML structure (except for Template mode).
modeCOMBOPatch KeyEXECUTION 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_secondaryoptSTRINGSECONDARY YAML • Purpose: The data to merge into the Base YAML. • Note: Only used in 'Merge (A + B)' mode.
target_keyoptSTRINGTARGET 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)

NameTypeDescription
yaml_outputSTRING
value_output*
is_validBOOLEAN