Skip to main content
Glama
keenanbb

TIDAL MCP Server

by keenanbb

search_albums

Find albums on TIDAL by searching with album names, artist names, or combined queries to discover music content.

Instructions

Search for albums on TIDAL.

Args: query: Search query - album name, artist name, or combination limit: Maximum results (1-50, default: 10)

Returns: List of matching albums with id, title, artist, release date, track count, and URL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
limitNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
countYesNumber of albums returned
queryNoSearch query used (for search results)
albumsYesList of album objects
statusYesOperation status (success/error)

Implementation Reference

  • The core handler function for the 'search_albums' tool, which includes the @mcp.tool() registration decorator. Performs authentication, searches TIDAL for albums, maps results to Album models, and returns AlbumList.
    @mcp.tool()
    async def search_albums(query: str, limit: int = 10) -> AlbumList:
        """
        Search for albums on TIDAL.
    
        Args:
            query: Search query - album name, artist name, or combination
            limit: Maximum results (1-50, default: 10)
    
        Returns:
            List of matching albums with id, title, artist, release date, track count, and URL
        """
        if not await ensure_authenticated():
            raise ToolError("Not authenticated. Please run the 'login' tool first.")
    
        try:
            limit = min(max(1, limit), 50)
            results = await anyio.to_thread.run_sync(
                lambda: session.search(query, models=[tidalapi.Album], limit=limit)
            )
    
            albums = []
            for album in results.get("albums", []):
                release_date = None
                if hasattr(album, "release_date") and album.release_date:
                    release_date = str(album.release_date)
    
                albums.append(
                    Album(
                        id=str(album.id),
                        title=album.name,
                        artist=album.artist.name if album.artist else "Unknown Artist",
                        release_date=release_date,
                        num_tracks=getattr(album, "num_tracks", 0),
                        duration_seconds=getattr(album, "duration", 0),
                        url=f"https://tidal.com/browse/album/{album.id}",
                    )
                )
    
            return AlbumList(status="success", query=query, count=len(albums), albums=albums)
        except Exception as e:
            raise ToolError(f"Album search failed: {str(e)}")
  • Pydantic BaseModel defining the output schema for the search_albums tool response.
    class AlbumList(BaseModel):
        """List of albums with metadata."""
    
        status: str = Field(description="Operation status (success/error)")
        query: Optional[str] = Field(None, description="Search query used (for search results)")
        count: int = Field(description="Number of albums returned")
        albums: List[Album] = Field(description="List of album objects")
  • Pydantic BaseModel for individual Album objects used within the AlbumList output schema.
    class Album(BaseModel):
        """Structured representation of a TIDAL album."""
    
        id: str = Field(description="Unique TIDAL album ID")
        title: str = Field(description="Album title")
        artist: str = Field(description="Primary artist name")
        release_date: Optional[str] = Field(None, description="Release date (YYYY-MM-DD)")
        num_tracks: int = Field(description="Number of tracks in album")
        duration_seconds: int = Field(description="Total album duration in seconds")
        url: str = Field(description="TIDAL web URL for the album")
  • Helper function used by search_albums (and other tools) to ensure user authentication before performing API calls.
    async def ensure_authenticated() -> bool:
        """
        Check if user is authenticated with TIDAL.
        Automatically loads persisted session if available.
        """
        if await anyio.Path(SESSION_FILE).exists():
            try:
                async with await anyio.open_file(SESSION_FILE, "r") as f:
                    content = await f.read()
                    data = json.loads(content)
    
                # Load OAuth session
                result = await anyio.to_thread.run_sync(
                    session.load_oauth_session,
                    data["token_type"]["data"],
                    data["access_token"]["data"],
                    data["refresh_token"]["data"],
                    None,  # expiry time
                )
    
                if result:
                    is_valid = await anyio.to_thread.run_sync(session.check_login)
                    if not is_valid:
                        await anyio.Path(SESSION_FILE).unlink()
                    return is_valid
                return False
            except Exception:
                await anyio.Path(SESSION_FILE).unlink()
                return False
    
        return await anyio.to_thread.run_sync(session.check_login)
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 effectively describes the search functionality and result format, but lacks details about authentication requirements, rate limits, error conditions, or pagination behavior. It provides basic operational context but misses important behavioral traits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is perfectly structured and front-loaded: first sentence states the core purpose, followed by clearly labeled sections for Args and Returns. Every sentence earns its place with no wasted words, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (search with 2 parameters), no annotations, but with an output schema (implied by the Returns section), the description is mostly complete. It explains purpose, parameters, and return format adequately. The main gap is lack of behavioral context like authentication or error handling, preventing a perfect score.

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 schema description coverage is 0%, so the description must fully compensate. It successfully explains both parameters: 'query' semantics (album name, artist name, or combination) and 'limit' semantics (maximum results with range and default). The description adds meaningful context beyond what the bare schema provides, though it doesn't cover all possible edge cases.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/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 with specific verb ('Search for') and resource ('albums on TIDAL'), and distinguishes it from sibling tools like search_artists, search_tracks, and search_playlists by specifying it searches for albums specifically. It provides a complete picture of what the tool does.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool (searching for albums) and implicitly distinguishes it from siblings like get_album (which retrieves a specific album) and get_favorite_albums (which retrieves user favorites). However, it doesn't explicitly state when NOT to use it or name alternatives, keeping it from a perfect score.

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

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