Skip to content

Add qdrant-delete tool for memory management#116

Open
sascha08-15 wants to merge 1 commit intoqdrant:masterfrom
sascha08-15:feature/add-delete-tool
Open

Add qdrant-delete tool for memory management#116
sascha08-15 wants to merge 1 commit intoqdrant:masterfrom
sascha08-15:feature/add-delete-tool

Conversation

@sascha08-15
Copy link
Copy Markdown

@sascha08-15 sascha08-15 commented Mar 20, 2026

Summary

Adds a qdrant-delete tool that removes memories by semantic search, enabling cleanup of stale or contradictory entries. This addresses a gap where memories could be stored and retrieved but never removed, leading to accumulation of outdated information.

  • QdrantConnector.delete() — finds the closest matching point(s) via embedding similarity and deletes them, returning the deleted entries for confirmation
  • qdrant-delete tool — registered alongside qdrant-store (write-mode only, respects read_only setting), with collection_name partial application when a default is configured
  • TOOL_DELETE_DESCRIPTION — customizable tool description via environment variable, consistent with existing TOOL_STORE_DESCRIPTION / TOOL_FIND_DESCRIPTION
  • 5 integration tests — covering store-then-delete, nonexistent collection, empty collection, selective deletion preserving other entries, and custom collection deletion
  • README — documents the new tool and environment variable

Motivation

Without a delete capability, stale memories accumulate and can contradict newer information. Users have no way to clean up outdated entries, which degrades the quality of semantic search results over time.

Closes #101, closes #74, closes #69

Test plan

  • All 14 integration tests pass (9 existing + 5 new)
  • Manual testing with MCP inspector (fastmcp dev)
  • Verify read_only mode does not expose qdrant-delete
  • Verify COLLECTION_NAME default applies to delete tool

Design decisions

  • Semantic search for deletion — matches the existing UX pattern (users describe what to delete in natural language, same as qdrant-find)
  • Default limit=1 — conservative default to avoid accidental mass deletion; callers can increase if needed
  • Returns deleted entries — allows the LLM to confirm what was removed and inform the user
  • Write-mode only — registered inside the if not self.qdrant_settings.read_only: block, consistent with qdrant-store

Add a delete tool that removes memories by semantic search, enabling
cleanup of stale or contradictory entries. The tool finds the closest
matching point(s) and deletes them, returning confirmation of what was
removed.

Changes:
- QdrantConnector.delete() method using semantic search + point deletion
- qdrant-delete tool registration in MCP server (write-mode only)
- TOOL_DELETE_DESCRIPTION setting for customization
- 5 integration tests covering deletion scenarios
- README documentation for the new tool and env var

Closes qdrant#74, closes qdrant#69

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sascha08-15
Copy link
Copy Markdown
Author

Verified two previously unchecked test-plan items against the current delete implementation:

  • QDRANT_READ_ONLY=1 exposes only qdrant-find, so qdrant-delete is correctly hidden in read-only mode.
  • With COLLECTION_NAME configured, the registered qdrant-delete tool no longer exposes a collection_name parameter; without a default collection it remains exposed.

So the remaining unchecked item in this PR is the manual MCP inspector / fastmcp dev validation.

One more repo-management note: issue #101 is specifically the delete request, so this PR is the one that should close it on merge. That likely belongs in the PR body as Closes #101
rather than only in comments, if auto-closing is desired.

@sascha08-15 sascha08-15 mentioned this pull request Mar 28, 2026
@sascha08-15
Copy link
Copy Markdown
Author

fastmcp inspection done.

Copy link
Copy Markdown
Author

@sascha08-15 sascha08-15 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ready to go!

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.

more mcp function calls delete Need tool to edit or delete records

1 participant