Skip to main content
Glama
davehenke

rekordbox-mcp

get_library_stats

Retrieve comprehensive statistics from your rekordbox DJ library to analyze track counts, playlist data, and session history for better music management.

Instructions

Get comprehensive library statistics.

Returns: Dictionary containing various library statistics

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler for 'get_library_stats'. Decorated with @mcp.tool() for registration. Delegates to database helper and returns stats.
    @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
  • Database class method that implements the core logic for computing library statistics including track count, playtime, BPM, and genre distribution.
    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"
        }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states what the tool returns ('Dictionary containing various library statistics') but provides no information about what 'comprehensive' means, whether this operation has side effects, requires authentication, has rate limits, or what specific statistics are included. The description is minimal and leaves critical behavioral questions unanswered.

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

Conciseness3/5

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

The description is brief (two sentences) but could be more efficiently structured. The first sentence states the purpose clearly, but the second sentence ('Returns: Dictionary containing various library statistics') essentially repeats information that could be inferred from the first sentence or would be better handled by the output schema. While not verbose, it doesn't maximize information density.

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

Completeness3/5

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

Given that the tool has zero parameters, 100% schema description coverage, and an output schema exists, the description doesn't need to explain parameters or return values. However, for a tool with no annotations and multiple similar sibling tools, the description should do more to clarify what 'comprehensive library statistics' means and how this differs from other statistical tools. The description is minimally adequate but leaves important contextual gaps.

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 tool has zero parameters (schema description coverage is 100%), so the description doesn't need to explain any parameters. The baseline for zero parameters is 4, as there are no parameters whose semantics need clarification beyond what the schema already provides.

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 tool's purpose with a specific verb ('Get') and resource ('comprehensive library statistics'), making it immediately understandable. However, it doesn't explicitly differentiate this from sibling tools like 'analyze_library', 'get_history_stats', or 'get_most_played_tracks', which might also provide statistical insights about the library.

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. With multiple sibling tools that might provide statistical or analytical data (analyze_library, get_history_stats, get_most_played_tracks, get_top_rated_tracks, get_unplayed_tracks), there's no indication of what makes 'get_library_stats' distinct or when it should be preferred over those other options.

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