Memory Tools Reference

May 8, 2025 ยท View on GitHub

This document provides a comprehensive reference for all tools available in the Memory Graph MCP. Each tool is described with its purpose, parameters, usage examples, and best practices.

Table of Contents

  1. Domain Management Tools

  2. Memory Management Tools

  3. Visualization Tools

  4. Search Tools

Domain Management Tools

select_domain

Switch to a different memory domain.

Parameters

ParameterTypeRequiredDescription
idstringYesDomain identifier to switch to

Response

Returns domain information for the selected domain.

Example

{
  "id": "select_domain",
  "params": {
    "id": "personal-journal"
  }
}

Best Practices

  • Always save your work in the current domain before switching to another domain
  • Use domain switching sparingly to maintain context
  • Consider using domain references instead if you only need to reference information from another domain

list_domains

List all available memory domains.

Parameters

None

Response

Returns information about all domains, including:

  • List of domain objects with id, name, description, created and lastAccess timestamps
  • Current domain indicator

Example

{
  "id": "list_domains",
  "params": {}
}

Best Practices

  • Use this tool to discover available domains before performing domain-specific operations
  • Check the timestamps to understand which domains are actively used

create_domain

Create a new memory domain.

Parameters

ParameterTypeRequiredDescription
idstringYesUnique identifier for the domain
namestringYesHuman-readable name for the domain
descriptionstringYesPurpose or scope of the domain

Response

Returns the created domain information.

Example

{
  "id": "create_domain",
  "params": {
    "id": "technical-documentation",
    "name": "Technical Documentation",
    "description": "Documentation for technical systems and architecture"
  }
}

Best Practices

  • Use descriptive IDs that reflect the domain purpose (e.g., "project-management", "personal-journal")
  • Provide a clear description to help understand the domain's scope
  • Create separate domains for distinctly different contexts or projects
  • Don't create too many domains โ€“ aim for a balance between separation and manageability

Memory Management Tools

store_memory

Store new information in the memory graph.

Parameters

ParameterTypeRequiredDescription
contentstringYesMain memory content
pathstringNoOrganizational path (default: "/")
tagsstring[]NoArray of tags for categorization
relationshipsobjectNoRelationships to other memories
domainRefsobject[]NoReferences to memories in other domains
domainPointerobjectNoPointer to another domain (for cross-domain connections)

Relationship Types

  • follows: Sequential relationship (memory A happens after memory B)
  • relates_to: General connection between memories
  • supports: Memory provides evidence/support for another
  • contradicts: Memory contradicts another
  • refines: Memory clarifies or extends another
  • synthesizes: Memory combines insights from others

Relationship Format

"relationships": {
  "relationship_type": [
    {
      "targetId": "target_memory_id",
      "strength": 0.8  // 0.0 to 1.0, higher means stronger connection
    }
  ]
}

Domain Reference Format

"domainRefs": [
  {
    "domain": "target_domain_id",
    "nodeId": "target_memory_id",
    "description": "Optional context for the reference"
  }
]

Response

Returns the created memory node with its ID and timestamp.

Example

{
  "id": "store_memory",
  "params": {
    "content": "The microservices architecture we chose allows for independent scaling of components, improving overall system resilience.",
    "path": "/architecture/decisions",
    "tags": ["architecture", "microservices", "scaling"],
    "relationships": {
      "relates_to": [
        {
          "targetId": "previous_memory_id",
          "strength": 0.9
        }
      ]
    }
  }
}

Best Practices

  • Keep memory content focused on a single topic or insight
  • Use consistent paths to organize related information
  • Add relevant tags to improve searchability
  • Create explicit relationships to build a connected knowledge graph
  • Use relationship strength to indicate confidence or importance
  • For cross-domain relationships, use domainRefs to maintain separation with connections

recall_memories

Retrieve memories using various strategies.

Parameters

ParameterTypeRequiredDescription
maxNodesnumberYesMaximum number of nodes to return
strategystringYesSearch strategy: recent, related, path, tag, content, combinedStrategy
startNodeIdstringNoRequired for 'related' strategy
pathstringNoRequired for 'path' strategy
tagsstring[]NoRequired for 'tag' strategy
searchobjectNoRequired for 'content' strategy
relationshipTypesstring[]NoFilter by relationship types
minStrengthnumberNoMinimum relationship strength (0-1)
beforestringNoOnly include memories before this timestamp
afterstringNoOnly include memories after this timestamp
combinedStrategyobjectNoUse multiple strategies together
sortBystringNoSort by: "relevance", "date", or "strength"
matchDetailsbooleanNoInclude details about matched content

Search Options Format

"search": {
  "keywords": ["term1", "term2"],
  "fuzzyMatch": true,
  "regex": false,
  "caseSensitive": false
}

Combined Strategy Format

"combinedStrategy": {
  "recent": { "maxNodes": 5 },
  "path": { "path": "/architecture", "maxNodes": 5 },
  "tag": { "tags": ["microservices"], "maxNodes": 5 }
}

Response

Returns an array of memory nodes matching the search criteria.

Example

{
  "id": "recall_memories",
  "params": {
    "maxNodes": 10,
    "strategy": "combinedStrategy",
    "combinedStrategy": {
      "path": {
        "path": "/architecture/decisions",
        "maxNodes": 5
      },
      "tag": {
        "tags": ["microservices"],
        "maxNodes": 5
      }
    },
    "sortBy": "date"
  }
}

Best Practices

  • Start with a specific strategy that matches your retrieval needs
  • Use combinedStrategy for more comprehensive searches
  • Limit maxNodes appropriately to focus on most relevant results
  • Consider using matchDetails: true when searching content to see what matched
  • Use sortBy to control how results are ordered
  • For path strategy, use broader paths for wider searches, more specific paths for focused recall
  • When searching by tags, include multiple related tags for better results

edit_memory

Edit an existing memory's content and relationships.

Parameters

ParameterTypeRequiredDescription
idstringYesMemory ID to edit
contentstringNoUpdated memory content
pathstringNoUpdated organizational path
tagsstring[]NoUpdated tags
relationshipsobjectNoUpdated relationships
domainRefsobject[]NoUpdated domain references
targetDomainstringNoDomain to move memory to

Response

Returns the updated memory node.

Example

{
  "id": "edit_memory",
  "params": {
    "id": "memory123",
    "content": "Updated content with more details about the microservices architecture.",
    "tags": ["architecture", "microservices", "scaling", "resilience"],
    "relationships": {
      "relates_to": [
        {
          "targetId": "memory456",
          "strength": 0.8
        }
      ]
    }
  }
}

Example (Moving to Another Domain)

{
  "id": "edit_memory",
  "params": {
    "id": "memory123",
    "targetDomain": "archived-decisions"
  }
}

Best Practices

  • Only provide parameters that need to change (unchanged fields will keep their current values)
  • When providing relationships, the entire relationships object is replaced (not merged)
  • When moving to another domain (targetDomain), verify the target domain exists first
  • Consider copying important relationships when moving between domains
  • Remember that moving a memory may affect other memories that reference it in the source domain

forget_memory

Remove a memory from the graph.

Parameters

ParameterTypeRequiredDescription
idstringYesMemory ID to remove
cascadebooleanNoWhether to also remove connected memories (default: false)

Response

Returns success status.

Example

{
  "id": "forget_memory",
  "params": {
    "id": "memory123",
    "cascade": false
  }
}

Best Practices

  • Use forget_memory sparingly, as deleted memories cannot be recovered
  • Consider editing or archiving memories instead of deleting them
  • Be very careful with cascade: true, as it can remove multiple connected memories
  • Always verify the memory ID before deleting
  • Consider using targetDomain with edit_memory to move to an archive domain instead of permanent deletion

Visualization Tools

generate_mermaid_graph

Generate a Mermaid flowchart visualization of memory relationships.

Parameters

ParameterTypeRequiredDescription
startNodeIdstringYesStarting memory ID for the graph
maxDepthnumberNoMaximum depth of relationships to traverse (1-5, default: 2)
directionstringNoGraph direction: 'TB', 'BT', 'LR', 'RL' (default: 'LR')
relationshipTypesstring[]NoFilter specific relationship types
minStrengthnumberNoMinimum relationship strength (0-1)
contentFormatobjectNoOptions for formatting node content

Content Format Options

"contentFormat": {
  "maxLength": 50,
  "truncationSuffix": "...",
  "includeTimestamp": false,
  "includeId": false
}

Response

Returns a Mermaid graph definition string that can be rendered as a flowchart.

Example

{
  "id": "generate_mermaid_graph",
  "params": {
    "startNodeId": "memory123",
    "maxDepth": 3,
    "direction": "LR",
    "relationshipTypes": ["follows", "relates_to"],
    "minStrength": 0.6,
    "contentFormat": {
      "maxLength": 60,
      "truncationSuffix": "...",
      "includeTimestamp": false,
      "includeId": true
    }
  }
}

Best Practices

  • Choose direction based on relationship semantics:
    • LR/RL: For showing flow/progression
    • TB/BT: For hierarchical relationships
  • Adjust maxDepth (1-5) to control visualization complexity
  • Use minStrength to filter for stronger relationships
  • Filter relationshipTypes for focused views
  • For large memory graphs, start with a smaller maxDepth (1-2) and increase if needed
  • Include node IDs (includeId: true) if you need to reference specific nodes in follow-up operations

Search Tools

search_memory_content

Search for memories using full-text search capabilities.

Parameters

ParameterTypeRequiredDescription
querystringYesSearch query text
domainstringNoOptional domain to restrict search to
maxResultsnumberNoMaximum number of results to return (default: 20)

Response

Returns an array of memory nodes matching the search query.

Example

{
  "id": "search_memory_content",
  "params": {
    "query": "microservices architecture resilience",
    "domain": "technical-documentation",
    "maxResults": 15
  }
}

Best Practices

  • Use specific, targeted terms in your query
  • Include synonyms or related terms to broaden the search
  • For SQLite and MariaDB storage backends, this uses full-text search capabilities
  • When using JSON storage, be aware that search is more limited and based on basic string matching
  • Use the maxResults parameter to control the number of results, especially for broad queries

traverse_memories

Traverse the memory graph following relationships and domain pointers.

Parameters

ParameterTypeRequiredDescription
startNodeIdstringNoStarting memory ID (uses recent memory if not specified)
maxDepthnumberNoMaximum depth of relationships to traverse (default: 2)
followDomainPointersbooleanNoWhether to follow connections across domains (default: true)
targetDomainstringNoOptional specific domain to traverse
maxNodesPerDomainnumberNoMaximum number of nodes to return per domain (default: 20)

Response

Returns a hierarchical representation of connected memories, showing both incoming and outgoing relationships.

Example

{
  "id": "traverse_memories",
  "params": {
    "startNodeId": "memory123",
    "maxDepth": 3,
    "followDomainPointers": true,
    "maxNodesPerDomain": 15
  }
}

Best Practices

  • Use traverse_memories when you want to explore the connection network around a specific memory
  • This differs from recall_memories by providing a more narrative, hierarchical view of connections
  • Especially useful for understanding how different pieces of information relate to each other
  • Increase maxDepth gradually to avoid overwhelming results
  • When working across multiple domains, use followDomainPointers: true to see the full picture
  • If a specific domain is of interest, use targetDomain to focus the traversal