Skip to main content
Glama

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
NameRequiredDescriptionDefault
limitNo

Implementation Reference

  • 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]
  • 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]]

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