Skip to main content
Glama
davehenke

rekordbox-mcp

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
NameRequiredDescriptionDefault
playlist_idYes

Implementation Reference

  • 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)}"
            }
  • 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)}")
  • @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
        }
    )

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/davehenke/rekordbox-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server