Skip to main content
Glama

get-recommendations

Generate personalized Spotify track recommendations using specific tracks, artists, or genres as seeds. Customize results by setting a limit to discover tailored playlists.

Instructions

Get track recommendations based on seeds

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of tracks to return (1-100, default: 20)
seedArtistsNoArray of Spotify artist IDs to use as seeds (optional)
seedGenresNoArray of genre names to use as seeds (optional)
seedTracksNoArray of Spotify track IDs to use as seeds (optional)

Implementation Reference

  • Handler for 'get-recommendations' tool: parses arguments with Zod schema, validates seeds, builds query params for Spotify /recommendations endpoint, fetches data via spotifyApiRequest, formats track list response.
          if (name === "get-recommendations") {
            const { seedTracks, seedArtists, seedGenres, limit } = GetRecommendationsSchema.parse(args);
            
            if (!seedTracks && !seedArtists && !seedGenres) {
              throw new Error("At least one seed (tracks, artists, or genres) must be provided");
            }
            
            const params = new URLSearchParams();
            
            if (limit) params.append("limit", limit.toString());
            if (seedTracks) params.append("seed_tracks", seedTracks.join(","));
            if (seedArtists) params.append("seed_artists", seedArtists.join(","));
            if (seedGenres) params.append("seed_genres", seedGenres.join(","));
            
            const recommendations = await spotifyApiRequest(`/recommendations?${params}`);
            
            const formattedRecommendations = recommendations.tracks
              .map(
                (track: any) => `
    Track: ${track.name}
    Artist: ${track.artists.map((a: any) => a.name).join(", ")}
    Album: ${track.album.name}
    ID: ${track.id}
    Duration: ${Math.floor(track.duration_ms / 1000 / 60)}:${(
                  Math.floor(track.duration_ms / 1000) % 60
                )
                  .toString()
                  .padStart(2, "0")}
    URL: ${track.external_urls.spotify}
    ---`
              )
              .join("\n");
            
            return {
              content: [
                {
                  type: "text",
                  text: recommendations.tracks.length > 0
                    ? `Recommended tracks:\n${formattedRecommendations}`
                    : "No recommendations found.",
                },
              ],
            };
          }
  • Zod schema for validating input parameters to get-recommendations tool: seedTracks, seedArtists, seedGenres (arrays of strings, optional), limit (number 1-100, default 20). Used in handler for parsing.
    const GetRecommendationsSchema = z.object({
      seedTracks: z.array(z.string()).optional(),
      seedArtists: z.array(z.string()).optional(),
      seedGenres: z.array(z.string()).optional(),
      limit: z.number().min(1).max(100).default(20),
    });
  • index.ts:772-805 (registration)
    Tool registration in ListTools response: defines name, description, and inputSchema matching the Zod schema for get-recommendations.
    {
      name: "get-recommendations",
      description: "Get track recommendations based on seeds",
      inputSchema: {
        type: "object",
        properties: {
          seedTracks: {
            type: "array",
            items: {
              type: "string",
            },
            description: "Array of Spotify track IDs to use as seeds (optional)",
          },
          seedArtists: {
            type: "array",
            items: {
              type: "string",
            },
            description: "Array of Spotify artist IDs to use as seeds (optional)",
          },
          seedGenres: {
            type: "array",
            items: {
              type: "string",
            },
            description: "Array of genre names to use as seeds (optional)",
          },
          limit: {
            type: "number",
            description: "Maximum number of tracks to return (1-100, default: 20)",
          },
        },
      },
    },
Behavior2/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 states the tool's function but omits critical details such as authentication requirements (implied by sibling 'auth-spotify'), rate limits, response format, or error handling. This is a significant gap for a tool that likely interacts with an external API.

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 succinctly conveying the tool's function, making it easy for an agent to parse quickly.

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 an API-based recommendation tool with no annotations and no output schema, the description is incomplete. It fails to address authentication, response structure, or error cases, leaving the agent with insufficient context for reliable invocation in a real-world scenario.

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%, with clear parameter documentation in the input schema (e.g., 'limit' range, optional arrays for seeds). The description adds no additional parameter semantics beyond the schema, but the schema is comprehensive, so the baseline score of 3 is appropriate.

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 track recommendations') and the mechanism ('based on seeds'), which is specific and informative. It doesn't explicitly distinguish from siblings like 'search-spotify' or 'get-top-tracks', but the focus on recommendations from seeds is reasonably distinct.

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 like 'search-spotify' for general searches or 'get-top-tracks' for user-specific tracks. It lacks context about prerequisites (e.g., needing seeds) or exclusions, leaving the agent to infer usage from the tool name alone.

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

Related 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/imprvhub/mcp-claude-spotify'

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