Skip to main content
Glama
davehenke

rekordbox-mcp

remove_track_from_playlist

Delete a specific track from a rekordbox playlist by providing playlist and track IDs. This action directly modifies your rekordbox database.

Instructions

Remove a track from a playlist.

⚠️ CAUTION: This modifies your rekordbox database!

Args: playlist_id: ID of the playlist to modify track_id: ID of the track to remove

Returns: Result of the operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
playlist_idYes
track_idYes

Implementation Reference

  • MCP tool handler that removes a track from a playlist by calling the database method and returning success/error status.
    async def remove_track_from_playlist(
        playlist_id: str,
        track_id: str
    ) -> Dict[str, Any]:
        """
        Remove a track from a playlist.
        
        ⚠️ CAUTION: This modifies your rekordbox database!
        
        Args:
            playlist_id: ID of the playlist to modify
            track_id: ID of the track to remove
            
        Returns:
            Result of the operation
        """
        await ensure_database_connected()
        
        try:
            success = await db.remove_track_from_playlist(playlist_id, track_id)
            if success:
                return {
                    "status": "success",
                    "message": f"Removed track {track_id} from playlist {playlist_id}",
                    "playlist_id": playlist_id,
                    "track_id": track_id
                }
            else:
                return {
                    "status": "error",
                    "message": "Failed to remove track from playlist"
                }
        except Exception as e:
            return {
                "status": "error",
                "message": f"Failed to remove track from playlist: {str(e)}"
            }
  • FastMCP tool registration decorator for remove_track_from_playlist with safety annotations.
    @mcp.tool(
        annotations={
            "readOnlyHint": False,
            "destructiveHint": False,
            "idempotentHint": True
        }
    )
  • Database layer helper method that executes the track removal using pyrekordbox API, including backup and transaction handling.
    async def remove_track_from_playlist(self, playlist_id: str, track_id: str) -> bool:
        """
        Remove a track from a playlist.
        
        Args:
            playlist_id: ID of the playlist
            track_id: ID of the track to remove
            
        Returns:
            True if successful
        """
        if not self.db:
            raise RuntimeError("Database not connected")
        
        try:
            # Create backup before mutation
            await self._create_backup()
            
            # Remove track from playlist using pyrekordbox
            playlist_int_id = int(playlist_id)
            track_int_id = int(track_id)
            
            self.db.remove_from_playlist(playlist_int_id, track_int_id)
            
            # Commit changes
            self.db.commit()
            
            logger.info(f"Removed track {track_id} from playlist {playlist_id}")
            return True
            
        except Exception as e:
            logger.error(f"Failed to remove track {track_id} from playlist {playlist_id}: {e}")
            # Rollback on error
            if hasattr(self.db, 'rollback'):
                self.db.rollback()
            raise RuntimeError(f"Failed to remove track from playlist: {str(e)}")

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