Skip to main content
Glama

Discogs MCP Server

by cswkim
label.ts1.81 kB
import { isDiscogsError } from '../errors.js'; import { type Label, type LabelIdParam, type LabelReleases, type LabelReleasesParams, LabelReleasesSchema, LabelSchema, } from '../types/label.js'; import { DiscogsService } from './index.js'; export class LabelService extends DiscogsService { constructor() { super('/labels'); } /** * Get a label * * @param params - Parameters containing the label ID * @returns {Label} The label information * @throws {DiscogsResourceNotFoundError} If the label cannot be found * @throws {Error} If there's an unexpected error */ async get({ label_id }: LabelIdParam): Promise<Label> { try { const response = await this.request<Label>(`/${label_id}`); const validatedResponse = LabelSchema.parse(response); return validatedResponse; } catch (error) { if (isDiscogsError(error)) { throw error; } throw new Error(`Failed to get label: ${String(error)}`); } } /** * Returns a list of Releases associated with the label * * @param params - Parameters containing the label ID and pagination options * @returns {LabelReleases} The label releases * @throws {DiscogsResourceNotFoundError} If the label cannot be found * @throws {Error} If there's an unexpected error */ async getReleases({ label_id, ...params }: LabelReleasesParams): Promise<LabelReleases> { try { const response = await this.request<LabelReleases>(`/${label_id}/releases`, { params, }); const validatedResponse = LabelReleasesSchema.parse(response); return validatedResponse; } catch (error) { if (isDiscogsError(error)) { throw error; } throw new Error(`Failed to get label 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