Skip to main content
Glama
superseoworld

MCP Spotify Server

get_recommendations

Generate personalized Spotify track recommendations using seed tracks, artists, or genres to discover new music aligned with your preferences.

Instructions

Get track recommendations based on seed tracks, artists, or genres

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
seed_tracksNoArray of Spotify track IDs or URIs
seed_artistsNoArray of Spotify artist IDs or URIs
seed_genresNoArray of genre names
limitNoMaximum number of recommendations (1-100)

Implementation Reference

  • Core handler function for the get_recommendations tool. Validates arguments, extracts Spotify IDs from URIs, builds query parameters, and calls the Spotify recommendations API.
    async getRecommendations(args: RecommendationsArgs) {
      const { 
        seed_tracks = [], 
        seed_artists = [], 
        seed_genres = [], 
        limit = 20 
      } = args;
    
      if (seed_tracks.length + seed_artists.length + seed_genres.length === 0) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'At least one seed (tracks, artists, or genres) must be provided'
        );
      }
    
      if (limit < 1 || limit > 100) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Limit must be between 1 and 100'
        );
      }
    
      const trackIds = seed_tracks.map(this.extractTrackId);
      const artistIds = seed_artists.map(id => 
        id.startsWith('spotify:artist:') ? id.split(':')[2] : id
      );
    
      const params = {
        seed_tracks: trackIds.length ? trackIds.join(',') : undefined,
        seed_artists: artistIds.length ? artistIds.join(',') : undefined,
        seed_genres: seed_genres.length ? seed_genres.join(',') : undefined,
        limit
      };
    
      return this.api.makeRequest(`/recommendations${this.api.buildQueryString(params)}`);
    }
  • TypeScript interface defining the input parameters for the get_recommendations tool handler.
    export interface RecommendationsArgs {
      seed_tracks?: string[];
      seed_artists?: string[];
      seed_genres?: string[];
      limit?: number;
    }
  • src/index.ts:344-375 (registration)
    Tool registration in MCP server's listTools response, including name, description, and JSON schema for input validation.
    {
      name: 'get_recommendations',
      description: 'Get track recommendations based on seed tracks, artists, or genres',
      inputSchema: {
        type: 'object',
        properties: {
          seed_tracks: {
            type: 'array',
            items: { type: 'string' },
            description: 'Array of Spotify track IDs or URIs'
          },
          seed_artists: {
            type: 'array',
            items: { type: 'string' },
            description: 'Array of Spotify artist IDs or URIs'
          },
          seed_genres: {
            type: 'array',
            items: { type: 'string' },
            description: 'Array of genre names'
          },
          limit: {
            type: 'number',
            description: 'Maximum number of recommendations (1-100)',
            minimum: 1,
            maximum: 100,
            default: 20
          }
        },
        required: []
      },
    },
  • src/index.ts:797-803 (registration)
    Dispatch case in the MCP callTool handler that routes get_recommendations calls to the TracksHandler implementation.
    case 'get_recommendations': {
      const args = this.validateArgs<RecommendationsArgs>(request.params.arguments || {}, []);
      const result = await this.tracksHandler.getRecommendations(args);
      return {
        content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
      };
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. It states the tool 'Get track recommendations' but lacks details on permissions, rate limits, response format, or how recommendations are generated (e.g., algorithm, personalization). For a tool with no annotation coverage, this leaves significant gaps in understanding its operational behavior.

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. Every part ('Get track recommendations based on seed tracks, artists, or genres') directly contributes to understanding the tool's function, 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 no annotations and no output schema, the description is incomplete for a tool with 4 parameters and behavioral complexity. It covers the basic purpose but lacks details on usage context, behavioral traits (e.g., response format, error handling), and output expectations, which are critical for an AI agent to invoke it correctly without structured guidance.

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%, providing clear documentation for all parameters (seed_tracks, seed_artists, seed_genres, limit). The description adds minimal value by mentioning these parameters in context ('based on seed tracks, artists, or genres') but doesn't explain semantics beyond what the schema already covers, such as how seeds are weighted or combined.

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 'track recommendations', specifying the purpose as generating recommendations based on seed inputs. It distinguishes from siblings like 'search' or 'get_available_genres' by focusing on personalized recommendations rather than direct retrieval or genre listing. However, it doesn't explicitly differentiate from all siblings (e.g., 'get_artist_related_artists' also provides recommendations but for 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 prerequisites (e.g., needing seed inputs), exclusions (e.g., not for general search), or comparisons to siblings like 'search' (for broad queries) or 'get_artist_related_artists' (for artist-specific recommendations). Usage is implied through the mention of seed parameters but not explicitly stated.

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