Skip to main content
Glama

touch

Boost a memory's strength to counteract forgetting. Use this when a memory is referenced or found relevant.

Instructions

Boost a memory's strength (simulate access, counteracts Ebbinghaus decay). Use this when a memory is referenced or found relevant.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesMemory filename (with or without .md extension)
boostNoStrength boost amount (default 0.15, max 1.0)

Implementation Reference

  • Schema definition for the 'touch' tool: accepts 'name' (required) and 'boost' (optional, default 0.15, max 1.0).
    {
        "name": "touch",
        "description": "Boost a memory's strength (simulate access, counteracts Ebbinghaus decay). Use this when a memory is referenced or found relevant.",
        "inputSchema": {
            "type": "object",
            "properties": {
                "name": {"type": "string", "description": "Memory filename (with or without .md extension)"},
                "boost": {"type": "number", "description": "Strength boost amount (default 0.15, max 1.0)"},
            },
            "required": ["name"],
        },
    },
  • Handler for the 'touch' tool: finds a memory by name, reads its frontmatter, boosts its strength (capped at 1.0), updates last_accessed and access_count, and writes back.
    elif name == "touch":
        target = args["name"]
        boost = min(float(args.get("boost", 0.15)), 1.0)
        target_lower = target.lower().replace(".md", "")
    
        files = list_memory_files()
        match = None
        for f in files:
            if f["name"].lower() == target_lower:
                match = f
                break
        if not match:
            return None, {"code": -32602, "message": f"Memory not found: {target}"}
    
        filepath = os.path.join(MEMORY_DIR, match["path"])
        with open(filepath, encoding="utf-8") as fh:
            text = fh.read()
    
        old_s = match["strength"]
        new_s = min(old_s + boost, 1.0)
        text = re.sub(r'^(strength:\s*)[\d.]+', rf'\g<1>{new_s:.2f}', text, flags=re.MULTILINE)
        text = re.sub(r'^(\s+strength:\s*)[\d.]+', rf'\g<1>{new_s:.2f}', text, flags=re.MULTILINE)
    
        today = date.today().isoformat()
        if re.search(r'last_accessed:', text):
            text = re.sub(r'^(last_accessed:\s*).*', rf'\g<1>{today}', text, flags=re.MULTILINE)
            text = re.sub(r'^(\s+last_accessed:\s*).*', rf'\g<1>{today}', text, flags=re.MULTILINE)
        if re.search(r'access_count:', text):
            ac = parse_frontmatter(text, "access_count")
            new_ac = int(ac) + 1 if ac else 1
            text = re.sub(r'^(access_count:\s*)\d+', rf'\g<1>{new_ac}', text, flags=re.MULTILINE)
            text = re.sub(r'^(\s+access_count:\s*)\d+', rf'\g<1>{new_ac}', text, flags=re.MULTILINE)
    
        with open(filepath, "w", encoding="utf-8") as fh:
            fh.write(text)
        return {"content": [{"type": "text", "text": f"Touched {target}: strength {old_s:.2f} → {new_s:.2f}"}]}, None
  • nexus_mcp.py:120-170 (registration)
    TOOL_DEFS list where all tools including 'touch' are registered.
    TOOL_DEFS = [
        {
            "name": "search",
            "description": "Search across all memory files by keyword. Returns matching file names, titles, strengths, and context snippets.",
            "inputSchema": {
                "type": "object",
                "properties": {"query": {"type": "string", "description": "Keyword or phrase to search for"}},
                "required": ["query"],
            },
        },
        {
            "name": "stats",
            "description": "Show memory health statistics: file counts per tier, average strength, active/decaying/archived counts.",
            "inputSchema": {"type": "object", "properties": {}},
        },
        {
            "name": "save",
            "description": "Save a new memory to a specified tier. Creates a markdown file with frontmatter. Use for recording new information, preferences, or experiences.",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "tier": {
                        "type": "string",
                        "enum": ["episodic", "semantic", "procedural", "reflection", "working"],
                        "description": "Memory tier: episodic (experiences), semantic (facts/preferences), procedural (workflows), reflection (meta), working (in-session)",
                    },
                    "name": {"type": "string", "description": "Filename slug (no extension, use dashes: my-memory-name)"},
                    "content": {"type": "string", "description": "Full markdown content of the memory (including title heading)"},
                    "tags": {"type": "string", "description": "Comma-separated tags (optional)"},
                },
                "required": ["tier", "name", "content"],
            },
        },
        {
            "name": "touch",
            "description": "Boost a memory's strength (simulate access, counteracts Ebbinghaus decay). Use this when a memory is referenced or found relevant.",
            "inputSchema": {
                "type": "object",
                "properties": {
                    "name": {"type": "string", "description": "Memory filename (with or without .md extension)"},
                    "boost": {"type": "number", "description": "Strength boost amount (default 0.15, max 1.0)"},
                },
                "required": ["name"],
            },
        },
        {
            "name": "decay",
            "description": "Run a dry-run decay check. Calculates Ebbinghaus decay for all memories and reports which would be archived. Does NOT modify any files.",
            "inputSchema": {"type": "object", "properties": {}},
        },
    ]
  • nexus_mcp.py:368-375 (registration)
    tools/call dispatch in main loop that routes to handle_tools_call for the 'touch' tool.
    elif method == "tools/call":
        name = params.get("name", "")
        args = params.get("arguments", {})
        result, err = handle_tools_call(req_id, name, args)
        if err:
            respond(req_id, error=err)
        else:
            respond(req_id, result)
  • Helper function parse_frontmatter used by the touch handler to read strength, access_count, etc.
    def parse_frontmatter(text, field):
        """Extract a YAML frontmatter field value from markdown text."""
        m = re.search(rf'^{re.escape(field)}:\s*(.+)$', text, re.MULTILINE)
        if m:
            val = m.group(1).strip()
            val = re.sub(r'\s*#.*$', '', val).strip()
            return val
        m = re.search(rf'^\s+{re.escape(field)}:\s*(.+)$', text, re.MULTILINE)
        if m:
            val = m.group(1).strip()
            val = re.sub(r'\s*#.*$', '', val).strip()
            return val
        return None
Behavior3/5

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

Discloses that the tool simulates access and counteracts decay, and mentions default boost values. However, without annotations, lacks details on persistence, side effects, or whether modification is permanent.

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?

Two sentences, front-loaded with the primary action, no redundant or missing words.

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?

Covers purpose and usage well for a simple tool with two parameters. Lacks return value description (no output schema), but the missing info is minor given tool simplicity.

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

Parameters3/5

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

Schema coverage is 100% with clear descriptions for both parameters (name and boost). The description adds purpose context but does not enhance parameter semantics beyond 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?

The description specifies a clear action ('Boost a memory's strength') and resource ('memory'), with context about counteracting Ebbinghaus decay. This distinguishes it from siblings like 'decay' and 'save'.

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 advises when to use ('when a memory is referenced or found relevant'), implying contrast with decay. Does not explicitly state when not to use or list alternatives, but the guidance is clear.

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/Y-Sky-bro/nexus-memory'

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