Skip to main content
Glama
superseoworld

MCP Spotify Server

get_category_playlists

Retrieve Spotify playlists by category ID to discover curated music collections for specific genres or moods. Specify category and optional limits to browse relevant playlists.

Instructions

Get a list of Spotify playlists tagged with a particular category

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
category_idYesThe Spotify category ID
limitNoOptional. Maximum number of playlists (1-50)
offsetNoOptional. Index of the first playlist to return

Implementation Reference

  • The core handler function that implements the logic for 'get_category_playlists' by making a Spotify API request to retrieve playlists for a given category.
    async getCategoryPlaylists(args: GetCategoryPlaylistsArgs) {
      const { category_id, limit, offset } = args;
    
      const params = {
        ...(limit !== undefined && { limit }),
        ...(offset !== undefined && { offset })
      };
    
      return this.api.makeRequest(
        `/browse/categories/${category_id}/playlists${this.api.buildQueryString(params)}`
      );
    }
  • TypeScript interface defining the input arguments for the get_category_playlists tool.
    export interface GetCategoryPlaylistsArgs {
      category_id: string;
      limit?: number;
      offset?: number;
    }
  • src/index.ts:664-688 (registration)
    Tool registration in the ListTools response, defining name, description, and input schema.
    {
      name: 'get_category_playlists',
      description: 'Get a list of Spotify playlists tagged with a particular category',
      inputSchema: {
        type: 'object',
        properties: {
          category_id: {
            type: 'string',
            description: 'The Spotify category ID'
          },
          limit: {
            type: 'number',
            description: 'Optional. Maximum number of playlists (1-50)',
            minimum: 1,
            maximum: 50
          },
          offset: {
            type: 'number',
            description: 'Optional. Index of the first playlist to return',
            minimum: 0
          }
        },
        required: ['category_id']
      },
    }
  • src/index.ts:893-899 (registration)
    Dispatch handler in the CallToolRequest that routes to the playlistsHandler.getCategoryPlaylists method.
    case 'get_category_playlists': {
      const args = this.validateArgs<GetCategoryPlaylistsArgs>(request.params.arguments, ['category_id']);
      const result = await this.playlistsHandler.getCategoryPlaylists(args);
      return {
        content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
      };
    }

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