MetaData Check Key & Value
The boolean your workflow can branch on
- exists
First thing to get straight, because the name misleads: this node does not read your PNGs. It never opens a file. "Metadata" here means a string you hand it in the pack's own small format, and the node's entire output is one boolean answering "does this string contain this key with exactly this value?"
What it's for
The format is Key1 [Value1]; Key2 [Value2]; Key3 [Value3], and it's shared across four nodes in this pack: Metadata Append writes those pairs, MetaData Extract pulls one value back out, MetaData Convert to EXTRA_METADATA turns the whole thing into a mapping for save nodes, and this node gates on a pair. The pack was written for a workflow that runs one prompt across a pile of checkpoints and settings, where the metadata string is the label attached to each run - which model, which sampler, which step count. This node is the reader that turns that label into something the graph can act on.
And that's the useful part: a boolean is the only way a ComfyUI graph can make a decision. There's no branching, so "was this run tagged with Model [flux-dev]?" has to become a True/False driving a switch, a muter, or a first-non-null node. This node makes that boolean out of a text label you wrote yourself - handy for routing a sweep to different upscalers or save folders per configuration, and handy as a dumb check that a required tag actually made it into the string.
The mechanism, up close
The whole check is one regex and one string comparison:
pattern = rf"(?:^|;\s*){re.escape(k_str)}\s*\[(.*?)\]"
match = re.search(pattern, in_str)
if match:
extracted_value = match.group(1).strip()
if extracted_value == v_str:
return (True,)
return (False,)
Four consequences worth internalising, because each one is a silent False rather than an error message:
- Exact, case-sensitive match.
Flux [true]checked against valueTrueis False. So is8against8.0. - Whitespace inside the brackets is forgiven.
Steps [ 8 ]matches value8, because both sides get stripped. That's the one piece of sloppiness that won't bite you. - Only the first occurrence counts.
re.searchstops at the first match, so if you appendedSteps [8]early andSteps [20]later, the check tests 8. This matters in the pack's own pipeline, where metadata gets appended incrementally as a run flows through the graph. - The capture stops at the first closing bracket (non-greedy), so a value containing
]gets truncated. Values with semicolons survive only if they're last.
The key is regex-escaped, so no wildcards or regex tricks - literal matching, which is the right call here. And if the key or the metadata string is empty, it returns False immediately rather than trying to match anything.
Inputs and output
- metadata - the string to parse, and it's forced to be a wire, not a text box. That surprises people: you can't type your test string into the node. Feed it from Metadata Append, or from a core
Primitive/String node if you just want to type one. - key - plain single-line box, default
my_key. The exact key name. - value - plain box, default
my_value. The exact value you require. - exists - the output, BOOLEAN. True only when both halves match.
A working example: the string Model [juggernaut-xl]; Steps [8]; Sampler [dpmpp_2m], checked with key Steps and value 8, returns True. Wire exists into anything that consumes a boolean - in this pack the Integer Switch; in general, a muter or a first-non-null switch, so an optional branch only lights up when the tag is present.
Installing it
ComfyUI Manager → search ComfyUI-MDSNodes → install, or:
cd ComfyUI/custom_nodes
git clone https://github.com/MarwanDSAI/comfyui-mdsnodes
Restart. No models, no Python packages - the shipped requirements.txt is empty, so the README's "works out-of-the-box" line is accurate. The README also doesn't document this node at all (its node list stops several versions behind the code), so if you want a manual, open nodes/MetaDataCheckKeyValue.py. It's under forty lines, including the regex.
Where people trip
It fails silently, which is the whole risk. There's no exception, no red node - a mistyped key just gives you False, and whatever branch you gated with it quietly doesn't run. When a workflow "does nothing downstream," put a Show Text or preview node on the metadata string first and read what's actually in it, then compare character by character. Nine times out of ten it's capitalisation.
The format is this pack's, not the ecosystem's. An A1111 parameters block (Model hash: abc123, Steps: 8) and ComfyUI's own embedded prompt chunk are both metadata about a generation, and neither matches this bracket syntax. If you're hoping to point this node at a PNG's metadata, you've got the wrong node entirely - this is a string checker for labels the pack wrote.
Duplicate keys are ambiguous by design. This node reads the first one; the sibling MetaData Convert to EXTRA_METADATA builds a dict and therefore keeps the last. Append the same key twice and two nodes reading the same string can disagree. Use distinct keys.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| metadata | STRING | The metadata string to parse. | |
| key | STRING | my_key | The exact key name to search for. |
| value | STRING | my_value | The exact value to verify. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| exists | BOOLEAN | True if both the key and the exact value match, False otherwise. |