get_artist_top_tracks
Retrieve an artist's top 10 tracks based on global streaming data, including track names, album details, popularity scores, and region-specific rankings. Build playlists, explore hits, and analyze music trends.
Instructions
Discover an artist's most popular and widely-played tracks based on global streaming data.
🎯 USE CASES: • Quick introduction to an artist's biggest hits • Building "best of" playlists for parties or events • Understanding which songs made an artist famous • Creating radio-friendly playlists with mainstream appeal • Checking what's trending from your favorite artists
📝 WHAT IT RETURNS: • Top 10 tracks ranked by global popularity • Track names, album information, and release dates • Popularity scores and play count estimates • Preview URLs and track durations • Market-specific popularity rankings
🔍 EXAMPLES: • "What are Ed Sheeran's top tracks?" • "Show me The Weeknd's biggest hits in the US" • "Get Ariana Grande's most popular songs" • "Find the top tracks for artist ID: 1Xyo4u8uXC1ZmMpatF05PJ"
🌍 MARKET SPECIFICITY: • Results can vary by country/region • Reflects local music preferences and cultural differences • Use country parameter for region-specific results • Defaults to US market if not specified
⚠️ REQUIREMENTS: • Valid Spotify access token • Artist must have released tracks
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| artistId | Yes | Spotify artist ID or URI | |
| country | No | Country code for localized content (e.g., 'US', 'GB') | |
| token | Yes | Spotify access token for authentication |
Implementation Reference
- src/mcp/tools/artists.ts:135-138 (handler)MCP tool handler function that destructures input arguments and delegates to SpotifyService.getArtistTopTracks method.handler: async (args: any, spotifyService: SpotifyService) => { const { token, artistId, country = "US" } = args; return await spotifyService.getArtistTopTracks(token, artistId, country); },
- src/mcp/tools/artists.ts:130-134 (schema)Input schema definition for the tool using common schema builders for token, artistId, and optional country.schema: createSchema({ token: commonSchemas.token(), artistId: commonSchemas.spotifyId("artist"), country: commonSchemas.country(), }),
- src/spotify.ts:401-413 (helper)SpotifyService helper method that makes API request to retrieve an artist's top tracks in a specific market/country.async getArtistTopTracks( token: string, artistId: string, country: string = "US" ): Promise<{ tracks: SpotifyTrack[] }> { const id = this.extractId(artistId); const params = { market: country }; return await this.makeRequest<{ tracks: SpotifyTrack[] }>( `artists/${id}/top-tracks`, token, params ); }
- src/mcp/tools/index.ts:25-25 (registration)Registration of artistTools (including get_artist_top_tracks) by spreading into the central allTools registry....artistTools,
- src/mcp/server.ts:14-14 (registration)Initialization of ToolRegistrar which handles MCP tool definitions and handlers for all tools including get_artist_top_tracks.const toolRegistrar = new ToolRegistrar(spotifyService);