Skip to main content
Glama

get_artist_albums

Retrieve an artist's full discography from Spotify, including albums, singles, compilations, and featured appearances, to analyze their musical evolution or build custom playlists.

Instructions

Explore an artist's complete discography including albums, singles, compilations, and appearances.

🎯 USE CASES: • Building complete artist discography playlists • Discovering rare releases and B-sides • Tracking artist evolution through their album releases • Finding collaborations and featured appearances • Creating chronological listening experiences

📝 WHAT IT RETURNS: • Complete album listing with release dates and types • Album artwork and track counts • Collaboration information and featured artists • Market availability and release formats • Popularity metrics for each release

🔍 EXAMPLES: • "Get all albums by The Beatles" • "Show me Drake's singles and EPs only" • "Find all releases by artist ID: 4dpARuHxo51G3z768sgnrY" • "I want to see Beyoncé's complete discography"

💡 ALBUM TYPES: • 'album' - Full studio albums • 'single' - Singles and EPs • 'compilation' - Greatest hits, compilations • 'appears_on' - Featured appearances on other artists' work

⚠️ REQUIREMENTS: • Valid Spotify access token • Artist must have releases available

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
albumTypeNoalbum
artistIdYesSpotify artist ID or URI
limitNo
tokenYesSpotify access token for authentication

Implementation Reference

  • The primary handler function in SpotifyService that executes the tool logic by querying the Spotify API for an artist's albums, handling album types (album, single, appears_on, compilation) and pagination limits.
    async getArtistAlbums( token: string, artistId: string, albumType: "album" | "single" | "appears_on" | "compilation" = "album", limit: number = 20 ): Promise<PagingObject<SpotifyAlbum>> { const id = this.extractId(artistId); const params = { include_groups: albumType, limit: Math.min(limit, 50), }; return await this.makeRequest<PagingObject<SpotifyAlbum>>( `artists/${id}/albums`, token, params ); }
  • Registers the 'get_artist_albums' tool in the artistTools object, including title, detailed description, input schema, and a delegating handler that calls SpotifyService.getArtistAlbums.
    get_artist_albums: { title: "Get Artist Albums", description: `Explore an artist's complete discography including albums, singles, compilations, and appearances. 🎯 USE CASES: • Building complete artist discography playlists • Discovering rare releases and B-sides • Tracking artist evolution through their album releases • Finding collaborations and featured appearances • Creating chronological listening experiences 📝 WHAT IT RETURNS: • Complete album listing with release dates and types • Album artwork and track counts • Collaboration information and featured artists • Market availability and release formats • Popularity metrics for each release 🔍 EXAMPLES: • "Get all albums by The Beatles" • "Show me Drake's singles and EPs only" • "Find all releases by artist ID: 4dpARuHxo51G3z768sgnrY" • "I want to see Beyoncé's complete discography" 💡 ALBUM TYPES: • 'album' - Full studio albums • 'single' - Singles and EPs • 'compilation' - Greatest hits, compilations • 'appears_on' - Featured appearances on other artists' work ⚠️ REQUIREMENTS: • Valid Spotify access token • Artist must have releases available`, schema: createSchema({ token: commonSchemas.token(), artistId: commonSchemas.spotifyId("artist"), albumType: commonSchemas.albumType(), limit: commonSchemas.limit(1, 50, 20), }), handler: async (args: any, spotifyService: SpotifyService) => { const { token, artistId, albumType = "album", limit = 20 } = args; return await spotifyService.getArtistAlbums( token, artistId, albumType, limit ); }, },
  • Input schema definition for the tool, validating token, artist ID, optional album type, and limit using shared common schemas.
    schema: createSchema({ token: commonSchemas.token(), artistId: commonSchemas.spotifyId("artist"), albumType: commonSchemas.albumType(), limit: commonSchemas.limit(1, 50, 20), }),
  • Top-level registration where artistTools (containing get_artist_albums) is imported and spread into the allTools registry used by ToolRegistrar for MCP tool exposure.
    import { artistTools } from "./artists"; import { trackTools } from "./tracks"; import { playlistTools } from "./playlists"; import { playbackTools } from "./playback"; import { userTools } from "./user"; import { searchTools } from "./search"; export interface ToolDefinition { title: string; description: string; schema: z.ZodObject<any>; handler: (args: any, spotifyService: SpotifyService) => Promise<any>; } export interface ToolsRegistry { [key: string]: ToolDefinition; } export const allTools: ToolsRegistry = { ...albumTools, ...artistTools,

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/latiftplgu/Spotify-OAuth-MCP-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server