Skip to main content
Glama

get_artist_related_artists

Find artists similar to a given artist using Spotify's catalog data to discover new music and expand your listening preferences.

Instructions

Get Spotify catalog information about artists similar to a given artist

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe Spotify ID or URI for the artist

Implementation Reference

  • The core handler function for the 'get_artist_related_artists' tool. It extracts the Spotify artist ID from the provided arguments and calls the Spotify API endpoint `/artists/{id}/related-artists` to fetch related artists.
    async getArtistRelatedArtists(args: ArtistRelatedArtistsArgs) { const artistId = this.extractArtistId(args.id); return this.api.makeRequest(`/artists/${artistId}/related-artists`); }
  • TypeScript interface definitions for the tool's input arguments. ArtistRelatedArtistsArgs extends ArtistArgs, which requires a single 'id' string (Spotify artist ID or URI).
    export interface ArtistArgs { id: string; } export interface ArtistTopTracksArgs extends ArtistArgs, MarketParams {} export interface ArtistRelatedArtistsArgs extends ArtistArgs {}
  • src/index.ts:189-202 (registration)
    Tool registration in the MCP server's listTools handler, including name, description, and input schema validation.
    { name: 'get_artist_related_artists', description: 'Get Spotify catalog information about artists similar to a given artist', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'The Spotify ID or URI for the artist' } }, required: ['id'] }, },
  • src/index.ts:734-740 (registration)
    Dispatch logic in the MCP server's callTool handler that validates arguments and delegates to the ArtistsHandler's getArtistRelatedArtists method.
    case 'get_artist_related_artists': { const args = this.validateArgs<ArtistRelatedArtistsArgs>(request.params.arguments, ['id']); const result = await this.artistsHandler.getArtistRelatedArtists(args); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }
  • Helper method used by the handler to normalize Spotify artist IDs or URIs to plain IDs.
    private extractArtistId(id: string): string { return id.startsWith('spotify:artist:') ? id.split(':')[2] : id; }

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