Skip to main content
Glama

get_artist_top_tracks

Retrieve an artist's most popular tracks on Spotify by providing their artist ID. Use this tool to access top-performing songs for music analysis or playlist creation.

Instructions

Get top tracks for an artist
Args:
    artist_id: Spotify artist ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
artist_idYes

Implementation Reference

  • Core handler function in SpotifyClient that fetches the artist's top tracks using the spotipy library and returns the results as a dictionary or error string.
    async def get_artist_top_tracks(self, artist_id: str) -> dict:
        """
        Get an artist's top tracks
        - artist_id: Spotify artist ID
        """
        try:
            # Note: market parameter defaults to user's country
            results = self.sp.artist_top_tracks(artist_id)
            return results
        except Exception as e:
            return f"Error getting artist top tracks: {str(e)}"
  • main.py:168-175 (registration)
    MCP tool registration decorator and wrapper function that calls the SpotifyClient's get_artist_top_tracks method.
    @mcp.tool()
    async def get_artist_top_tracks(artist_id: str) -> str:
        """
        Get top tracks for an artist
        Args:
            artist_id: Spotify artist ID
        """
        return await client.get_artist_top_tracks(artist_id)
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool 'Get top tracks for an artist', implying a read-only operation, but does not specify details like rate limits, authentication requirements, error handling, or what 'top tracks' means (e.g., based on popularity, region, or time). For a tool with zero annotation coverage, this is inadequate.

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 brief and front-loaded with the main purpose, followed by parameter details. It uses only two sentences, with no wasted words, making it efficient. However, the structure could be slightly improved by integrating the parameter info more seamlessly, but it remains highly concise.

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

Completeness2/5

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

Given the complexity of a music API tool with no annotations, no output schema, and low schema description coverage (0%), the description is incomplete. It lacks details on return values (e.g., track list format), error cases, authentication needs, and usage context, making it insufficient for an agent to use the tool effectively without additional assumptions.

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?

The description includes an 'Args' section that documents the 'artist_id' parameter as a 'Spotify artist ID', adding meaning beyond the input schema, which has 0% description coverage. However, it does not explain how to obtain this ID, format constraints, or provide examples, leaving some gaps in parameter understanding.

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

Purpose4/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: 'Get top tracks for an artist' specifies the verb ('Get') and resource ('top tracks for an artist'), making it easy to understand what the tool does. However, it does not explicitly differentiate from sibling tools like 'get_top_artists' or 'search_spotify', which could provide similar or overlapping functionality, preventing a score of 5.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It does not mention prerequisites (e.g., authentication), context (e.g., for recommendations or playback), or exclusions (e.g., not for searching tracks). With sibling tools like 'get_top_artists' and 'search_spotify' available, this lack of usage context is a significant gap.

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/ashwanth1109/mcp-spotify'

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