Nodes/🗂️ Dict Tools/bool → Dict🗂️
ComfyUI Node

bool → Dict🗂️

Store a Yes/No in Your Dict

By Lex-DRL·Created 4 months ago·Updated 4 months ago· 1
bool → Dict🗂️
  • dict
  • dict
key
cleanup_keytrue
valuefalse

Booleans are the unglamorous workhorse of a workflow bus. Is inpainting on? Is the face-detail pass enabled? Should this stage run at all? DictAddBool is how you park a yes/no inside a dict so it rides along with everything else instead of having its own wire.

It's one of the "basic type" Add nodes - the trio of bool, int, and float that work the same way: the value isn't a wire you connect, it's a toggle right on the node. Set it, name it, done. That's genuinely convenient when you're building a settings dict at the top of a graph and want the flags visible without hunting for whatever node produced them.

How it works

Like every Add node in the pack, this one validates its value (a real Python bool), stores it under your key, and hands back a new frozendict - your input dict is never mutated, so it's safe to feed the same dict through several Add nodes in sequence. Keys get sorted alphabetically on update, which is by design and only affects display order, never lookup.

The inputs that matter

  • key (STRING) - the name you'll fetch this flag by later. Pick something descriptive like do_face_detail or use_inpaint, because you'll be typing it again in DictExtractBool.
  • cleanup_key (BOOL, default on) - trims stray spaces and newlines from the key. Leave it on.
  • value (BOOL, default false) - the toggle on the node itself. No wire needed; this is the widget you flip.
  • dict (DICT, optional) - the dict to extend, or empty for a fresh one.

Output is dict (DICT).

Install

ComfyUI Manager: search Dict Tools, install, restart. Or by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/Lex-DRL/ComfyUI-DictTools

Restart ComfyUI after. Only dependency is frozendict, installed automatically.

Gotchas

The pack needs ComfyUI 0.18.0+ (it's built on the newer node API), so if it shows as failed to load in Manager, update ComfyUI before touching anything else.

One thing to keep straight: since the value is a widget, you can't wire a boolean from another node into this one - the source of truth is the toggle on the node. If you want to compute the flag elsewhere and store it, you're better off with DictAddAny or a data-handling pack. And remember, extraction is typed too: pull this key with DictExtractBool and you get a bool out the other end; ask for it as anything else and the pack will object.

Category🗂️ Dict Tools/Add

Inputs (4)

NameTypeDefaultDescription
keySTRINGKey (name) of the item inserted into the dict.
cleanup_keyBOOLEANtrueAutomatically remove leading/trailing spaces and extra newlines from the key.
valueBOOLEANfalseThe actual bool-type item to add into the Dict.
dictoptDICTAn (optional) Dictionary to work with.

Outputs (1)

NameTypeDescription
dictDICT