Skip to main content
Glama

update_memory

Update a saved memory by providing its ID and any fields to change, ensuring relevant context persists across sessions.

Instructions

Update an existing memory. Provide the ID and any fields to change.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe memory ID to update
contentNoNew content
categoryNoNew category
importanceNoNew importance score

Implementation Reference

  • Defines and registers the update_memory tool handler. Accepts id (required), content, category, and importance (optional). Calls storage.update(), returns success/failure with the updated memory.
    export function registerUpdateMemory(
      server: McpServer,
      storage: RekindleStorage
    ): void {
      server.tool(
        "update_memory",
        "Update an existing memory. Provide the ID and any fields to change.",
        {
          id: z.string().describe("The memory ID to update"),
          content: z.string().optional().describe("New content"),
          category: z
            .enum(["preference", "lesson", "context", "relationship", "general"])
            .optional()
            .describe("New category"),
          importance: z
            .number()
            .min(1)
            .max(10)
            .optional()
            .describe("New importance score"),
        },
        async ({ id, content, category, importance }) => {
          const updated = storage.update(id, {
            content,
            category: category as MemoryCategory | undefined,
            importance,
          });
    
          if (!updated) {
            return {
              content: [
                {
                  type: "text" as const,
                  text: JSON.stringify({
                    success: false,
                    message: "Memory not found",
                  }),
                },
              ],
            };
          }
    
          const memory = storage.get(id);
          return {
            content: [
              {
                type: "text" as const,
                text: JSON.stringify({ success: true, memory }),
              },
            ],
          };
        }
      );
    }
  • Zod schema for update_memory input validation: id (required string), content (optional string), category (optional enum of 5 categories), importance (optional number 1-10).
    {
      id: z.string().describe("The memory ID to update"),
      content: z.string().optional().describe("New content"),
      category: z
        .enum(["preference", "lesson", "context", "relationship", "general"])
        .optional()
        .describe("New category"),
      importance: z
        .number()
        .min(1)
        .max(10)
        .optional()
        .describe("New importance score"),
    },
  • src/server.ts:8-22 (registration)
    Imports and calls registerUpdateMemory(server, storage) in the server setup to register the tool with the MCP server.
    import { registerUpdateMemory } from "./tools/update.js";
    import { registerBootReport } from "./tools/boot-report.js";
    import { registerEndSession } from "./tools/end-session.js";
    
    export function createServer(storage: RekindleStorage): McpServer {
      const server = new McpServer({
        name: "rekindle",
        version: "0.2.0",
      });
    
      registerStoreMemory(server, storage);
      registerSearchMemory(server, storage);
      registerListMemories(server, storage);
      registerDeleteMemory(server, storage);
      registerUpdateMemory(server, storage);
  • Storage-layer update method: fetches existing memory, merges provided fields with defaults, clamps importance to 1-10, sets updated_at timestamp, and runs the SQL UPDATE query.
    update(
      id: string,
      fields: { content?: string; category?: MemoryCategory; importance?: number }
    ): boolean {
      const existing = this.get(id);
      if (!existing) return false;
    
      const content = fields.content ?? existing.content;
      const category = fields.category ?? existing.category;
      const importance = fields.importance
        ? Math.max(1, Math.min(10, fields.importance))
        : existing.importance;
      const now = new Date().toISOString().replace("T", " ").slice(0, 19);
    
      this.db
        .prepare(
          `UPDATE memories SET content = ?, category = ?, importance = ?, updated_at = ? WHERE id = ?`
        )
        .run(content, category, importance, now, id);
      return true;
    }
Behavior2/5

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

No annotations are provided, so the description must convey behavioral traits. It only states 'update', implying mutation, but fails to disclose side effects, required permissions, or behavior for omitted fields. Minimal disclosure.

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

Conciseness4/5

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

Single sentence is efficient, but could include more critical info without becoming verbose. It is well-structured and front-loaded with the core action.

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

Completeness2/5

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

With no output schema and no annotations, the description should compensate by explaining behavior like partial updates, error conditions, and effect of omitted fields. It does not, leaving gaps for an AI agent.

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?

Input schema has 100% description coverage for parameters, providing clear meanings. The description adds little beyond restating 'any fields to change', which is already implied by the schema's optional fields besides 'id'.

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 uses the verb 'update' and resource 'memory', clearly indicating modification of an existing memory. It is distinct from siblings like 'store_memory' (create) and 'delete_memory' (delete).

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?

No explicit guidance on when to use vs. alternatives. The description implies usage for changing existing memories, but lacks context for when not to use or comparisons with other tools.

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/Skitchy/rekindle'

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