Skip to main content
Glama

store_memento

Store persistent knowledge like solutions, errors, and patterns with metadata and tags for reliable long-term retrieval across all sessions.

Instructions

Store a new memento with context and metadata.

Required: type, title, content. Optional: id, tags, importance (0-1), context.

USE FOR: Long-term knowledge that should survive across ALL sessions. DO NOT USE FOR: Temporary session state or project-specific context.

LIMITS:

  • title: max 500 characters

  • content: max 50KB (50,000 characters)

  • tags: max 50 tags, 100 chars each

  • id: if provided, must be unique string identifier

TAGGING BEST PRACTICE:

  • Always include acronyms AS TAGS (e.g., tags=["jwt", "auth"])

  • Fuzzy search struggles with acronyms in content

  • Tags provide exact match fallback for reliable retrieval

Types: solution, problem, error, fix, task, code_pattern, technology, command, file_context, workflow, project, general, conversation

Note: decision is not a standalone type — use type="general" with tags=["decision", "architecture"]. Note: pattern is not a standalone type — use type="code_pattern".

EXAMPLES:

  • store_memento(type="solution", title="Fixed Redis timeout", content="Increased timeout to 30s...", tags=["redis"], importance=0.8)

  • store_memento(type="error", title="OAuth2 auth failure", content="Error details...", tags=["auth", "oauth2"], id="custom-error-123")

Returns memory_id. Use create_memento_relationship to link related memories.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeYesType of memory to store
idNoOptional memory ID (if not provided, a UUID will be generated automatically)
titleYesShort descriptive title for the memory
contentYesDetailed content of the memory
summaryNoOptional brief summary of the memory
tagsNoTags to categorize the memory
importanceNoImportance score (0.0-1.0)
contextNoContext information for the memory

Implementation Reference

  • The handle_store_memento function is the handler implementation for the store_memento MCP tool. It validates the input, manages memory IDs (generating a UUID if none is provided), creates a Memory object, and persists it in the SQLite database.
    async def handle_store_memento(
        memory_db: SQLiteMemoryDatabase, arguments: Dict[str, Any]
    ) -> CallToolResult:
        """Handle store_memory tool call.
    
        Args:
            memory_db: Database instance for memory operations
            arguments: Tool arguments from MCP call containing:
                - type: Memory type (solution, problem, error, etc.)
                - title: Short descriptive title
                - content: Detailed content
                - summary: Optional brief summary
                - tags: Optional list of tags
                - importance: Optional importance score (0.0-1.0)
                - context: Optional context information
                - id: Optional memory ID (if not provided, one will be generated)
    
        Returns:
            CallToolResult with memory ID on success or error message on failure
        """
        # Validate input arguments
        validate_memory_input(arguments)
    
        # Handle memory ID: generate or validate
        if "id" in arguments:
            # User provided an ID (might be empty or whitespace)
            memory_id = arguments["id"]
    
            # Strip whitespace and validate
            if not isinstance(memory_id, str):
                raise ValidationError("Memory ID must be a string")
    
            memory_id = memory_id.strip()
            if not memory_id:
                raise ValidationError(
                    "Memory ID must be a non-empty string after removing whitespace"
                )
    
            # Check if memory with this ID already exists
            existing = await memory_db.get_memory_by_id(memory_id)
            if existing:
                raise ValidationError(f"Memory with ID '{memory_id}' already exists")
        else:
            # Generate new UUID
            memory_id = str(uuid.uuid4())
    
        # Extract context if provided
        context = None
        if "context" in arguments:
            context = MemoryContext(**arguments["context"])
    
        # Create memory object with ID
        memory = Memory(
            id=memory_id,
            type=MemoryType(arguments["type"]),
            title=arguments["title"],
            content=arguments["content"],
            summary=arguments.get("summary"),
            tags=arguments.get("tags", []),
            importance=arguments.get("importance", 0.5),
            context=context,
        )
    
        # Store in database
        stored_memory = await memory_db.store_memory(memory)
    
        return CallToolResult(
            content=[
                TextContent(
                    type="text",
                    text=f"Memory stored successfully with ID: {stored_memory.id}",
                )
            ]
        )
Behavior5/5

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

No annotations provided, yet description fully discloses behavioral traits: return value ('Returns memory_id'), hard limits (500 char title, 50KB content, 50 tags), uniqueness constraint on ID, and mutation scope (cross-session persistence). Exceeds baseline for zero-annotation tools.

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?

Exceptionally structured with clear headers (USE FOR, LIMITS, TAGGING BEST PRACTICE, EXAMPLES). Information is front-loaded with required/optional distinction immediately after the one-line purpose. Every section serves a distinct purpose; length is justified by complexity and lack of annotations.

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

Completeness5/5

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

Comprehensive for an 8-parameter tool with nested objects and no output schema. Covers input constraints, return values, type enumerations with usage notes, relationship to sibling tools, and operational best practices. Leaves no critical gaps despite high complexity.

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% (baseline 3), but description adds substantial value: validation limits not in schema (max 500 chars, 50KB), tagging best practices (acronym handling), and critical type clarifications ('decision' and 'pattern' are not valid standalone types). Elevates understanding beyond raw schema.

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?

Opens with specific verb+resource ('Store a new memento') and explicitly distinguishes from siblings via 'USE FOR: Long-term knowledge...' vs 'DO NOT USE FOR: Temporary session state', clearly differentiating it from session-based tools and update/delete siblings.

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

Usage Guidelines5/5

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

Provides explicit dual guidance: 'USE FOR' and 'DO NOT USE FOR' blocks clearly define scope boundaries. Also references sibling `create_memento_relationship` for linking memories, guiding the agent toward the correct workflow.

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