Skip to main content
Glama
cswkim

Discogs MCP Server

by cswkim

get_label_releases

Retrieve releases associated with a specific label from the Discogs music database to explore catalog content and manage collections.

Instructions

Returns a list of Releases associated with the label

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
label_idYes
pageNo
per_pageNo
sortNo
sort_orderNo

Implementation Reference

  • The tool object definition including the execute handler function that performs the core logic by calling LabelService.getReleases.
    export const getLabelReleasesTool: Tool<FastMCPSessionAuth, typeof LabelReleasesParamsSchema> = {
      name: 'get_label_releases',
      description: 'Returns a list of Releases associated with the label',
      parameters: LabelReleasesParamsSchema,
      execute: async (args) => {
        try {
          const labelService = new LabelService();
          const labelReleases = await labelService.getReleases(args);
    
          return JSON.stringify(labelReleases);
        } catch (error) {
          throw formatDiscogsError(error);
        }
      },
    };
  • Zod schema for input parameters of the get_label_releases tool, merging label ID and query params.
    /**
     * Schema for label releases parameters
     */
    export const LabelReleasesParamsSchema = LabelIdParamSchema.merge(QueryParamsSchema());
  • Registration of the get_label_releases tool with the FastMCP server.
    server.addTool(getLabelReleasesTool);
  • Supporting method in LabelService that fetches releases for a label from the Discogs API, called by the tool handler.
    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)}`);
      }
    }
  • Base schema for label ID parameter, merged into LabelReleasesParamsSchema.
    export const LabelIdParamSchema = z.object({
      label_id: z.number(),
    });

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