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
| Name | Required | Description | Default |
|---|---|---|---|
| album_id | Yes |
Implementation Reference
- src/tidal_mcp/server.py:777-823 (handler)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)}")
- src/tidal_mcp/models.py:108-117 (schema)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")
- src/tidal_mcp/server.py:85-85 (registration)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