Nodes/ComfyUI INOUT/Schema Enum Parameter
ComfyUI Node

Schema Enum Parameter

A dropdown for your agent (the node itself is just a text box)

By Liquid-XO·Created 6 months ago·Updated 5 months ago· 0
Schema Enum Parameter
    • value
    nameparameter_name
    io_kindinput
    description
    requiredtrue
    optionsoption_a option_b
    defaultoption_a
    allow_custom_valuefalse
    value_in

    Some workflow inputs aren't a range, they're a menu: which sampler, which upscaler, which aspect-ratio preset, which LoRA. An agent guessing at euler_ancestral has no idea it should be picking from a fixed list - unless your workflow declares the list. That's what this node is for: an enum parameter whose choices become part of the machine-readable contract, so the agent's tooling renders an actual dropdown for it.

    The one thing that surprises people: the node in your graph is not a dropdown. It's a text field for typing options, one per line, plus a text field for the default. The dropdown exists on the other side - your tool reads the options list and renders it for the agent. The node is the declaration; the menu is downstream. That distinction is the whole design of ComfyUI_SchemaNodes, and it's worth internalizing before you go looking for a combo widget that isn't there.

    The inputs that matter

    • options - one choice per line:
      euler
      euler_ancestral
      dpmpp_2m
      dpmpp_sde
      
      This becomes the JSON Schema enum array. Order matters - it's the order your tool will render.
    • default - which option wins when nothing is wired in. Keep it to one of the listed options, or you've got a field that can emit a value the schema says is impossible.
    • allow_custom_value - set true to let the agent pass a value that's not in the list. Useful for "yes, but also maybe a custom filename" cases; otherwise your tool should validate strictly against the enum.
    • name / description - the usual stable-identifier and machine-readable-description advice. For an enum, the description is where you explain when to pick which option.
    • io_kind - input for agent-supplied choices, output if you want to surface a selected option (like the sampler actually used) as a result.
    • value_in (STRING, forced input) - the override, same as every node in this pack.

    How it works

    At runtime it resolves value = value_in or default, does a bit of newline/whitespace cleanup on the options list, and returns the value as a plain STRING on the value output - it plugs straight into a KSampler's sampler_name or a UpscaleModelLoader-adjacent selector. The node does not validate that the resolved value is in the list; allow_custom_value is metadata for the tooling, not a runtime gate.

    One note on the README: it still describes a SCHEMA_FIELD output on these nodes, but the current code removed it (commit 8e5676d). You get one value output. The enum declaration - type: string, enum: [...], default: ... - lives in the widget values inside the workflow JSON, which is exactly where a parser reads it from.

    Installing it

    Same as the rest of the pack.

    cd ComfyUI/custom_nodes
    git clone https://github.com/Liquid-XO/ComfyUI_SchemaNodes
    

    Restart ComfyUI, or install via ComfyUI Manager (search "ComfyUI SchemaNodes"). No pip dependencies, no model downloads, no API keys.

    Common gotchas

    • Don't set a default that isn't in options. The node won't stop you, but you've handed your tool a schema where the default violates the enum - the exact kind of inconsistency that makes agents produce nonsense.
    • The enum is only as good as your options list. This is the node where sloppy input hurts most. Type dpmpp_2m with a trailing space and you've silently got a different value in the schema. Keep options trimmed and exact.
    • allow_custom_value=true defeats the point unless you mean it. If you're trying to constrain an agent, leave it off; it exists for genuinely open-ended-but-mostly-fixed fields, and a strict enum is a much better agent UX in practice.
    Categoryinout/schema

    Inputs (8)

    NameTypeDefaultDescription
    nameSTRINGparameter_name
    io_kindCOMBOinput2 options: input, output
    descriptionSTRING
    requiredBOOLEANtrue
    optionsSTRINGoption_a option_b
    defaultSTRINGoption_a
    allow_custom_valueBOOLEANfalse
    value_inoptSTRING

    Outputs (1)

    NameTypeDescription
    valueSTRING