Skip to main content
Glama
superseoworld

MCP Spotify Server

get_playlist_items

Retrieve detailed information about tracks and episodes in a Spotify playlist, including metadata and playback options, using the playlist's ID or URI.

Instructions

Get full details of the items of a playlist

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe Spotify ID or URI of the playlist
marketNoOptional. An ISO 3166-1 alpha-2 country code
fieldsNoOptional. Filters for the query
limitNoOptional. Maximum number of items to return (1-100)
offsetNoOptional. Index of the first item to return

Implementation Reference

  • The core handler function implementing the get_playlist_items tool. It extracts the playlist ID, builds query parameters (market, limit, offset, fields), and makes a GET request to Spotify's /playlists/{id}/items endpoint via the SpotifyApi utility.
    async getPlaylistItems(args: PlaylistItemsArgs) {
      const playlistId = this.extractPlaylistId(args.id);
      const { market, limit, offset, fields } = args;
    
      const params = {
        market,
        ...(limit !== undefined && { limit }),
        ...(offset !== undefined && { offset }),
        ...(fields !== undefined && { fields })
      };
    
      return this.api.makeRequest(
        `/playlists/${playlistId}/items${this.api.buildQueryString(params)}`
      );
    }
  • TypeScript interface defining the input arguments for the getPlaylistItems handler: playlist ID (required), fields (optional), extending MarketParams (market) and PaginationParams (limit, offset). Used for type safety and validation.
    export interface PlaylistItemsArgs extends MarketParams, PaginationParams {
      id: string;
      fields?: string;
    }
  • src/index.ts:495-526 (registration)
    MCP tool registration in listTools response: defines name, description, and inputSchema matching the handler arguments.
      name: 'get_playlist_items',
      description: 'Get full details of the items of a playlist',
      inputSchema: {
        type: 'object',
        properties: {
          id: {
            type: 'string',
            description: 'The Spotify ID or URI of the playlist'
          },
          market: {
            type: 'string',
            description: 'Optional. An ISO 3166-1 alpha-2 country code'
          },
          fields: {
            type: 'string',
            description: 'Optional. Filters for the query'
          },
          limit: {
            type: 'number',
            description: 'Optional. Maximum number of items to return (1-100)',
            minimum: 1,
            maximum: 100
          },
          offset: {
            type: 'number',
            description: 'Optional. Index of the first item to return',
            minimum: 0
          }
        },
        required: ['id']
      },
    },
  • src/index.ts:845-851 (registration)
    Dispatch handler in the main CallToolRequest switch statement: validates arguments, calls the playlistsHandler.getPlaylistItems, and returns JSON stringified result.
    case 'get_playlist_items': {
      const args = this.validateArgs<PlaylistItemsArgs>(request.params.arguments, ['id']);
      const result = await this.playlistsHandler.getPlaylistItems(args);
      return {
        content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
      };
    }
  • Helper method used by getPlaylistItems (and other playlist methods) to normalize playlist ID from Spotify URI or plain ID.
    private extractPlaylistId(id: string): string {
      return id.startsWith('spotify:playlist:') ? id.split(':')[2] : id;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states it 'gets' data (implying read-only) but doesn't mention authentication needs, rate limits, pagination behavior (despite limit/offset parameters), error conditions, or what 'full details' entails. This leaves significant gaps for a tool with 5 parameters.

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 a single, efficient sentence that front-loads the core purpose. Every word earns its place with no redundancy or unnecessary elaboration.

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

Completeness2/5

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

For a tool with 5 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what 'full details' includes, how results are structured, pagination behavior, or authentication requirements. The agent would need to guess at important behavioral aspects.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so parameters are well-documented in the schema. The description adds no additional parameter information beyond implying the 'id' parameter is for playlists. This meets the baseline for high schema coverage but doesn't enhance understanding.

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

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get full details') and resource ('items of a playlist'), making the purpose immediately understandable. It distinguishes from siblings like 'get_playlist' (which gets playlist metadata) and 'get_playlist_tracks' (which might be more specific), though it doesn't explicitly name these alternatives.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'get_playlist_tracks' or 'get_playlist'. It doesn't mention prerequisites, context, or exclusions, leaving the agent to infer usage from the name alone.

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

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