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
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes |
Implementation Reference
- src/tools/inventoryExport.ts:11-26 (handler)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); } }, };
- src/types/inventory.ts:5-7 (schema)Zod schema for input parameters: object with required 'id' field of type number.export const InventoryIdParamSchema = z.object({ id: z.number(), });
- src/tools/inventoryExport.ts:85-90 (registration)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); }
- src/services/inventory.ts:25-35 (helper)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)}`); } }