Skip to main content
Glama

get_library_stats

Retrieve detailed statistics for your rekordbox music library, including track counts, playlist data, and session history, using the MCP server query tool.

Instructions

Get comprehensive library statistics.

Returns: Dictionary containing various library statistics

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The MCP tool handler function for 'get_library_stats', decorated with @mcp.tool(). It checks database connection and delegates to the RekordboxDatabase.get_library_stats() method.
    @mcp.tool() async def get_library_stats() -> Dict[str, Any]: """ Get comprehensive library statistics. Returns: Dictionary containing various library statistics """ if not db: raise RuntimeError("Database not initialized.") stats = await db.get_library_stats() return stats
  • The supporting method in RekordboxDatabase class that computes and returns comprehensive library statistics including total tracks, playtime, average BPM, and top genres.
    async def get_library_stats(self) -> Dict[str, Any]: """ Get comprehensive library statistics. Returns: Dictionary containing various statistics """ 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] # Calculate statistics total_tracks = len(active_content) total_playtime = sum(getattr(c, 'Length', 0) or 0 for c in active_content) avg_bpm = sum((getattr(c, 'BPM', 0) or 0) / 100.0 for c in active_content) / total_tracks if total_tracks > 0 else 0 # Genre distribution genres = {} for content in active_content: genre = getattr(content, 'GenreName', '') or "Unknown" genres[genre] = genres.get(genre, 0) + 1 return { "total_tracks": total_tracks, "total_playtime_seconds": total_playtime, "average_bpm": round(avg_bpm, 2), "genre_distribution": dict(sorted(genres.items(), key=lambda x: x[1], reverse=True)[:10]), "database_path": str(self.database_path), "connection_status": "connected" }

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