Skip to main content
Glama
davehenke

rekordbox-mcp

get_most_played_tracks

Retrieve your most frequently played tracks from the rekordbox DJ database to analyze performance trends and identify popular selections.

Instructions

Get the most played tracks in the library.

Args: limit: Maximum number of tracks to return

Returns: List of most played tracks

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo

Implementation Reference

  • MCP tool handler decorated with @mcp.tool(). Ensures database connection, calls the database helper method, serializes Track models to dicts, and returns the list of most played tracks.
    @mcp.tool()
    async def get_most_played_tracks(limit: int = 20) -> List[Dict[str, Any]]:
        """
        Get the most played tracks in the library.
        
        Args:
            limit: Maximum number of tracks to return
            
        Returns:
            List of most played tracks
        """
        if not db:
            raise RuntimeError("Database not initialized.")
        
        tracks = await db.get_most_played_tracks(limit)
        return [track.model_dump() for track in tracks]
  • Database class method that fetches all active content from pyrekordbox database, sorts by DJPlayCount descending, converts top limit contents to Track models using _content_to_track, and returns the list.
    async def get_most_played_tracks(self, limit: int = 20) -> List[Track]:
        """Get the most played tracks."""
        if not self.db:
            raise RuntimeError("Database not connected")
        
        all_content = list(self.db.get_content())
        active_content = [c for c in all_content if getattr(c, 'rb_local_deleted', 0) == 0]
        # Sort by play count descending
        sorted_content = sorted(active_content, key=lambda x: getattr(x, 'DJPlayCount', 0) or 0, reverse=True)
        
        return [self._content_to_track(content) for content in sorted_content[:limit]]

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