Skip to main content
Glama
keenanbass1

TIDAL MCP Server

by keenanbass1

get_album_tracks

Retrieve all tracks and album metadata from a TIDAL album using its ID to access complete track listings.

Instructions

Get all tracks from a specific album.

Args: album_id: ID of the album

Returns: List of tracks in the album with album metadata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
album_idYes

Implementation Reference

  • The main async handler function for the 'get_album_tracks' tool. It authenticates if needed, fetches the album using tidalapi.session.album(album_id), retrieves its tracks, maps them to Track models, and returns an AlbumTracks response.
    @mcp.tool()
    async def get_album_tracks(album_id: str) -> AlbumTracks:
        """
        Get all tracks from a specific album.
    
        Args:
            album_id: ID of the album
    
        Returns:
            List of tracks in the album with album metadata
        """
        if not await ensure_authenticated():
            raise ToolError("Not authenticated. Please run the 'login' tool first.")
    
        try:
            album = await anyio.to_thread.run_sync(session.album, album_id)
            if not album:
                raise ToolError(f"Album with ID '{album_id}' not found")
    
            album_tracks = await anyio.to_thread.run_sync(album.tracks)
    
            tracks = []
            for track in album_tracks:
                tracks.append(
                    Track(
                        id=str(track.id),
                        title=track.name,
                        artist=track.artist.name if track.artist else "Unknown Artist",
                        album=album.name,
                        duration_seconds=track.duration,
                        url=f"https://tidal.com/browse/track/{track.id}",
                    )
                )
    
            return AlbumTracks(
                status="success",
                album_title=album.name,
                album_id=album_id,
                artist=album.artist.name if album.artist else "Unknown Artist",
                count=len(tracks),
                tracks=tracks,
            )
        except ToolError:
            raise
        except Exception as e:
            raise ToolError(f"Failed to get album tracks: {str(e)}")
  • Pydantic BaseModel defining the structured output schema for the get_album_tracks tool response, including album metadata and list of Track objects.
    class AlbumTracks(BaseModel):
        """Tracks from a specific album."""
    
        status: str = Field(description="Operation status (success/error)")
        album_title: str = Field(description="Title of the album")
        album_id: str = Field(description="ID of the album")
        artist: str = Field(description="Album artist name")
        count: int = Field(description="Number of tracks returned")
        tracks: List[Track] = Field(description="List of track objects")
  • The tool is listed in the SERVER_INSTRUCTIONS string, which provides documentation and context for the MCP server's capabilities, including this tool.
    - get_album_tracks: Get all tracks from an album

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

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