Skip to content

fix(mcp): allow clear_index to drop orphaned collections without local path#387

Open
MukundaKatta wants to merge 1 commit into
zilliztech:masterfrom
MukundaKatta:fix/clear-index-no-local-path
Open

fix(mcp): allow clear_index to drop orphaned collections without local path#387
MukundaKatta wants to merge 1 commit into
zilliztech:masterfrom
MukundaKatta:fix/clear-index-no-local-path

Conversation

@MukundaKatta

Copy link
Copy Markdown

What

clear_index validated that the codebase path exists on disk before dropping its Milvus collection:

if (!fs.existsSync(absolutePath)) { ... "does not exist" ... }
const stat = fs.statSync(absolutePath);
if (!stat.isDirectory()) { ... "is not a directory" ... }

But the path is only used as the collection identifier. If a codebase is moved or deleted on disk, its collection is left orphaned with no way to clear it, since the existence check fails before any Milvus call runs.

Change

Remove the fs.existsSync and fs.statSync directory checks from handleClearIndex. The existing isIndexed/isIndexing check already proves there is a collection to drop, and the path serves only as the key. Index and search handlers, which genuinely need a local directory, are untouched.

Testing

  • tsc --noEmit clean for the mcp package
  • pnpm --filter @zilliz/claude-context-mcp test passes (4/4)
  • core package builds

Fixes #375

…l path

clear_index validated that the codebase path exists on disk before
dropping its Milvus collection. The local folder is only used as the
collection identifier, so a moved or deleted directory left the
collection orphaned with no way to clear it. Drop the fs existence and
directory checks; the isIndexed/isIndexing check already proves there is
a collection to remove.

Fixes zilliztech#375
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.

clear_index validates fs.existsSync(path) but the operation drops a remote Milvus collection — local path requirement is incidental

1 participant