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
| Name | Required | Description | Default |
|---|---|---|---|
| label_id | Yes |
Implementation Reference
- src/tools/database.ts:104-113 (handler)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); } },
- src/types/label.ts:9-11 (schema)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(), });
- src/tools/database.ts:263-263 (registration)Registration of the getLabelTool (named 'get_label') to the FastMCP server.server.addTool(getLabelTool);
- src/services/label.ts:25-38 (helper)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)}`); } }
- src/types/label.ts:28-55 (schema)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(), });