Skip to main content
Glama

delete_memory

Remove outdated or incorrect memories by specifying namespace, type, and key. Keep memory accurate by deleting specific entries.

Instructions

Delete a specific memory by namespace, type, and key. Use when a memory is outdated or incorrect.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
namespaceYesMemory namespace
memoryTypeYesMemory type
keyYesMemory key
projectIdNoProject ID (defaults to current project)

Implementation Reference

  • The MCP tool handler for 'delete_memory'. Defined via server.tool(), it accepts namespace, memoryType, key, and optional projectId, then calls memoryService.delete(). Returns success or error message.
      // ─── delete_memory ──────────────────────────────────────────────
      server.tool(
        'delete_memory',
        'Delete a specific memory by namespace, type, and key. Use when a memory is outdated or incorrect.',
        {
          namespace: z.string().describe('Memory namespace'),
          memoryType: z.string().describe('Memory type'),
          key: z.string().describe('Memory key'),
          projectId: z.string().optional().describe('Project ID (defaults to current project)'),
        },
        async ({ namespace, memoryType, key, projectId }) => {
          try {
            const { memoryService, currentProjectId } = await getServices()
            const targetProjectId = projectId || currentProjectId
    
            const deleted = await memoryService.delete({
              projectId: targetProjectId,
              namespace,
              memoryType,
              key,
            })
    
            return {
              content: [{
                type: 'text',
                text: deleted
                  ? `Deleted memory: ${namespace}/${memoryType}/${key}`
                  : `Memory not found: ${namespace}/${memoryType}/${key}`,
              }],
            }
          } catch (error) {
            return {
              content: [{ type: 'text', text: `Error deleting memory: ${error.message}` }],
              isError: true,
            }
          }
        }
      )
    }
  • Input schema for the delete_memory tool: namespace (string), memoryType (string), key (string), and optional projectId (string).
    server.tool(
      'delete_memory',
      'Delete a specific memory by namespace, type, and key. Use when a memory is outdated or incorrect.',
      {
        namespace: z.string().describe('Memory namespace'),
        memoryType: z.string().describe('Memory type'),
        key: z.string().describe('Memory key'),
        projectId: z.string().optional().describe('Project ID (defaults to current project)'),
      },
  • The MemoryService.delete() method. Checks if a memory exists by composite key (project_id, namespace, memory_type, key), deletes it from the project_memories table, and returns true if deleted or false if not found.
    /**
     * Delete a specific memory by composite key.
     */
    async delete({ projectId, namespace, memoryType, key }) {
      // Check existence first since promisified db.run doesn't return changes
      const existing = await this.searchDb.db.get(
        'SELECT id FROM project_memories WHERE project_id = ? AND namespace = ? AND memory_type = ? AND key = ?',
        [projectId, namespace, memoryType, key]
      )
      if (!existing) return false
    
      await this.searchDb.db.run(`
        DELETE FROM project_memories
        WHERE project_id = ? AND namespace = ? AND memory_type = ? AND key = ?
      `, [projectId, namespace, memoryType, key])
      return true
    }
  • The delete_memory tool is registered inside the registerTools() function (line 32) which is called from server/src/mcp/index.js line 106.
    export function registerTools(server, getServices) {
  • registerTools(server, getServices) is called here, which registers all tools including delete_memory.
    registerTools(server, getServices)
Behavior2/5

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

With no annotations, the description bears full responsibility for behavioral disclosure. It only states 'Delete' without mentioning side effects (e.g., permanent removal), authorization requirements, or error behavior (e.g., if memory does not exist). This is insufficient for a destructive operation.

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, 17 words, front-loaded with the essential action and usage condition. No unnecessary information, making it highly efficient.

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 delete operation with 4 parameters and no output schema, the description lacks critical context such as what happens on success/failure, whether the operation is reversible, and any preconditions. It is incomplete for an agent to fully understand the tool's implications.

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?

The input schema covers all parameters with descriptions (100% coverage), so baseline is 3. The description merely reiterates the required parameters without adding additional meaning or constraints beyond the 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 clearly states the action 'Delete' and the resource 'memory', with specific identifiers (namespace, type, key). It distinguishes from sibling tools like store_memory and recall_memory by focusing on deletion.

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?

The description explicitly states when to use this tool: 'when a memory is outdated or incorrect.' However, it does not mention when not to use it or provide alternatives, such as using store_memory to update instead.

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/kunwar-shah/claudex'

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