discogs-mcp-server 0.1.0 → 0.3.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/LICENSE +21 -0
- package/README.md +11 -6
- package/dist/index.js +1156 -81
- package/dist/index.js.map +1 -1
- package/package.json +8 -3
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.
|
|
7
|
+
var VERSION = "0.3.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
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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",
|
|
@@ -1008,52 +1087,660 @@ var getReleaseRatingTool = {
|
|
|
1008
1087
|
throw formatDiscogsError(error);
|
|
1009
1088
|
}
|
|
1010
1089
|
}
|
|
1011
|
-
};
|
|
1012
|
-
var searchTool = {
|
|
1013
|
-
name: "search",
|
|
1014
|
-
description: "Issue a search query to the Discogs database",
|
|
1015
|
-
parameters: SearchParamsSchema,
|
|
1016
|
-
execute: async (args) => {
|
|
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;
|
|
1669
|
+
} catch (error) {
|
|
1670
|
+
if (isDiscogsError(error)) {
|
|
1671
|
+
throw error;
|
|
1672
|
+
}
|
|
1673
|
+
throw new Error(`Failed to get orders: ${String(error)}`);
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
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 }) {
|
|
1685
|
+
try {
|
|
1686
|
+
const response = await this.request(`/stats/${release_id}`, {
|
|
1687
|
+
params: options
|
|
1688
|
+
});
|
|
1689
|
+
const validatedResponse = ReleaseStatsResponseSchema.parse(response);
|
|
1690
|
+
return validatedResponse;
|
|
1691
|
+
} catch (error) {
|
|
1692
|
+
if (isDiscogsError(error)) {
|
|
1693
|
+
throw error;
|
|
1694
|
+
}
|
|
1695
|
+
throw new Error(`Failed to get release stats: ${String(error)}`);
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
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
|
|
1019
|
-
|
|
1020
|
-
|
|
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
|
-
|
|
1716
|
+
if (isDiscogsError(error)) {
|
|
1717
|
+
throw error;
|
|
1718
|
+
}
|
|
1719
|
+
throw new Error(`Failed to edit order: ${String(error)}`);
|
|
1023
1720
|
}
|
|
1024
1721
|
}
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
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
|
-
|
|
1732
|
+
await this.request(`/listings/${listing_id}`, {
|
|
1733
|
+
method: "POST",
|
|
1734
|
+
body
|
|
1735
|
+
});
|
|
1049
1736
|
} catch (error) {
|
|
1050
|
-
|
|
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
|
});
|
|
@@ -1070,6 +1757,14 @@ var UserCollectionCustomFieldsSchema = z.object({
|
|
|
1070
1757
|
})
|
|
1071
1758
|
)
|
|
1072
1759
|
});
|
|
1760
|
+
var UserCollectionCustomFieldEditParamsSchema = UsernameInputSchema.merge(
|
|
1761
|
+
FolderIdParamSchema().extend({
|
|
1762
|
+
value: z.string(),
|
|
1763
|
+
release_id: z.union([z.number(), z.string()]),
|
|
1764
|
+
instance_id: z.union([z.number(), z.string()]),
|
|
1765
|
+
field_id: z.number()
|
|
1766
|
+
})
|
|
1767
|
+
);
|
|
1073
1768
|
var UserCollectionFolderSchema = z.object({
|
|
1074
1769
|
id: z.number(),
|
|
1075
1770
|
count: z.number(),
|
|
@@ -1140,6 +1835,24 @@ var UserCollectionValueSchema = z.object({
|
|
|
1140
1835
|
median: z.string(),
|
|
1141
1836
|
minimum: z.string()
|
|
1142
1837
|
});
|
|
1838
|
+
|
|
1839
|
+
// src/types/user/inventory.ts
|
|
1840
|
+
var UserInventoryGetParamsSchema = UsernameInputSchema.extend({
|
|
1841
|
+
status: SaleStatusSchema.optional()
|
|
1842
|
+
}).merge(
|
|
1843
|
+
QueryParamsSchema([
|
|
1844
|
+
"listed",
|
|
1845
|
+
"price",
|
|
1846
|
+
"item",
|
|
1847
|
+
"artist",
|
|
1848
|
+
"label",
|
|
1849
|
+
"catno",
|
|
1850
|
+
"audio",
|
|
1851
|
+
"status",
|
|
1852
|
+
"location"
|
|
1853
|
+
])
|
|
1854
|
+
);
|
|
1855
|
+
var UserInventoryResponseSchema = PaginatedResponseSchema(ListingSchema, "listings");
|
|
1143
1856
|
var UserListItemSchema = z.object({
|
|
1144
1857
|
id: z.number(),
|
|
1145
1858
|
date_added: z.string(),
|
|
@@ -1217,6 +1930,218 @@ var UserWantlistItemParamsSchema = UsernameInputSchema.merge(
|
|
|
1217
1930
|
})
|
|
1218
1931
|
);
|
|
1219
1932
|
|
|
1933
|
+
// src/services/user/inventory.ts
|
|
1934
|
+
var UserInventoryService = class extends BaseUserService {
|
|
1935
|
+
/**
|
|
1936
|
+
* Returns the list of listings in a user's inventory
|
|
1937
|
+
* @param params - Parameters for the request including username and optional pagination/sorting
|
|
1938
|
+
* @returns {UserInventoryResponse} A paginated response containing the user's inventory
|
|
1939
|
+
* @throws {DiscogsResourceNotFoundError} If the username cannot be found
|
|
1940
|
+
* @throws {Error} If there's an unexpected error
|
|
1941
|
+
*/
|
|
1942
|
+
async get({ username, ...options }) {
|
|
1943
|
+
try {
|
|
1944
|
+
const response = await this.request(`/${username}/inventory`, {
|
|
1945
|
+
params: options
|
|
1946
|
+
});
|
|
1947
|
+
const validatedResponse = UserInventoryResponseSchema.parse(response);
|
|
1948
|
+
return validatedResponse;
|
|
1949
|
+
} catch (error) {
|
|
1950
|
+
if (isDiscogsError(error)) {
|
|
1951
|
+
throw error;
|
|
1952
|
+
}
|
|
1953
|
+
throw new Error(`Failed to get inventory: ${String(error)}`);
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
};
|
|
1957
|
+
|
|
1958
|
+
// src/tools/marketplace.ts
|
|
1959
|
+
var createMarketplaceListingTool = {
|
|
1960
|
+
name: "create_marketplace_listing",
|
|
1961
|
+
description: "Create a new marketplace listing",
|
|
1962
|
+
parameters: ListingNewParamsSchema,
|
|
1963
|
+
execute: async (args) => {
|
|
1964
|
+
try {
|
|
1965
|
+
const marketplaceService = new MarketplaceService();
|
|
1966
|
+
const listing = await marketplaceService.createListing(args);
|
|
1967
|
+
return JSON.stringify(listing);
|
|
1968
|
+
} catch (error) {
|
|
1969
|
+
throw formatDiscogsError(error);
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
};
|
|
1973
|
+
var createMarketplaceOrderMessageTool = {
|
|
1974
|
+
name: "create_marketplace_order_message",
|
|
1975
|
+
description: `Adds a new message to the order's message log`,
|
|
1976
|
+
parameters: OrderCreateMessageParamsSchema,
|
|
1977
|
+
execute: async (args) => {
|
|
1978
|
+
try {
|
|
1979
|
+
const marketplaceService = new MarketplaceService();
|
|
1980
|
+
const message = await marketplaceService.createOrderMessage(args);
|
|
1981
|
+
return JSON.stringify(message);
|
|
1982
|
+
} catch (error) {
|
|
1983
|
+
throw formatDiscogsError(error);
|
|
1984
|
+
}
|
|
1985
|
+
}
|
|
1986
|
+
};
|
|
1987
|
+
var deleteMarketplaceListingTool = {
|
|
1988
|
+
name: "delete_marketplace_listing",
|
|
1989
|
+
description: "Delete a marketplace listing",
|
|
1990
|
+
parameters: ListingIdParamSchema,
|
|
1991
|
+
execute: async (args) => {
|
|
1992
|
+
try {
|
|
1993
|
+
const marketplaceService = new MarketplaceService();
|
|
1994
|
+
await marketplaceService.deleteListing(args);
|
|
1995
|
+
return "Listing deleted successfully";
|
|
1996
|
+
} catch (error) {
|
|
1997
|
+
throw formatDiscogsError(error);
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2000
|
+
};
|
|
2001
|
+
var getMarketplaceListingTool = {
|
|
2002
|
+
name: "get_marketplace_listing",
|
|
2003
|
+
description: "Get a listing from the marketplace",
|
|
2004
|
+
parameters: ListingGetParamsSchema,
|
|
2005
|
+
execute: async (args) => {
|
|
2006
|
+
try {
|
|
2007
|
+
const marketplaceService = new MarketplaceService();
|
|
2008
|
+
const listing = await marketplaceService.getListing(args);
|
|
2009
|
+
return JSON.stringify(listing);
|
|
2010
|
+
} catch (error) {
|
|
2011
|
+
throw formatDiscogsError(error);
|
|
2012
|
+
}
|
|
2013
|
+
}
|
|
2014
|
+
};
|
|
2015
|
+
var getMarketplaceOrderTool = {
|
|
2016
|
+
name: "get_marketplace_order",
|
|
2017
|
+
description: "Get a marketplace order",
|
|
2018
|
+
parameters: OrderIdParamSchema,
|
|
2019
|
+
execute: async (args) => {
|
|
2020
|
+
try {
|
|
2021
|
+
const marketplaceService = new MarketplaceService();
|
|
2022
|
+
const order = await marketplaceService.getOrder(args);
|
|
2023
|
+
return JSON.stringify(order);
|
|
2024
|
+
} catch (error) {
|
|
2025
|
+
throw formatDiscogsError(error);
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
};
|
|
2029
|
+
var getMarketplaceOrdersTool = {
|
|
2030
|
+
name: "get_marketplace_orders",
|
|
2031
|
+
description: "Get a list of marketplace orders",
|
|
2032
|
+
parameters: OrdersParamsSchema,
|
|
2033
|
+
execute: async (args) => {
|
|
2034
|
+
try {
|
|
2035
|
+
const marketplaceService = new MarketplaceService();
|
|
2036
|
+
const orders = await marketplaceService.getOrders(args);
|
|
2037
|
+
return JSON.stringify(orders);
|
|
2038
|
+
} catch (error) {
|
|
2039
|
+
throw formatDiscogsError(error);
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
};
|
|
2043
|
+
var getMarketplaceOrderMessagesTool = {
|
|
2044
|
+
name: "get_marketplace_order_messages",
|
|
2045
|
+
description: `Get a list of an order's messages`,
|
|
2046
|
+
parameters: OrderMessagesParamsSchema,
|
|
2047
|
+
execute: async (args) => {
|
|
2048
|
+
try {
|
|
2049
|
+
const marketplaceService = new MarketplaceService();
|
|
2050
|
+
const messages = await marketplaceService.getOrderMessages(args);
|
|
2051
|
+
return JSON.stringify(messages);
|
|
2052
|
+
} catch (error) {
|
|
2053
|
+
throw formatDiscogsError(error);
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
};
|
|
2057
|
+
var getMarketplaceReleaseStatsTool = {
|
|
2058
|
+
name: "get_marketplace_release_stats",
|
|
2059
|
+
description: "Retrieve marketplace statistics for the provided Release ID",
|
|
2060
|
+
parameters: ReleaseParamsSchema,
|
|
2061
|
+
execute: async (args) => {
|
|
2062
|
+
try {
|
|
2063
|
+
const marketplaceService = new MarketplaceService();
|
|
2064
|
+
const stats = await marketplaceService.getReleaseStats(args);
|
|
2065
|
+
return JSON.stringify(stats);
|
|
2066
|
+
} catch (error) {
|
|
2067
|
+
throw formatDiscogsError(error);
|
|
2068
|
+
}
|
|
2069
|
+
}
|
|
2070
|
+
};
|
|
2071
|
+
var getUserInventoryTool = {
|
|
2072
|
+
name: "get_user_inventory",
|
|
2073
|
+
description: `Returns the list of listings in a user's inventory`,
|
|
2074
|
+
parameters: UserInventoryGetParamsSchema,
|
|
2075
|
+
execute: async (args) => {
|
|
2076
|
+
try {
|
|
2077
|
+
const userInventoryService = new UserInventoryService();
|
|
2078
|
+
const inventory = await userInventoryService.get(args);
|
|
2079
|
+
return JSON.stringify(inventory);
|
|
2080
|
+
} catch (error) {
|
|
2081
|
+
throw formatDiscogsError(error);
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2084
|
+
};
|
|
2085
|
+
var editMarketplaceOrderTool = {
|
|
2086
|
+
name: "edit_marketplace_order",
|
|
2087
|
+
description: "Edit a marketplace order",
|
|
2088
|
+
parameters: OrderEditParamsSchema,
|
|
2089
|
+
execute: async (args) => {
|
|
2090
|
+
try {
|
|
2091
|
+
const marketplaceService = new MarketplaceService();
|
|
2092
|
+
const order = await marketplaceService.editOrder(args);
|
|
2093
|
+
return JSON.stringify(order);
|
|
2094
|
+
} catch (error) {
|
|
2095
|
+
throw formatDiscogsError(error);
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2098
|
+
};
|
|
2099
|
+
var updateMarketplaceListingTool = {
|
|
2100
|
+
name: "update_marketplace_listing",
|
|
2101
|
+
description: "Update a marketplace listing",
|
|
2102
|
+
parameters: ListingUpdateParamsSchema,
|
|
2103
|
+
execute: async (args) => {
|
|
2104
|
+
try {
|
|
2105
|
+
const marketplaceService = new MarketplaceService();
|
|
2106
|
+
await marketplaceService.updateListing(args);
|
|
2107
|
+
return "Listing updated successfully";
|
|
2108
|
+
} catch (error) {
|
|
2109
|
+
throw formatDiscogsError(error);
|
|
2110
|
+
}
|
|
2111
|
+
}
|
|
2112
|
+
};
|
|
2113
|
+
function registerMarketplaceTools(server) {
|
|
2114
|
+
server.addTool(getUserInventoryTool);
|
|
2115
|
+
server.addTool(getMarketplaceListingTool);
|
|
2116
|
+
server.addTool(createMarketplaceListingTool);
|
|
2117
|
+
server.addTool(updateMarketplaceListingTool);
|
|
2118
|
+
server.addTool(deleteMarketplaceListingTool);
|
|
2119
|
+
server.addTool(getMarketplaceOrderTool);
|
|
2120
|
+
server.addTool(editMarketplaceOrderTool);
|
|
2121
|
+
server.addTool(getMarketplaceOrdersTool);
|
|
2122
|
+
server.addTool(getMarketplaceOrderMessagesTool);
|
|
2123
|
+
server.addTool(createMarketplaceOrderMessageTool);
|
|
2124
|
+
server.addTool(getMarketplaceReleaseStatsTool);
|
|
2125
|
+
}
|
|
2126
|
+
var MediaParamsSchema = z.object({
|
|
2127
|
+
url: z.string().url()
|
|
2128
|
+
});
|
|
2129
|
+
var fetchImageTool = {
|
|
2130
|
+
name: "fetch_image",
|
|
2131
|
+
description: "Fetch an image by URL",
|
|
2132
|
+
parameters: MediaParamsSchema,
|
|
2133
|
+
execute: async ({ url }) => {
|
|
2134
|
+
try {
|
|
2135
|
+
return imageContent({ url });
|
|
2136
|
+
} catch (error) {
|
|
2137
|
+
throw formatDiscogsError(error);
|
|
2138
|
+
}
|
|
2139
|
+
}
|
|
2140
|
+
};
|
|
2141
|
+
function registerMediaTools(server) {
|
|
2142
|
+
server.addTool(fetchImageTool);
|
|
2143
|
+
}
|
|
2144
|
+
|
|
1220
2145
|
// src/services/user/collection.ts
|
|
1221
2146
|
var UserCollectionService = class extends BaseUserService {
|
|
1222
2147
|
/**
|
|
@@ -1331,6 +2256,39 @@ var UserCollectionService = class extends BaseUserService {
|
|
|
1331
2256
|
throw new Error(`Failed to delete release from folder: ${String(error)}`);
|
|
1332
2257
|
}
|
|
1333
2258
|
}
|
|
2259
|
+
/**
|
|
2260
|
+
* Edit a custom field value for a release in a user's collection
|
|
2261
|
+
*
|
|
2262
|
+
* @param params The parameters for the custom field value edit
|
|
2263
|
+
* @throws {DiscogsAuthenticationError} If authentication fails
|
|
2264
|
+
* @throws {DiscogsPermissionError} If trying to edit a custom field value of another user
|
|
2265
|
+
* @throws {DiscogsResourceNotFoundError} If the username, folder_id, release_id, or instance_id cannot be found
|
|
2266
|
+
* @throws {DiscogsValidationFailedError} If the field is a dropdown and the value is not in the list of options
|
|
2267
|
+
* @throws {Error} If there's an unexpected error
|
|
2268
|
+
*/
|
|
2269
|
+
async editCustomFieldValue({
|
|
2270
|
+
username,
|
|
2271
|
+
folder_id,
|
|
2272
|
+
release_id,
|
|
2273
|
+
instance_id,
|
|
2274
|
+
field_id,
|
|
2275
|
+
value
|
|
2276
|
+
}) {
|
|
2277
|
+
try {
|
|
2278
|
+
await this.request(
|
|
2279
|
+
`/${username}/collection/folders/${folder_id}/releases/${release_id}/instances/${instance_id}/fields/${field_id}`,
|
|
2280
|
+
{
|
|
2281
|
+
method: "POST",
|
|
2282
|
+
body: { value }
|
|
2283
|
+
}
|
|
2284
|
+
);
|
|
2285
|
+
} catch (error) {
|
|
2286
|
+
if (isDiscogsError(error)) {
|
|
2287
|
+
throw error;
|
|
2288
|
+
}
|
|
2289
|
+
throw new Error(`Failed to edit custom field value: ${String(error)}`);
|
|
2290
|
+
}
|
|
2291
|
+
}
|
|
1334
2292
|
/**
|
|
1335
2293
|
* Edit a folder's metadata. Folders 0 and 1 cannot be renamed.
|
|
1336
2294
|
*
|
|
@@ -1839,6 +2797,20 @@ var deleteUserCollectionFolderTool = {
|
|
|
1839
2797
|
}
|
|
1840
2798
|
}
|
|
1841
2799
|
};
|
|
2800
|
+
var editUserCollectionCustomFieldValueTool = {
|
|
2801
|
+
name: "edit_user_collection_custom_field_value",
|
|
2802
|
+
description: `Edit a custom field value for a release in a user's collection`,
|
|
2803
|
+
parameters: UserCollectionCustomFieldEditParamsSchema,
|
|
2804
|
+
execute: async (args) => {
|
|
2805
|
+
try {
|
|
2806
|
+
const userService = new UserService();
|
|
2807
|
+
await userService.collection.editCustomFieldValue(args);
|
|
2808
|
+
return "Custom field value edited successfully";
|
|
2809
|
+
} catch (error) {
|
|
2810
|
+
throw formatDiscogsError(error);
|
|
2811
|
+
}
|
|
2812
|
+
}
|
|
2813
|
+
};
|
|
1842
2814
|
var editUserCollectionFolderTool = {
|
|
1843
2815
|
name: "edit_user_collection_folder",
|
|
1844
2816
|
description: `Edit a folder's metadata. Folders 0 and 1 cannot be renamed.`,
|
|
@@ -1978,6 +2950,7 @@ function registerUserCollectionTools(server) {
|
|
|
1978
2950
|
server.addTool(moveReleaseInUserCollectionTool);
|
|
1979
2951
|
server.addTool(deleteReleaseFromUserCollectionFolderTool);
|
|
1980
2952
|
server.addTool(getUserCollectionCustomFieldsTool);
|
|
2953
|
+
server.addTool(editUserCollectionCustomFieldValueTool);
|
|
1981
2954
|
server.addTool(getUserCollectionValueTool);
|
|
1982
2955
|
}
|
|
1983
2956
|
var DiscogsUserIdentitySchema = z.object({
|
|
@@ -2010,6 +2983,76 @@ var OAuthService = class extends DiscogsService {
|
|
|
2010
2983
|
}
|
|
2011
2984
|
}
|
|
2012
2985
|
};
|
|
2986
|
+
var SubmissionSchema = z.object({
|
|
2987
|
+
artists: z.array(ArtistSchema).optional(),
|
|
2988
|
+
labels: z.array(LabelSchema).optional(),
|
|
2989
|
+
releases: z.array(ReleaseSchema).optional()
|
|
2990
|
+
});
|
|
2991
|
+
var ContributionsParamsSchema = UsernameInputSchema.merge(
|
|
2992
|
+
QueryParamsSchema([
|
|
2993
|
+
"label",
|
|
2994
|
+
"artist",
|
|
2995
|
+
"title",
|
|
2996
|
+
"catno",
|
|
2997
|
+
"format",
|
|
2998
|
+
"rating",
|
|
2999
|
+
"year",
|
|
3000
|
+
"added"
|
|
3001
|
+
])
|
|
3002
|
+
);
|
|
3003
|
+
var ContributionsResponseSchema = PaginatedResponseSchema(ReleaseSchema, "contributions");
|
|
3004
|
+
var SubmissionsResponseSchema = PaginatedResponseWithObjectSchema(
|
|
3005
|
+
SubmissionSchema,
|
|
3006
|
+
"submissions"
|
|
3007
|
+
);
|
|
3008
|
+
|
|
3009
|
+
// src/services/user/contribution.ts
|
|
3010
|
+
var UserContributionsService = class extends BaseUserService {
|
|
3011
|
+
/**
|
|
3012
|
+
* Retrieve a user's contributions by username
|
|
3013
|
+
*
|
|
3014
|
+
* @param username The username of the user to get contributions for
|
|
3015
|
+
* @throws {DiscogsResourceNotFoundError} If the username is not found
|
|
3016
|
+
* @throws {DiscogsError} If there's an unexpected error
|
|
3017
|
+
* @returns {ContributionsResponse} The user's contributions
|
|
3018
|
+
*/
|
|
3019
|
+
async get({ username, ...options }) {
|
|
3020
|
+
try {
|
|
3021
|
+
const response = await this.request(`/${username}/contributions`, {
|
|
3022
|
+
params: options
|
|
3023
|
+
});
|
|
3024
|
+
const validatedResponse = ContributionsResponseSchema.parse(response);
|
|
3025
|
+
return validatedResponse;
|
|
3026
|
+
} catch (error) {
|
|
3027
|
+
if (isDiscogsError(error)) {
|
|
3028
|
+
throw error;
|
|
3029
|
+
}
|
|
3030
|
+
throw new Error(`Failed to get user contributions: ${String(error)}`);
|
|
3031
|
+
}
|
|
3032
|
+
}
|
|
3033
|
+
};
|
|
3034
|
+
var UserSubmissionsService = class extends BaseUserService {
|
|
3035
|
+
/**
|
|
3036
|
+
* Retrieve a user's submissions by username
|
|
3037
|
+
*
|
|
3038
|
+
* @param username The username of the user to get submissions for
|
|
3039
|
+
* @throws {DiscogsResourceNotFoundError} If the username is not found
|
|
3040
|
+
* @throws {DiscogsError} If there's an unexpected error
|
|
3041
|
+
* @returns {SubmissionResponse} The user's submissions
|
|
3042
|
+
*/
|
|
3043
|
+
async get({ username }) {
|
|
3044
|
+
try {
|
|
3045
|
+
const response = await this.request(`/${username}/submissions`);
|
|
3046
|
+
const validatedResponse = SubmissionsResponseSchema.parse(response);
|
|
3047
|
+
return validatedResponse;
|
|
3048
|
+
} catch (error) {
|
|
3049
|
+
if (isDiscogsError(error)) {
|
|
3050
|
+
throw error;
|
|
3051
|
+
}
|
|
3052
|
+
throw new Error(`Failed to get user submissions: ${String(error)}`);
|
|
3053
|
+
}
|
|
3054
|
+
}
|
|
3055
|
+
};
|
|
2013
3056
|
|
|
2014
3057
|
// src/tools/userIdentity.ts
|
|
2015
3058
|
var getUserIdentityTool = {
|
|
@@ -2040,6 +3083,34 @@ var getUserProfileTool = {
|
|
|
2040
3083
|
}
|
|
2041
3084
|
}
|
|
2042
3085
|
};
|
|
3086
|
+
var getUserSubmissionsTool = {
|
|
3087
|
+
name: "get_user_submissions",
|
|
3088
|
+
description: `Retrieve a user's submissions by username`,
|
|
3089
|
+
parameters: UsernameInputSchema,
|
|
3090
|
+
execute: async (args) => {
|
|
3091
|
+
try {
|
|
3092
|
+
const userSubmissionsService = new UserSubmissionsService();
|
|
3093
|
+
const submissions = await userSubmissionsService.get(args);
|
|
3094
|
+
return JSON.stringify(submissions);
|
|
3095
|
+
} catch (error) {
|
|
3096
|
+
throw formatDiscogsError(error);
|
|
3097
|
+
}
|
|
3098
|
+
}
|
|
3099
|
+
};
|
|
3100
|
+
var getUserContributionsTool = {
|
|
3101
|
+
name: "get_user_contributions",
|
|
3102
|
+
description: `Retrieve a user's contributions by username`,
|
|
3103
|
+
parameters: ContributionsParamsSchema,
|
|
3104
|
+
execute: async (args) => {
|
|
3105
|
+
try {
|
|
3106
|
+
const userContributionsService = new UserContributionsService();
|
|
3107
|
+
const contributions = await userContributionsService.get(args);
|
|
3108
|
+
return JSON.stringify(contributions);
|
|
3109
|
+
} catch (error) {
|
|
3110
|
+
throw formatDiscogsError(error);
|
|
3111
|
+
}
|
|
3112
|
+
}
|
|
3113
|
+
};
|
|
2043
3114
|
var editUserProfileTool = {
|
|
2044
3115
|
name: "edit_user_profile",
|
|
2045
3116
|
description: `Edit a user's profile data`,
|
|
@@ -2058,6 +3129,8 @@ function registerUserIdentityTools(server) {
|
|
|
2058
3129
|
server.addTool(getUserIdentityTool);
|
|
2059
3130
|
server.addTool(getUserProfileTool);
|
|
2060
3131
|
server.addTool(editUserProfileTool);
|
|
3132
|
+
server.addTool(getUserSubmissionsTool);
|
|
3133
|
+
server.addTool(getUserContributionsTool);
|
|
2061
3134
|
}
|
|
2062
3135
|
var ListItemSchema = z.object({
|
|
2063
3136
|
id: z.number(),
|
|
@@ -2229,6 +3302,8 @@ function registerUserWantlistTools(server) {
|
|
|
2229
3302
|
// src/tools/index.ts
|
|
2230
3303
|
function registerTools(server) {
|
|
2231
3304
|
registerDatabaseTools(server);
|
|
3305
|
+
registerMarketplaceTools(server);
|
|
3306
|
+
registerInventoryExportTool(server);
|
|
2232
3307
|
registerUserIdentityTools(server);
|
|
2233
3308
|
registerUserCollectionTools(server);
|
|
2234
3309
|
registerUserWantlistTools(server);
|