Skip to main content
Glama
davehenke

rekordbox-mcp

create_playlist

Create a new playlist in rekordbox DJ software by specifying a name and optional parent folder, directly modifying your rekordbox database.

Instructions

Create a new playlist in rekordbox.

⚠️ CAUTION: This modifies your rekordbox database!

Args: name: Name for the new playlist parent_id: Optional parent folder ID (omit for root level)

Returns: Information about the created playlist

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
parent_idNo

Implementation Reference

  • MCP tool handler for 'create_playlist'. Decorated with @mcp.tool() which registers it as an MCP tool. Validates input, ensures DB connection, calls database helper, and returns formatted response.
    @mcp.tool(
        annotations={
            "readOnlyHint": False,
            "destructiveHint": False,
            "idempotentHint": False
        }
    )
    async def create_playlist(
        name: str,
        parent_id: Optional[str] = None
    ) -> Dict[str, Any]:
        """
        Create a new playlist in rekordbox.
        
        ⚠️ CAUTION: This modifies your rekordbox database!
        
        Args:
            name: Name for the new playlist
            parent_id: Optional parent folder ID (omit for root level)
            
        Returns:
            Information about the created playlist
        """
        await ensure_database_connected()
        
        if not name.strip():
            raise ValueError("Playlist name cannot be empty")
        
        try:
            playlist_id = await db.create_playlist(name.strip(), parent_id)
            return {
                "status": "success",
                "message": f"Created playlist '{name}'",
                "playlist_id": playlist_id,
                "playlist_name": name
            }
        except Exception as e:
            return {
                "status": "error", 
                "message": f"Failed to create playlist: {str(e)}"
            }
  • Database helper method implementing playlist creation using pyrekordbox library. Creates backup, calls pyrekordbox.create_playlist, commits, handles return value, with error rollback.
    async def create_playlist(self, name: str, parent_id: Optional[str] = None) -> str:
        """
        Create a new playlist.
        
        Args:
            name: Name for the new playlist
            parent_id: Optional parent folder ID
            
        Returns:
            ID of the created playlist
        """
        if not self.db:
            raise RuntimeError("Database not connected")
        
        try:
            # Create backup before mutation
            await self._create_backup()
            
            # Create playlist using pyrekordbox
            playlist = self.db.create_playlist(
                name=name,
                parent=parent_id if parent_id and parent_id != "root" else None
            )
            
            # Debug: check what type playlist is
            logger.debug(f"playlist type: {type(playlist)}")
            logger.debug(f"playlist value: {playlist}")
            
            # Commit changes
            self.db.commit()
            
            # Handle different return types
            if hasattr(playlist, 'ID'):
                playlist_id = str(playlist.ID)
            elif isinstance(playlist, str):
                playlist_id = playlist
            else:
                # Try to get ID from the playlist object
                playlist_id = str(playlist)
            
            logger.info(f"Created playlist '{name}' with ID {playlist_id}")
            return playlist_id
            
        except Exception as e:
            logger.error(f"Failed to create playlist '{name}': {e}")
            # Rollback on error
            if hasattr(self.db, 'rollback'):
                self.db.rollback()
            raise RuntimeError(f"Failed to create 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