get_artist
Retrieve detailed artist information from Discogs by providing a specific artist ID. Simplify music catalog management and enhance your Discogs collection with accurate metadata.
Instructions
Get an artist
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| artist_id | Yes |
Implementation Reference
- src/tools/database.ts:62-76 (handler)Tool definition and handler (execute function) for 'get_artist', which uses ArtistService to fetch artist data by ID and returns JSON string.export const getArtistTool: Tool<FastMCPSessionAuth, typeof ArtistIdParamSchema> = { name: 'get_artist', description: 'Get an artist', parameters: ArtistIdParamSchema, execute: async (args) => { try { const artistService = new ArtistService(); const artist = await artistService.get(args); return JSON.stringify(artist); } catch (error) { throw formatDiscogsError(error); } }, };
- src/types/artist.ts:8-10 (schema)Input schema defining the required 'artist_id' number parameter for the get_artist tool.export const ArtistIdParamSchema = z.object({ artist_id: z.number(), });
- src/tools/database.ts:261-261 (registration)Registration of the get_artist tool via server.addTool in the registerDatabaseTools function.server.addTool(getArtistTool);
- src/types/artist.ts:28-61 (schema)Output validation schema (ArtistSchema) used in ArtistService to parse the fetched artist data.export const ArtistSchema = z.object({ id: z.number(), aliases: z .array( z.object({ id: z.number(), name: z.string(), resource_url: urlOrEmptySchema(), thumbnail_url: urlOrEmptySchema().optional(), }), ) .optional(), data_quality: z.string().optional(), images: z.array(ImageSchema).optional(), members: z .array( z.object({ id: z.number(), active: z.boolean().optional(), name: z.string(), resource_url: urlOrEmptySchema(), thumbnail_url: urlOrEmptySchema().optional(), }), ) .optional(), name: z.string(), namevariations: z.array(z.string()).optional(), profile: z.string().optional(), realname: z.string().optional(), releases_url: urlOrEmptySchema().optional(), resource_url: urlOrEmptySchema(), uri: urlOrEmptySchema().optional(), urls: z.array(z.string()).optional(), });
- src/services/artist.ts:28-41 (helper)ArtistService.get method, which performs the HTTP request to Discogs API for the artist and validates with ArtistSchema.async get({ artist_id }: ArtistIdParam): Promise<Artist> { try { const response = await this.request<Artist>(`/${artist_id}`); const validatedResponse = ArtistSchema.parse(response); return validatedResponse; } catch (error) { if (isDiscogsError(error)) { throw error; } throw new Error(`Failed to get artist: ${String(error)}`); } }