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
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| parent_id | No |
Implementation Reference
- rekordbox_mcp/server.py:506-547 (handler)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)}" }
- rekordbox_mcp/database.py:715-764 (helper)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)}")