delete_playlist
Permanently remove a playlist from rekordbox by specifying its ID. This action cannot be undone, so verify the playlist before proceeding.
Instructions
Delete a playlist from rekordbox.
⚠️ DANGER: This permanently deletes a playlist and cannot be undone!
Args: playlist_id: ID of the playlist to delete
Returns: Result of the operation
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| playlist_id | Yes |
Implementation Reference
- rekordbox_mcp/server.py:688-747 (handler)Primary MCP tool handler decorated with @mcp.tool(). Performs safety checks (existence, smart playlist), calls database helper, formats response with status, message, and details.@mcp.tool( annotations={ "readOnlyHint": False, "destructiveHint": True, "idempotentHint": True } ) async def delete_playlist(playlist_id: str) -> Dict[str, Any]: """ Delete a playlist from rekordbox. ⚠️ DANGER: This permanently deletes a playlist and cannot be undone! Args: playlist_id: ID of the playlist to delete Returns: Result of the operation """ await ensure_database_connected() try: # Get playlist info before deletion for confirmation playlists = await db.get_playlists() target_playlist = next((p for p in playlists if p.id == playlist_id), None) if not target_playlist: return { "status": "error", "message": f"Playlist {playlist_id} not found" } # Prevent deletion of smart playlists for safety if target_playlist.is_smart_playlist: return { "status": "error", "message": "Cannot delete smart playlists - they are managed by rekordbox" } success = await db.delete_playlist(playlist_id) if success: return { "status": "success", "message": f"Deleted playlist '{target_playlist.name}' ({playlist_id})", "deleted_playlist": { "id": playlist_id, "name": target_playlist.name, "track_count": target_playlist.track_count } } else: return { "status": "error", "message": "Failed to delete playlist" } except Exception as e: return { "status": "error", "message": f"Failed to delete playlist: {str(e)}" }
- rekordbox_mcp/database.py:892-924 (helper)RekordboxDatabase class method implementing the core deletion logic: creates backup, converts ID to int, calls pyrekordbox db.delete_playlist(), commits or rolls back.async def delete_playlist(self, playlist_id: str) -> bool: """ Delete a playlist. Args: playlist_id: ID of the playlist to delete Returns: True if successful """ if not self.db: raise RuntimeError("Database not connected") try: # Create backup before mutation await self._create_backup() # Delete playlist using pyrekordbox playlist_int_id = int(playlist_id) self.db.delete_playlist(playlist_int_id) # Commit changes self.db.commit() logger.info(f"Deleted playlist {playlist_id}") return True except Exception as e: logger.error(f"Failed to delete playlist {playlist_id}: {e}") # Rollback on error if hasattr(self.db, 'rollback'): self.db.rollback() raise RuntimeError(f"Failed to delete playlist: {str(e)}")
- rekordbox_mcp/server.py:688-694 (registration)@mcp.tool decorator registers the delete_playlist function as an MCP tool with destructive and idempotent hints.@mcp.tool( annotations={ "readOnlyHint": False, "destructiveHint": True, "idempotentHint": True } )