MessagesToList
MessagesToList strips the type, keeps the data
- messages
- Messages
Chat messages in this pack travel as a custom type called LLLM_MESSAGES. That's great for the pack's own nodes, and useless the moment you want to hand your conversation to something that doesn't know what an LLLM_MESSAGES is. MessagesToList is the bridge: it takes your message chain and re-emits it as a plain LIST, which just about every other node ecosystem accepts.
It's a one-liner of a node, but it earns its spot whenever you want to:
- pass a conversation to a generic Python/text/list-processing node from another pack,
- save the whole dialogue to disk as structured data,
- iterate over messages in a custom script node,
- or convert once so you can rebuild it later with
ListToMessages.
How it works
One required input, messages (LLLM_MESSAGES), and one output, Messages (LIST). The handler does two things: it passes the list through unchanged, and it validates every message as it goes - each one must have both a content key and a role key, or the node raises a ValueError naming the missing key.
That validation is genuinely useful, not just ceremony. It catches the classic mistake of building a message list that's missing a role, which would otherwise fail halfway through an API call downstream - after you've already spent the tokens. Better to fail in a converter than at the provider.
Wiring it up
The typical shape is at the end of a message-building chain:
LiteLLMMessage → LiteLLMMessage → MessagesToList → (generic node / save / inspect)
Where it lives in the graph is up to you - it doesn't consume or alter anything, it just changes the type label. The inverse node is ListToMessages, which takes a plain list back into LLLM_MESSAGES (and does the same validation). Between the two, you can hop in and out of the pack's type system freely.
Installing
MessagesToList ships in the ComfyUI_LiteLLM pack, so the install is pack-level: ComfyUI Manager → search "LiteLLM" (repo Hopping-Mad-Games/ComfyUI_LiteLLM) → Install → Restart, or clone into ComfyUI/custom_nodes and pip install -r requirements.txt. Note that requirements file is heavy - litellm, boto3, sentence-transformers, a LightRAG fork - so the first install takes a while even though this node itself is trivial. No API keys, no network calls.
Gotchas
- Empty in, empty out. An empty messages list passes straight through without complaint. If you're chaining and something upstream silently produced nothing, you'll get a silent empty list here - the validation only fires when messages exist.
- It's not a copy-safe shuffle. The output is the same Python list object, so downstream mutation could, in theory, reach back upstream. In normal ComfyUI usage that never matters; just don't build a node that mutates lists in place and blame this one.
- Don't confuse it with
MessagesToText.MessagesToListkeeps the structured{role, content}dicts;MessagesToTextflattens everything to a single string. Different jobs, same prefix.
It's the sort of node you'll forget exists until the day you need it - and then you'll be glad it's there.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| messages | LLLM_MESSAGES | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Messages | LIST | — |