Skip to main content
Glama

get_artist_top_tracks

Retrieve an artist's most popular tracks globally or by country using Spotify streaming data to identify hits and build playlists.

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

TableJSON Schema
NameRequiredDescriptionDefault
tokenYesSpotify access token for authentication
artistIdYesSpotify artist ID or URI
countryNoCountry code for localized content (e.g., 'US', 'GB')

Implementation Reference

  • The handler function for the MCP 'get_artist_top_tracks' tool. It destructures the input arguments and delegates the API call to SpotifyService.getArtistTopTracks.
    handler: async (args: any, spotifyService: SpotifyService) => {
      const { token, artistId, country = "US" } = args;
      return await spotifyService.getArtistTopTracks(token, artistId, country);
    },
  • The input schema for the 'get_artist_top_tracks' tool defining validation for token, artistId, and optional country parameters.
    schema: createSchema({
      token: commonSchemas.token(),
      artistId: commonSchemas.spotifyId("artist"),
      country: commonSchemas.country(),
    }),
  • Registration of all tools including artistTools (which contains get_artist_top_tracks) into the central allTools registry used by ToolRegistrar for MCP tool exposure.
    export const allTools: ToolsRegistry = {
      ...albumTools,
    
      ...artistTools,
    
      ...trackTools,
    
      ...playlistTools,
    
      ...playbackTools,
    
      ...userTools,
    
      ...searchTools,
    };
  • The SpotifyService helper method that performs the actual Spotify API request to retrieve the top tracks for an artist in a specific market.
    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
      );
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behaviors: it returns a ranked list ('Top 10 tracks ranked by global popularity'), includes market-specific variations ('Results can vary by country/region'), and has authentication requirements ('Valid Spotify access token'). However, it lacks details on rate limits, error handling, or pagination, which would be beneficial for a tool accessing external API data.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (USE CASES, WHAT IT RETURNS, EXAMPLES, etc.), making it easy to scan. However, it is somewhat verbose (e.g., the USE CASES list includes five items, some of which are redundant like 'Quick introduction' and 'Understanding which songs made an artist famous'). While informative, it could be more concise by consolidating similar points.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (3 parameters, no output schema, no annotations), the description is largely complete. It covers purpose, usage, return values, examples, market specificity, and requirements. The main gap is the lack of an output schema, but the 'WHAT IT RETURNS' section partially compensates by listing return data types (e.g., 'Track names, album information'). However, it doesn't specify the exact structure or data types of the response, which could be improved.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all three parameters (token, artistId, country) with clear descriptions. The description adds minimal value beyond this: it mentions 'Use country parameter for region-specific results' and 'Defaults to US market if not specified,' which slightly elaborates on the country parameter but doesn't provide significant additional semantics. This meets the baseline score of 3 when schema coverage is high.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Discover an artist's most popular and widely-played tracks based on global streaming data.' It specifies the verb ('discover'), resource ('artist's tracks'), and scope ('most popular and widely-played'), distinguishing it from siblings like get_artist_albums (which returns albums) or get_track (which returns a single track).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit usage guidance through dedicated sections: 'USE CASES' lists five specific scenarios (e.g., 'Quick introduction to an artist's biggest hits'), and 'REQUIREMENTS' states prerequisites ('Valid Spotify access token', 'Artist must have released tracks'). It also distinguishes when to use this tool versus alternatives by specifying it returns 'Top 10 tracks ranked by global popularity,' unlike get_top_tracks (which likely returns user-specific top tracks).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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