Skip to main content
Glama
cswkim

Discogs MCP Server

by cswkim

get_marketplace_release_stats

Retrieve marketplace statistics for a Discogs music release to analyze pricing trends and availability across different currencies.

Instructions

Retrieve marketplace statistics for the provided Release ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
release_idYes
curr_abbrNo

Implementation Reference

  • The main handler for the 'get_marketplace_release_stats' tool. Defines the tool object with name, description, input schema, and the execute function that creates a MarketplaceService instance and calls getReleaseStats on the provided arguments.
    export const getMarketplaceReleaseStatsTool: Tool<FastMCPSessionAuth, typeof ReleaseParamsSchema> =
      {
        name: 'get_marketplace_release_stats',
        description: 'Retrieve marketplace statistics for the provided Release ID',
        parameters: ReleaseParamsSchema,
        execute: async (args) => {
          try {
            const marketplaceService = new MarketplaceService();
            const stats = await marketplaceService.getReleaseStats(args);
    
            return JSON.stringify(stats);
          } catch (error) {
            throw formatDiscogsError(error);
          }
        },
      };
  • Input parameters schema for the tool, extending ReleaseIdParamSchema with optional currency code.
    export const ReleaseParamsSchema = ReleaseIdParamSchema.extend({
      curr_abbr: CurrencyCodeSchema.optional(),
    });
  • Registration of the tool in the FastMCP server within the registerMarketplaceTools function.
    server.addTool(getMarketplaceReleaseStatsTool);
  • Supporting helper method in MarketplaceService that performs the actual API call to retrieve marketplace stats for a release.
    async getReleaseStats({ release_id, ...options }: ReleaseParams): Promise<ReleaseStatsResponse> {
      try {
        const response = await this.request<ReleaseStatsResponse>(`/stats/${release_id}`, {
          params: options,
        });
    
        const validatedResponse = ReleaseStatsResponseSchema.parse(response);
        return validatedResponse;
      } catch (error) {
        if (isDiscogsError(error)) {
          throw error;
        }
    
        throw new Error(`Failed to get release stats: ${String(error)}`);
      }
    }
  • Base schema for release_id parameter used in ReleaseParamsSchema.
    export const ReleaseIdParamSchema = z.object({
      release_id: z.number().min(1, 'The release_id must be non-zero'),
    });

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