Skip to main content
Glama
cswkim

Discogs MCP Server

by cswkim

download_inventory_export

Download your Discogs inventory data as a CSV file for analysis or backup purposes.

Instructions

Download an inventory export as a CSV

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes

Implementation Reference

  • Defines the MCP Tool object for 'download_inventory_export', including the execute handler function that instantiates InventoryService and calls downloadExport to retrieve the CSV.
    export const downloadInventoryExportTool: Tool<FastMCPSessionAuth, typeof InventoryIdParamSchema> =
      {
        name: 'download_inventory_export',
        description: 'Download an inventory export as a CSV',
        parameters: InventoryIdParamSchema,
        execute: async (args) => {
          try {
            const inventoryService = new InventoryService();
            const csv = await inventoryService.downloadExport(args);
    
            return csv;
          } catch (error) {
            throw formatDiscogsError(error);
          }
        },
      };
  • Zod schema for input parameters: object with required 'id' field of type number.
    export const InventoryIdParamSchema = z.object({
      id: z.number(),
    });
  • Function that registers the downloadInventoryExportTool to the FastMCP server instance (along with related inventory tools). This function is imported and called in src/tools/index.ts.
    export function registerInventoryExportTool(server: FastMCP): void {
      server.addTool(inventoryExportTool);
      server.addTool(getInventoryExportsTool);
      server.addTool(getInventoryExportTool);
      server.addTool(downloadInventoryExportTool);
    }
  • The core helper method in InventoryService that makes the HTTP request to Discogs API endpoint '/inventory/export/{id}/download' to fetch the CSV content.
    async downloadExport({ id }: InventoryIdParam): Promise<string> {
      try {
        const response = await this.request<string>(`/export/${id}/download`);
        return response;
      } catch (error) {
        if (isDiscogsError(error)) {
          throw error;
        }
        throw new Error(`Failed to download inventory export: ${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