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
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The Spotify ID or URI for the artist |
Implementation Reference
- src/handlers/artists.ts:57-60 (handler)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`); }
- src/types/artists.ts:3-9 (schema)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) }], }; }
- src/handlers/artists.ts:14-16 (helper)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; }