The `KB LIST COLLECTIONS` keyword returns a list of all knowledge base collection names associated with the current bot.
---
## Syntax
```basic
collections = KB LIST COLLECTIONS
```
---
## Parameters
None. Returns collections for the current bot.
---
## Description
`KB LIST COLLECTIONS` queries Qdrant to retrieve all collection names that belong to the current bot. Collections are filtered by the bot ID prefix (`kb_{bot_id}`), returning only collections owned by the calling bot.
Use cases include:
- Discovering available knowledge domains
- Building dynamic collection selection interfaces
- Admin dashboards and monitoring
- Iterating over collections for batch operations
- Validating collection existence before operations
---
## Return Value
Returns an array of collection name strings. Returns an empty array if no collections exist.
- [KB COLLECTION STATS](keyword-kb-collection-stats.md) — Stats for specific collection
- [KB DOCUMENTS COUNT](keyword-kb-documents-count.md) — Total document count
- [KB STORAGE SIZE](keyword-kb-storage-size.md) — Storage usage in MB
- [USE KB](keyword-use-kb.md) — Enable KB for queries
- [CLEAR KB](keyword-clear-kb.md) — Clear knowledge base content
---
## Implementation Notes
- Implemented in Rust under `src/basic/keywords/kb_statistics.rs`
- Queries Qdrant REST API at `/collections`
- Filters results by bot ID prefix (`kb_{bot_id}`)
- Returns array of Dynamic strings for easy iteration
- Empty array returned if no collections or on error
- Collection names include the full prefix (e.g., `kb_products`)
---
## Summary
`KB LIST COLLECTIONS` provides a way to discover all knowledge base collections belonging to the current bot. Use it for dynamic collection selection, admin dashboards, batch operations, or validating collection existence before performing operations. Combine with `KB COLLECTION STATS` to get detailed information about each collection.