Skip to content

Add delete_memories MCP tool for targeted deletion#3616

Merged
prateekchhikara merged 1 commit intomem0ai:mainfrom
frederikb96:feature/mcp-delete-memories
Oct 22, 2025
Merged

Add delete_memories MCP tool for targeted deletion#3616
prateekchhikara merged 1 commit intomem0ai:mainfrom
frederikb96:feature/mcp-delete-memories

Conversation

@frederikb96
Copy link
Copy Markdown
Contributor

Description

Adds new delete_memories tool to MCP API for deleting specific memories by ID.

Context:

  • Existing MCP API only had delete_all_memories (bulk delete all)
  • No way to delete specific individual memories
  • This provides granular control over memory deletion

Changes:

  • New delete_memories(memory_ids: list[str]) tool
  • Accepts array of memory IDs to delete
  • Validates permissions - only deletes accessible memories
  • Deletes from both vector store (Qdrant) and database (PostgreSQL)
  • Creates history and access log entries for audit trail
  • Returns count of successfully deleted memories

Implementation Details:

  • Filters requested IDs against accessible memories (ACL check)
  • Gracefully handles vector store deletion failures (logs warning)
  • Maintains consistency between vector store and database
  • Follows same pattern as existing delete_all_memories function

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Test Script (manual verification via MCP client)

Test verification:

  • Added memory with infer=False
  • Searched and extracted memory ID from results
  • Called delete_memories with that ID
  • Verified deletion - search returns empty results
  • Confirmed proper cleanup in both vector store and database

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have checked my code and corrected any misspellings

- New delete_memories tool accepts array of memory IDs
- Validates permissions and filters to accessible memories only
- Deletes from both vector store and database
- Creates history and access log entries
@prateekchhikara prateekchhikara merged commit ec1a60b into mem0ai:main Oct 22, 2025
1 of 2 checks passed
garciaba79 pushed a commit to garciaba79/mem0 that referenced this pull request Feb 12, 2026
jamebobob pushed a commit to jamebobob/mem0-vigil-recall that referenced this pull request Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants