Skip to main content
Glama

Discogs MCP Server

by cswkim
artist.ts1.88 kB
import { isDiscogsError } from '../errors.js'; import { ArtistReleasesSchema, ArtistSchema, type Artist, type ArtistIdParam, type ArtistReleases, type ArtistReleasesParams, } from '../types/artist.js'; import { DiscogsService } from './index.js'; /** * Service for Discogs Artist-related operations */ export class ArtistService extends DiscogsService { constructor() { super('/artists'); } /** * Get an artist * * @param params - Parameters containing the artist ID * @returns {Artist} The artist information * @throws {DiscogsResourceNotFoundError} If the artist cannot be found * @throws {Error} If there's an unexpected error */ 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)}`); } } /** * Get an artist's releases * * @param params - Parameters containing the artist ID and pagination options * @returns {ArtistReleases} The artist releases * @throws {DiscogsResourceNotFoundError} If the artist cannot be found * @throws {Error} If there's an unexpected error */ async getReleases({ artist_id, ...options }: ArtistReleasesParams): Promise<ArtistReleases> { try { const response = await this.request<ArtistReleases>(`/${artist_id}/releases`, { params: options, }); const validatedResponse = ArtistReleasesSchema.parse(response); return validatedResponse; } catch (error) { if (isDiscogsError(error)) { throw error; } throw new Error(`Failed to get artist releases: ${String(error)}`); } } }

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/cswkim/discogs-mcp-server'

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