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

🗂️Dict → string

The Dict Tools node you'll actually reach for every day

By Lex-DRL·Created 4 months ago·Updated 4 months ago· 1
🗂️Dict → string
  • dict
  • value
◄key—►
â—„cleanup_keytrueâ–ş
â—„show_statusfalseâ–ş

The one you'll actually use

Every dict pack has an extract node you reach for 90% of the time. For Lex Darlog's 🗂️ Dict Tools, this is it. Dict → string pulls a single value back out of a dictionary by its key name and hands it to you as a plain STRING.

You put things into a dict to keep your graph tidy, and eventually you have to take them back out. Prompts are the most common thing bussed around a ComfyUI workflow - positive and negative text get built once, reused across stages, and then have to land in a CLIP Text Encode node. That last hop is exactly what this node does.

How it works

A dict in this pack is just a named set of values. You stuffed "positive" → some prompt text in earlier; this node looks up dict["positive"] and returns the value. If the value isn't a string, it gets turned into one with Python's repr(). If it's None, you get an empty string back.

The inputs that matter:

  • dict - the DICT you're pulling from.
  • key - the exact name of the item. Case-sensitive.
  • cleanup_key - on by default. Strips leading/trailing spaces and extra newlines from the key you type, so a stray space in the box can't silently break your lookup.
  • show_status - off by default. Flip it on and the extracted string renders right on the node, which is handy when you're debugging and don't want to wire up a ShowText.

The value output is a STRING, so it plugs straight into CLIP Text Encode, any text combiner, or a display node.

Installing it

This is a whole pack, not a standalone node. ComfyUI Manager is the easy route: search Dict Tools (repo: Lex-DRL/ComfyUI-DictTools) and hit install. Manual route:

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

Restart ComfyUI after. The only dependency is frozendict - no models, no heavy installs. One thing to know: the pack targets the newer Node schema (ComfyUI >= 0.18.0). If you install it and the nodes don't show up in the menu, your ComfyUI is older than the pack expects - update ComfyUI itself first.

Where people get burned

The key lookup is strict. If "positive" isn't in the dict, execution stops with a KeyError: No such key in Dict: 'positive'. The tooltip on the key field claims a missing key returns an empty string, but the shipped code raises instead - so don't plan around the tooltip there. Make sure the key you type matches the key the Add node used, exactly.

Also worth knowing: everything in this pack is an immutable frozendict. You can't mutate a dict in place - you always thread the output back through another node to get an updated copy. That's a feature (no accidental shared-state bugs between nodes), not something to fight.

If you're seeing an old workflow with a node named StringConstructorDictExtractString, that's just this node's legacy ID from when it lived in the String Constructor pack - same behavior, and it's kept around so saved graphs keep loading.

Category🗂️ Dict Tools/Extract

Inputs (4)

NameTypeDefaultDescription
dictDICTA Dictionary to work with.
keySTRINGKey (unique name) of a string to extract from dictionary. If the element with such key isn't a string, it will be turned to one. If no such key exists in the dict, an empty string returned.
cleanup_keyBOOLEANtrueAutomatically remove leading/trailing spaces and extra newlines from the key.
show_statusBOOLEANfalseShow the extracted string on the node itself?

Outputs (1)

NameTypeDescription
valueSTRINGThe actual string item extracted from the Dict.