removeCollection
Delete a local transcript collection and its search index to manage storage and organize YouTube intelligence data.
Instructions
Delete a local transcript collection and its search index.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collectionId | Yes |
Implementation Reference
- Handler logic to delete a collection from the database, clear its associated data (chunks/videos), and update the application state if the collection was active.
removeCollection(collectionId: string): RemoveCommentCollectionOutput { const existing = this.db .prepare( "SELECT 1 FROM comment_collections WHERE collection_id = ?", ) .get(collectionId); if (!existing) { return { removed: false, collectionId, chunksDeleted: 0, videosDeleted: 0, clearedActiveCollection: false, provenance: localProvenance(), }; } const chunkRow = this.db .prepare( "SELECT COUNT(*) AS count FROM comment_chunks WHERE collection_id = ?", ) .get(collectionId) as { count: number } | undefined; const videoRow = this.db .prepare( "SELECT COUNT(*) AS count FROM comment_collection_videos WHERE collection_id = ?", ) .get(collectionId) as { count: number } | undefined; const wasActive = this.getActiveCollectionId() === collectionId; this.db .prepare("DELETE FROM comment_collections WHERE collection_id = ?") .run(collectionId); if (wasActive) { this.deleteAppState("active_comment_collection_id"); } return { removed: true, collectionId, chunksDeleted: Number(chunkRow?.count ?? 0), videosDeleted: Number(videoRow?.count ?? 0), clearedActiveCollection: wasActive, provenance: localProvenance(), }; } - src/server/mcp-server.ts:1101-1104 (registration)Registration and dispatching of the "removeCommentCollection" tool in the MCP server request handler. Note that while searching for "removeCollection", the actual tool registered is "removeCommentCollection". Wait, the prompt asked for "removeCollection". Let me re-verify. Oh, looking at the tools list again, I see both "removeCollection" (index 335) and "removeCommentCollection" (index 649). They are different. Checking the registration for "removeCollection".
case "removeCommentCollection": return service.removeCommentCollection({ collectionId: readString(args, "collectionId"), }); - src/server/mcp-server.ts:1028-1031 (registration)Registration of the "removeCollection" tool handler in the MCP server.
case "removeCollection": return service.removeCollection({ collectionId: readString(args, "collectionId"), });