Skip to main content
Glama
mikeysrecipes

TIDAL MCP: My Custom Picks

get_favorite_tracks

Retrieve your saved favorite tracks from TIDAL to view or manage your preferred music collection.

Instructions

Retrieves tracks from the user's TIDAL account favorites.

USE THIS TOOL WHENEVER A USER ASKS FOR:
- "What are my favorite tracks?"
- "Show me my TIDAL favorites"
- "What music do I have saved?"
- "Get my favorite songs"
- Any request to view their saved/favorite tracks

This function retrieves the user's favorite tracks from TIDAL.

Args:
    limit: Maximum number of tracks to retrieve (default: 20, note it should be large enough by default unless specified otherwise).

Returns:
    A dictionary containing track information including track ID, title, artist, album, and duration.
    Returns an error message if not authenticated or if retrieval fails.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo

Implementation Reference

  • MCP tool handler decorated with @mcp.tool() that implements the get_favorite_tracks tool logic by checking authentication and proxying requests to the Flask backend /api/tracks endpoint.
    @mcp.tool()
    def get_favorite_tracks(limit: int = 20) -> dict:
        """
        Retrieves tracks from the user's TIDAL account favorites.
        
        USE THIS TOOL WHENEVER A USER ASKS FOR:
        - "What are my favorite tracks?"
        - "Show me my TIDAL favorites"
        - "What music do I have saved?"
        - "Get my favorite songs"
        - Any request to view their saved/favorite tracks
        
        This function retrieves the user's favorite tracks from TIDAL.
        
        Args:
            limit: Maximum number of tracks to retrieve (default: 20, note it should be large enough by default unless specified otherwise).
        
        Returns:
            A dictionary containing track information including track ID, title, artist, album, and duration.
            Returns an error message if not authenticated or if retrieval fails.
        """
        try:
            # First, check if the user is authenticated
            auth_check = requests.get(f"{FLASK_APP_URL}/api/auth/status")
            auth_data = auth_check.json()
            
            if not auth_data.get("authenticated", False):
                return {
                    "status": "error",
                    "message": "You need to login to TIDAL first before I can fetch your favorite tracks. Please use the tidal_login() function."
                }
                
            # Call your Flask endpoint to retrieve tracks with the specified limit
            response = requests.get(f"{FLASK_APP_URL}/api/tracks", params={"limit": limit})
            
            # Check if the request was successful
            if response.status_code == 200:
                return response.json()
            elif response.status_code == 401:
                return {
                    "status": "error",
                    "message": "Not authenticated with TIDAL. Please login first using tidal_login()."
                }
            else:
                error_data = response.json()
                return {
                    "status": "error",
                    "message": f"Failed to retrieve tracks: {error_data.get('error', 'Unknown error')}"
                }
        except Exception as e:
            return {
                "status": "error",
                "message": f"Failed to connect to TIDAL tracks service: {str(e)}"
            }
  • Flask backend endpoint /api/tracks that implements the core logic for fetching user's favorite tracks from TIDAL API using session.user.favorites.tracks(). Called by the MCP tool handler.
    @app.route('/api/tracks', methods=['GET'])
    @requires_tidal_auth
    def get_tracks(session: BrowserSession):
        """
        Get tracks from the user's history.
        """
        try:        
            # TODO: Add streaminig history support if TIDAL API allows it
            # Get user favorites or history (for now limiting to user favorites only)
            favorites = session.user.favorites
            
            # Get limit from query parameter, default to 10 if not specified
            limit = bound_limit(request.args.get('limit', default=10, type=int))
            
            tracks = favorites.tracks(limit=limit, order="DATE", order_direction="DESC")        
            track_list = [format_track_data(track) for track in tracks]
    
            return jsonify({"tracks": track_list})
        except Exception as e:
            return jsonify({"error": f"Error fetching tracks: {str(e)}"}), 500
  • Registration of the get_favorite_tracks tool using the @mcp.tool() decorator.
    @mcp.tool()
Behavior3/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 mentions authentication requirements ('Returns an error message if not authenticated') and potential failure modes ('if retrieval fails'), which adds useful context. However, it lacks details on rate limits, pagination, or data freshness, leaving gaps for a tool that accesses user data.

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 well-structured with clear sections (purpose, usage guidelines, args, returns) and front-loaded key information. It avoids redundancy, but the usage examples could be more concise (e.g., listing multiple similar queries). Overall, most sentences add value, though slight trimming is possible.

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 no annotations, no output schema, and a simple input schema, the description is moderately complete. It covers purpose, usage, parameters, and basic returns/errors, but lacks details on output structure (beyond a high-level mention), authentication flow, or error handling specifics. For a data retrieval tool, this leaves some operational 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 semantics for the single parameter 'limit', explaining it's the 'Maximum number of tracks to retrieve' with a default of 20 and a note that it 'should be large enough by default unless specified otherwise.' This compensates for the 0% schema description coverage by clarifying the parameter's role and default behavior beyond the schema's basic type and title.

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: 'Retrieves tracks from the user's TIDAL account favorites.' It specifies the verb ('retrieves'), resource ('tracks'), and source ('user's TIDAL account favorites'), making the function unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'get_playlist_tracks' or 'recommend_tracks' beyond the 'favorites' focus.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit usage guidelines with a dedicated section listing example user queries (e.g., 'What are my favorite tracks?', 'Show me my TIDAL favorites'). It clearly indicates when to use this tool for viewing saved/favorite tracks, though it doesn't specify when not to use it or mention alternatives like 'get_playlist_tracks' for non-favorite content.

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/mikeysrecipes/tidal-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server