Skip to main content
Glama
davehenke

rekordbox-mcp

get_playlists

Retrieve all playlists and their metadata from a rekordbox DJ database. Access playlist information for DJ set organization and track management.

Instructions

Get all playlists from the rekordbox database.

Returns: List of playlists with metadata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main MCP tool handler for 'get_playlists', registered via @mcp.tool() decorator. Ensures database connection, retrieves playlists from the database layer, and serializes them to dictionaries for the MCP response.
    @mcp.tool()
    async def get_playlists() -> List[Dict[str, Any]]:
        """
        Get all playlists from the rekordbox database.
        
        Returns:
            List of playlists with metadata
        """
        await ensure_database_connected()
        
        playlists = await db.get_playlists()
        return [playlist.model_dump() for playlist in playlists]
  • Pydantic BaseModel defining the schema/structure of each Playlist object returned by the tool. Includes fields like id, name, track_count, is_smart_playlist, etc., with validation.
    class Playlist(BaseModel):
        """
        Rekordbox playlist model.
        """
        
        id: str = Field(..., description="Unique playlist identifier")
        name: str = Field(..., description="Playlist name")
        parent_id: Optional[str] = Field(None, description="Parent folder ID")
        is_folder: bool = Field(False, description="Whether this is a folder")
        is_smart_playlist: bool = Field(False, description="Whether this is a smart/intelligent playlist")
        track_count: int = Field(0, ge=0, description="Number of tracks in playlist")
        created_date: Optional[str] = Field(None, description="Date playlist was created")
        modified_date: Optional[str] = Field(None, description="Date playlist was last modified")
        smart_criteria: Optional[str] = Field(None, description="Smart playlist criteria (XML)")
        
        @field_validator('created_date', 'modified_date', mode='before')
        @classmethod
        def validate_date(cls, v):
            """Convert datetime objects to strings."""
            if hasattr(v, 'strftime'):  # datetime object
                return v.strftime("%Y-%m-%d %H:%M:%S")
            return str(v) if v is not None else None
  • Core helper method in RekordboxDatabase class that implements the playlist fetching logic: queries pyrekordbox database, filters active playlists, computes track counts by querying playlist_songs, determines folder/smart types, and constructs Playlist models.
    async def get_playlists(self) -> List[Playlist]:
        """
        Get all playlists from the database.
        
        Returns:
            List of playlist objects
        """
        if not self.db:
            raise RuntimeError("Database not connected")
        
        try:
            # Get all playlists, filtering out soft-deleted ones
            all_playlists = list(self.db.get_playlist())
            active_playlists = [p for p in all_playlists if getattr(p, 'rb_local_deleted', 0) == 0]
            
            playlists = []
            for playlist in active_playlists:
                # Get track count for this playlist
                try:
                    playlist_songs = list(self.db.get_playlist_songs(PlaylistID=playlist.ID))
                    # Filter out soft-deleted song-playlist relationships
                    active_songs = [s for s in playlist_songs if getattr(s, 'rb_local_deleted', 0) == 0]
                    track_count = len(active_songs)
                except Exception:
                    track_count = 0
                
                # Check if this is a smart playlist
                is_smart = getattr(playlist, 'is_smart_playlist', False) or False
                smart_criteria = None
                if is_smart and hasattr(playlist, 'SmartList') and playlist.SmartList:
                    smart_criteria = str(playlist.SmartList)
                
                # Check if this is a folder (has children)
                is_folder = getattr(playlist, 'is_folder', False) or False
                if not is_folder and hasattr(playlist, 'Attribute'):
                    # Attribute 1 seems to indicate folders
                    is_folder = playlist.Attribute == 1
                
                playlists.append(Playlist(
                    id=str(playlist.ID),
                    name=playlist.Name or "",
                    track_count=track_count,
                    created_date=getattr(playlist, 'created_at', '') or "",
                    modified_date=getattr(playlist, 'updated_at', '') or "",
                    is_folder=is_folder,
                    is_smart_playlist=is_smart,
                    smart_criteria=smart_criteria,
                    parent_id=str(playlist.ParentID) if playlist.ParentID and playlist.ParentID != "root" else None
                ))
            
            return playlists
        except Exception as e:
            logger.error(f"Failed to get playlists: {e}")
            return []
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the return type ('List of playlists with metadata'), which adds some value, but lacks details on permissions, rate limits, error handling, or whether this is a read-only operation. For a tool with zero annotation coverage, this is insufficient to fully inform the agent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is brief and front-loaded with the main action, consisting of two sentences that efficiently convey the purpose and return value. However, the second sentence ('Returns: List of playlists with metadata') could be integrated more smoothly, and there is minor room for improvement in flow.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (0 parameters, output schema provided), the description is reasonably complete. It states what the tool does and the return type, and the output schema handles return values. However, it lacks context on behavioral aspects like permissions or limitations, which would be beneficial for full completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description does not add parameter details, which is appropriate, but it does not explicitly state 'no parameters required' or similar, preventing a perfect score. Baseline for 0 parameters is 4, as the schema fully covers the absence of inputs.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Get') and resource ('all playlists from the rekordbox database'), making the purpose evident. However, it does not explicitly distinguish this tool from sibling tools like 'get_playlist_tracks' or 'create_playlist', which would require more specific differentiation to achieve a score of 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives, such as 'get_playlist_tracks' for tracks within a playlist or 'search_tracks' for filtering. Without any context on usage scenarios or exclusions, it relies solely on the agent's inference from the tool name and description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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