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
| Name | Required | Description | Default |
|---|---|---|---|
| category_id | Yes | The Spotify category ID | |
| limit | No | Optional. Maximum number of playlists (1-50) | |
| offset | No | Optional. Index of the first playlist to return |
Implementation Reference
- src/handlers/playlists.ts:131-142 (handler)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)}` ); }
- src/types/playlists.ts:51-55 (schema)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) }], }; }