Skip to main content
Glama

get_artist_albums

Retrieve an artist's albums from Spotify's catalog using their ID, with options to filter by album type and control result pagination.

Instructions

Get Spotify catalog information about an artist's albums

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe Spotify ID or URI for the artist
include_groupsNoOptional. Filter by album types
limitNoMaximum number of albums to return (1-50)
offsetNoThe index of the first album to return

Implementation Reference

  • Core handler function that implements the get_artist_albums tool logic: extracts artist ID, validates limit/offset, builds query params, and calls Spotify API endpoint /artists/{id}/albums.
    async getArtistAlbums(args: ArtistAlbumsArgs) { const artistId = this.extractArtistId(args.id); const { limit = 20, offset = 0, include_groups } = args; if (limit < 1 || limit > 50) { throw new McpError( ErrorCode.InvalidParams, 'Limit must be between 1 and 50' ); } if (offset < 0) { throw new McpError( ErrorCode.InvalidParams, 'Offset must be non-negative' ); } const params = { limit, offset, include_groups: include_groups?.join(',') }; return this.api.makeRequest( `/artists/${artistId}/albums${this.api.buildQueryString(params)}` ); }
  • src/index.ts:203-237 (registration)
    Tool registration in listTools handler, defining name, description, and inputSchema for get_artist_albums.
    { name: 'get_artist_albums', description: 'Get Spotify catalog information about an artist\'s albums', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'The Spotify ID or URI for the artist' }, include_groups: { type: 'array', items: { type: 'string', enum: ['album', 'single', 'appears_on', 'compilation'] }, description: 'Optional. Filter by album types' }, limit: { type: 'number', description: 'Maximum number of albums to return (1-50)', minimum: 1, maximum: 50, default: 20 }, offset: { type: 'number', description: 'The index of the first album to return', minimum: 0, default: 0 } }, required: ['id'] }, },
  • src/index.ts:742-748 (registration)
    Dispatch case in callToolRequestSchema handler that routes get_artist_albums calls to ArtistsHandler.getArtistAlbums.
    case 'get_artist_albums': { const args = this.validateArgs<ArtistAlbumsArgs>(request.params.arguments, ['id']); const result = await this.artistsHandler.getArtistAlbums(args); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }
  • TypeScript interface defining the input arguments for get_artist_albums, used for type validation and matching the MCP inputSchema.
    export interface ArtistAlbumsArgs extends ArtistArgs, PaginationParams { include_groups?: ('album' | 'single' | 'appears_on' | 'compilation')[]; }

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