Nodes/ComfyUI String Tools/StringToolsStringsToList
ComfyUI Node

StringToolsStringsToList

Turn several text wires into one list of strings

By Taremin·Created 3 years ago·Updated 2 months ago· 3
StringToolsStringsToList
    • STRING

    The bridge between "one wire per text" and "one list of texts"

    Most of the String Tools nodes trade in individual strings: text_0, text_1, and so on, each on its own wire. But the pack's list variants - StringToolsRandomChoiceList, StringToolsConcatList, StringToolsBalancedChoiceList - take a single list of strings on one text_list port. StringToolsStringsToList is the bridge: it collects all your separate text wires and bundles them into one STRING list.

    Same dynamic-slot mechanic as the rest of the pack, by the way. You get a text_0 slot; connect a string and an empty text_1 appears, and so on. Unplug empties and they clean up. Double-clicking a slot creates a StringToolsText node, and PrimitiveNode connections are refused - the whole family shares that behavior. The one real difference is the output: instead of a single string, this node emits a list of strings (OUTPUT_IS_LIST), which is what the List variants want on their text_list port.

    Why you'd reach for it

    Two workflows make it earn its keep:

    1. Feed the list nodes. Build a list of alternatives with several StringToolsString/StringToolsText nodes, bundle them here, and wire the list into a StringToolsRandomChoiceList or StringToolsConcatList. Now your downstream node sees one port instead of five.
    2. Hand a list to any other list-hungry node. ComfyUI has plenty of nodes that accept a list of strings (batch text, some dynamic-prompt tooling, etc.). This is a clean way to produce one from discrete wires.

    Under the hood it's the same collection-and-sort logic the choice nodes use: gather every connected text_N, order by numeric suffix, return them as a list. text_0 first, always.

    Inputs and output

    • text_0, text_1, … - the strings to bundle. Disconnected slots are skipped.
    • Output: STRING as a list (is_list: true). Wire it into a text_list port, not a plain string port - a single-string consumer will not be happy with a list.

    Installing it

    One-pack install. ComfyUI Manager: "Install Custom Nodes", search ComfyUI String Tools (repo Taremin/comfyui-string-tools), install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Taremin/comfyui-string-tools
    

    Restart fully. No pip deps, no model downloads - stdlib Python plus a small JS file, MIT license, release 0.0.7.

    Gotchas

    • Lists and single strings are not interchangeable. If the receiving node expects one string and you hand it a list, you'll get a type error or a silent mismatch. The List nodes exist precisely so you don't have to flatten by hand.
    • Empty or unconnected slots are skipped, so a half-filled bundle is fine - but a fully empty one outputs an empty list, which the downstream List nodes will handle as a blank string.
    • If a wire won't connect here, it's the usual PrimitiveNode refusal; swap the source for a StringToolsString/StringToolsText.
    Categorystring-tools

    Inputs (0)

    No inputs

    Outputs (1)

    NameTypeDescription
    STRINGSTRING