Skip to main content
Glama
cswkim

Discogs MCP Server

by cswkim

get_marketplace_listing

Retrieve detailed marketplace listings from Discogs by providing a listing ID, with optional currency selection for pricing information.

Instructions

Get a listing from the marketplace

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
listing_idYes
curr_abbrNo

Implementation Reference

  • MCP tool definition and handler (execute function) for 'get_marketplace_listing', which calls MarketplaceService.getListing(args) and returns JSON string.
    export const getMarketplaceListingTool: Tool<FastMCPSessionAuth, typeof ListingGetParamsSchema> = {
      name: 'get_marketplace_listing',
      description: 'Get a listing from the marketplace',
      parameters: ListingGetParamsSchema,
      execute: async (args) => {
        try {
          const marketplaceService = new MarketplaceService();
          const listing = await marketplaceService.getListing(args);
    
          return JSON.stringify(listing);
        } catch (error) {
          throw formatDiscogsError(error);
        }
      },
    };
  • Input schema (parameters) for the get_marketplace_listing tool: ListingGetParamsSchema extending ListingIdParamSchema with optional currency.
    export const ListingIdParamSchema = z.object({
      listing_id: z.number().int(),
    });
    
    /**
     * The listing get parameters schema
     */
    export const ListingGetParamsSchema = ListingIdParamSchema.extend({
      curr_abbr: CurrencyCodeSchema.optional(),
    });
  • Registration function that adds the getMarketplaceListingTool (among others) to the FastMCP server.
    export function registerMarketplaceTools(server: FastMCP): void {
      server.addTool(getUserInventoryTool);
      server.addTool(getMarketplaceListingTool);
      server.addTool(createMarketplaceListingTool);
      server.addTool(updateMarketplaceListingTool);
      server.addTool(deleteMarketplaceListingTool);
      server.addTool(getMarketplaceOrderTool);
      server.addTool(editMarketplaceOrderTool);
      server.addTool(getMarketplaceOrdersTool);
      server.addTool(getMarketplaceOrderMessagesTool);
      server.addTool(createMarketplaceOrderMessageTool);
      server.addTool(getMarketplaceReleaseStatsTool);
    }
  • MarketplaceService.getListing method: performs the actual Discogs API request to fetch the listing and validates with ListingSchema.
    async getListing({ listing_id, ...options }: ListingGetParams): Promise<Listing> {
      try {
        const response = await this.request<Listing>(`/listings/${listing_id}`, {
          params: options,
        });
    
        const validatedResponse = ListingSchema.parse(response);
        return validatedResponse;
      } catch (error) {
        if (isDiscogsError(error)) {
          throw error;
        }
    
        throw new Error(`Failed to get listing: ${String(error)}`);
      }
    }

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