Nodes/comfyui-mdsnodes/MetaData Extract
ComfyUI Node

MetaData Extract

Your workflow is carrying notes you can actually read back

By MarwanDSAI·Created 22 days ago·Updated about 8 hours ago· 1
MetaData Extract
    • value
    • key_exists
    metadata
    keymy_key

    Every workflow you've built is carrying around little labels already - the checkpoint, the CFG, the sampler - and most of the time they're just sitting there as numbers in widgets. The MetaData Extract node (class MarMetaDataExtract) from the comfyui-mdsnodes pack is for when you want to reach into that pile and pull one specific value back out. It takes a string in the Key1 [Value1]; Key2 [Value2] format and returns the value for one key you name, plus a boolean that tells you whether that key was even there.

    It comes from MarwanDSAI's ComfyUI-MDSNodes pack, which was built to power the author's "Ultimate Model Tester Workflow" on CivitAI - the kind of workflow where you fire the same prompt through a dozen checkpoint/sampler/CFG combos and need to know which combination made which image. If you're doing anything like that - or you just want the sampler and CFG values embedded in your output filename - this node is the cheap way to get at them.

    How it works

    The node expects metadata in the exact format its sibling MetaData Append produces: key, then a value in square brackets, pairs separated by semicolons. Give it steps [28]; cfg [6.5]; sampler [euler] and a key of cfg, and it returns 6.5. Under the hood it's a single regex - (?:^|;\s*) for the start or a semicolon, then your key, then \[(.*?)\] to capture whatever is inside the brackets. The key is matched exactly, so it's case-sensitive: CFG won't find cfg.

    Two details are worth knowing before you build on it. First, if the key isn't found - or the metadata input is empty - you get an empty string for the value and False for the key_exists flag, not an error. That's friendly behavior for a workflow you want to keep running. Second, the regex only matches a key at the start of the string or after a semicolon, so your metadata needs to stay in the append format for this to work at all.

    The inputs and outputs that matter

    Only two inputs, both strings:

    • metadata - the string to parse. This one is forceInput, meaning it's meant to be wired from a node (like MetaData Append or a hub node), not typed.
    • key - the exact key you're hunting for, typed into a single-line box. Defaults to my_key; change it.

    And two outputs:

    • value - the string inside the brackets for that key.
    • key_exists - True if the key was found, False otherwise.

    The key_exists boolean is the sneaky-useful one. Wire it into a switch or an if-node and you can branch the workflow on whether a tag is present - like only running an upscaler when the metadata says a specific LoRA was used. The value output usually heads to something that builds filenames or a display node.

    Installing it

    The pack has no extra dependencies at all - the requirements file is empty and it runs on stock ComfyUI. Two routes:

    # ComfyUI Manager: search "ComfyUI-MDSNodes" and click Install
    # or manually:
    cd ComfyUI/custom_nodes
    git clone https://github.com/MarwanDSAI/comfyui-mdsnodes
    

    Restart ComfyUI after either one. No model downloads, no Python packages to fight with.

    Where people get burned

    The classic mistake is feeding this node a string that isn't in the append format. If you pipe in raw JSON, or an A1111-style parameters string, or a ComfyUI workflow dump, the regex finds nothing and you get empty values with no error message to tell you why. The node is deliberately narrow: it parses the Key [Value] dialect its sibling produces, and nothing else.

    Second gotcha: the value comes back as a string. steps [28] returns the characters "28", not the number 28. If you're comparing it against a numeric CFG or feeding it somewhere that expects an integer, you'll need a convert-to-number node in between.

    One more honest note: this is a niche tool. If your metadata needs are one-off, a generic JSON node might do. But if you're already in the MDSNodes ecosystem - especially the model-tester workflow it was built for - MetaData Extract is the natural, dependency-free way to read your own notes back.

    CategoryMDSNodes/text

    Inputs (2)

    NameTypeDefaultDescription
    metadataSTRINGThe metadata string to parse.
    keySTRINGmy_keyThe exact key name to search for in the metadata.

    Outputs (2)

    NameTypeDescription
    valueSTRINGThe extracted value string.
    key_existsBOOLEANTrue if the key was found, False otherwise.