What this means in practice
When you have organized information into a knowledge base (via import or chunking), usecrystal_query_knowledge_base to:
- Retrieve relevant information by semantic meaning (not just keyword match)
- Scope queries to a specific knowledge base
- Filter by agent or channel if the knowledge base supports it
- Limit results to reduce noise and context overhead
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
knowledgeBaseId | string | Conditional | The ID of the knowledge base to query. Either this or knowledgeBaseName is required. |
knowledgeBaseName | string | Conditional | The human-readable name of the knowledge base. Either this or knowledgeBaseId is required. |
query | string | Yes | The search query. Automatically embedded and searched against KB chunks. |
limit | number | No | Maximum results to return. Default: unspecified. Range: 1–20. |
agentId | string | No | Optional agent identifier for scoped queries. |
channel | string | No | Optional channel identifier for scoped queries. |
Returns
Examples
Basic query by name:When to use vs alternatives
| Use case | Tool |
|---|---|
| Search a specific knowledge base by semantic meaning | crystal_query_knowledge_base |
| Semantic search across all memories (not KBs) | crystal_recall |
| Exact text match in messages | crystal_search_messages |
| Get all KBs available to the user | crystal_list_knowledge_bases |
| Import or create a new knowledge base | Use dashboard or API |
Error handling
| Error | Cause | Resolution |
|---|---|---|
Knowledge base not found | The specified ID or name doesn’t exist or is not accessible. | Verify the KB name/ID via crystal_list_knowledge_bases. |
query is required | No query parameter was provided. | Provide a non-empty query string. |
knowledgeBaseId or knowledgeBaseName is required | Neither ID nor name was provided. | Provide at least one identifier. |
| Empty results | The query matched no chunks above the similarity threshold. | Try a simpler or more general query. |
Source of truth
mcp-server/src/tools/query-knowledge-base.ts— tool definition and HTTP handlerconvex/crystal/knowledgeBases.ts— backend query logicapps/web/app/(dashboard)/knowledge-bases/— KB management UI
