Skip to main content
Glama
superseoworld

MCP Spotify Server

get_album_tracks

Retrieve track listings and details from Spotify albums using album ID or URI, with options to limit results and paginate through tracks.

Instructions

Get Spotify catalog information for an album's tracks

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe Spotify ID or URI for the album
limitNoMaximum number of tracks to return (1-50)
offsetNoThe index of the first track to return

Implementation Reference

  • The core handler function that implements the get_album_tracks tool. It extracts the album ID, validates pagination parameters (limit 1-50, offset >=0), and makes a Spotify API request to fetch the album's tracks.
    async getAlbumTracks(args: AlbumTracksArgs) {
      const albumId = this.extractAlbumId(args.id);
      const { limit = 20, offset = 0 } = args;
    
      if (limit < 1 || limit > 50) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Limit must be between 1 and 50'
        );
      }
    
      if (offset < 0) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Offset must be non-negative'
        );
      }
    
      const params = { limit, offset };
      return this.api.makeRequest(
        `/albums/${albumId}/tracks${this.api.buildQueryString(params)}`
      );
    }
  • src/index.ts:252-278 (registration)
    Registers the get_album_tracks tool in the MCP server's listTools response, defining its name, description, and input schema.
    {
      name: 'get_album_tracks',
      description: 'Get Spotify catalog information for an album\'s tracks',
      inputSchema: {
        type: 'object',
        properties: {
          id: {
            type: 'string',
            description: 'The Spotify ID or URI for the album'
          },
          limit: {
            type: 'number',
            description: 'Maximum number of tracks to return (1-50)',
            minimum: 1,
            maximum: 50,
            default: 20
          },
          offset: {
            type: 'number',
            description: 'The index of the first track to return',
            minimum: 0,
            default: 0
          }
        },
        required: ['id']
      },
    },
  • src/index.ts:758-764 (registration)
    Handles incoming callTool requests for get_album_tracks by validating arguments and delegating execution to the AlbumsHandler instance.
    case 'get_album_tracks': {
      const args = this.validateArgs<AlbumTracksArgs>(request.params.arguments, ['id']);
      const result = await this.albumsHandler.getAlbumTracks(args);
      return {
        content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
      };
    }
  • TypeScript type definitions for AlbumTracksArgs (used in handler and validation), extending AlbumArgs and PaginationParams for input structure.
    import { PaginationParams } from './common.js';
    
    export interface AlbumArgs {
      id: string;
    }
    
    export interface AlbumTracksArgs extends AlbumArgs, PaginationParams {}
    
    export interface MultipleAlbumsArgs {
      ids: string[];
    }
    
    export interface NewReleasesArgs extends PaginationParams {
      country?: string;
    }
  • Helper method to normalize Spotify album IDs or URIs to plain IDs, used in getAlbumTracks.
    private extractAlbumId(id: string): string {
      return id.startsWith('spotify:album:') ? id.split(':')[2] : 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 action is to 'Get' information, implying a read-only operation, but does not cover aspects like rate limits, authentication needs, error handling, or pagination behavior (beyond what the schema hints at with limit/offset). This is a significant gap for a tool with no annotation coverage.

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 front-loads the core purpose without unnecessary words. It earns its place by clearly stating what the tool does, making it appropriately sized and well-structured.

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?

Given the tool's moderate complexity (3 parameters, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose but lacks details on usage guidelines, behavioral traits, and output format, which are needed for full contextual understanding. Without an output schema, the description should ideally hint at return values, but it does not.

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 fully documents the parameters (id, limit, offset) with descriptions and constraints. The description adds no additional meaning beyond what the schema provides, such as explaining the format of the 'id' (Spotify ID or URI) or how pagination works. Baseline 3 is appropriate when the schema does the heavy lifting.

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 verb ('Get') and resource ('Spotify catalog information for an album's tracks'), making the purpose specific and understandable. However, it does not explicitly differentiate from sibling tools like 'get_album' or 'get_playlist_tracks', which handle related but distinct resources, so it lacks sibling differentiation.

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, such as needing an album ID, or compare it to siblings like 'get_album' (which might include track info) or 'get_playlist_tracks', leaving usage context implied at best.

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