List to String | Ollama Nodes
Flatten a list into a string — and where that's actually useful
- list
- string
ListToString takes a list and joins it into a single string with a delimiter - think Python's ", ".join(your_list) rendered as a node. You feed it a LIST, pick a separator, and out comes one STRING. It's a utility node that lives in this pack because the Ollama nodes churn out lists (ListModels' model_list, GenerateOllama's context) and strings are what most other nodes eat.
Why you'd reach for it
The immediate use case in this pack: ListModels gives you a LIST of installed model names, but a lot of downstream nodes - ShowText, prompt templates, anything expecting a plain string - can't handle a list. ListToString turns ["llava:latest", "phi3:latest"] into "llava:latest, phi3:latest" so you can display it or stuff it into a prompt. Same trick works on GenerateOllama's context output if you ever want to peek at what token IDs it's carrying.
Beyond the Ollama nodes, it's a general type adapter. Any node that hands you a list of tags, names, or labels can be flattened into readable text. If you've ever stared at a list output and wished it was a sentence, this is the node.
How it works
It iterates the list, casts each element to a string (so mixed types don't crash it - numbers and text both get flattened), and joins them with your delimiter. Simple, always re-executes, no caching surprises.
Inputs:
list(required) - the LIST to flatten, forced as an input connection. Must come from another node; you can't hand-type it.delimiter(optional) - the separator between elements. Leave it empty for plain concatenation, or set,or|for readable output.
Output:
string- the joined result, a single STRING ready for any text input.
Installing it
It ships in the slyt/comfyui-ollama-nodes pack, so install the family:
cd ComfyUI/custom_nodes
git clone https://github.com/slyt/comfyui-ollama-nodes
cd comfyui-ollama-nodes
pip install -r requirements.txt
or ComfyUI Manager → search "comfyui-ollama-nodes" → Install → restart. Note the category is LLM/Ollama, not Utility, even though it's a utility at heart - that's where it shows up in the menu.
Gotchas
- Trailing delimiter. The node appends the delimiter after every element, including the last one. With a comma you get
"a, b, c,"not"a, b, c". Usually harmless, but if you're piping the result into a strict parser, expect a trailing separator and plan around it. - Class-name collision, dodged. The author wanted to call it
StringListToString, but that name is already taken by ComfyUI-Impact-Pack - ComfyUI requires globally unique class names, so it shipped asListToString. Useful context if you ever see both names in an old workflow and wonder what's what. - Empty list just yields an empty string, which is fine unless you expected a placeholder. Handle that upstream if it matters.
Honest verdict: it's glue. You won't build a workflow around it, but the moment a list output needs to become readable text, it's the right tool and it costs nothing to have installed.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| list | LIST | — | |
| delimiteropt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| string | STRING | — |