Skip to main content
Glama

get_user_playlists

Retrieve your TIDAL playlists to view music collections, track counts, and recent updates. Organize and access your saved playlists from your account.

Instructions

Fetches the user's playlists from their TIDAL account. USE THIS TOOL WHENEVER A USER ASKS FOR: - "Show me my playlists" - "List my TIDAL playlists" - "What playlists do I have?" - "Get my music collections" - Any request to view or list their TIDAL playlists This function retrieves the user's playlists from TIDAL and returns them sorted by last updated date (most recent first). When processing the results of this tool: 1. Present the playlists in a clear, organized format 2. Include key information like title, track count, and the TIDAL URL for each playlist 3. Mention when each playlist was last updated if available 4. If the user has many playlists, focus on the most recently updated ones unless specified otherwise Returns: A dictionary containing the user's playlists sorted by last updated date

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Primary MCP tool handler and registration for get_user_playlists. This @mcp.tool()-decorated function implements the tool logic by checking authentication status and proxying the GET request to the Tidal Flask API endpoint /api/playlists to retrieve the user's playlists.
    @mcp.tool() def get_user_playlists() -> dict: """ Fetches the user's playlists from their TIDAL account. USE THIS TOOL WHENEVER A USER ASKS FOR: - "Show me my playlists" - "List my TIDAL playlists" - "What playlists do I have?" - "Get my music collections" - Any request to view or list their TIDAL playlists This function retrieves the user's playlists from TIDAL and returns them sorted by last updated date (most recent first). When processing the results of this tool: 1. Present the playlists in a clear, organized format 2. Include key information like title, track count, and the TIDAL URL for each playlist 3. Mention when each playlist was last updated if available 4. If the user has many playlists, focus on the most recently updated ones unless specified otherwise Returns: A dictionary containing the user's playlists sorted by last updated date """ # 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 playlists. Please use the tidal_login() function." } try: # Call the Flask endpoint to retrieve playlists with the specified limit response = requests.get(f"{FLASK_APP_URL}/api/playlists") # Check if the request was successful if response.status_code == 200: return { "status": "success", "playlists": response.json().get("playlists", []), "playlist_count": len(response.json().get("playlists", [])) } 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 playlists: {error_data.get('error', 'Unknown error')}" } except Exception as e: return { "status": "error", "message": f"Failed to connect to TIDAL playlists service: {str(e)}" }
  • Core backend implementation of get_user_playlists logic in the Flask route /api/playlists (GET). Fetches playlists using session.user.playlists(), formats playlist data with details like ID, title, description, track count, and URL, sorts by last_updated descending, and returns JSON.
    def get_user_playlists(session: BrowserSession): """ Get the user's playlists from TIDAL. """ try: # Get user playlists playlists = session.user.playlists() # Format playlist data playlist_list = [] for playlist in playlists: playlist_info = { "id": playlist.id, "title": playlist.name, "description": playlist.description if hasattr(playlist, 'description') else "", "created": playlist.created if hasattr(playlist, 'created') else None, "last_updated": playlist.last_updated if hasattr(playlist, 'last_updated') else None, "track_count": playlist.num_tracks if hasattr(playlist, 'num_tracks') else 0, "duration": playlist.duration if hasattr(playlist, 'duration') else 0, "url": f"https://tidal.com/playlist/{playlist.id}" } playlist_list.append(playlist_info) # Sort playlists by last_updated in descending order sorted_playlists = sorted( playlist_list, key=lambda x: x.get('last_updated', ''), reverse=True ) return jsonify({"playlists": sorted_playlists}) except Exception as e: return jsonify({"error": f"Error fetching playlists: {str(e)}"}), 500

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

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