Count List Items
Count the number of items in a list
What does this node do?
The Count List Items node counts the number of items in a list and returns the total as a single value.
Common uses:
- Check list size before a Loop node
- Validate data completeness (e.g., ensure enough results were fetched)
- Conditional branching based on item count
Quick setup
Add the Count List Items node
Drag it onto the canvas from the Tools panel.
Connect a list input
Connect the output of any node that produces a list (e.g., Create List, Notion Database Reader) to the list input.
Use the count output
Connect the count output to the next node in your workflow.
Configuration
This node has no custom parameters. Only the standard Name and Description fields are available.
Input
list json required The list to count. Accepts JSON arrays, strings, and text that can be parsed as a list.
Output
A single count value representing the number of items in the list.
{
"count": "12"
}
Examples
Count articles from a database
graph LR
A[Notion Database Reader] --> B[Count List Items]
B --> C[LLM: Summarize results]
Use the count to inform an LLM how many articles were retrieved, so it can adapt its summary accordingly.
Branch based on count
graph LR
A[API Connector] --> B[Count List Items]
B --> C{Conditional}
C -->|count > 0| D[Process results]
C -->|count = 0| E[Fail: No results]
Check whether the API returned any results before processing them.
Best practices
- Validate before looping. Use Count List Items before a Loop node to check that the list is not empty, avoiding unnecessary iterations.
- Combine with Conditional. Route your workflow based on the count value to handle empty lists, single-item lists, or large lists differently.
Common issues
Input is not recognized as a list
The list input must be a valid JSON array (e.g., ["a", "b", "c"]). If you pass a plain string or an object, the node may not count correctly. Make sure the upstream node outputs a proper list format.
Count is 0 when I expect items
Check that the upstream node actually produced output. Connect a Merge or LLM node to inspect the raw data. An empty array [] or a failed upstream node will both result in a count of 0.