Skip to main content
Glama
mikeysrecipes

TIDAL MCP: My Custom Picks

get_playlist_tracks

Retrieve and display all tracks from a specific TIDAL playlist, including track names, artists, albums, and durations. Use playlist_id to fetch and organize playlist content for clear viewing.

Instructions

Retrieves all tracks from a specified TIDAL playlist. USE THIS TOOL WHENEVER A USER ASKS FOR: - "Show me the songs in my playlist" - "What tracks are in my [playlist name] playlist?" - "List the songs from my playlist" - "Get tracks from my playlist" - "View contents of my TIDAL playlist" - Any request to see what songs/tracks are in a specific playlist This function retrieves all tracks from a specific playlist in the user's TIDAL account. The playlist_id must be provided, which can be obtained from the get_user_playlists() function. When processing the results of this tool: 1. Present the playlist information (title, description, track count) as context 2. List the tracks in a clear, organized format with track name, artist, and album 3. Include track durations where available 4. Mention the total number of tracks in the playlist 5. If there are many tracks, focus on highlighting interesting patterns or variety Args: playlist_id: The TIDAL ID of the playlist to retrieve (required) limit: Maximum number of tracks to retrieve (default: 100) Returns: A dictionary containing the playlist information and all tracks in the playlist

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
playlist_idYes

Implementation Reference

  • MCP tool handler for 'get_playlist_tracks'. This function is decorated with @mcp.tool(), making it the primary implementation exposed to MCP clients. It checks authentication, validates input, and proxies the request to the Tidal Flask API endpoint to fetch playlist tracks.
    @mcp.tool() def get_playlist_tracks(playlist_id: str, limit: int = 100) -> dict: """ Retrieves all tracks from a specified TIDAL playlist. USE THIS TOOL WHENEVER A USER ASKS FOR: - "Show me the songs in my playlist" - "What tracks are in my [playlist name] playlist?" - "List the songs from my playlist" - "Get tracks from my playlist" - "View contents of my TIDAL playlist" - Any request to see what songs/tracks are in a specific playlist This function retrieves all tracks from a specific playlist in the user's TIDAL account. The playlist_id must be provided, which can be obtained from the get_user_playlists() function. When processing the results of this tool: 1. Present the playlist information (title, description, track count) as context 2. List the tracks in a clear, organized format with track name, artist, and album 3. Include track durations where available 4. Mention the total number of tracks in the playlist 5. If there are many tracks, focus on highlighting interesting patterns or variety Args: playlist_id: The TIDAL ID of the playlist to retrieve (required) limit: Maximum number of tracks to retrieve (default: 100) Returns: A dictionary containing the playlist information and all tracks in the playlist """ # 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 playlist tracks. Please use the tidal_login() function." } # Validate playlist_id if not playlist_id: return { "status": "error", "message": "A playlist ID is required. You can get playlist IDs by using the get_user_playlists() function." } try: # Call the Flask endpoint to retrieve tracks from the playlist response = requests.get( f"{FLASK_APP_URL}/api/playlists/{playlist_id}/tracks", params={"limit": limit} ) # Check if the request was successful if response.status_code == 200: data = response.json() return { "status": "success", "tracks": data.get("tracks", []), "track_count": data.get("total_tracks", 0) } elif response.status_code == 404: return { "status": "error", "message": f"Playlist with ID {playlist_id} not found. Please check the playlist ID and try again." } 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 playlist tracks: {error_data.get('error', 'Unknown error')}" } except Exception as e: return { "status": "error", "message": f"Failed to connect to TIDAL playlist service: {str(e)}" }
  • Helper function in the Tidal API Flask app that implements the core logic for retrieving tracks from a TIDAL playlist using BrowserSession. Called by the MCP handler via HTTP request.
    def get_playlist_tracks(playlist_id: str, session: BrowserSession): """ Get tracks from a specific TIDAL playlist. """ try: # Get limit from query parameter, default to 100 if not specified limit = bound_limit(request.args.get('limit', default=100, type=int)) # Get the playlist object playlist = session.playlist(playlist_id) if not playlist: return jsonify({"error": f"Playlist with ID {playlist_id} not found"}), 404 # Get tracks from the playlist with pagination if needed tracks = playlist.items(limit=limit) # Format track data track_list = [format_track_data(track) for track in tracks] return jsonify({ "playlist_id": playlist.id, "tracks": track_list, "total_tracks": len(track_list) }) except Exception as e: return jsonify({"error": f"Error fetching playlist tracks: {str(e)}"}), 500
  • The @mcp.tool() decorator registers this function as an MCP tool.
    @mcp.tool() def get_playlist_tracks(playlist_id: str, limit: int = 100) -> dict: """ Retrieves all tracks from a specified TIDAL playlist. USE THIS TOOL WHENEVER A USER ASKS FOR: - "Show me the songs in my playlist" - "What tracks are in my [playlist name] playlist?" - "List the songs from my playlist" - "Get tracks from my playlist" - "View contents of my TIDAL playlist" - Any request to see what songs/tracks are in a specific playlist This function retrieves all tracks from a specific playlist in the user's TIDAL account. The playlist_id must be provided, which can be obtained from the get_user_playlists() function. When processing the results of this tool: 1. Present the playlist information (title, description, track count) as context 2. List the tracks in a clear, organized format with track name, artist, and album 3. Include track durations where available 4. Mention the total number of tracks in the playlist 5. If there are many tracks, focus on highlighting interesting patterns or variety Args: playlist_id: The TIDAL ID of the playlist to retrieve (required) limit: Maximum number of tracks to retrieve (default: 100) Returns: A dictionary containing the playlist information and all tracks in the playlist """ # 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 playlist tracks. Please use the tidal_login() function." } # Validate playlist_id if not playlist_id: return { "status": "error", "message": "A playlist ID is required. You can get playlist IDs by using the get_user_playlists() function." } try: # Call the Flask endpoint to retrieve tracks from the playlist response = requests.get( f"{FLASK_APP_URL}/api/playlists/{playlist_id}/tracks", params={"limit": limit} ) # Check if the request was successful if response.status_code == 200: data = response.json() return { "status": "success", "tracks": data.get("tracks", []), "track_count": data.get("total_tracks", 0) } elif response.status_code == 404: return { "status": "error", "message": f"Playlist with ID {playlist_id} not found. Please check the playlist ID and try again." } 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 playlist tracks: {error_data.get('error', 'Unknown error')}" } except Exception as e: return { "status": "error", "message": f"Failed to connect to TIDAL playlist service: {str(e)}" }

Other Tools

Related 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