get_most_played_tracks
Retrieve a list of the most played tracks from a rekordbox DJ library, customizable by a specified limit for focused analysis or playlist creation.
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
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No |
Implementation Reference
- rekordbox_mcp/server.py:151-166 (handler)MCP tool handler for get_most_played_tracks. Decorated with @mcp.tool() for automatic registration. Fetches data from database and serializes to dicts.@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]
- rekordbox_mcp/database.py:310-320 (helper)Database method implementing the core logic: retrieves all active tracks, sorts by DJPlayCount descending, converts to Track models.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]]