Skip to main content
Glama
superseoworld

MCP Spotify Server

get_artist_top_tracks

Retrieve an artist's most popular tracks from Spotify's catalog using their ID, with optional market filtering for regional availability.

Instructions

Get Spotify catalog information about an artist's top tracks

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe Spotify ID or URI for the artist
marketNoOptional. An ISO 3166-1 alpha-2 country code

Implementation Reference

  • Core handler function that implements the get_artist_top_tracks tool logic: extracts artist ID, validates market, calls Spotify API for top tracks.
    async getArtistTopTracks(args: ArtistTopTracksArgs) {
      const artistId = this.extractArtistId(args.id);
    
      if (!args.market) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'market parameter is required for top tracks'
        );
      }
    
      return this.api.makeRequest(
        `/artists/${artistId}/top-tracks?market=${args.market}`
      );
    }
  • TypeScript interfaces defining input args for the tool: ArtistArgs (id) extended by ArtistTopTracksArgs with MarketParams.
    export interface ArtistArgs {
      id: string;
    }
    
    export interface ArtistTopTracksArgs extends ArtistArgs, MarketParams {}
  • src/index.ts:171-188 (registration)
    MCP tool registration in listTools handler: defines name, description, and input schema matching ArtistTopTracksArgs.
    {
      name: 'get_artist_top_tracks',
      description: 'Get Spotify catalog information about an artist\'s top tracks',
      inputSchema: {
        type: 'object',
        properties: {
          id: {
            type: 'string',
            description: 'The Spotify ID or URI for the artist'
          },
          market: {
            type: 'string',
            description: 'Optional. An ISO 3166-1 alpha-2 country code'
          }
        },
        required: ['id']
      },
    },
  • src/index.ts:726-731 (registration)
    Dispatch logic in CallToolRequest handler: validates args, calls artistsHandler.getArtistTopTracks, returns JSON result.
    case 'get_artist_top_tracks': {
      const args = this.validateArgs<ArtistTopTracksArgs>(request.params.arguments, ['id']);
      const result = await this.artistsHandler.getArtistTopTracks(args);
      return {
        content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
      };
  • Helper method used by getArtistTopTracks to normalize Spotify artist ID from ID or URI.
    private extractArtistId(id: string): string {
      return id.startsWith('spotify:artist:') ? id.split(':')[2] : id;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states this is a read operation ('Get'), but doesn't mention authentication requirements, rate limits, response format, or whether this returns a complete list or limited set of tracks. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

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

Conciseness5/5

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

The description is a single, efficient sentence that communicates the core purpose without unnecessary words. It's appropriately sized for a simple read operation and front-loads the essential information.

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

Completeness3/5

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

For a simple read operation with 2 parameters and 100% schema coverage, the description is minimally adequate. However, with no annotations and no output schema, it should ideally provide more context about authentication, response format, or limitations. The description alone doesn't fully compensate for the lack of structured metadata.

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 schema description coverage is 100%, with both parameters clearly documented in the schema. The description doesn't add any parameter-specific information beyond what's already in the schema, so it meets the baseline expectation when schema documentation is complete.

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 action ('Get Spotify catalog information') and resource ('about an artist's top tracks'), making the purpose immediately understandable. It distinguishes this from other artist-related tools like get_artist or get_artist_albums by specifying 'top tracks', though it doesn't explicitly contrast with siblings like get_artist_related_artists.

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 doesn't mention when this is appropriate compared to general artist information tools or search tools, nor does it specify any prerequisites or contextual constraints for usage.

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

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