Skip to main content
Glama

delete_memory

Remove a specific memory from the Memory Box MCP Server by providing its unique ID, ensuring precise and efficient management of stored data.

Instructions

Delete a specific memory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
memory_idYesThe ID of the memory to delete

Implementation Reference

  • MCP CallToolRequest handler case for 'delete_memory': validates memory_id parameter and calls memoryBoxClient.deleteMemory, returning success message.
    case "delete_memory": {
      const memoryId = request.params.arguments?.memory_id;
    
      if (!memoryId) {
        throw new McpError(ErrorCode.InvalidParams, "Memory ID is required");
      }
    
      // Delete the memory
      const result = await memoryBoxClient.deleteMemory(Number(memoryId));
    
      return {
        content: [{
          type: "text",
          text: `Memory ${memoryId} deleted successfully!\n\n${result.message || "The memory has been permanently removed."}`
        }]
      };
    }
  • MemoryBoxClient.deleteMemory method: performs the actual HTTP DELETE request to the Memory Box API endpoint /api/v2/memory/{memoryId}.
    async deleteMemory(memoryId: number): Promise<any> {
      try {
        const response = await axios.delete(
          `${this.baseUrl}/api/v2/memory/${memoryId}`,
          {
            headers: {
              "Authorization": `Bearer ${this.token}`
            }
          }
        );
        return response.data;
      } catch (error) {
        if (axios.isAxiosError(error)) {
          throw new McpError(
            ErrorCode.InternalError,
            `Failed to delete memory: ${error.response?.data?.detail || error.message}`
          );
        }
        throw error;
      }
    }
  • Tool schema registration in ListTools response: defines name, description, and inputSchema requiring integer memory_id.
    {
      name: "delete_memory",
      description: "Delete a specific memory",
      inputSchema: {
        type: "object",
        properties: {
          memory_id: {
            type: "integer",
            description: "The ID of the memory to delete"
          }
        },
        required: ["memory_id"]
      }
    }
  • src/index.ts:543-866 (registration)
    ListToolsRequestSchema handler that returns the list of available tools including 'delete_memory'.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          {
            name: "save_memory",
            description: "Save a memory to Memory Box",
            inputSchema: {
              type: "object",
              properties: {
                text: {
                  type: "string",
                  description: "The memory content to save (either text OR raw_content required)"
                },
                raw_content: {
                  type: "string",
                  description: "Raw content for processing (alternative to text)"
                },
                bucket_id: {
                  type: "string",
                  description: `The bucket to save the memory to (default: "${DEFAULT_BUCKET}")`
                },
                source_type: {
                  type: "string",
                  description: "Type of memory source (default: 'llm_plugin')"
                },
                reference_data: {
                  type: "object",
                  description: "Structured metadata for memory storage",
                  properties: {
                    source: {
                      type: "object",
                      required: ["platform"],
                      properties: {
                        platform: { type: "string", description: "Platform identifier (required)" },
                        type: { type: "string", description: "Source type" },
                        version: { type: "string", description: "Version info" },
                        url: { type: "string", description: "Source URL" },
                        title: { type: "string", description: "Source title" },
                        additional_metadata: { type: "object", description: "Extra metadata" }
                      }
                    },
                    context: {
                      type: "object",
                      properties: {
                        related_memories: { type: "array", items: { type: "object" }, description: "Related memory references" },
                        conversation_id: { type: "string", description: "Conversation identifier" },
                        message_id: { type: "string", description: "Message identifier" }
                      }
                    },
                    content_context: {
                      type: "object",
                      properties: {
                        url: { type: "string", description: "Content URL" },
                        title: { type: "string", description: "Content title" },
                        surrounding_text: { type: "string", description: "Context around selection" },
                        selected_text: { type: "string", description: "Selected text" },
                        additional_context: { type: "object", description: "Extra context" }
                      }
                    }
                  }
                }
              },
              required: ["text"]
            }
          },
          {
            name: "search_memories",
            description: "Search for memories using semantic search",
            inputSchema: {
              type: "object",
              properties: {
                query: {
                  type: "string",
                  description: "The search query (semantic search)"
                },
                bucket_id: {
                  type: "string",
                  description: "Filter to specific bucket"
                },
                source_type: {
                  type: "string",
                  description: "Filter by source type"
                },
                limit: {
                  type: "integer",
                  description: "Maximum number of results to return (1-100, default: 10)",
                  minimum: 1,
                  maximum: 100
                },
                offset: {
                  type: "integer",
                  description: "Number of results to skip for pagination (default: 0)",
                  minimum: 0
                },
                debug: {
                  type: "boolean",
                  description: "Include debug information in results (default: false)"
                },
                include_reference_data: {
                  type: "boolean",
                  description: "Include reference data in response (default: false)"
                },
                date_sort: {
                  type: "boolean",
                  description: "Sort semantic search results by date after similarity filtering (default: false)"
                },
                sort_order: {
                  type: "string",
                  description: "Sort order when date_sort is enabled (default: 'desc')",
                  enum: ["asc", "desc"]
                }
              },
              required: ["query"]
            }
          },
          {
            name: "get_all_memories",
            description: "Retrieve all memories with pagination support",
            inputSchema: {
              type: "object",
              properties: {
                all: {
                  type: "boolean",
                  description: "Get all memories (overrides pagination, default: false)"
                },
                bucket_id: {
                  type: "string",
                  description: "Filter to specific bucket"
                },
                source_type: {
                  type: "string",
                  description: "Filter by source type"
                },
                limit: {
                  type: "integer",
                  description: "Maximum number of results to return (1-100, default: 10)",
                  minimum: 1,
                  maximum: 100
                },
                offset: {
                  type: "integer",
                  description: "Number of results to skip for pagination (default: 0)",
                  minimum: 0
                },
                include_reference_data: {
                  type: "boolean",
                  description: "Include reference data in response (default: false)"
                },
                date_sort: {
                  type: "boolean",
                  description: "Sort results by date (default: false)"
                },
                sort_order: {
                  type: "string",
                  description: "Sort order (default: 'desc')",
                  enum: ["asc", "desc"]
                }
              }
            }
          },
          {
            name: "get_bucket_memories",
            description: "Get memories from a specific bucket",
            inputSchema: {
              type: "object",
              properties: {
                bucket_id: {
                  type: "string",
                  description: "The bucket to retrieve memories from"
                },
                limit: {
                  type: "integer",
                  description: "Maximum number of results to return (1-100, default: 10)",
                  minimum: 1,
                  maximum: 100
                },
                offset: {
                  type: "integer",
                  description: "Number of results to skip for pagination (default: 0)",
                  minimum: 0
                },
                include_reference_data: {
                  type: "boolean",
                  description: "Include reference data in response (default: false)"
                }
              },
              required: ["bucket_id"]
            }
          },
          {
            name: "get_related_memories",
            description: "Find semantically similar memories to a specific memory",
            inputSchema: {
              type: "object",
              properties: {
                memory_id: {
                  type: "integer",
                  description: "The ID of the memory to find related memories for"
                },
                min_similarity: {
                  type: "number",
                  description: "Minimum similarity threshold (0.0-1.0) for related memories (default: 0.7)"
                }
              },
              required: ["memory_id"]
            }
          },
          {
            name: "check_memory_status",
            description: "Check the processing status of a memory",
            inputSchema: {
              type: "object",
              properties: {
                memory_id: {
                  type: "integer",
                  description: "The ID of the memory to check status for"
                }
              },
              required: ["memory_id"]
            }
          },
          {
            name: "get_usage_stats",
            description: "Retrieve user usage statistics and plan information",
            inputSchema: {
              type: "object",
              properties: {
                // No specific parameters needed for this operation
              }
            }
          },
          {
            name: "get_buckets",
            description: "Retrieve a list of all available buckets",
            inputSchema: {
              type: "object",
              properties: {
                // No specific parameters needed for this operation
              }
            }
          },
          {
            name: "create_bucket",
            description: "Create a new bucket for organizing memories",
            inputSchema: {
              type: "object",
              properties: {
                bucket_name: {
                  type: "string",
                  description: "Name of the bucket to create"
                }
              },
              required: ["bucket_name"]
            }
          },
          {
            name: "delete_bucket",
            description: "Delete a bucket (empty by default, use force to delete with content)",
            inputSchema: {
              type: "object",
              properties: {
                bucket_name: {
                  type: "string",
                  description: "Name of the bucket to delete"
                },
                force: {
                  type: "boolean",
                  description: "Force deletion even if bucket contains memories (default: false)"
                }
              },
              required: ["bucket_name"]
            }
          },
          {
            name: "update_memory",
            description: "Update an existing memory including text, bucket, and relationships",
            inputSchema: {
              type: "object",
              properties: {
                memory_id: {
                  type: "integer",
                  description: "The ID of the memory to update"
                },
                text: {
                  type: "string",
                  description: "New text content for the memory"
                },
                raw_content: {
                  type: "string",
                  description: "New raw content for the memory"
                },
                bucket_id: {
                  type: "string",
                  description: "Move memory to different bucket"
                },
                source_type: {
                  type: "string",
                  description: "Update source type"
                },
                reference_data: {
                  type: "object",
                  description: "Updated reference data (same structure as save_memory)"
                }
              },
              required: ["memory_id"]
            }
          },
          {
            name: "delete_memory",
            description: "Delete a specific memory",
            inputSchema: {
              type: "object",
              properties: {
                memory_id: {
                  type: "integer",
                  description: "The ID of the memory to delete"
                }
              },
              required: ["memory_id"]
            }
          }
        ]
      };
    });
Behavior2/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 states 'Delete' which implies a destructive mutation, but doesn't specify whether this is permanent, requires special permissions, has side effects (e.g., affecting related memories), or provides confirmation. This leaves significant gaps in understanding the tool's behavior.

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 extremely concise with just four words, front-loading the essential action and resource. There's no wasted language or unnecessary elaboration, making it efficient for quick understanding.

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?

For a destructive mutation tool with no annotations and no output schema, the description is inadequate. It doesn't explain what happens after deletion (e.g., success confirmation, error handling), whether the action is reversible, or how it interacts with sibling tools like 'get_all_memories'. More context is needed given the tool's complexity and lack of structured metadata.

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 description coverage is 100%, with the single parameter 'memory_id' fully documented in the schema as 'The ID of the memory to delete'. The description adds no additional parameter information beyond what the schema provides, so it meets the baseline score when schema coverage is high.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Delete') and the resource ('a specific memory'), which provides a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'delete_bucket' or explain what distinguishes a 'memory' from other resources in this system.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'update_memory' or 'delete_bucket', nor does it mention prerequisites such as needing the memory ID or whether deletion is reversible. It simply states what the tool does without contextual usage information.

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

Related 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/amotivv/memory-box-mcp'

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