Skip to main content
Glama
jamiew

Spotify MCP Server

get_playlist_info

Retrieve basic metadata for a Spotify playlist by providing its ID. Returns playlist details without tracks.

Instructions

Get basic information about a Spotify playlist.

Args:
    playlist_id: Spotify playlist ID

Returns:
    Dict with playlist metadata (no tracks - use get_playlist_tracks for tracks)

Note: This returns playlist info only. For tracks, use get_playlist_tracks
which supports full pagination for large playlists.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
playlist_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the get_playlist_info tool. Calls spotify_client.playlist() with specific fields, constructs a Playlist model, and returns its dict representation.
    @mcp.tool()
    @log_tool_execution
    def get_playlist_info(playlist_id: str) -> dict[str, Any]:
        """Get basic information about a Spotify playlist.
    
        Args:
            playlist_id: Spotify playlist ID
    
        Returns:
            Dict with playlist metadata (no tracks - use get_playlist_tracks for tracks)
    
        Note: This returns playlist info only. For tracks, use get_playlist_tracks
        which supports full pagination for large playlists.
        """
        try:
            logger.info(f"📋 Getting playlist info: {playlist_id}")
            result = spotify_client.playlist(
                playlist_id, fields="id,name,description,owner,public,tracks.total"
            )
    
            playlist = Playlist(
                name=result["name"],
                id=result["id"],
                owner=result.get("owner", {}).get("display_name"),
                description=result.get("description"),
                tracks=None,  # No tracks - use get_playlist_tracks
                total_tracks=result.get("tracks", {}).get("total"),
                public=result.get("public"),
            )
    
            return playlist.model_dump()
        except SpotifyException as e:
            raise convert_spotify_error(e) from e
  • The Playlist Pydantic model used as the return schema for get_playlist_info. Defines fields: name, id, owner, description, tracks, total_tracks, public.
    class Playlist(BaseModel):
        """A Spotify playlist."""
    
        name: str
        id: str
        owner: str | None = None
        description: str | None = None
        tracks: list[Track] | None = None
        total_tracks: int | None = None
        public: bool | None = None
  • The @mcp.tool() decorator registers get_playlist_info as a tool in the FastMCP server named 'Spotify MCP' (line 32).
    @mcp.tool()
    @log_tool_execution
  • The log_tool_execution decorator used on get_playlist_info for logging.
        log_tool_execution,
    )
  • The spotify_client wrapper initialization used by get_playlist_info to call the Spotify API.
    # Initialize Spotify client
    _client_wrapper = spotify_api.Client()
Behavior4/5

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

No annotations provided, so description carries full burden. It indicates a read operation by stating it returns metadata and no tracks, but could explicitly state it is non-destructive. Still, it sufficiently implies safety.

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?

Very concise, with clear sections for Args, Returns, and a Note. Every sentence adds value with no redundancy.

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

Completeness5/5

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

Low complexity tool with one parameter and output schema. Description fully covers purpose, parameter, return behavior, and sibling distinction. No gaps.

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?

Single parameter playlist_id has 0% schema coverage, but the description's Args section clarifies it is a Spotify playlist ID, adding meaning beyond the schema's type string.

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 it gets basic playlist info, explicitly excludes tracks, and references the sibling tool get_playlist_tracks for tracks, providing clear distinction.

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

Usage Guidelines5/5

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

The note explicitly says to use get_playlist_tracks for tracks and mentions pagination support for large playlists, giving clear when-to-use and when-not-to-use guidance.

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