query_memory
Query the memory graph by search, entity lookup, or listing
Query stored memories using three modes: semantic search, entity context lookup, or paginated listing.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
mode | enum | Yes | - | Query mode: search, entity, or list |
query | string | mode=search | - | Search query (1-1000 chars) |
entityTypes | enum[] | No | all | Filter by entity types |
searchMode | enum | No | hybrid | Search mode: hybrid or semantic (mode=search only) |
entityName | string | mode=entity | - | Entity name to look up (1-200 chars) |
includeRelated | boolean | No | true | Include relations (mode=entity only) |
maxObs | number | No | 20 | Max observations per entity (mode=entity only) |
limit | number | No | 10 | Max results (1-50 for search, 1-100 for list) |
offset | number | No | 0 | Pagination offset (mode=list only) |
Mode: search
Semantic search across stored memories. Replaces the former recall_memories tool.
Example
Search Modes
| Mode | Description |
|---|---|
hybrid | Combines keyword matching with semantic similarity (recommended) |
semantic | Pure semantic similarity search |
Response (Compact)
Key mapping: n=count/name, e=entities, t=type, m=memories, c=content, s=score
Response (Verbose)
Score Interpretation
| Score Range | Meaning |
|---|---|
| 0.9 - 1.0 | Highly relevant match |
| 0.7 - 0.9 | Good match |
| 0.5 - 0.7 | Moderate relevance |
| < 0.5 | Weak match |
Mode: entity
Get all information about a specific entity including observations and relations. Replaces the former get_entity_context tool.
Example
Response (Compact)
Key mapping: t=type, o=observations (content strings), r=relations (string format), more=remaining observations beyond maxObs
Response (Verbose)
Entity Not Found
Mode: list
List all entities with optional type filtering and pagination. Replaces the former list_entities tool.
Example
Response (Compact)
Response (Verbose)
Output Schema
This tool MUST return structuredContent alongside the text response. The structuredContent object MUST use canonical verbose keys regardless of the COMPACT_RESPONSES setting. Fields vary by mode:
Search Mode
| Field | Type | Description |
|---|---|---|
mode | "search" | Query mode |
totalMemories | integer | Number of matching memories |
entities | array | Results grouped by entity |
entities[].entityName | string | Entity name |
entities[].entityType | string | Entity type |
entities[].memories | array | Matching memories |
entities[].memories[].content | string | Memory content |
entities[].memories[].source | string | Memory source |
entities[].memories[].score | number | Relevance score |
Entity Mode
| Field | Type | Description |
|---|---|---|
mode | "entity" | Query mode |
found | boolean | Whether the entity was found |
entity | object | Entity details |
entity.id | string | Entity UUID |
entity.name | string | Entity name |
entity.type | string | Entity type |
entity.description | string? | Entity description |
observations | array | Entity observations |
relations | object | Entity relations (outgoing, incoming) |
hasMore | boolean | Whether more observations exist |
totalObservations | integer | Total observation count |
List Mode
| Field | Type | Description |
|---|---|---|
mode | "list" | Query mode |
total | integer | Total entity count |
returned | integer | Entities in this page |
offset | integer | Current offset |
entityList | array | Array of entities |
entityList[].id | string | Entity UUID |
entityList[].name | string | Entity name |
entityList[].type | string | Entity type |
entityList[].description | string? | Entity description |
entityList[].updatedAt | string | ISO update timestamp |
Entity Types
Valid types: person, concept, project, preference, fact, location, organization
Errors
| Error | Cause | Fix |
|---|---|---|
| Memory not enabled | ENABLE_MEMORY feature flag is false | Set ENABLE_MEMORY=true |
| Missing query | mode=search without query | Provide query parameter |
| Missing entityName | mode=entity without entityName | Provide entityName parameter |
| Embedding service not configured | Missing API key | Set OPENAI_API_KEY or configure Ollama |
| Invalid entity type | Unknown entity type in filter | Use valid types listed above |
Related Tools
remember_fact- Store new facts about entitiesbuild_knowledge- Store multiple facts and relations in a batchrelate_entities- Create relationships between entitiesforget_entity- Delete an entity and all its memories