Skip to main content
Glama

get_memento

Retrieve stored memories by ID to access specific solutions, facts, or decisions from a persistent knowledge base, including related memories when needed.

Instructions

Retrieve a specific memento by ID.

Use when you have a memory_id from search results or store_memento. Set include_relationships=true (default) to see connected memories.

EXAMPLE: get_memento(memory_id="abc-123")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
memory_idYesID of the memory to retrieve
include_relationshipsNoWhether to include related memories

Implementation Reference

  • The implementation of the get_memento tool handler in memory_tools.py.
    @handle_tool_errors("get memory")
    async def handle_get_memento(
        memory_db: SQLiteMemoryDatabase, arguments: Dict[str, Any]
    ) -> CallToolResult:
        """Handle get_memory tool call.
    
        Args:
            memory_db: Database instance for memory operations
            arguments: Tool arguments from MCP call containing:
                - memory_id: ID of memory to retrieve
                - include_relationships: Whether to include related memories (default: True)
    
        Returns:
            CallToolResult with formatted memory details or error message
        """
        memory_id = arguments["memory_id"]
        include_relationships = arguments.get("include_relationships", True)
    
        memory = await memory_db.get_memory(memory_id, include_relationships)
    
        if not memory:
            return CallToolResult(
                content=[TextContent(type="text", text=f"Memory not found: {memory_id}")],
                isError=True,
            )
    
        # Format memory for display
        memory_text = f"""**Memory: {memory.title}**
    Type: {memory.type.value}
    Created: {memory.created_at}
    Importance: {memory.importance}
    Tags: {", ".join(memory.tags) if memory.tags else "None"}
    
    **Content:**
    {memory.content}"""
    
        if memory.summary:
            memory_text = f"**Summary:** {memory.summary}\n\n" + memory_text
    
        # Add context information if available
        if memory.context:
            context_parts = []
    
            if memory.context.project_path:
                context_parts.append(f"Project: {memory.context.project_path}")
    
            if memory.context.files_involved:
                files_str = ", ".join(memory.context.files_involved[:3])
                if len(memory.context.files_involved) > 3:
                    files_str += f" (+{len(memory.context.files_involved) - 3} more)"
                context_parts.append(f"Files: {files_str}")
    
            if memory.context.languages:
                context_parts.append(f"Languages: {', '.join(memory.context.languages)}")
    
            if memory.context.frameworks:
                context_parts.append(f"Frameworks: {', '.join(memory.context.frameworks)}")
    
            if memory.context.technologies:
                context_parts.append(
                    f"Technologies: {', '.join(memory.context.technologies)}"
                )
    
            if memory.context.git_branch:
                context_parts.append(f"Branch: {memory.context.git_branch}")
    
            if context_parts:
                context_text = "\n**Context:**\n" + "\n".join(
                    f"  {part}" for part in context_parts
                )
                memory_text += "\n" + context_text
    
        # Add relationships section if requested
        if include_relationships:
            related = await memory_db.get_related_memories(memory_id, max_depth=1)
    
            if related:
                memory_text += "\n\n**Relationships:**"
    
                by_type: dict = {}
                for rel_memory, relationship in related:
                    rel_type = relationship.type.value if relationship and hasattr(relationship, "type") else "RELATED_TO"
                    if rel_type not in by_type:
                        by_type[rel_type] = []
                    by_type[rel_type].append(
                        f"{rel_memory.title} (ID: {rel_memory.id})"
                    )
    
                for rel_type, entries in sorted(by_type.items()):
                    memory_text += f"\n  {rel_type}:"
                    for entry in entries:
                        memory_text += f"\n    - {entry}"
    
        return CallToolResult(content=[TextContent(type="text", text=memory_text)])
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. Discloses that include_relationships shows 'connected memories' and notes default behavior (true). Missing error handling (what if ID invalid?) and return format details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three distinct, front-loaded segments (purpose, usage guidance, parameter tip) plus example. No filler. Each sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Adequate for a 2-parameter retrieval tool without output schema. Covers the core retrieval action, relationship expansion behavior, and integration with sibling workflows. Minor gap on error scenarios.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, establishing baseline 3. Description adds critical semantic detail that include_relationships defaults to true, plus a concrete usage example showing syntax.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Specific verb 'Retrieve' + resource 'memento' + scope 'by ID' clearly distinguishes this from siblings like 'search_mementos' (multi-result) and 'store_memento' (create).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly states workflow context: 'Use when you have a memory_id from search results or store_memento.' Links the tool into the usage chain. Lacks explicit 'when not to use' or named alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/x-hannibal/mcp-memento'

If you have feedback or need assistance with the MCP directory API, please join our Discord server