Skip to main content
Glama
cswkim

Discogs MCP Server

by cswkim

get_label

Retrieve label information from Discogs music database by providing a label ID to access catalog details and metadata.

Instructions

Get a label

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
label_idYes

Implementation Reference

  • The execute handler function of the get_label tool, which creates a LabelService instance and calls its get method to fetch the label data, then returns it as JSON string.
    execute: async (args) => { try { const labelService = new LabelService(); const label = await labelService.get(args); return JSON.stringify(label); } catch (error) { throw formatDiscogsError(error); } },
  • Input parameter schema for the get_label tool, defining the required label_id as a number.
    export const LabelIdParamSchema = z.object({ label_id: z.number(), });
  • Registration of the getLabelTool (named 'get_label') to the FastMCP server.
    server.addTool(getLabelTool);
  • The LabelService.get method, which performs the HTTP request to the Discogs API for the label and validates the response using LabelSchema.
    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)}`); } }
  • Output validation schema (LabelSchema) used by LabelService to parse the Discogs API response for label data.
    export const LabelSchema = z.object({ id: z.number(), contact_info: z.string().optional(), data_quality: z.string().optional(), images: z.array(ImageSchema).optional(), name: z.string(), parent_label: z .object({ id: z.number(), name: z.string(), resource_url: urlOrEmptySchema(), }) .optional(), profile: z.string().optional(), releases_url: urlOrEmptySchema().optional(), resource_url: urlOrEmptySchema(), sublabels: z .array( z.object({ id: z.number(), name: z.string(), resource_url: urlOrEmptySchema(), }), ) .optional(), uri: urlOrEmptySchema().optional(), urls: z.array(z.string()).optional(), });

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

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