Skip to main content
Glama

touch_memory

Reinforce memories by updating access time and use count to reset temporal decay and increase resistance to forgetting. Optionally boost memory strength to maintain retention.

Instructions

Reinforce a memory by updating its last accessed time and use count.

This resets the temporal decay and increases the memory's resistance to
being forgotten. Optionally can boost the memory's base strength.

Args:
    memory_id: ID of the memory to reinforce.
    boost_strength: Whether to boost the base strength.

Returns:
    Updated memory statistics including old and new scores.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
boost_strengthNo
memory_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The touch_memory function that executes the tool logic: reinforces a memory by updating its last used time, use count, and optionally boosting strength. Calculates and returns old/new scores.
    def touch_memory(memory_id: str, boost_strength: bool = False) -> dict[str, Any]:
        """
        Reinforce a memory by updating its last accessed time and use count.
    
        This resets the temporal decay and increases the memory's resistance to
        being forgotten. Optionally can boost the memory's base strength.
    
        Args:
            memory_id: ID of the memory to reinforce (valid UUID).
            boost_strength: Whether to boost the base strength.
    
        Returns:
            Updated memory statistics including old and new scores.
    
        Raises:
            ValueError: If memory_id is invalid.
        """
        # Input validation
        memory_id = validate_uuid(memory_id, "memory_id")
    
        memory = db.get_memory(memory_id)
        if memory is None:
            return {"success": False, "message": f"Memory not found: {memory_id}"}
    
        now = int(time.time())
        old_score = calculate_score(
            use_count=memory.use_count,
            last_used=memory.last_used,
            strength=memory.strength,
            now=now,
        )
    
        new_use_count = memory.use_count + 1
        new_strength = memory.strength
        if boost_strength:
            new_strength = min(2.0, memory.strength + 0.1)
    
        db.update_memory(
            memory_id=memory_id,
            last_used=now,
            use_count=new_use_count,
            strength=new_strength,
        )
    
        new_score = calculate_score(
            use_count=new_use_count,
            last_used=now,
            strength=new_strength,
            now=now,
        )
    
        return {
            "success": True,
            "memory_id": memory_id,
            "old_score": round(old_score, 4),
            "new_score": round(new_score, 4),
            "use_count": new_use_count,
            "strength": round(new_strength, 4),
            "message": f"Memory reinforced. Score: {old_score:.2f} -> {new_score:.2f}",
        }
  • The @mcp.tool() decorator registers the touch_memory function as an MCP tool.
    @mcp.tool()
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes the tool's effects ('resets temporal decay', 'increases resistance to being forgotten', 'optionally boost base strength') and the return value ('updated memory statistics including old and new scores'). It doesn't cover potential side effects, rate limits, or error conditions, but provides solid operational context.

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?

The description is well-structured and front-loaded with the core purpose in the first sentence. Each subsequent sentence adds value: explaining effects, documenting parameters, and describing returns. There's no wasted text, and it efficiently communicates essential information in four concise sentences.

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?

Given the tool has an output schema (which handles return values), no annotations, and moderate complexity with 2 parameters, the description is reasonably complete. It covers purpose, effects, parameters, and returns at a high level. However, it lacks details on error cases, side effects, or specific usage scenarios that would be helpful for a mutation tool.

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?

The schema description coverage is 0%, so the description must compensate. It adds meaningful context for both parameters: 'memory_id' is explained as 'ID of the memory to reinforce', and 'boost_strength' as 'Whether to boost the base strength' with the optional nature clarified. This goes beyond the schema's basic type information, though it could provide more detail on what boosting entails.

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?

The description clearly states the tool's purpose with specific verbs ('reinforce', 'updating', 'resets', 'increases') and identifies the resource ('memory'). It distinguishes this from siblings like 'promote_memory' or 'save_memory' by focusing on temporal reinforcement rather than creation or promotion.

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

Usage Guidelines3/5

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

The description implies usage context through phrases like 'resets the temporal decay' and 'increases resistance to being forgotten', suggesting it's for maintaining memory relevance. However, it doesn't explicitly state when to use this tool versus alternatives like 'promote_memory' or 'consolidate_memories', nor does it mention prerequisites or exclusions.

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/prefrontal-systems/mnemex'

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