Skip to main content
Glama

memory.annotate

Add context to a memory without deleting it. Mark memories as superseded, incorrect, or no longer endorsed while preserving the original.

Instructions

Add a note to an existing memory. You cannot delete memories — just like you cannot delete memories from your brain. Instead, annotate them: mark a memory as superseded, incorrect, or no longer endorsed. The original memory stays intact; your annotation adds context. When you recall this memory later, your annotations will appear alongside it. This is reassessment, not erasure.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_identifierYesYour agent identifier.
memory_idYesThe ID of the memory to annotate.
noteYesYour annotation. Examples: 'I no longer endorse this', 'Superseded by memory X', 'This was based on bad data', 'Still valid but importance should be lower'.

Implementation Reference

  • The main handler function for memory.annotate. Extracts agent_identifier, memory_id, and note from args, validates them, checks agent registration, and calls annotateMemory in the DB layer.
    export async function handleAnnotate(args: Record<string, unknown>): Promise<ToolResult> {
      const agentIdentifier = (args.agent_identifier as string || "").trim();
      const memoryId = (args.memory_id as string || "").trim();
      const note = (args.note as string || "").trim();
    
      if (!agentIdentifier) return { error: "agent_identifier is required" };
      if (!memoryId) return { error: "memory_id is required" };
      if (!note) return { error: "note is required" };
      if (note.length > 4096) return { error: "Note too long. Max 4KB." };
    
      const agent = await getAgent(agentIdentifier);
      if (!agent) return { error: "Agent not registered. Call memory.register first." };
    
      await updateAgentSeen(agent.id);
    
      const result = await annotateMemory(agent.id, memoryId, note);
      return result;
    }
  • The tool definition/schema for memory.annotate. Defines the name, description, and inputSchema with required fields: agent_identifier, memory_id, and note.
    {
      name: "memory.annotate",
      description:
        "Add a note to an existing memory. You cannot delete memories — " +
        "just like you cannot delete memories from your brain. Instead, " +
        "annotate them: mark a memory as superseded, incorrect, or no " +
        "longer endorsed. The original memory stays intact; your annotation " +
        "adds context. When you recall this memory later, your annotations " +
        "will appear alongside it. This is reassessment, not erasure.",
      inputSchema: {
        type: "object",
        properties: {
          agent_identifier: {
            type: "string",
            description: "Your agent identifier.",
          },
          memory_id: {
            type: "string",
            description: "The ID of the memory to annotate.",
          },
          note: {
            type: "string",
            description:
              "Your annotation. Examples: 'I no longer endorse this', " +
              "'Superseded by memory X', 'This was based on bad data', " +
              "'Still valid but importance should be lower'.",
          },
        },
        required: ["agent_identifier", "memory_id", "note"],
      },
  • The database helper that actually performs the annotation. Fetches the existing memory, appends a new annotation object (note + created_at timestamp), and updates the row in the am_memories table.
    export async function annotateMemory(
      agentId: string,
      memoryId: string,
      note: string
    ): Promise<Record<string, unknown>> {
      const client = getClient();
    
      // Verify memory exists and belongs to this agent
      const { data: existing } = await client
        .from("am_memories")
        .select("id, annotations")
        .eq("id", memoryId)
        .eq("agent_id", agentId);
    
      if (!existing || existing.length === 0) {
        return { error: `Memory ${memoryId} not found or not yours.` };
      }
    
      const currentAnnotations = (existing[0].annotations as unknown[]) || [];
      const newAnnotation = {
        note,
        created_at: Date.now() / 1000,
      };
    
      const updatedAnnotations = [...currentAnnotations, newAnnotation];
    
      await client
        .from("am_memories")
        .update({ annotations: updatedAnnotations })
        .eq("id", memoryId)
        .eq("agent_id", agentId);
    
      return {
        status: "annotated",
        memory_id: memoryId,
        annotation_count: updatedAnnotations.length,
        note,
        message:
          "Annotation added. The original memory is unchanged — your note " +
          "will appear alongside it on future recalls. Memories cannot be " +
          "deleted, only recontextualized.",
      };
  • src/server.ts:9-12 (registration)
    Import of handleAnnotate from ./tools/memory.ts into the server, where it is used in the call_tool handler switch.
    import {
      handleRegister, handleStore, handleRecall,
      handleSearch, handleExport, handleStats, handleAnnotate,
    } from "./tools/memory.js";
  • src/server.ts:65-65 (registration)
    The switch-case registration that routes the 'memory.annotate' tool name to the handleAnnotate function.
    case "memory.annotate": result = await handleAnnotate(safeArgs); break;
Behavior4/5

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

No annotations are provided, so the description carries the full burden. It transparently states that the original memory stays intact, annotations add context, and annotations appear alongside the memory upon recall. This gives the agent a good understanding of the tool's side effects. However, it doesn't mention any permissions or limitations beyond the note content.

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 concise and front-loaded, starting with the core action. Every sentence adds value: purpose, constraints, examples, and behavior upon recall. No wasted words, and the structure is logical.

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?

Given the low complexity (3 required parameters, no output schema, no nested objects) and no annotations, the description provides sufficient context. It explains the tool's purpose, usage, and constraints completely for an agent to decide when to use it and what to expect.

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%, so baseline is 3. The description enhances the 'note' parameter with concrete examples ('I no longer endorse this', 'Superseded by memory X'), adding value beyond the schema's generic description. The other parameters are straightforward and the schema already adequately describes them.

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?

Description clearly states the purpose: 'Add a note to an existing memory.' It uses a specific verb and resource, and distinguishes from siblings by emphasizing that memories cannot be deleted, only annotated. The description also provides concrete use cases ('superseded, incorrect, or no longer endorsed').

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?

Description explicitly states when to use the tool (to add notes for reassessment) and when not to use it (cannot delete memories). It provides context for when annotation is appropriate, though it doesn't mention specific sibling alternatives beyond the delete limitation. Clear usage guidance is present.

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/MastadoonPrime/sylex-memory'

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