Skip to main content
Glama
jamiew

Spotify MCP Server

get_playlist_info

Retrieve Spotify playlist metadata including title, description, and owner details using the playlist ID. Use this tool to access playlist information without track listings.

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 handler function for the 'get_playlist_info' tool. It fetches basic metadata about a Spotify playlist using the Spotify API and structures the response using the Playlist Pydantic model. The @mcp.tool() decorator registers this function as an MCP tool.
    @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
  • Pydantic BaseModel defining the output schema for playlist information, used directly in the get_playlist_info handler to structure the API response.
    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 on the get_playlist_info function, which registers it as an MCP tool.
    @mcp.tool()
Behavior4/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 communicates that this is a read-only operation (implied by 'Get'), specifies the return type (Dict with playlist metadata), and clarifies limitations (no tracks). However, it doesn't mention potential errors, rate limits, or authentication requirements.

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 well-structured with clear sections (Args, Returns, Note), uses bullet-like formatting for readability, and every sentence adds value without redundancy. It efficiently conveys essential information in a compact form.

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?

Given the tool's low complexity (1 parameter, no annotations but has output schema), the description is complete. It explains the purpose, usage guidelines, parameter semantics, and return value, with the output schema handling detailed return structure. No significant gaps remain for this simple read operation.

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 compensate. It adds meaningful context by explaining that playlist_id is a 'Spotify playlist ID', which clarifies the parameter's purpose beyond the schema's generic string type. The description adequately covers the single parameter.

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 basic information') and resource ('about a Spotify playlist'), and explicitly distinguishes it from the sibling tool get_playlist_tracks by specifying it returns metadata only, not tracks.

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 description provides explicit guidance on when to use this tool (for playlist metadata) versus when to use the alternative get_playlist_tracks (for tracks with pagination), including a note reinforcing this distinction.

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