get_multiple_albums
Retrieve Spotify catalog details for multiple albums using their IDs, enabling batch access to album information for up to 20 albums at once.
Instructions
Get Spotify catalog information for multiple albums
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ids | Yes | Array of Spotify album IDs or URIs (max 20) |
Implementation Reference
- src/handlers/albums.ts:22-39 (handler)The main handler function that fetches multiple albums from Spotify API after validation and ID extraction.async getMultipleAlbums(args: MultipleAlbumsArgs) { if (args.ids.length === 0) { throw new McpError( ErrorCode.InvalidParams, 'At least one album ID must be provided' ); } if (args.ids.length > 20) { throw new McpError( ErrorCode.InvalidParams, 'Maximum of 20 album IDs allowed' ); } const albumIds = args.ids.map(this.extractAlbumId); return this.api.makeRequest(`/albums?ids=${albumIds.join(',')}`); }
- src/types/albums.ts:9-11 (schema)TypeScript interface defining the input arguments for getMultipleAlbums.export interface MultipleAlbumsArgs { ids: string[]; }
- src/index.ts:280-294 (registration)Tool registration in the listTools response, including name, description, and input schema.name: 'get_multiple_albums', description: 'Get Spotify catalog information for multiple albums', inputSchema: { type: 'object', properties: { ids: { type: 'array', items: { type: 'string' }, description: 'Array of Spotify album IDs or URIs (max 20)', maxItems: 20 } }, required: ['ids'] }, },
- src/index.ts:766-772 (registration)Dispatch logic in callTool handler that invokes the albums handler.case 'get_multiple_albums': { const args = this.validateArgs<MultipleAlbumsArgs>(request.params.arguments, ['ids']); const result = await this.albumsHandler.getMultipleAlbums(args); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }