discogs-mcp-server 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import dotenv from 'dotenv';
4
4
  import { z } from 'zod';
5
5
 
6
6
  // src/version.ts
7
- var VERSION = "0.1.0";
7
+ var VERSION = "0.2.0";
8
8
 
9
9
  // src/config.ts
10
10
  dotenv.config();
@@ -167,21 +167,54 @@ var CurrencyCodeSchema = z.enum([
167
167
  "ZAR"
168
168
  // South African Rand
169
169
  ]);
170
- var PaginatedResponseSchema = (itemSchema, resultsFieldName) => z.object({
171
- pagination: z.object({
172
- page: z.number().int().min(0).optional(),
173
- per_page: z.number().int().min(0).optional(),
174
- pages: z.number().int().min(0),
175
- items: z.number().int().min(0),
176
- urls: z.object({
177
- first: z.string().url().optional(),
178
- prev: z.string().url().optional(),
179
- next: z.string().url().optional(),
180
- last: z.string().url().optional()
181
- })
170
+ var ImageSchema = z.object({
171
+ width: z.number().int().optional(),
172
+ height: z.number().int().optional(),
173
+ resource_url: urlOrEmptySchema(),
174
+ type: z.string().optional(),
175
+ uri: urlOrEmptySchema(),
176
+ uri150: urlOrEmptySchema().optional()
177
+ });
178
+ var FilteredResponseSchema = z.object({
179
+ filters: z.object({
180
+ applied: z.record(z.array(z.any())).default({}),
181
+ available: z.record(z.record(z.number().int())).default({})
182
182
  }),
183
+ filter_facets: z.array(
184
+ z.object({
185
+ title: z.string(),
186
+ id: z.string(),
187
+ values: z.array(
188
+ z.object({
189
+ title: z.string(),
190
+ value: z.string(),
191
+ count: z.number().int()
192
+ })
193
+ ),
194
+ allows_multiple_values: z.boolean()
195
+ })
196
+ )
197
+ });
198
+ var PaginationSchema = z.object({
199
+ page: z.number().int().min(0).optional(),
200
+ per_page: z.number().int().min(0).optional(),
201
+ pages: z.number().int().min(0),
202
+ items: z.number().int().min(0),
203
+ urls: z.object({
204
+ first: z.string().url().optional(),
205
+ prev: z.string().url().optional(),
206
+ next: z.string().url().optional(),
207
+ last: z.string().url().optional()
208
+ }).optional()
209
+ });
210
+ var PaginatedResponseSchema = (itemSchema, resultsFieldName) => z.object({
211
+ pagination: PaginationSchema,
183
212
  [resultsFieldName]: z.array(itemSchema)
184
213
  });
214
+ var PaginatedResponseWithObjectSchema = (itemSchema, resultsFieldName) => z.object({
215
+ pagination: PaginationSchema,
216
+ [resultsFieldName]: itemSchema
217
+ });
185
218
  var QueryParamsSchema = (validSortKeys = []) => z.object({
186
219
  // Pagination
187
220
  page: z.number().int().min(1).optional(),
@@ -190,6 +223,7 @@ var QueryParamsSchema = (validSortKeys = []) => z.object({
190
223
  sort: z.enum(validSortKeys).optional(),
191
224
  sort_order: z.enum(["asc", "desc"]).optional()
192
225
  });
226
+ var StatusSchema = z.enum(["Accepted", "Draft", "Deleted", "Rejected"]);
193
227
  var UsernameInputSchema = z.object({
194
228
  username: z.string().min(1, "username is required")
195
229
  });
@@ -218,16 +252,7 @@ var ArtistSchema = z.object({
218
252
  })
219
253
  ).optional(),
220
254
  data_quality: z.string().optional(),
221
- images: z.array(
222
- z.object({
223
- height: z.number().int().optional(),
224
- resource_url: urlOrEmptySchema(),
225
- type: z.string().optional(),
226
- uri: urlOrEmptySchema(),
227
- uri150: urlOrEmptySchema().optional(),
228
- width: z.number().int().optional()
229
- })
230
- ).optional(),
255
+ images: z.array(ImageSchema).optional(),
231
256
  members: z.array(
232
257
  z.object({
233
258
  id: z.number(),
@@ -478,16 +503,7 @@ var LabelSchema = z.object({
478
503
  id: z.number(),
479
504
  contact_info: z.string().optional(),
480
505
  data_quality: z.string().optional(),
481
- images: z.array(
482
- z.object({
483
- height: z.number().int().optional(),
484
- resource_url: urlOrEmptySchema(),
485
- type: z.string().optional(),
486
- uri: urlOrEmptySchema(),
487
- uri150: urlOrEmptySchema().optional(),
488
- width: z.number().int().optional()
489
- })
490
- ).optional(),
506
+ images: z.array(ImageSchema).optional(),
491
507
  name: z.string(),
492
508
  parent_label: z.object({
493
509
  id: z.number(),
@@ -631,18 +647,9 @@ var ReleaseSchema = z.object({
631
647
  description: z.string().optional()
632
648
  })
633
649
  ).optional(),
634
- images: z.array(
635
- z.object({
636
- height: z.number().int().optional(),
637
- width: z.number().int().optional(),
638
- resource_url: urlOrEmptySchema(),
639
- type: z.string().optional(),
640
- uri: urlOrEmptySchema().optional(),
641
- uri150: urlOrEmptySchema().optional()
642
- })
643
- ).optional(),
650
+ images: z.array(ImageSchema).optional(),
644
651
  labels: z.array(LabelBasicSchema).optional(),
645
- lowest_price: z.number().optional(),
652
+ lowest_price: z.number().nullable().optional(),
646
653
  master_id: z.number().optional(),
647
654
  master_url: urlOrEmptySchema().optional(),
648
655
  notes: z.string().optional(),
@@ -700,6 +707,12 @@ var ReleaseRatingEditParamsSchema = ReleaseRatingParamsSchema.extend({
700
707
  var MasterReleaseIdParamSchema = z.object({
701
708
  master_id: z.number().int()
702
709
  });
710
+ var MasterReleaseVersionsParamSchema = MasterReleaseIdParamSchema.extend({
711
+ format: z.string().optional(),
712
+ label: z.string().optional(),
713
+ released: z.string().optional(),
714
+ country: z.string().optional()
715
+ }).merge(QueryParamsSchema(["released", "title", "format", "label", "catno", "country"]));
703
716
  var MasterReleaseSchema = ReleaseSchema.extend({
704
717
  main_release: z.number(),
705
718
  most_recent_release: z.number(),
@@ -721,6 +734,33 @@ var MasterReleaseSchema = ReleaseSchema.extend({
721
734
  })
722
735
  )
723
736
  });
737
+ var MasterReleaseVersionItemSchema = z.object({
738
+ id: z.number().int(),
739
+ label: z.string(),
740
+ country: z.string(),
741
+ title: z.string(),
742
+ major_formats: z.array(z.string()),
743
+ format: z.string(),
744
+ catno: z.string(),
745
+ released: z.string(),
746
+ status: StatusSchema,
747
+ resource_url: urlOrEmptySchema(),
748
+ thumb: urlOrEmptySchema().optional(),
749
+ stats: z.object({
750
+ community: z.object({
751
+ in_wantlist: z.number().int(),
752
+ in_collection: z.number().int()
753
+ }).optional(),
754
+ user: z.object({
755
+ in_wantlist: z.number().int(),
756
+ in_collection: z.number().int()
757
+ }).optional()
758
+ })
759
+ });
760
+ var MasterReleaseVersionsResponseSchema = z.object({
761
+ ...PaginatedResponseSchema(MasterReleaseVersionItemSchema, "versions").shape,
762
+ ...FilteredResponseSchema.shape
763
+ });
724
764
 
725
765
  // src/services/master.ts
726
766
  var MasterReleaseService = class extends DiscogsService {
@@ -747,6 +787,31 @@ var MasterReleaseService = class extends DiscogsService {
747
787
  throw new Error(`Failed to get master release: ${String(error)}`);
748
788
  }
749
789
  }
790
+ /**
791
+ * Retrieves a list of all Releases that are versions of this master
792
+ *
793
+ * @param params - Parameters containing the master release ID and optional query parameters
794
+ * @returns {MasterReleaseVersionsResponse} The master release versions information
795
+ * @throws {DiscogsResourceNotFoundError} If the master release versions cannot be found
796
+ * @throws {Error} If there's an unexpected error
797
+ */
798
+ async getVersions({
799
+ master_id,
800
+ ...options
801
+ }) {
802
+ try {
803
+ const response = await this.request(`/${master_id}/versions`, {
804
+ params: options
805
+ });
806
+ const validatedResponse = MasterReleaseVersionsResponseSchema.parse(response);
807
+ return validatedResponse;
808
+ } catch (error) {
809
+ if (isDiscogsError(error)) {
810
+ throw error;
811
+ }
812
+ throw new Error(`Failed to get master release versions: ${String(error)}`);
813
+ }
814
+ }
750
815
  };
751
816
 
752
817
  // src/services/release.ts
@@ -967,6 +1032,20 @@ var getMasterReleaseTool = {
967
1032
  }
968
1033
  }
969
1034
  };
1035
+ var getMasterReleaseVersionsTool = {
1036
+ name: "get_master_release_versions",
1037
+ description: "Retrieves a list of all Releases that are versions of this master",
1038
+ parameters: MasterReleaseVersionsParamSchema,
1039
+ execute: async (args) => {
1040
+ try {
1041
+ const masterReleaseService = new MasterReleaseService();
1042
+ const masterReleaseVersions = await masterReleaseService.getVersions(args);
1043
+ return JSON.stringify(masterReleaseVersions);
1044
+ } catch (error) {
1045
+ throw formatDiscogsError(error);
1046
+ }
1047
+ }
1048
+ };
970
1049
  var getReleaseTool = {
971
1050
  name: "get_release",
972
1051
  description: "Get a release",
@@ -987,73 +1066,681 @@ var getReleaseCommunityRatingTool = {
987
1066
  parameters: ReleaseIdParamSchema,
988
1067
  execute: async (args) => {
989
1068
  try {
990
- const releaseService = new ReleaseService();
991
- const releaseRating = await releaseService.getCommunityRating(args);
992
- return JSON.stringify(releaseRating);
1069
+ const releaseService = new ReleaseService();
1070
+ const releaseRating = await releaseService.getCommunityRating(args);
1071
+ return JSON.stringify(releaseRating);
1072
+ } catch (error) {
1073
+ throw formatDiscogsError(error);
1074
+ }
1075
+ }
1076
+ };
1077
+ var getReleaseRatingTool = {
1078
+ name: "get_release_rating_by_user",
1079
+ description: `Retrieves the release's rating for a given user`,
1080
+ parameters: ReleaseRatingParamsSchema,
1081
+ execute: async (args) => {
1082
+ try {
1083
+ const releaseService = new ReleaseService();
1084
+ const releaseRating = await releaseService.getRatingByUser(args);
1085
+ return JSON.stringify(releaseRating);
1086
+ } catch (error) {
1087
+ throw formatDiscogsError(error);
1088
+ }
1089
+ }
1090
+ };
1091
+ var searchTool = {
1092
+ name: "search",
1093
+ description: "Issue a search query to the Discogs database",
1094
+ parameters: SearchParamsSchema,
1095
+ execute: async (args) => {
1096
+ try {
1097
+ const databaseService = new DatabaseService();
1098
+ const searchResults = await databaseService.search(args);
1099
+ return JSON.stringify(searchResults);
1100
+ } catch (error) {
1101
+ throw formatDiscogsError(error);
1102
+ }
1103
+ }
1104
+ };
1105
+ function registerDatabaseTools(server) {
1106
+ server.addTool(getReleaseTool);
1107
+ server.addTool(getReleaseRatingTool);
1108
+ server.addTool(editReleaseRatingTool);
1109
+ server.addTool(deleteReleaseRatingTool);
1110
+ server.addTool(getReleaseCommunityRatingTool);
1111
+ server.addTool(getMasterReleaseTool);
1112
+ server.addTool(getMasterReleaseVersionsTool);
1113
+ server.addTool(getArtistTool);
1114
+ server.addTool(getArtistReleasesTool);
1115
+ server.addTool(getLabelTool);
1116
+ server.addTool(getLabelReleasesTool);
1117
+ server.addTool(searchTool);
1118
+ }
1119
+ var InventoryIdParamSchema = z.object({
1120
+ id: z.number()
1121
+ });
1122
+ var InventoryExportItemSchema = z.object({
1123
+ status: z.string(),
1124
+ created_ts: z.string().nullable(),
1125
+ url: urlOrEmptySchema(),
1126
+ finished_ts: z.string().nullable(),
1127
+ download_url: urlOrEmptySchema(),
1128
+ filename: z.string(),
1129
+ id: z.number()
1130
+ });
1131
+ var InventoryExportsResponseSchema = PaginatedResponseSchema(
1132
+ InventoryExportItemSchema,
1133
+ "items"
1134
+ );
1135
+
1136
+ // src/services/inventory.ts
1137
+ var InventoryService = class extends DiscogsService {
1138
+ constructor() {
1139
+ super("/inventory");
1140
+ }
1141
+ /**
1142
+ * Download an inventory export as a CSV
1143
+ *
1144
+ * @param {InventoryIdParam} params - The parameters for the request
1145
+ * @returns {string} The inventory export as a CSV
1146
+ * @throws {DiscogsAuthenticationError} If the request is not authenticated
1147
+ * @throws {DiscogsResourceNotFoundError} If the inventory export does not exist
1148
+ * @throws {Error} If there's an unexpected error
1149
+ */
1150
+ async downloadExport({ id }) {
1151
+ try {
1152
+ const response = await this.request(`/export/${id}/download`);
1153
+ return response;
1154
+ } catch (error) {
1155
+ if (isDiscogsError(error)) {
1156
+ throw error;
1157
+ }
1158
+ throw new Error(`Failed to download inventory export: ${String(error)}`);
1159
+ }
1160
+ }
1161
+ /**
1162
+ * Request an export of your inventory as a CSV
1163
+ *
1164
+ * @returns {void}
1165
+ * @throws {DiscogsAuthenticationError} If the request is not authenticated
1166
+ * @throws {Error} If there's an unexpected error
1167
+ */
1168
+ async export() {
1169
+ try {
1170
+ await this.request("/export", {
1171
+ method: "POST"
1172
+ });
1173
+ } catch (error) {
1174
+ if (isDiscogsError(error)) {
1175
+ throw error;
1176
+ }
1177
+ throw new Error(`Failed to export inventory: ${String(error)}`);
1178
+ }
1179
+ }
1180
+ /**
1181
+ * Get details about an inventory export
1182
+ *
1183
+ * @param {InventoryIdParam} params - The parameters for the request
1184
+ * @returns {InventoryExportItem} The inventory export item
1185
+ * @throws {DiscogsAuthenticationError} If the request is not authenticated
1186
+ * @throws {DiscogsResourceNotFoundError} If the inventory export does not exist
1187
+ * @throws {Error} If there's an unexpected error
1188
+ */
1189
+ async getExport({ id }) {
1190
+ try {
1191
+ const response = await this.request(`/export/${id}`);
1192
+ const validatedResponse = InventoryExportItemSchema.parse(response);
1193
+ return validatedResponse;
1194
+ } catch (error) {
1195
+ if (isDiscogsError(error)) {
1196
+ throw error;
1197
+ }
1198
+ throw new Error(`Failed to get inventory export: ${String(error)}`);
1199
+ }
1200
+ }
1201
+ /**
1202
+ * Get a list of all recent exports of your inventory
1203
+ *
1204
+ * @returns {InventoryExportsResponse} The inventory exports
1205
+ * @throws {DiscogsAuthenticationError} If the request is not authenticated
1206
+ * @throws {Error} If there's an unexpected error
1207
+ */
1208
+ async getExports() {
1209
+ try {
1210
+ const response = await this.request("/export");
1211
+ const validatedResponse = InventoryExportsResponseSchema.parse(response);
1212
+ return validatedResponse;
1213
+ } catch (error) {
1214
+ if (isDiscogsError(error)) {
1215
+ throw error;
1216
+ }
1217
+ throw new Error(`Failed to get inventory exports: ${String(error)}`);
1218
+ }
1219
+ }
1220
+ };
1221
+
1222
+ // src/tools/inventoryExport.ts
1223
+ var downloadInventoryExportTool = {
1224
+ name: "download_inventory_export",
1225
+ description: "Download an inventory export as a CSV",
1226
+ parameters: InventoryIdParamSchema,
1227
+ execute: async (args) => {
1228
+ try {
1229
+ const inventoryService = new InventoryService();
1230
+ const csv = await inventoryService.downloadExport(args);
1231
+ return csv;
1232
+ } catch (error) {
1233
+ throw formatDiscogsError(error);
1234
+ }
1235
+ }
1236
+ };
1237
+ var getInventoryExportTool = {
1238
+ name: "get_inventory_export",
1239
+ description: "Get details about an inventory export",
1240
+ parameters: InventoryIdParamSchema,
1241
+ execute: async (args) => {
1242
+ try {
1243
+ const inventoryService = new InventoryService();
1244
+ const exportItem = await inventoryService.getExport(args);
1245
+ return JSON.stringify(exportItem);
1246
+ } catch (error) {
1247
+ throw formatDiscogsError(error);
1248
+ }
1249
+ }
1250
+ };
1251
+ var getInventoryExportsTool = {
1252
+ name: "get_inventory_exports",
1253
+ description: "Get a list of all recent exports of your inventory",
1254
+ parameters: z.object({}),
1255
+ execute: async () => {
1256
+ try {
1257
+ const inventoryService = new InventoryService();
1258
+ const exports = await inventoryService.getExports();
1259
+ return JSON.stringify(exports);
1260
+ } catch (error) {
1261
+ throw formatDiscogsError(error);
1262
+ }
1263
+ }
1264
+ };
1265
+ var inventoryExportTool = {
1266
+ name: "inventory_export",
1267
+ description: "Request an export of your inventory as a CSV",
1268
+ parameters: z.object({}),
1269
+ execute: async () => {
1270
+ try {
1271
+ const inventoryService = new InventoryService();
1272
+ await inventoryService.export();
1273
+ return "Inventory export requested";
1274
+ } catch (error) {
1275
+ throw formatDiscogsError(error);
1276
+ }
1277
+ }
1278
+ };
1279
+ function registerInventoryExportTool(server) {
1280
+ server.addTool(inventoryExportTool);
1281
+ server.addTool(getInventoryExportsTool);
1282
+ server.addTool(getInventoryExportTool);
1283
+ server.addTool(downloadInventoryExportTool);
1284
+ }
1285
+ var ConditionSchema = z.enum([
1286
+ "Mint (M)",
1287
+ "Near Mint (NM or M-)",
1288
+ "Very Good Plus (VG+)",
1289
+ "Very Good (VG)",
1290
+ "Good Plus (G+)",
1291
+ "Good (G)",
1292
+ "Fair (F)",
1293
+ "Poor (P)"
1294
+ ]);
1295
+ var SleeveConditionSchema = z.enum([
1296
+ ...ConditionSchema.options,
1297
+ "Generic",
1298
+ "Not Graded",
1299
+ "No Cover"
1300
+ ]);
1301
+ var OrderStatusSchema = z.enum([
1302
+ "New Order",
1303
+ "Buyer Contacted",
1304
+ "Invoice Sent",
1305
+ "Payment Pending",
1306
+ "Payment Received",
1307
+ "Shipped",
1308
+ "Refund Sent",
1309
+ "Cancelled (Non-Paying Buyer)",
1310
+ "Cancelled (Item Unavailable)",
1311
+ `Cancelled (Per Buyer's Request)`
1312
+ ]);
1313
+ var ListingReleaseSchema = z.object({
1314
+ catalog_number: z.string().optional(),
1315
+ resource_url: urlOrEmptySchema(),
1316
+ year: z.number(),
1317
+ id: z.number().int(),
1318
+ description: z.string(),
1319
+ images: z.array(ImageSchema).optional(),
1320
+ artist: z.string(),
1321
+ title: z.string(),
1322
+ format: z.string(),
1323
+ thumbnail: urlOrEmptySchema(),
1324
+ stats: z.object({
1325
+ community: z.object({
1326
+ in_wantlist: z.number().int(),
1327
+ in_collection: z.number().int()
1328
+ }),
1329
+ user: z.object({
1330
+ in_wantlist: z.number().int(),
1331
+ in_collection: z.number().int()
1332
+ }).optional()
1333
+ })
1334
+ });
1335
+ var PriceSchema = z.object({
1336
+ currency: CurrencyCodeSchema.optional(),
1337
+ value: z.number().optional()
1338
+ });
1339
+ var OriginalPriceSchema = z.object({
1340
+ curr_abbr: CurrencyCodeSchema.optional(),
1341
+ curr_id: z.number().optional(),
1342
+ formatted: z.string().optional(),
1343
+ value: z.number().optional()
1344
+ });
1345
+ var OrderMessageSchema = z.object({
1346
+ timestamp: z.string().optional(),
1347
+ message: z.string(),
1348
+ type: z.string().optional(),
1349
+ order: z.object({
1350
+ id: z.number(),
1351
+ resource_url: urlOrEmptySchema()
1352
+ }),
1353
+ subject: z.string().optional(),
1354
+ refund: z.object({
1355
+ amount: z.number(),
1356
+ order: z.object({
1357
+ id: z.number(),
1358
+ resource_url: urlOrEmptySchema()
1359
+ })
1360
+ }).optional(),
1361
+ from: z.object({
1362
+ id: z.number().optional(),
1363
+ resource_url: urlOrEmptySchema(),
1364
+ username: z.string(),
1365
+ avatar_url: urlOrEmptySchema().optional()
1366
+ }).optional(),
1367
+ status_id: z.number().optional(),
1368
+ actor: z.object({
1369
+ username: z.string(),
1370
+ resource_url: urlOrEmptySchema()
1371
+ }).optional(),
1372
+ original: z.number().optional(),
1373
+ new: z.number().optional()
1374
+ });
1375
+ var SaleStatusSchema = z.enum(["For Sale", "Expired", "Draft", "Pending"]);
1376
+ var ListingSchema = z.object({
1377
+ id: z.number(),
1378
+ resource_url: z.string().url(),
1379
+ uri: z.string().url(),
1380
+ status: SaleStatusSchema,
1381
+ condition: z.string(),
1382
+ sleeve_condition: z.string(),
1383
+ comments: z.string().optional(),
1384
+ ships_from: z.string(),
1385
+ posted: z.string(),
1386
+ allow_offers: z.boolean(),
1387
+ offer_submitted: z.boolean().optional(),
1388
+ audio: z.boolean(),
1389
+ price: PriceSchema,
1390
+ original_price: OriginalPriceSchema,
1391
+ shipping_price: PriceSchema.optional(),
1392
+ original_shipping_price: OriginalPriceSchema.optional(),
1393
+ seller: z.object({
1394
+ id: z.number(),
1395
+ username: z.string(),
1396
+ resource_url: urlOrEmptySchema().optional(),
1397
+ avatar_url: urlOrEmptySchema().optional(),
1398
+ stats: z.object({
1399
+ rating: z.string(),
1400
+ stars: z.number(),
1401
+ total: z.number()
1402
+ }),
1403
+ min_order_total: z.number(),
1404
+ html_url: urlOrEmptySchema(),
1405
+ uid: z.number(),
1406
+ url: urlOrEmptySchema(),
1407
+ payment: z.string(),
1408
+ shipping: z.string()
1409
+ }),
1410
+ release: ListingReleaseSchema
1411
+ });
1412
+ var ListingIdParamSchema = z.object({
1413
+ listing_id: z.number().int()
1414
+ });
1415
+ var ListingGetParamsSchema = ListingIdParamSchema.extend({
1416
+ curr_abbr: CurrencyCodeSchema.optional()
1417
+ });
1418
+ var ListingNewParamsSchema = z.object({
1419
+ release_id: z.number().int(),
1420
+ condition: ConditionSchema,
1421
+ sleeve_condition: SleeveConditionSchema.optional(),
1422
+ price: z.number(),
1423
+ comments: z.string().optional(),
1424
+ allow_offers: z.boolean().optional(),
1425
+ status: SaleStatusSchema,
1426
+ external_id: z.string().optional(),
1427
+ location: z.string().optional(),
1428
+ weight: z.number().optional(),
1429
+ format_quantity: z.number().optional()
1430
+ });
1431
+ var ListingNewResponseSchema = z.object({
1432
+ listing_id: z.number().int(),
1433
+ resource_url: z.string().url()
1434
+ });
1435
+ var ListingUpdateParamsSchema = ListingIdParamSchema.merge(ListingNewParamsSchema);
1436
+ var OrderIdParamSchema = z.object({
1437
+ order_id: z.number()
1438
+ });
1439
+ var OrderCreateMessageParamsSchema = OrderIdParamSchema.extend({
1440
+ message: z.string().optional(),
1441
+ status: OrderStatusSchema.optional()
1442
+ });
1443
+ var OrderEditParamsSchema = OrderIdParamSchema.extend({
1444
+ status: OrderStatusSchema.optional(),
1445
+ shipping: z.number().optional()
1446
+ });
1447
+ var OrderMessagesParamsSchema = QueryParamsSchema().merge(OrderIdParamSchema);
1448
+ var OrderMessagesResponseSchema = PaginatedResponseSchema(OrderMessageSchema, "messages");
1449
+ var OrdersParamsSchema = z.object({
1450
+ status: OrderStatusSchema.optional(),
1451
+ created_after: z.string().optional(),
1452
+ created_before: z.string().optional(),
1453
+ archived: z.boolean().optional()
1454
+ }).merge(QueryParamsSchema(["id", "buyer", "created", "status", "last_activity"]));
1455
+ var OrderResponseSchema = z.object({
1456
+ id: z.number(),
1457
+ resource_url: urlOrEmptySchema(),
1458
+ messages_url: urlOrEmptySchema(),
1459
+ uri: urlOrEmptySchema(),
1460
+ status: OrderStatusSchema,
1461
+ next_status: z.array(OrderStatusSchema),
1462
+ fee: PriceSchema,
1463
+ created: z.string(),
1464
+ items: z.array(
1465
+ z.object({
1466
+ release: z.object({
1467
+ id: z.number(),
1468
+ description: z.string().optional()
1469
+ }),
1470
+ price: PriceSchema,
1471
+ media_condition: ConditionSchema,
1472
+ sleeve_condition: SleeveConditionSchema.optional(),
1473
+ id: z.number()
1474
+ })
1475
+ ),
1476
+ shipping: z.object({
1477
+ currency: CurrencyCodeSchema,
1478
+ method: z.string(),
1479
+ value: z.number()
1480
+ }),
1481
+ shipping_address: z.string(),
1482
+ address_instructions: z.string().optional(),
1483
+ archived: z.boolean().optional(),
1484
+ seller: z.object({
1485
+ id: z.number(),
1486
+ username: z.string(),
1487
+ resource_url: urlOrEmptySchema().optional()
1488
+ }),
1489
+ last_activity: z.string().optional(),
1490
+ buyer: z.object({
1491
+ id: z.number(),
1492
+ username: z.string(),
1493
+ resource_url: urlOrEmptySchema().optional()
1494
+ }),
1495
+ total: PriceSchema
1496
+ });
1497
+ var OrdersResponseSchema = PaginatedResponseSchema(OrderResponseSchema, "orders");
1498
+ var ReleaseStatsResponseSchema = z.object({
1499
+ lowest_price: PriceSchema.nullable().optional(),
1500
+ num_for_sale: z.number().nullable().optional(),
1501
+ blocked_from_sale: z.boolean()
1502
+ });
1503
+
1504
+ // src/services/marketplace.ts
1505
+ var MarketplaceService = class extends DiscogsService {
1506
+ constructor() {
1507
+ super("/marketplace");
1508
+ }
1509
+ /**
1510
+ * Create a new marketplace listing
1511
+ *
1512
+ * @param params - Parameters containing the listing data
1513
+ * @returns {ListingNewResponse} The listing information
1514
+ * @throws {DiscogsAuthenticationError} If the user is not authenticated
1515
+ * @throws {DiscogsPermissionError} If the user does not have permission to create a listing
1516
+ * @throws {Error} If there's an unexpected error
1517
+ */
1518
+ async createListing(params) {
1519
+ try {
1520
+ const response = await this.request(`/listings`, {
1521
+ method: "POST",
1522
+ body: params
1523
+ });
1524
+ const validatedResponse = ListingNewResponseSchema.parse(response);
1525
+ return validatedResponse;
1526
+ } catch (error) {
1527
+ if (isDiscogsError(error)) {
1528
+ throw error;
1529
+ }
1530
+ throw new Error(`Failed to create listing: ${String(error)}`);
1531
+ }
1532
+ }
1533
+ /**
1534
+ * Adds a new message to the order's message log
1535
+ *
1536
+ * @param params - Parameters containing the order ID and the message data
1537
+ * @returns {OrderMessageResponse} The order message information
1538
+ * @throws {DiscogsAuthenticationError} If the user is not authenticated
1539
+ * @throws {DiscogsPermissionError} If the user does not have permission to create a message
1540
+ * @throws {DiscogsResourceNotFoundError} If the order cannot be found
1541
+ * @throws {Error} If there's an unexpected error
1542
+ */
1543
+ async createOrderMessage({
1544
+ order_id,
1545
+ ...body
1546
+ }) {
1547
+ try {
1548
+ const response = await this.request(`/orders/${order_id}/messages`, {
1549
+ method: "POST",
1550
+ body
1551
+ });
1552
+ const validatedResponse = OrderMessageSchema.parse(response);
1553
+ return validatedResponse;
1554
+ } catch (error) {
1555
+ if (isDiscogsError(error)) {
1556
+ throw error;
1557
+ }
1558
+ throw new Error(`Failed to create order message: ${String(error)}`);
1559
+ }
1560
+ }
1561
+ /**
1562
+ * Delete a listing from the marketplace
1563
+ *
1564
+ * @param params - Parameters containing the listing ID
1565
+ * @throws {DiscogsAuthenticationError} If the user is not authenticated
1566
+ * @throws {DiscogsPermissionError} If the user does not have permission to delete a listing
1567
+ * @throws {DiscogsResourceNotFoundError} If the listing cannot be found
1568
+ * @throws {Error} If there's an unexpected error
1569
+ */
1570
+ async deleteListing({ listing_id }) {
1571
+ try {
1572
+ await this.request(`/listings/${listing_id}`, {
1573
+ method: "DELETE"
1574
+ });
1575
+ } catch (error) {
1576
+ if (isDiscogsError(error)) {
1577
+ throw error;
1578
+ }
1579
+ throw new Error(`Failed to delete listing: ${String(error)}`);
1580
+ }
1581
+ }
1582
+ /**
1583
+ * The Listing resource allows you to view Marketplace listings
1584
+ *
1585
+ * @param params - Parameters containing the listing ID and optional currency code
1586
+ * @returns {Listing} The listing information
1587
+ * @throws {DiscogsResourceNotFoundError} If the listing cannot be found
1588
+ * @throws {Error} If there's an unexpected error
1589
+ */
1590
+ async getListing({ listing_id, ...options }) {
1591
+ try {
1592
+ const response = await this.request(`/listings/${listing_id}`, {
1593
+ params: options
1594
+ });
1595
+ const validatedResponse = ListingSchema.parse(response);
1596
+ return validatedResponse;
1597
+ } catch (error) {
1598
+ if (isDiscogsError(error)) {
1599
+ throw error;
1600
+ }
1601
+ throw new Error(`Failed to get listing: ${String(error)}`);
1602
+ }
1603
+ }
1604
+ /**
1605
+ * Get a marketplace order
1606
+ *
1607
+ * @param params - Parameters containing the order ID
1608
+ * @throws {DiscogsAuthenticationError} If the user is not authenticated
1609
+ * @throws {DiscogsPermissionError} If the user does not have permission to view the order
1610
+ * @throws {DiscogsResourceNotFoundError} If the order cannot be found
1611
+ * @throws {Error} If there's an unexpected error
1612
+ * @returns {OrderResponse} The order information
1613
+ */
1614
+ async getOrder({ order_id }) {
1615
+ try {
1616
+ const response = await this.request(`/orders/${order_id}`);
1617
+ const validatedResponse = OrderResponseSchema.parse(response);
1618
+ return validatedResponse;
1619
+ } catch (error) {
1620
+ if (isDiscogsError(error)) {
1621
+ throw error;
1622
+ }
1623
+ throw new Error(`Failed to get order: ${String(error)}`);
1624
+ }
1625
+ }
1626
+ /**
1627
+ * Get a list of an order's messages
1628
+ *
1629
+ * @param params - OrderMessagesParams
1630
+ * @throws {DiscogsAuthenticationError} If the user is not authenticated
1631
+ * @throws {DiscogsPermissionError} If the user does not have permission to view the order messages
1632
+ * @throws {DiscogsResourceNotFoundError} If the order cannot be found
1633
+ * @throws {Error} If there's an unexpected error
1634
+ * @returns {OrderMessagesResponse} The order messages
1635
+ */
1636
+ async getOrderMessages({
1637
+ order_id,
1638
+ ...options
1639
+ }) {
1640
+ try {
1641
+ const response = await this.request(`/orders/${order_id}/messages`, {
1642
+ params: options
1643
+ });
1644
+ const validatedResponse = OrderMessagesResponseSchema.parse(response);
1645
+ return validatedResponse;
1646
+ } catch (error) {
1647
+ if (isDiscogsError(error)) {
1648
+ throw error;
1649
+ }
1650
+ throw new Error(`Failed to get order messages: ${String(error)}`);
1651
+ }
1652
+ }
1653
+ /**
1654
+ * Get a list of marketplace orders
1655
+ *
1656
+ * @param params - OrdersParams
1657
+ * @throws {DiscogsAuthenticationError} If the user is not authenticated
1658
+ * @throws {DiscogsPermissionError} If the user does not have permission to view the orders
1659
+ * @throws {Error} If there's an unexpected error
1660
+ * @returns {OrdersResponse} The order information
1661
+ */
1662
+ async getOrders(params) {
1663
+ try {
1664
+ const response = await this.request(`/orders`, {
1665
+ params
1666
+ });
1667
+ const validatedResponse = OrdersResponseSchema.parse(response);
1668
+ return validatedResponse;
993
1669
  } catch (error) {
994
- throw formatDiscogsError(error);
1670
+ if (isDiscogsError(error)) {
1671
+ throw error;
1672
+ }
1673
+ throw new Error(`Failed to get orders: ${String(error)}`);
995
1674
  }
996
1675
  }
997
- };
998
- var getReleaseRatingTool = {
999
- name: "get_release_rating_by_user",
1000
- description: `Retrieves the release's rating for a given user`,
1001
- parameters: ReleaseRatingParamsSchema,
1002
- execute: async (args) => {
1676
+ /**
1677
+ * Retrieve marketplace statistics for the provided Release ID
1678
+ *
1679
+ * @param params - Parameters containing the release ID and optional currency code
1680
+ * @throws {DiscogsResourceNotFoundError} If the release cannot be found
1681
+ * @throws {Error} If there's an unexpected error
1682
+ * @returns {ReleaseStatsResponse} The release stats
1683
+ */
1684
+ async getReleaseStats({ release_id, ...options }) {
1003
1685
  try {
1004
- const releaseService = new ReleaseService();
1005
- const releaseRating = await releaseService.getRatingByUser(args);
1006
- return JSON.stringify(releaseRating);
1686
+ const response = await this.request(`/stats/${release_id}`, {
1687
+ params: options
1688
+ });
1689
+ const validatedResponse = ReleaseStatsResponseSchema.parse(response);
1690
+ return validatedResponse;
1007
1691
  } catch (error) {
1008
- throw formatDiscogsError(error);
1692
+ if (isDiscogsError(error)) {
1693
+ throw error;
1694
+ }
1695
+ throw new Error(`Failed to get release stats: ${String(error)}`);
1009
1696
  }
1010
1697
  }
1011
- };
1012
- var searchTool = {
1013
- name: "search",
1014
- description: "Issue a search query to the Discogs database",
1015
- parameters: SearchParamsSchema,
1016
- execute: async (args) => {
1698
+ /**
1699
+ * Edit a marketplace order
1700
+ *
1701
+ * @param params - Parameters containing the order ID and the order data
1702
+ * @throws {DiscogsAuthenticationError} If the user is not authenticated
1703
+ * @throws {DiscogsPermissionError} If the user does not have permission to edit the order
1704
+ * @throws {DiscogsResourceNotFoundError} If the order cannot be found
1705
+ * @throws {Error} If there's an unexpected error
1706
+ */
1707
+ async editOrder({ order_id, ...body }) {
1017
1708
  try {
1018
- const databaseService = new DatabaseService();
1019
- const searchResults = await databaseService.search(args);
1020
- return JSON.stringify(searchResults);
1709
+ const response = await this.request(`/orders/${order_id}`, {
1710
+ method: "POST",
1711
+ body
1712
+ });
1713
+ const validatedResponse = OrderResponseSchema.parse(response);
1714
+ return validatedResponse;
1021
1715
  } catch (error) {
1022
- throw formatDiscogsError(error);
1716
+ if (isDiscogsError(error)) {
1717
+ throw error;
1718
+ }
1719
+ throw new Error(`Failed to edit order: ${String(error)}`);
1023
1720
  }
1024
1721
  }
1025
- };
1026
- function registerDatabaseTools(server) {
1027
- server.addTool(getReleaseTool);
1028
- server.addTool(getReleaseRatingTool);
1029
- server.addTool(editReleaseRatingTool);
1030
- server.addTool(deleteReleaseRatingTool);
1031
- server.addTool(getReleaseCommunityRatingTool);
1032
- server.addTool(getMasterReleaseTool);
1033
- server.addTool(getArtistTool);
1034
- server.addTool(getArtistReleasesTool);
1035
- server.addTool(getLabelTool);
1036
- server.addTool(getLabelReleasesTool);
1037
- server.addTool(searchTool);
1038
- }
1039
- var MediaParamsSchema = z.object({
1040
- url: z.string().url()
1041
- });
1042
- var fetchImageTool = {
1043
- name: "fetch_image",
1044
- description: "Fetch an image by URL",
1045
- parameters: MediaParamsSchema,
1046
- execute: async ({ url }) => {
1722
+ /**
1723
+ * Update a marketplace listing
1724
+ *
1725
+ * @param params - Parameters containing the listing ID and the listing data
1726
+ * @throws {DiscogsAuthenticationError} If the user is not authenticated
1727
+ * @throws {DiscogsResourceNotFoundError} If the listing cannot be found
1728
+ * @throws {Error} If there's an unexpected error
1729
+ */
1730
+ async updateListing({ listing_id, ...body }) {
1047
1731
  try {
1048
- return imageContent({ url });
1732
+ await this.request(`/listings/${listing_id}`, {
1733
+ method: "POST",
1734
+ body
1735
+ });
1049
1736
  } catch (error) {
1050
- throw formatDiscogsError(error);
1737
+ if (isDiscogsError(error)) {
1738
+ throw error;
1739
+ }
1740
+ throw new Error(`Failed to update listing: ${String(error)}`);
1051
1741
  }
1052
1742
  }
1053
1743
  };
1054
- function registerMediaTools(server) {
1055
- server.addTool(fetchImageTool);
1056
- }
1057
1744
  var FolderIdParamSchema = (min) => z.object({
1058
1745
  folder_id: z.number().int().min(min ?? 0)
1059
1746
  });
@@ -1140,6 +1827,24 @@ var UserCollectionValueSchema = z.object({
1140
1827
  median: z.string(),
1141
1828
  minimum: z.string()
1142
1829
  });
1830
+
1831
+ // src/types/user/inventory.ts
1832
+ var UserInventoryGetParamsSchema = UsernameInputSchema.extend({
1833
+ status: SaleStatusSchema.optional()
1834
+ }).merge(
1835
+ QueryParamsSchema([
1836
+ "listed",
1837
+ "price",
1838
+ "item",
1839
+ "artist",
1840
+ "label",
1841
+ "catno",
1842
+ "audio",
1843
+ "status",
1844
+ "location"
1845
+ ])
1846
+ );
1847
+ var UserInventoryResponseSchema = PaginatedResponseSchema(ListingSchema, "listings");
1143
1848
  var UserListItemSchema = z.object({
1144
1849
  id: z.number(),
1145
1850
  date_added: z.string(),
@@ -1217,6 +1922,218 @@ var UserWantlistItemParamsSchema = UsernameInputSchema.merge(
1217
1922
  })
1218
1923
  );
1219
1924
 
1925
+ // src/services/user/inventory.ts
1926
+ var UserInventoryService = class extends BaseUserService {
1927
+ /**
1928
+ * Returns the list of listings in a user's inventory
1929
+ * @param params - Parameters for the request including username and optional pagination/sorting
1930
+ * @returns {UserInventoryResponse} A paginated response containing the user's inventory
1931
+ * @throws {DiscogsResourceNotFoundError} If the username cannot be found
1932
+ * @throws {Error} If there's an unexpected error
1933
+ */
1934
+ async get({ username, ...options }) {
1935
+ try {
1936
+ const response = await this.request(`/${username}/inventory`, {
1937
+ params: options
1938
+ });
1939
+ const validatedResponse = UserInventoryResponseSchema.parse(response);
1940
+ return validatedResponse;
1941
+ } catch (error) {
1942
+ if (isDiscogsError(error)) {
1943
+ throw error;
1944
+ }
1945
+ throw new Error(`Failed to get inventory: ${String(error)}`);
1946
+ }
1947
+ }
1948
+ };
1949
+
1950
+ // src/tools/marketplace.ts
1951
+ var createMarketplaceListingTool = {
1952
+ name: "create_marketplace_listing",
1953
+ description: "Create a new marketplace listing",
1954
+ parameters: ListingNewParamsSchema,
1955
+ execute: async (args) => {
1956
+ try {
1957
+ const marketplaceService = new MarketplaceService();
1958
+ const listing = await marketplaceService.createListing(args);
1959
+ return JSON.stringify(listing);
1960
+ } catch (error) {
1961
+ throw formatDiscogsError(error);
1962
+ }
1963
+ }
1964
+ };
1965
+ var createMarketplaceOrderMessageTool = {
1966
+ name: "create_marketplace_order_message",
1967
+ description: `Adds a new message to the order's message log`,
1968
+ parameters: OrderCreateMessageParamsSchema,
1969
+ execute: async (args) => {
1970
+ try {
1971
+ const marketplaceService = new MarketplaceService();
1972
+ const message = await marketplaceService.createOrderMessage(args);
1973
+ return JSON.stringify(message);
1974
+ } catch (error) {
1975
+ throw formatDiscogsError(error);
1976
+ }
1977
+ }
1978
+ };
1979
+ var deleteMarketplaceListingTool = {
1980
+ name: "delete_marketplace_listing",
1981
+ description: "Delete a marketplace listing",
1982
+ parameters: ListingIdParamSchema,
1983
+ execute: async (args) => {
1984
+ try {
1985
+ const marketplaceService = new MarketplaceService();
1986
+ await marketplaceService.deleteListing(args);
1987
+ return "Listing deleted successfully";
1988
+ } catch (error) {
1989
+ throw formatDiscogsError(error);
1990
+ }
1991
+ }
1992
+ };
1993
+ var getMarketplaceListingTool = {
1994
+ name: "get_marketplace_listing",
1995
+ description: "Get a listing from the marketplace",
1996
+ parameters: ListingGetParamsSchema,
1997
+ execute: async (args) => {
1998
+ try {
1999
+ const marketplaceService = new MarketplaceService();
2000
+ const listing = await marketplaceService.getListing(args);
2001
+ return JSON.stringify(listing);
2002
+ } catch (error) {
2003
+ throw formatDiscogsError(error);
2004
+ }
2005
+ }
2006
+ };
2007
+ var getMarketplaceOrderTool = {
2008
+ name: "get_marketplace_order",
2009
+ description: "Get a marketplace order",
2010
+ parameters: OrderIdParamSchema,
2011
+ execute: async (args) => {
2012
+ try {
2013
+ const marketplaceService = new MarketplaceService();
2014
+ const order = await marketplaceService.getOrder(args);
2015
+ return JSON.stringify(order);
2016
+ } catch (error) {
2017
+ throw formatDiscogsError(error);
2018
+ }
2019
+ }
2020
+ };
2021
+ var getMarketplaceOrdersTool = {
2022
+ name: "get_marketplace_orders",
2023
+ description: "Get a list of marketplace orders",
2024
+ parameters: OrdersParamsSchema,
2025
+ execute: async (args) => {
2026
+ try {
2027
+ const marketplaceService = new MarketplaceService();
2028
+ const orders = await marketplaceService.getOrders(args);
2029
+ return JSON.stringify(orders);
2030
+ } catch (error) {
2031
+ throw formatDiscogsError(error);
2032
+ }
2033
+ }
2034
+ };
2035
+ var getMarketplaceOrderMessagesTool = {
2036
+ name: "get_marketplace_order_messages",
2037
+ description: `Get a list of an order's messages`,
2038
+ parameters: OrderMessagesParamsSchema,
2039
+ execute: async (args) => {
2040
+ try {
2041
+ const marketplaceService = new MarketplaceService();
2042
+ const messages = await marketplaceService.getOrderMessages(args);
2043
+ return JSON.stringify(messages);
2044
+ } catch (error) {
2045
+ throw formatDiscogsError(error);
2046
+ }
2047
+ }
2048
+ };
2049
+ var getMarketplaceReleaseStatsTool = {
2050
+ name: "get_marketplace_release_stats",
2051
+ description: "Retrieve marketplace statistics for the provided Release ID",
2052
+ parameters: ReleaseParamsSchema,
2053
+ execute: async (args) => {
2054
+ try {
2055
+ const marketplaceService = new MarketplaceService();
2056
+ const stats = await marketplaceService.getReleaseStats(args);
2057
+ return JSON.stringify(stats);
2058
+ } catch (error) {
2059
+ throw formatDiscogsError(error);
2060
+ }
2061
+ }
2062
+ };
2063
+ var getUserInventoryTool = {
2064
+ name: "get_user_inventory",
2065
+ description: `Returns the list of listings in a user's inventory`,
2066
+ parameters: UserInventoryGetParamsSchema,
2067
+ execute: async (args) => {
2068
+ try {
2069
+ const userInventoryService = new UserInventoryService();
2070
+ const inventory = await userInventoryService.get(args);
2071
+ return JSON.stringify(inventory);
2072
+ } catch (error) {
2073
+ throw formatDiscogsError(error);
2074
+ }
2075
+ }
2076
+ };
2077
+ var editMarketplaceOrderTool = {
2078
+ name: "edit_marketplace_order",
2079
+ description: "Edit a marketplace order",
2080
+ parameters: OrderEditParamsSchema,
2081
+ execute: async (args) => {
2082
+ try {
2083
+ const marketplaceService = new MarketplaceService();
2084
+ const order = await marketplaceService.editOrder(args);
2085
+ return JSON.stringify(order);
2086
+ } catch (error) {
2087
+ throw formatDiscogsError(error);
2088
+ }
2089
+ }
2090
+ };
2091
+ var updateMarketplaceListingTool = {
2092
+ name: "update_marketplace_listing",
2093
+ description: "Update a marketplace listing",
2094
+ parameters: ListingUpdateParamsSchema,
2095
+ execute: async (args) => {
2096
+ try {
2097
+ const marketplaceService = new MarketplaceService();
2098
+ await marketplaceService.updateListing(args);
2099
+ return "Listing updated successfully";
2100
+ } catch (error) {
2101
+ throw formatDiscogsError(error);
2102
+ }
2103
+ }
2104
+ };
2105
+ function registerMarketplaceTools(server) {
2106
+ server.addTool(getUserInventoryTool);
2107
+ server.addTool(getMarketplaceListingTool);
2108
+ server.addTool(createMarketplaceListingTool);
2109
+ server.addTool(updateMarketplaceListingTool);
2110
+ server.addTool(deleteMarketplaceListingTool);
2111
+ server.addTool(getMarketplaceOrderTool);
2112
+ server.addTool(editMarketplaceOrderTool);
2113
+ server.addTool(getMarketplaceOrdersTool);
2114
+ server.addTool(getMarketplaceOrderMessagesTool);
2115
+ server.addTool(createMarketplaceOrderMessageTool);
2116
+ server.addTool(getMarketplaceReleaseStatsTool);
2117
+ }
2118
+ var MediaParamsSchema = z.object({
2119
+ url: z.string().url()
2120
+ });
2121
+ var fetchImageTool = {
2122
+ name: "fetch_image",
2123
+ description: "Fetch an image by URL",
2124
+ parameters: MediaParamsSchema,
2125
+ execute: async ({ url }) => {
2126
+ try {
2127
+ return imageContent({ url });
2128
+ } catch (error) {
2129
+ throw formatDiscogsError(error);
2130
+ }
2131
+ }
2132
+ };
2133
+ function registerMediaTools(server) {
2134
+ server.addTool(fetchImageTool);
2135
+ }
2136
+
1220
2137
  // src/services/user/collection.ts
1221
2138
  var UserCollectionService = class extends BaseUserService {
1222
2139
  /**
@@ -2010,6 +2927,76 @@ var OAuthService = class extends DiscogsService {
2010
2927
  }
2011
2928
  }
2012
2929
  };
2930
+ var SubmissionSchema = z.object({
2931
+ artists: z.array(ArtistSchema).optional(),
2932
+ labels: z.array(LabelSchema).optional(),
2933
+ releases: z.array(ReleaseSchema).optional()
2934
+ });
2935
+ var ContributionsParamsSchema = UsernameInputSchema.merge(
2936
+ QueryParamsSchema([
2937
+ "label",
2938
+ "artist",
2939
+ "title",
2940
+ "catno",
2941
+ "format",
2942
+ "rating",
2943
+ "year",
2944
+ "added"
2945
+ ])
2946
+ );
2947
+ var ContributionsResponseSchema = PaginatedResponseSchema(ReleaseSchema, "contributions");
2948
+ var SubmissionsResponseSchema = PaginatedResponseWithObjectSchema(
2949
+ SubmissionSchema,
2950
+ "submissions"
2951
+ );
2952
+
2953
+ // src/services/user/contribution.ts
2954
+ var UserContributionsService = class extends BaseUserService {
2955
+ /**
2956
+ * Retrieve a user's contributions by username
2957
+ *
2958
+ * @param username The username of the user to get contributions for
2959
+ * @throws {DiscogsResourceNotFoundError} If the username is not found
2960
+ * @throws {DiscogsError} If there's an unexpected error
2961
+ * @returns {ContributionsResponse} The user's contributions
2962
+ */
2963
+ async get({ username, ...options }) {
2964
+ try {
2965
+ const response = await this.request(`/${username}/contributions`, {
2966
+ params: options
2967
+ });
2968
+ const validatedResponse = ContributionsResponseSchema.parse(response);
2969
+ return validatedResponse;
2970
+ } catch (error) {
2971
+ if (isDiscogsError(error)) {
2972
+ throw error;
2973
+ }
2974
+ throw new Error(`Failed to get user contributions: ${String(error)}`);
2975
+ }
2976
+ }
2977
+ };
2978
+ var UserSubmissionsService = class extends BaseUserService {
2979
+ /**
2980
+ * Retrieve a user's submissions by username
2981
+ *
2982
+ * @param username The username of the user to get submissions for
2983
+ * @throws {DiscogsResourceNotFoundError} If the username is not found
2984
+ * @throws {DiscogsError} If there's an unexpected error
2985
+ * @returns {SubmissionResponse} The user's submissions
2986
+ */
2987
+ async get({ username }) {
2988
+ try {
2989
+ const response = await this.request(`/${username}/submissions`);
2990
+ const validatedResponse = SubmissionsResponseSchema.parse(response);
2991
+ return validatedResponse;
2992
+ } catch (error) {
2993
+ if (isDiscogsError(error)) {
2994
+ throw error;
2995
+ }
2996
+ throw new Error(`Failed to get user submissions: ${String(error)}`);
2997
+ }
2998
+ }
2999
+ };
2013
3000
 
2014
3001
  // src/tools/userIdentity.ts
2015
3002
  var getUserIdentityTool = {
@@ -2040,6 +3027,34 @@ var getUserProfileTool = {
2040
3027
  }
2041
3028
  }
2042
3029
  };
3030
+ var getUserSubmissionsTool = {
3031
+ name: "get_user_submissions",
3032
+ description: `Retrieve a user's submissions by username`,
3033
+ parameters: UsernameInputSchema,
3034
+ execute: async (args) => {
3035
+ try {
3036
+ const userSubmissionsService = new UserSubmissionsService();
3037
+ const submissions = await userSubmissionsService.get(args);
3038
+ return JSON.stringify(submissions);
3039
+ } catch (error) {
3040
+ throw formatDiscogsError(error);
3041
+ }
3042
+ }
3043
+ };
3044
+ var getUserContributionsTool = {
3045
+ name: "get_user_contributions",
3046
+ description: `Retrieve a user's contributions by username`,
3047
+ parameters: ContributionsParamsSchema,
3048
+ execute: async (args) => {
3049
+ try {
3050
+ const userContributionsService = new UserContributionsService();
3051
+ const contributions = await userContributionsService.get(args);
3052
+ return JSON.stringify(contributions);
3053
+ } catch (error) {
3054
+ throw formatDiscogsError(error);
3055
+ }
3056
+ }
3057
+ };
2043
3058
  var editUserProfileTool = {
2044
3059
  name: "edit_user_profile",
2045
3060
  description: `Edit a user's profile data`,
@@ -2058,6 +3073,8 @@ function registerUserIdentityTools(server) {
2058
3073
  server.addTool(getUserIdentityTool);
2059
3074
  server.addTool(getUserProfileTool);
2060
3075
  server.addTool(editUserProfileTool);
3076
+ server.addTool(getUserSubmissionsTool);
3077
+ server.addTool(getUserContributionsTool);
2061
3078
  }
2062
3079
  var ListItemSchema = z.object({
2063
3080
  id: z.number(),
@@ -2229,6 +3246,8 @@ function registerUserWantlistTools(server) {
2229
3246
  // src/tools/index.ts
2230
3247
  function registerTools(server) {
2231
3248
  registerDatabaseTools(server);
3249
+ registerMarketplaceTools(server);
3250
+ registerInventoryExportTool(server);
2232
3251
  registerUserIdentityTools(server);
2233
3252
  registerUserCollectionTools(server);
2234
3253
  registerUserWantlistTools(server);