Skip to main content
Glama
jamiew

Spotify MCP Server

get_album_info

Retrieve detailed Spotify album metadata including release date, label information, and track listings using the album's unique identifier.

Instructions

Get detailed information about a Spotify album.

Args:
    album_id: Spotify album ID

Returns:
    Dict with album metadata including release_date, label, tracks

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
album_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'get_album_info' tool. Decorated with @mcp.tool() for registration and @log_tool_execution. Fetches album details and tracks from Spotify API, parses using Album and Track models, and returns structured data.
    @mcp.tool()
    @log_tool_execution
    def get_album_info(album_id: str) -> dict[str, Any]:
        """Get detailed information about a Spotify album.
    
        Args:
            album_id: Spotify album ID
    
        Returns:
            Dict with album metadata including release_date, label, tracks
        """
        try:
            logger.info(f"💿 Getting album info: {album_id}")
            result = spotify_client.album(album_id)
    
            album = Album(
                name=result["name"],
                id=result["id"],
                artist=result["artists"][0]["name"] if result.get("artists") else "Unknown",
                artists=[a["name"] for a in result.get("artists", [])],
                release_date=result.get("release_date"),
                release_date_precision=result.get("release_date_precision"),
                total_tracks=result.get("total_tracks"),
                album_type=result.get("album_type"),
                label=result.get("label"),
                genres=result.get("genres", []),
                popularity=result.get("popularity"),
                external_urls=result.get("external_urls"),
            )
    
            # Parse album tracks
            tracks = []
            for item in result.get("tracks", {}).get("items", []):
                if item:
                    # Album track items don't have album info, add it
                    item["album"] = {
                        "name": result["name"],
                        "id": result["id"],
                        "release_date": result.get("release_date"),
                    }
                    tracks.append(parse_track(item).model_dump())
    
            return {
                "album": album.model_dump(),
                "tracks": tracks,
            }
        except SpotifyException as e:
            raise convert_spotify_error(e) from e
  • Pydantic BaseModel schema defining the structure for Spotify album data, used in the get_album_info tool output.
    class Album(BaseModel):
        """A Spotify album."""
    
        name: str
        id: str
        artist: str
        artists: list[str] | None = None
        release_date: str | None = None
        release_date_precision: str | None = None
        total_tracks: int | None = None
        album_type: str | None = None
        label: str | None = None
        genres: list[str] | None = None
        popularity: int | None = None
        external_urls: dict[str, str] | None = None
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It mentions it returns a dict with metadata, but doesn't disclose behavioral traits like whether it requires authentication, rate limits, error conditions, or if it's a read-only operation. The description is minimal on behavioral context.

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 appropriately sized and front-loaded with the core purpose, followed by structured Args and Returns sections. Every sentence earns its place without redundancy, making it efficient and clear.

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 low complexity (1 parameter) and the presence of an output schema (which handles return values), the description is reasonably complete. It covers purpose and parameter semantics adequately, though more behavioral transparency would enhance completeness for a tool with no annotations.

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?

With 0% schema description coverage and only 1 parameter, the description compensates by specifying that album_id is a 'Spotify album ID', adding meaning beyond the schema's generic 'Album Id' title. It doesn't detail format or examples, but provides essential context.

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 specific action ('Get detailed information') and resource ('about a Spotify album'), distinguishing it from siblings like get_artist_info or get_track_info. It's precise about what it retrieves without being tautological.

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

Usage Guidelines3/5

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

The description implies usage when album metadata is needed, but doesn't explicitly state when to use this tool versus alternatives like get_artist_info for artist details or search_tracks for broader queries. No exclusions or prerequisites are mentioned.

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/jamiew/spotify-mcp'

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