Skip to main content
Glama
davehenke

rekordbox-mcp

get_top_rated_tracks

Retrieve the highest-rated tracks from your rekordbox library to identify quality music for DJ sets and playlists.

Instructions

Get the highest rated tracks in the library.

Args: limit: Maximum number of tracks to return

Returns: List of top rated tracks

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The MCP tool handler for 'get_top_rated_tracks', decorated with @mcp.tool() for registration. It checks database connection, calls the database helper method, and returns list of track dictionaries.
    @mcp.tool()
    async def get_top_rated_tracks(limit: int = 20) -> List[Dict[str, Any]]:
        """
        Get the highest rated tracks in the library.
        
        Args:
            limit: Maximum number of tracks to return
            
        Returns:
            List of top rated tracks
        """
        if not db:
            raise RuntimeError("Database not initialized.")
        
        tracks = await db.get_top_rated_tracks(limit)
        return [track.model_dump() for track in tracks]
  • Core implementation logic in RekordboxDatabase class: fetches all active tracks, sorts by rating (desc) then play count, limits to top N, converts to Track models.
    async def get_top_rated_tracks(self, limit: int = 20) -> List[Track]:
        """Get the highest rated 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 rating descending, then by play count
        sorted_content = sorted(active_content, key=lambda x: (getattr(x, 'Rating', 0) or 0, getattr(x, 'DJPlayCount', 0) or 0), reverse=True)
        
        return [self._content_to_track(content) for content in sorted_content[:limit]]
  • Pydantic BaseModel defining the Track schema used for output structures (converted to dicts via model_dump()). Defines all track metadata fields with validation.
    class Track(BaseModel):
        """
        Rekordbox track model with comprehensive metadata.
        """
        
        id: str = Field(..., description="Unique track identifier")
        title: str = Field(..., description="Track title")
        artist: str = Field(..., description="Track artist")
        album: Optional[str] = Field(None, description="Album name")
        genre: Optional[str] = Field(None, description="Musical genre")
        bpm: float = Field(0.0, description="Beats per minute")
        key: Optional[str] = Field(None, description="Musical key (e.g., '5A', '12B')")
        rating: int = Field(0, ge=0, le=5, description="Track rating (0-5)")
        play_count: int = Field(0, ge=0, description="Number of times played")
        length: int = Field(0, ge=0, description="Track length in seconds")
        file_path: Optional[str] = Field(None, description="Path to audio file")
        date_added: Optional[str] = Field(None, description="Date track was added to library")
        date_modified: Optional[str] = Field(None, description="Date track was last modified")
        
        # Additional metadata
        bitrate: Optional[int] = Field(None, description="Audio bitrate in kbps")
        sample_rate: Optional[int] = Field(None, description="Audio sample rate in Hz")
        color: Optional[str] = Field(None, description="Track color tag")
        comments: Optional[str] = Field(None, description="Track comments")
        
        @field_validator('key')
        @classmethod
        def validate_key(cls, v):
            """Validate musical key format."""
            if v and v not in []:  # Add valid key formats
                # Basic validation - could be more sophisticated
                pass
            return v
        
        def duration_formatted(self) -> str:
            """Get track duration in MM:SS format."""
            if self.length <= 0:
                return "0:00"
            
            minutes = self.length // 60
            seconds = self.length % 60
            return f"{minutes}:{seconds:02d}"
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions returning a list of tracks but lacks details on what 'highest rated' entails (e.g., rating criteria, sorting order), whether results are paginated, or if there are rate limits. For a read operation with zero annotation coverage, this leaves significant gaps in understanding the tool's behavior.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded, with the core purpose stated first, followed by brief sections for args and returns. Every sentence adds value, and there's no redundant information. A slight improvement could be integrating the args/returns more seamlessly, but it remains efficient.

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 the tool's moderate complexity (single parameter, read-only operation), the description is adequate but incomplete. It lacks details on rating criteria, sorting, or output format, though the presence of an output schema mitigates the need to explain return values. Without annotations, it should do more to clarify behavioral aspects, making it minimally viable but with clear 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 description adds meaningful context for the single parameter 'limit' by explaining it as 'Maximum number of tracks to return,' which clarifies its purpose beyond the schema's basic type and default. With 0% schema description coverage, this compensates well, though it doesn't specify constraints like minimum/maximum values or how ties in ratings are handled.

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 as 'Get the highest rated tracks in the library,' which is a specific verb+resource combination. It distinguishes itself from siblings like 'get_most_played_tracks' or 'get_unplayed_tracks' by focusing on rating rather than play count or other metrics. However, it doesn't explicitly mention what 'highest rated' means (e.g., based on user ratings, internal scores), which prevents a perfect score.

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. It doesn't mention scenarios where this is preferred over 'get_racks_by_key' or 'search_tracks,' nor does it specify prerequisites like requiring a connected database or existing library. Without such context, users must infer usage from the tool name alone.

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