Skip to main content
Glama

get_top_artists

Retrieve your most listened-to Spotify artists over customizable time periods to analyze listening habits and discover music preferences.

Instructions

Analyze your personal listening habits to discover your most played artists over different time periods.

🎯 USE CASES: β€’ Understanding your personal music taste evolution β€’ Creating "Year in Music" summaries and statistics β€’ Building playlists based on your actual listening habits β€’ Sharing your music taste with friends and social media β€’ Discovering patterns in your music preferences

πŸ“ WHAT IT RETURNS: β€’ Your most listened-to artists ranked by play time β€’ Artist names, images, and genre breakdowns β€’ Listening statistics and time-period comparisons β€’ Popularity scores and follower information β€’ Insights into your musical preferences

πŸ” EXAMPLES: β€’ "Who are my top artists this month?" β€’ "Show my most played artists of all time" β€’ "Get my top 10 artists from the last 6 months" β€’ "What artists have I been listening to most recently?"

⏰ TIME RANGES: β€’ 'short_term' - Last 4 weeks of listening β€’ 'medium_term' - Last 6 months of listening
β€’ 'long_term' - All-time listening history β€’ Compare across different periods for insights

⚠️ REQUIREMENTS: β€’ Valid Spotify access token with user-top-read scope β€’ Sufficient listening history for accurate results

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tokenYesSpotify access token for authentication
timeRangeNomedium_term
limitNo

Implementation Reference

  • The core handler function that executes the tool logic by making an authenticated API request to Spotify's 'me/top/artists' endpoint to retrieve the user's top artists over the specified time range.
    async getTopArtists( token: string, timeRange: "short_term" | "medium_term" | "long_term" = "medium_term", limit: number = 20 ): Promise<TopItemsResponse<SpotifyArtist>> { const params = { time_range: timeRange, limit: Math.min(limit, 50), }; return await this.makeRequest<TopItemsResponse<SpotifyArtist>>( "me/top/artists", token, params ); }
  • Defines the input schema for the 'get_top_artists' tool, validating token, timeRange (short_term|medium_term|long_term), and limit parameters.
    schema: createSchema({ token: commonSchemas.token(), timeRange: commonSchemas.timeRange(), limit: commonSchemas.limit(1, 50, 20), }),
  • Registers the 'get_top_artists' MCP tool with title, detailed description, schema, and wrapper handler that delegates to the SpotifyService.getTopArtists method.
    get_top_artists: { title: "Get User's Top Artists", description: `Analyze your personal listening habits to discover your most played artists over different time periods. 🎯 USE CASES: β€’ Understanding your personal music taste evolution β€’ Creating "Year in Music" summaries and statistics β€’ Building playlists based on your actual listening habits β€’ Sharing your music taste with friends and social media β€’ Discovering patterns in your music preferences πŸ“ WHAT IT RETURNS: β€’ Your most listened-to artists ranked by play time β€’ Artist names, images, and genre breakdowns β€’ Listening statistics and time-period comparisons β€’ Popularity scores and follower information β€’ Insights into your musical preferences πŸ” EXAMPLES: β€’ "Who are my top artists this month?" β€’ "Show my most played artists of all time" β€’ "Get my top 10 artists from the last 6 months" β€’ "What artists have I been listening to most recently?" ⏰ TIME RANGES: β€’ 'short_term' - Last 4 weeks of listening β€’ 'medium_term' - Last 6 months of listening β€’ 'long_term' - All-time listening history β€’ Compare across different periods for insights ⚠️ REQUIREMENTS: β€’ Valid Spotify access token with user-top-read scope β€’ Sufficient listening history for accurate results`, schema: createSchema({ token: commonSchemas.token(), timeRange: commonSchemas.timeRange(), limit: commonSchemas.limit(1, 50, 20), }), handler: async (args: any, spotifyService: SpotifyService) => { const { token, timeRange = "medium_term", limit = 20 } = args; return await spotifyService.getTopArtists(token, timeRange, limit); }, },

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