Skip to main content
Glama

get_playlist

Retrieve a Spotify user's playlist details including tracks and metadata by providing the playlist ID or URI.

Instructions

Get a playlist owned by a Spotify user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe Spotify ID or URI of the playlist
marketNoOptional. An ISO 3166-1 alpha-2 country code

Implementation Reference

  • Core implementation of the 'get_playlist' tool. Normalizes the playlist ID, handles optional market parameter, and fetches playlist data via Spotify API GET /playlists/{id}.
    async getPlaylist(args: PlaylistArgs) { const playlistId = this.extractPlaylistId(args.id); const { market } = args; const params = { market }; return this.api.makeRequest( `/playlists/${playlistId}${this.api.buildQueryString(params)}` ); }
  • TypeScript type definition for input arguments: required 'id' (Spotify playlist ID or URI) extending MarketParams (optional market).
    export interface PlaylistArgs extends MarketParams { id: string; }
  • src/index.ts:444-459 (registration)
    MCP tool registration in listTools response, including name, description, and JSON input schema.
    name: 'get_playlist', description: 'Get a playlist owned by a Spotify user', 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' } }, required: ['id'] },
  • src/index.ts:829-835 (registration)
    Dispatch handler in CallToolRequest that validates args and calls the playlistsHandler.getPlaylist.
    case 'get_playlist': { const args = this.validateArgs<PlaylistArgs>(request.params.arguments, ['id']); const result = await this.playlistsHandler.getPlaylist(args); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }
  • Utility method used by getPlaylist to normalize Spotify playlist URI to plain ID.
    private extractPlaylistId(id: string): string { return id.startsWith('spotify:playlist:') ? id.split(':')[2] : id; }

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