@lehaotech/walmart-mcp 0.5.4
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/.env.example +25 -0
- package/CHANGELOG.md +247 -0
- package/LICENSE +21 -0
- package/README.md +344 -0
- package/build/api/advertising/ad-client.d.ts +24 -0
- package/build/api/advertising/ad-client.js +174 -0
- package/build/api/advertising/advertising-api.d.ts +50 -0
- package/build/api/advertising/advertising-api.js +89 -0
- package/build/api/client.d.ts +19 -0
- package/build/api/client.js +150 -0
- package/build/api/feeds/feeds-api.d.ts +15 -0
- package/build/api/feeds/feeds-api.js +53 -0
- package/build/api/fulfillment/fulfillment-api.d.ts +37 -0
- package/build/api/fulfillment/fulfillment-api.js +81 -0
- package/build/api/index.d.ts +44 -0
- package/build/api/index.js +56 -0
- package/build/api/inventory/inventory-api.d.ts +27 -0
- package/build/api/inventory/inventory-api.js +49 -0
- package/build/api/items/items-api.d.ts +33 -0
- package/build/api/items/items-api.js +67 -0
- package/build/api/notifications/notifications-api.d.ts +14 -0
- package/build/api/notifications/notifications-api.js +33 -0
- package/build/api/orders/orders-api.d.ts +32 -0
- package/build/api/orders/orders-api.js +47 -0
- package/build/api/pricing/pricing-api.d.ts +32 -0
- package/build/api/pricing/pricing-api.js +60 -0
- package/build/api/reports/reports-api.d.ts +37 -0
- package/build/api/reports/reports-api.js +51 -0
- package/build/api/returns/returns-api.d.ts +26 -0
- package/build/api/returns/returns-api.js +37 -0
- package/build/api/settings/settings-api.d.ts +9 -0
- package/build/api/settings/settings-api.js +21 -0
- package/build/auth/oauth.d.ts +16 -0
- package/build/auth/oauth.js +125 -0
- package/build/config/environment.d.ts +22 -0
- package/build/config/environment.js +50 -0
- package/build/index.d.ts +2 -0
- package/build/index.js +180 -0
- package/build/scripts/client-configs.d.ts +36 -0
- package/build/scripts/client-configs.js +132 -0
- package/build/scripts/diagnose.d.ts +15 -0
- package/build/scripts/diagnose.js +320 -0
- package/build/scripts/setup.d.ts +17 -0
- package/build/scripts/setup.js +276 -0
- package/build/tools/definitions/advertising.d.ts +664 -0
- package/build/tools/definitions/advertising.js +315 -0
- package/build/tools/definitions/discovery.d.ts +24 -0
- package/build/tools/definitions/discovery.js +65 -0
- package/build/tools/definitions/feeds.d.ts +46 -0
- package/build/tools/definitions/feeds.js +42 -0
- package/build/tools/definitions/fulfillment.d.ts +1127 -0
- package/build/tools/definitions/fulfillment.js +272 -0
- package/build/tools/definitions/inventory.d.ts +392 -0
- package/build/tools/definitions/inventory.js +182 -0
- package/build/tools/definitions/items.d.ts +447 -0
- package/build/tools/definitions/items.js +223 -0
- package/build/tools/definitions/notifications.d.ts +84 -0
- package/build/tools/definitions/notifications.js +73 -0
- package/build/tools/definitions/orders.d.ts +2659 -0
- package/build/tools/definitions/orders.js +298 -0
- package/build/tools/definitions/pricing.d.ts +724 -0
- package/build/tools/definitions/pricing.js +254 -0
- package/build/tools/definitions/reports.d.ts +223 -0
- package/build/tools/definitions/reports.js +144 -0
- package/build/tools/definitions/returns.d.ts +441 -0
- package/build/tools/definitions/returns.js +126 -0
- package/build/tools/definitions/settings.d.ts +100 -0
- package/build/tools/definitions/settings.js +52 -0
- package/build/tools/definitions/shared-schemas.d.ts +40 -0
- package/build/tools/definitions/shared-schemas.js +47 -0
- package/build/tools/definitions/token-management.d.ts +16 -0
- package/build/tools/definitions/token-management.js +41 -0
- package/build/tools/index.d.ts +6924 -0
- package/build/tools/index.js +379 -0
- package/build/utils/api-error.d.ts +41 -0
- package/build/utils/api-error.js +97 -0
- package/build/utils/endpoint-catalog.d.ts +22 -0
- package/build/utils/endpoint-catalog.js +89 -0
- package/build/utils/env-file.d.ts +12 -0
- package/build/utils/env-file.js +27 -0
- package/build/utils/known-issues.d.ts +29 -0
- package/build/utils/known-issues.js +122 -0
- package/build/utils/logger.d.ts +15 -0
- package/build/utils/logger.js +56 -0
- package/build/utils/rate-limiter.d.ts +51 -0
- package/build/utils/rate-limiter.js +109 -0
- package/package.json +1 -0
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SkuSchema, MoneySchema, Iso8601UtcSchema, Iso4217CurrencySchema, ProcessModeSchema, } from './shared-schemas.js';
|
|
3
|
+
// ---------- Standard (BASE) price feed (feedType=price, legacy v1.5) ----------
|
|
4
|
+
// Walmart legacy price-feed body:
|
|
5
|
+
// { PriceHeader: {version}, Price: [{ itemIdentifier: {sku, productIdType, productId},
|
|
6
|
+
// pricingList: { pricing: [{ currentPrice: { value: {amount, currency} }, currentPriceType }] }
|
|
7
|
+
// }] }
|
|
8
|
+
const LegacyPricingEntrySchema = z
|
|
9
|
+
.object({
|
|
10
|
+
itemIdentifier: z
|
|
11
|
+
.object({
|
|
12
|
+
sku: SkuSchema,
|
|
13
|
+
productIdType: z.literal('SKU').default('SKU'),
|
|
14
|
+
productId: z.string().min(1).optional(),
|
|
15
|
+
})
|
|
16
|
+
.strict(),
|
|
17
|
+
pricingList: z
|
|
18
|
+
.object({
|
|
19
|
+
pricing: z
|
|
20
|
+
.array(z
|
|
21
|
+
.object({
|
|
22
|
+
currentPrice: z
|
|
23
|
+
.object({
|
|
24
|
+
value: z
|
|
25
|
+
.object({
|
|
26
|
+
amount: z.number().positive(),
|
|
27
|
+
currency: Iso4217CurrencySchema,
|
|
28
|
+
})
|
|
29
|
+
.strict(),
|
|
30
|
+
})
|
|
31
|
+
.strict(),
|
|
32
|
+
currentPriceType: z.enum(['BASE', 'REDUCED', 'CLEARANCE']).default('BASE'),
|
|
33
|
+
})
|
|
34
|
+
.strict())
|
|
35
|
+
.min(1, 'Need at least 1 pricing entry per SKU'),
|
|
36
|
+
})
|
|
37
|
+
.strict(),
|
|
38
|
+
})
|
|
39
|
+
.strict();
|
|
40
|
+
const LegacyPriceFeedSchema = z
|
|
41
|
+
.object({
|
|
42
|
+
PriceHeader: z
|
|
43
|
+
.object({
|
|
44
|
+
version: z.string().default('1.5'),
|
|
45
|
+
feedDate: Iso8601UtcSchema.optional(),
|
|
46
|
+
})
|
|
47
|
+
.strict(),
|
|
48
|
+
Price: z
|
|
49
|
+
.array(LegacyPricingEntrySchema)
|
|
50
|
+
.min(1, 'Need at least 1 SKU in a price feed')
|
|
51
|
+
.max(10_000, 'Walmart caps price feeds at ~10000 SKUs per submission'),
|
|
52
|
+
})
|
|
53
|
+
.strict();
|
|
54
|
+
// ---------- MP_ITEM_PRICE_UPDATE feed (newer style) ----------
|
|
55
|
+
const MpPriceEntrySchema = z
|
|
56
|
+
.object({
|
|
57
|
+
sku: SkuSchema,
|
|
58
|
+
pricing: z
|
|
59
|
+
.array(z
|
|
60
|
+
.object({
|
|
61
|
+
currentPrice: MoneySchema,
|
|
62
|
+
currentPriceType: z.enum(['BASE', 'REDUCED', 'CLEARANCE']).default('BASE'),
|
|
63
|
+
processMode: ProcessModeSchema.optional(),
|
|
64
|
+
})
|
|
65
|
+
.strict())
|
|
66
|
+
.min(1)
|
|
67
|
+
.max(10, 'Max 10 pricing entries per SKU'),
|
|
68
|
+
})
|
|
69
|
+
.strict();
|
|
70
|
+
const MpPriceFeedSchema = z
|
|
71
|
+
.object({
|
|
72
|
+
PriceHeader: z
|
|
73
|
+
.object({
|
|
74
|
+
version: z.string().default('1.5.1'),
|
|
75
|
+
feedDate: Iso8601UtcSchema.optional(),
|
|
76
|
+
})
|
|
77
|
+
.strict(),
|
|
78
|
+
Price: z
|
|
79
|
+
.array(MpPriceEntrySchema)
|
|
80
|
+
.min(1)
|
|
81
|
+
.max(10_000),
|
|
82
|
+
})
|
|
83
|
+
.strict();
|
|
84
|
+
// ---------- PROMO_PRICE feed body ----------
|
|
85
|
+
const PromoPricingEntrySchema = z
|
|
86
|
+
.object({
|
|
87
|
+
currentPrice: MoneySchema,
|
|
88
|
+
currentPriceType: z.enum(['REDUCED', 'CLEARANCE']),
|
|
89
|
+
comparisonPrice: MoneySchema,
|
|
90
|
+
comparisonPriceType: z.literal('BASE'),
|
|
91
|
+
priceDisplayCodes: z.literal('CART').default('CART'),
|
|
92
|
+
effectiveDate: Iso8601UtcSchema,
|
|
93
|
+
expirationDate: Iso8601UtcSchema,
|
|
94
|
+
processMode: ProcessModeSchema,
|
|
95
|
+
})
|
|
96
|
+
.strict()
|
|
97
|
+
.refine((p) => p.currentPrice.amount < p.comparisonPrice.amount, {
|
|
98
|
+
message: 'currentPrice.amount must be < comparisonPrice.amount',
|
|
99
|
+
path: ['currentPrice', 'amount'],
|
|
100
|
+
})
|
|
101
|
+
.refine((p) => new Date(p.expirationDate).getTime() > new Date(p.effectiveDate).getTime(), {
|
|
102
|
+
message: 'expirationDate must be after effectiveDate',
|
|
103
|
+
path: ['expirationDate'],
|
|
104
|
+
})
|
|
105
|
+
.refine((p) => {
|
|
106
|
+
const days = (new Date(p.expirationDate).getTime() - new Date(p.effectiveDate).getTime()) /
|
|
107
|
+
(24 * 60 * 60 * 1000);
|
|
108
|
+
return days <= 180;
|
|
109
|
+
}, { message: 'Promo duration cannot exceed 180 days', path: ['expirationDate'] })
|
|
110
|
+
.refine((p) => new Date(p.effectiveDate).getTime() - Date.now() >= 4 * 60 * 60 * 1000, {
|
|
111
|
+
message: 'effectiveDate must be at least 4 hours from current UTC',
|
|
112
|
+
path: ['effectiveDate'],
|
|
113
|
+
})
|
|
114
|
+
.refine((p) => p.currentPrice.currency === p.comparisonPrice.currency, {
|
|
115
|
+
message: 'currentPrice and comparisonPrice must use the same currency',
|
|
116
|
+
path: ['currentPrice', 'currency'],
|
|
117
|
+
});
|
|
118
|
+
const PromoPriceEntrySchema = z
|
|
119
|
+
.object({
|
|
120
|
+
sku: SkuSchema,
|
|
121
|
+
pricing: z
|
|
122
|
+
.array(PromoPricingEntrySchema)
|
|
123
|
+
.min(1, 'Need at least 1 pricing entry per SKU')
|
|
124
|
+
.max(10, 'Max 10 active promos per SKU'),
|
|
125
|
+
})
|
|
126
|
+
.strict();
|
|
127
|
+
const PromoPriceFeedSchema = z
|
|
128
|
+
.object({
|
|
129
|
+
PriceHeader: z
|
|
130
|
+
.object({
|
|
131
|
+
version: z.string().default('1.5.1'),
|
|
132
|
+
feedDate: Iso8601UtcSchema.optional(),
|
|
133
|
+
})
|
|
134
|
+
.strict(),
|
|
135
|
+
Price: z
|
|
136
|
+
.array(PromoPriceEntrySchema)
|
|
137
|
+
.min(1)
|
|
138
|
+
.max(10_000, 'Walmart caps PROMO_PRICE feeds at ~10000 SKUs per submission'),
|
|
139
|
+
})
|
|
140
|
+
.strict();
|
|
141
|
+
// ---------- Repricer strategy ----------
|
|
142
|
+
// Walmart Repricer's strategy body shape varies and is sparsely documented.
|
|
143
|
+
// We require the documented "must have a name + rules array" envelope and
|
|
144
|
+
// passthrough the rest until Walmart publishes a public spec.
|
|
145
|
+
const RepricerStrategySchema = z
|
|
146
|
+
.object({
|
|
147
|
+
strategyName: z.string().min(1).max(100),
|
|
148
|
+
description: z.string().max(500).optional(),
|
|
149
|
+
rules: z.array(z.unknown()).min(1, 'Repricer strategy must have at least 1 rule'),
|
|
150
|
+
minPrice: z.number().positive().optional(),
|
|
151
|
+
maxPrice: z.number().positive().optional(),
|
|
152
|
+
})
|
|
153
|
+
.passthrough()
|
|
154
|
+
.refine((s) => !(s.minPrice != null && s.maxPrice != null) || s.minPrice <= s.maxPrice, { message: 'minPrice must be <= maxPrice', path: ['minPrice'] });
|
|
155
|
+
// ---------- Strategy assignment ----------
|
|
156
|
+
const StrategyAssignmentItemSchema = z
|
|
157
|
+
.object({
|
|
158
|
+
sku: SkuSchema,
|
|
159
|
+
})
|
|
160
|
+
.passthrough();
|
|
161
|
+
export const pricingTools = [
|
|
162
|
+
{
|
|
163
|
+
name: 'walmart_update_price',
|
|
164
|
+
description: 'Update the regular (BASE) price for a single item by SKU. Pass sku and amount; ' +
|
|
165
|
+
'the Walmart /v3/price payload is built for you. For promo/strikethrough pricing use ' +
|
|
166
|
+
'walmart_submit_promo_price_feed.',
|
|
167
|
+
inputSchema: {
|
|
168
|
+
sku: z.string().describe('Seller-defined SKU'),
|
|
169
|
+
amount: z.number().positive().describe('New price amount, e.g. 16.99'),
|
|
170
|
+
currency: z.string().length(3).optional().describe('ISO 4217 currency code (default USD)'),
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
name: 'walmart_submit_price_feed',
|
|
175
|
+
description: 'Submit a bulk legacy price update feed (feedType=price, spec 1.5). Payload: ' +
|
|
176
|
+
'{ PriceHeader: { version }, Price: [{ itemIdentifier: { sku, productIdType, productId }, ' +
|
|
177
|
+
'pricingList: { pricing: [{ currentPrice: { value: { amount, currency } }, ' +
|
|
178
|
+
'currentPriceType }] } }] }. Returns a feedId; poll walmart_get_feed_status.',
|
|
179
|
+
inputSchema: {
|
|
180
|
+
feedData: LegacyPriceFeedSchema,
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
name: 'walmart_submit_mp_price_feed',
|
|
185
|
+
description: 'Submit a marketplace price update feed (feedType=MP_ITEM_PRICE_UPDATE). Payload: ' +
|
|
186
|
+
'{ PriceHeader, Price: [{ sku, pricing: [{ currentPrice: { currency, amount }, ' +
|
|
187
|
+
'currentPriceType }] }] }. Returns a feedId.',
|
|
188
|
+
inputSchema: {
|
|
189
|
+
feedData: MpPriceFeedSchema,
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
name: 'walmart_submit_promo_price_feed',
|
|
194
|
+
description: 'Submit a promotional price feed (feedType=PROMO_PRICE). Walmart business rules enforced at ' +
|
|
195
|
+
'the schema layer BEFORE the API call: currentPrice < comparisonPrice, currency matches on ' +
|
|
196
|
+
'both, effectiveDate >= now + 4h, expirationDate > effectiveDate, duration <= 180 days, ' +
|
|
197
|
+
'max 10 promos per SKU, max 10000 SKUs per feed. Supports REDUCED and CLEARANCE ' +
|
|
198
|
+
'currentPriceType. Returns a feedId; poll walmart_get_feed_status until PROCESSED.',
|
|
199
|
+
inputSchema: {
|
|
200
|
+
feedData: PromoPriceFeedSchema,
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
name: 'walmart_get_repricer_strategies',
|
|
205
|
+
description: 'List all configured repricer strategies. Repricer automates price adjustments based on Buy Box competition.',
|
|
206
|
+
inputSchema: {},
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
name: 'walmart_create_repricer_strategy',
|
|
210
|
+
description: 'Create a new repricer strategy. Required: strategyName, rules (non-empty array). ' +
|
|
211
|
+
'Optional: description, minPrice / maxPrice (minPrice <= maxPrice).',
|
|
212
|
+
inputSchema: {
|
|
213
|
+
strategyData: RepricerStrategySchema,
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
name: 'walmart_update_repricer_strategy',
|
|
218
|
+
description: 'Update an existing repricer strategy. Same shape as create.',
|
|
219
|
+
inputSchema: {
|
|
220
|
+
strategyData: RepricerStrategySchema,
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
name: 'walmart_delete_repricer_strategy',
|
|
225
|
+
description: 'Delete a repricer strategy by ID.',
|
|
226
|
+
inputSchema: {
|
|
227
|
+
strategyId: z.string().describe('Repricer strategy ID to delete'),
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
name: 'walmart_assign_items_to_strategy',
|
|
232
|
+
description: 'Assign items to a repricer strategy. Pass items: [{ sku }, ...]. The repricer will then ' +
|
|
233
|
+
'automatically manage pricing for these SKUs.',
|
|
234
|
+
inputSchema: {
|
|
235
|
+
strategyId: z.string().describe('Repricer strategy ID'),
|
|
236
|
+
items: z
|
|
237
|
+
.array(StrategyAssignmentItemSchema)
|
|
238
|
+
.min(1, 'Need at least 1 item to assign')
|
|
239
|
+
.max(10_000, 'Assignment capped at 10000 SKUs per call'),
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
name: 'walmart_unassign_items_from_strategy',
|
|
244
|
+
description: 'Remove items from a repricer strategy. Items will return to manual pricing.',
|
|
245
|
+
inputSchema: {
|
|
246
|
+
strategyId: z.string().describe('Repricer strategy ID'),
|
|
247
|
+
skus: z
|
|
248
|
+
.array(SkuSchema)
|
|
249
|
+
.min(1)
|
|
250
|
+
.max(10_000)
|
|
251
|
+
.describe('Array of SKUs to unassign'),
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
];
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const reportTools: ({
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
reportData: z.ZodEffects<z.ZodObject<{
|
|
7
|
+
reportType: z.ZodEnum<["ITEM", "BUYBOX", "CANCELLATION", "DELIVERY_DEFECT", "CPA", "ITEM_PERFORMANCE", "RETURN_OVERRIDES", "PROMO", "INVENTORY", "SETTLEMENT", "PERFORMANCE", "ITEM_LISTING_AUDIT"]>;
|
|
8
|
+
reportVersion: z.ZodOptional<z.ZodString>;
|
|
9
|
+
startDate: z.ZodOptional<z.ZodString>;
|
|
10
|
+
endDate: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
12
|
+
reportType: z.ZodEnum<["ITEM", "BUYBOX", "CANCELLATION", "DELIVERY_DEFECT", "CPA", "ITEM_PERFORMANCE", "RETURN_OVERRIDES", "PROMO", "INVENTORY", "SETTLEMENT", "PERFORMANCE", "ITEM_LISTING_AUDIT"]>;
|
|
13
|
+
reportVersion: z.ZodOptional<z.ZodString>;
|
|
14
|
+
startDate: z.ZodOptional<z.ZodString>;
|
|
15
|
+
endDate: z.ZodOptional<z.ZodString>;
|
|
16
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
17
|
+
reportType: z.ZodEnum<["ITEM", "BUYBOX", "CANCELLATION", "DELIVERY_DEFECT", "CPA", "ITEM_PERFORMANCE", "RETURN_OVERRIDES", "PROMO", "INVENTORY", "SETTLEMENT", "PERFORMANCE", "ITEM_LISTING_AUDIT"]>;
|
|
18
|
+
reportVersion: z.ZodOptional<z.ZodString>;
|
|
19
|
+
startDate: z.ZodOptional<z.ZodString>;
|
|
20
|
+
endDate: z.ZodOptional<z.ZodString>;
|
|
21
|
+
}, z.ZodTypeAny, "passthrough">>, z.objectOutputType<{
|
|
22
|
+
reportType: z.ZodEnum<["ITEM", "BUYBOX", "CANCELLATION", "DELIVERY_DEFECT", "CPA", "ITEM_PERFORMANCE", "RETURN_OVERRIDES", "PROMO", "INVENTORY", "SETTLEMENT", "PERFORMANCE", "ITEM_LISTING_AUDIT"]>;
|
|
23
|
+
reportVersion: z.ZodOptional<z.ZodString>;
|
|
24
|
+
startDate: z.ZodOptional<z.ZodString>;
|
|
25
|
+
endDate: z.ZodOptional<z.ZodString>;
|
|
26
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
27
|
+
reportType: z.ZodEnum<["ITEM", "BUYBOX", "CANCELLATION", "DELIVERY_DEFECT", "CPA", "ITEM_PERFORMANCE", "RETURN_OVERRIDES", "PROMO", "INVENTORY", "SETTLEMENT", "PERFORMANCE", "ITEM_LISTING_AUDIT"]>;
|
|
28
|
+
reportVersion: z.ZodOptional<z.ZodString>;
|
|
29
|
+
startDate: z.ZodOptional<z.ZodString>;
|
|
30
|
+
endDate: z.ZodOptional<z.ZodString>;
|
|
31
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
32
|
+
reportType?: undefined;
|
|
33
|
+
reportVersion?: undefined;
|
|
34
|
+
requestId?: undefined;
|
|
35
|
+
scheduleData?: undefined;
|
|
36
|
+
scheduleId?: undefined;
|
|
37
|
+
limit?: undefined;
|
|
38
|
+
offset?: undefined;
|
|
39
|
+
category?: undefined;
|
|
40
|
+
};
|
|
41
|
+
} | {
|
|
42
|
+
name: string;
|
|
43
|
+
description: string;
|
|
44
|
+
inputSchema: {
|
|
45
|
+
reportType: z.ZodOptional<z.ZodEnum<["ITEM", "BUYBOX", "CANCELLATION", "DELIVERY_DEFECT", "CPA", "ITEM_PERFORMANCE", "RETURN_OVERRIDES", "PROMO", "INVENTORY", "SETTLEMENT", "PERFORMANCE", "ITEM_LISTING_AUDIT"]>>;
|
|
46
|
+
reportVersion: z.ZodOptional<z.ZodString>;
|
|
47
|
+
reportData?: undefined;
|
|
48
|
+
requestId?: undefined;
|
|
49
|
+
scheduleData?: undefined;
|
|
50
|
+
scheduleId?: undefined;
|
|
51
|
+
limit?: undefined;
|
|
52
|
+
offset?: undefined;
|
|
53
|
+
category?: undefined;
|
|
54
|
+
};
|
|
55
|
+
} | {
|
|
56
|
+
name: string;
|
|
57
|
+
description: string;
|
|
58
|
+
inputSchema: {
|
|
59
|
+
requestId: z.ZodString;
|
|
60
|
+
reportData?: undefined;
|
|
61
|
+
reportType?: undefined;
|
|
62
|
+
reportVersion?: undefined;
|
|
63
|
+
scheduleData?: undefined;
|
|
64
|
+
scheduleId?: undefined;
|
|
65
|
+
limit?: undefined;
|
|
66
|
+
offset?: undefined;
|
|
67
|
+
category?: undefined;
|
|
68
|
+
};
|
|
69
|
+
} | {
|
|
70
|
+
name: string;
|
|
71
|
+
description: string;
|
|
72
|
+
inputSchema: {
|
|
73
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
74
|
+
reportType: z.ZodOptional<z.ZodEnum<["ITEM", "BUYBOX", "CANCELLATION", "DELIVERY_DEFECT", "CPA", "ITEM_PERFORMANCE", "RETURN_OVERRIDES", "PROMO", "INVENTORY", "SETTLEMENT", "PERFORMANCE", "ITEM_LISTING_AUDIT"]>>;
|
|
75
|
+
reportData?: undefined;
|
|
76
|
+
reportVersion?: undefined;
|
|
77
|
+
scheduleData?: undefined;
|
|
78
|
+
scheduleId?: undefined;
|
|
79
|
+
limit?: undefined;
|
|
80
|
+
offset?: undefined;
|
|
81
|
+
category?: undefined;
|
|
82
|
+
};
|
|
83
|
+
} | {
|
|
84
|
+
name: string;
|
|
85
|
+
description: string;
|
|
86
|
+
inputSchema: {
|
|
87
|
+
scheduleData: z.ZodObject<{
|
|
88
|
+
reportType: z.ZodEnum<["ITEM", "BUYBOX", "CANCELLATION", "DELIVERY_DEFECT", "CPA", "ITEM_PERFORMANCE", "RETURN_OVERRIDES", "PROMO", "INVENTORY", "SETTLEMENT", "PERFORMANCE", "ITEM_LISTING_AUDIT"]>;
|
|
89
|
+
reportVersion: z.ZodOptional<z.ZodString>;
|
|
90
|
+
frequency: z.ZodEnum<["DAILY", "WEEKLY", "MONTHLY"]>;
|
|
91
|
+
timeOfDay: z.ZodOptional<z.ZodString>;
|
|
92
|
+
dayOfWeek: z.ZodOptional<z.ZodEnum<["MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"]>>;
|
|
93
|
+
dayOfMonth: z.ZodOptional<z.ZodNumber>;
|
|
94
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
95
|
+
reportType: z.ZodEnum<["ITEM", "BUYBOX", "CANCELLATION", "DELIVERY_DEFECT", "CPA", "ITEM_PERFORMANCE", "RETURN_OVERRIDES", "PROMO", "INVENTORY", "SETTLEMENT", "PERFORMANCE", "ITEM_LISTING_AUDIT"]>;
|
|
96
|
+
reportVersion: z.ZodOptional<z.ZodString>;
|
|
97
|
+
frequency: z.ZodEnum<["DAILY", "WEEKLY", "MONTHLY"]>;
|
|
98
|
+
timeOfDay: z.ZodOptional<z.ZodString>;
|
|
99
|
+
dayOfWeek: z.ZodOptional<z.ZodEnum<["MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"]>>;
|
|
100
|
+
dayOfMonth: z.ZodOptional<z.ZodNumber>;
|
|
101
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
102
|
+
reportType: z.ZodEnum<["ITEM", "BUYBOX", "CANCELLATION", "DELIVERY_DEFECT", "CPA", "ITEM_PERFORMANCE", "RETURN_OVERRIDES", "PROMO", "INVENTORY", "SETTLEMENT", "PERFORMANCE", "ITEM_LISTING_AUDIT"]>;
|
|
103
|
+
reportVersion: z.ZodOptional<z.ZodString>;
|
|
104
|
+
frequency: z.ZodEnum<["DAILY", "WEEKLY", "MONTHLY"]>;
|
|
105
|
+
timeOfDay: z.ZodOptional<z.ZodString>;
|
|
106
|
+
dayOfWeek: z.ZodOptional<z.ZodEnum<["MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"]>>;
|
|
107
|
+
dayOfMonth: z.ZodOptional<z.ZodNumber>;
|
|
108
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
109
|
+
reportData?: undefined;
|
|
110
|
+
reportType?: undefined;
|
|
111
|
+
reportVersion?: undefined;
|
|
112
|
+
requestId?: undefined;
|
|
113
|
+
scheduleId?: undefined;
|
|
114
|
+
limit?: undefined;
|
|
115
|
+
offset?: undefined;
|
|
116
|
+
category?: undefined;
|
|
117
|
+
};
|
|
118
|
+
} | {
|
|
119
|
+
name: string;
|
|
120
|
+
description: string;
|
|
121
|
+
inputSchema: {
|
|
122
|
+
reportType: z.ZodOptional<z.ZodEnum<["ITEM", "BUYBOX", "CANCELLATION", "DELIVERY_DEFECT", "CPA", "ITEM_PERFORMANCE", "RETURN_OVERRIDES", "PROMO", "INVENTORY", "SETTLEMENT", "PERFORMANCE", "ITEM_LISTING_AUDIT"]>>;
|
|
123
|
+
reportData?: undefined;
|
|
124
|
+
reportVersion?: undefined;
|
|
125
|
+
requestId?: undefined;
|
|
126
|
+
scheduleData?: undefined;
|
|
127
|
+
scheduleId?: undefined;
|
|
128
|
+
limit?: undefined;
|
|
129
|
+
offset?: undefined;
|
|
130
|
+
category?: undefined;
|
|
131
|
+
};
|
|
132
|
+
} | {
|
|
133
|
+
name: string;
|
|
134
|
+
description: string;
|
|
135
|
+
inputSchema: {
|
|
136
|
+
scheduleId: z.ZodString;
|
|
137
|
+
scheduleData: z.ZodObject<{
|
|
138
|
+
reportType: z.ZodEnum<["ITEM", "BUYBOX", "CANCELLATION", "DELIVERY_DEFECT", "CPA", "ITEM_PERFORMANCE", "RETURN_OVERRIDES", "PROMO", "INVENTORY", "SETTLEMENT", "PERFORMANCE", "ITEM_LISTING_AUDIT"]>;
|
|
139
|
+
reportVersion: z.ZodOptional<z.ZodString>;
|
|
140
|
+
frequency: z.ZodEnum<["DAILY", "WEEKLY", "MONTHLY"]>;
|
|
141
|
+
timeOfDay: z.ZodOptional<z.ZodString>;
|
|
142
|
+
dayOfWeek: z.ZodOptional<z.ZodEnum<["MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"]>>;
|
|
143
|
+
dayOfMonth: z.ZodOptional<z.ZodNumber>;
|
|
144
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
145
|
+
reportType: z.ZodEnum<["ITEM", "BUYBOX", "CANCELLATION", "DELIVERY_DEFECT", "CPA", "ITEM_PERFORMANCE", "RETURN_OVERRIDES", "PROMO", "INVENTORY", "SETTLEMENT", "PERFORMANCE", "ITEM_LISTING_AUDIT"]>;
|
|
146
|
+
reportVersion: z.ZodOptional<z.ZodString>;
|
|
147
|
+
frequency: z.ZodEnum<["DAILY", "WEEKLY", "MONTHLY"]>;
|
|
148
|
+
timeOfDay: z.ZodOptional<z.ZodString>;
|
|
149
|
+
dayOfWeek: z.ZodOptional<z.ZodEnum<["MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"]>>;
|
|
150
|
+
dayOfMonth: z.ZodOptional<z.ZodNumber>;
|
|
151
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
152
|
+
reportType: z.ZodEnum<["ITEM", "BUYBOX", "CANCELLATION", "DELIVERY_DEFECT", "CPA", "ITEM_PERFORMANCE", "RETURN_OVERRIDES", "PROMO", "INVENTORY", "SETTLEMENT", "PERFORMANCE", "ITEM_LISTING_AUDIT"]>;
|
|
153
|
+
reportVersion: z.ZodOptional<z.ZodString>;
|
|
154
|
+
frequency: z.ZodEnum<["DAILY", "WEEKLY", "MONTHLY"]>;
|
|
155
|
+
timeOfDay: z.ZodOptional<z.ZodString>;
|
|
156
|
+
dayOfWeek: z.ZodOptional<z.ZodEnum<["MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"]>>;
|
|
157
|
+
dayOfMonth: z.ZodOptional<z.ZodNumber>;
|
|
158
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
159
|
+
reportData?: undefined;
|
|
160
|
+
reportType?: undefined;
|
|
161
|
+
reportVersion?: undefined;
|
|
162
|
+
requestId?: undefined;
|
|
163
|
+
limit?: undefined;
|
|
164
|
+
offset?: undefined;
|
|
165
|
+
category?: undefined;
|
|
166
|
+
};
|
|
167
|
+
} | {
|
|
168
|
+
name: string;
|
|
169
|
+
description: string;
|
|
170
|
+
inputSchema: {
|
|
171
|
+
scheduleId: z.ZodString;
|
|
172
|
+
reportData?: undefined;
|
|
173
|
+
reportType?: undefined;
|
|
174
|
+
reportVersion?: undefined;
|
|
175
|
+
requestId?: undefined;
|
|
176
|
+
scheduleData?: undefined;
|
|
177
|
+
limit?: undefined;
|
|
178
|
+
offset?: undefined;
|
|
179
|
+
category?: undefined;
|
|
180
|
+
};
|
|
181
|
+
} | {
|
|
182
|
+
name: string;
|
|
183
|
+
description: string;
|
|
184
|
+
inputSchema: {
|
|
185
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
186
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
187
|
+
reportData?: undefined;
|
|
188
|
+
reportType?: undefined;
|
|
189
|
+
reportVersion?: undefined;
|
|
190
|
+
requestId?: undefined;
|
|
191
|
+
scheduleData?: undefined;
|
|
192
|
+
scheduleId?: undefined;
|
|
193
|
+
category?: undefined;
|
|
194
|
+
};
|
|
195
|
+
} | {
|
|
196
|
+
name: string;
|
|
197
|
+
description: string;
|
|
198
|
+
inputSchema: {
|
|
199
|
+
category: z.ZodOptional<z.ZodString>;
|
|
200
|
+
reportData?: undefined;
|
|
201
|
+
reportType?: undefined;
|
|
202
|
+
reportVersion?: undefined;
|
|
203
|
+
requestId?: undefined;
|
|
204
|
+
scheduleData?: undefined;
|
|
205
|
+
scheduleId?: undefined;
|
|
206
|
+
limit?: undefined;
|
|
207
|
+
offset?: undefined;
|
|
208
|
+
};
|
|
209
|
+
} | {
|
|
210
|
+
name: string;
|
|
211
|
+
description: string;
|
|
212
|
+
inputSchema: {
|
|
213
|
+
category: z.ZodOptional<z.ZodString>;
|
|
214
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
215
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
216
|
+
reportData?: undefined;
|
|
217
|
+
reportType?: undefined;
|
|
218
|
+
reportVersion?: undefined;
|
|
219
|
+
requestId?: undefined;
|
|
220
|
+
scheduleData?: undefined;
|
|
221
|
+
scheduleId?: undefined;
|
|
222
|
+
};
|
|
223
|
+
})[];
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Iso8601UtcSchema } from './shared-schemas.js';
|
|
3
|
+
// Walmart on-demand report types.
|
|
4
|
+
const ReportTypeSchema = z.enum([
|
|
5
|
+
'ITEM',
|
|
6
|
+
'BUYBOX',
|
|
7
|
+
'CANCELLATION',
|
|
8
|
+
'DELIVERY_DEFECT',
|
|
9
|
+
'CPA',
|
|
10
|
+
'ITEM_PERFORMANCE',
|
|
11
|
+
'RETURN_OVERRIDES',
|
|
12
|
+
'PROMO',
|
|
13
|
+
'INVENTORY',
|
|
14
|
+
'SETTLEMENT',
|
|
15
|
+
'PERFORMANCE',
|
|
16
|
+
'ITEM_LISTING_AUDIT',
|
|
17
|
+
]);
|
|
18
|
+
// Recurring schedule frequencies.
|
|
19
|
+
const ScheduleFrequencySchema = z.enum(['DAILY', 'WEEKLY', 'MONTHLY']);
|
|
20
|
+
// Create-report body. reportType required, rest passthrough so we don't
|
|
21
|
+
// re-document every per-report-type filter set.
|
|
22
|
+
const CreateReportBodySchema = z
|
|
23
|
+
.object({
|
|
24
|
+
reportType: ReportTypeSchema.describe('Walmart report type'),
|
|
25
|
+
reportVersion: z.string().optional().describe('Optional report version'),
|
|
26
|
+
startDate: Iso8601UtcSchema.optional().describe('Date-range start (ISO 8601)'),
|
|
27
|
+
endDate: Iso8601UtcSchema.optional().describe('Date-range end (ISO 8601)'),
|
|
28
|
+
})
|
|
29
|
+
.passthrough()
|
|
30
|
+
.refine((r) => !(r.startDate && r.endDate) || new Date(r.endDate).getTime() >= new Date(r.startDate).getTime(), { message: 'endDate must be >= startDate', path: ['endDate'] });
|
|
31
|
+
const CreateScheduleBodySchema = z
|
|
32
|
+
.object({
|
|
33
|
+
reportType: ReportTypeSchema,
|
|
34
|
+
reportVersion: z.string().optional(),
|
|
35
|
+
frequency: ScheduleFrequencySchema,
|
|
36
|
+
timeOfDay: z
|
|
37
|
+
.string()
|
|
38
|
+
.regex(/^([01][0-9]|2[0-3]):[0-5][0-9]$/, 'timeOfDay must be HH:MM (24-hour)')
|
|
39
|
+
.optional(),
|
|
40
|
+
dayOfWeek: z.enum(['MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT', 'SUN']).optional(),
|
|
41
|
+
dayOfMonth: z.number().int().min(1).max(31).optional(),
|
|
42
|
+
})
|
|
43
|
+
.passthrough();
|
|
44
|
+
export const reportTools = [
|
|
45
|
+
// ===== Report Requests =====
|
|
46
|
+
{
|
|
47
|
+
name: 'walmart_create_report',
|
|
48
|
+
description: 'Request generation of a report. reportType is required; supported types: ITEM, BUYBOX, ' +
|
|
49
|
+
'CANCELLATION, DELIVERY_DEFECT, CPA, ITEM_PERFORMANCE, RETURN_OVERRIDES, PROMO, INVENTORY, ' +
|
|
50
|
+
'SETTLEMENT, PERFORMANCE, ITEM_LISTING_AUDIT. Optional startDate/endDate (ISO 8601). ' +
|
|
51
|
+
'Per-report-type extra filters pass through. Returns a requestId; poll walmart_get_report_status.',
|
|
52
|
+
inputSchema: {
|
|
53
|
+
reportData: CreateReportBodySchema,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'walmart_get_report_requests',
|
|
58
|
+
description: 'List all report generation requests with optional filtering by type.',
|
|
59
|
+
inputSchema: {
|
|
60
|
+
reportType: ReportTypeSchema.optional().describe('Filter by report type'),
|
|
61
|
+
reportVersion: z.string().optional().describe('Filter by report version'),
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'walmart_get_report_status',
|
|
66
|
+
description: 'Check the status of a specific report request. Status: RECEIVED, INPROGRESS, READY, ERROR.',
|
|
67
|
+
inputSchema: {
|
|
68
|
+
requestId: z.string().describe('Report request ID'),
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: 'walmart_download_report',
|
|
73
|
+
description: 'Download a completed report. Report must be in READY status.',
|
|
74
|
+
inputSchema: {
|
|
75
|
+
requestId: z.string().optional().describe('Report request ID'),
|
|
76
|
+
reportType: ReportTypeSchema.optional().describe('Report type to download the latest for'),
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
// ===== Report Schedules =====
|
|
80
|
+
{
|
|
81
|
+
name: 'walmart_create_report_schedule',
|
|
82
|
+
description: 'Create a recurring report schedule. Required: reportType + frequency (DAILY/WEEKLY/MONTHLY). ' +
|
|
83
|
+
'Optional: timeOfDay (HH:MM 24h), dayOfWeek (MON-SUN), dayOfMonth (1-31). Walmart enforces ' +
|
|
84
|
+
'reportType + frequency combinations.',
|
|
85
|
+
inputSchema: {
|
|
86
|
+
scheduleData: CreateScheduleBodySchema,
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: 'walmart_get_report_schedules',
|
|
91
|
+
description: 'List all configured report schedules.',
|
|
92
|
+
inputSchema: {
|
|
93
|
+
reportType: ReportTypeSchema.optional().describe('Filter by report type'),
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'walmart_update_report_schedule',
|
|
98
|
+
description: 'Update an existing report schedule configuration.',
|
|
99
|
+
inputSchema: {
|
|
100
|
+
scheduleId: z.string().describe('Report schedule ID to update'),
|
|
101
|
+
scheduleData: CreateScheduleBodySchema,
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: 'walmart_delete_report_schedule',
|
|
106
|
+
description: 'Delete a recurring report schedule.',
|
|
107
|
+
inputSchema: {
|
|
108
|
+
scheduleId: z.string().describe('Report schedule ID to delete'),
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
// ===== Insights =====
|
|
112
|
+
{
|
|
113
|
+
name: 'walmart_get_unpublished_items',
|
|
114
|
+
description: 'Get items that are not published on Walmart.com with reasons. Helps fix listing issues.',
|
|
115
|
+
inputSchema: {
|
|
116
|
+
limit: z.number().int().min(1).max(200).optional().describe('Results per page'),
|
|
117
|
+
offset: z.number().int().min(0).optional().describe('Pagination offset'),
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: 'walmart_get_listing_quality',
|
|
122
|
+
description: 'Get overall listing quality score. Higher scores improve search visibility and Buy Box win rate.',
|
|
123
|
+
inputSchema: {
|
|
124
|
+
category: z.string().optional().describe('Filter by category'),
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: 'walmart_get_quality_categories',
|
|
129
|
+
description: 'Get listing quality issues grouped by category. Identifies which categories need improvement.',
|
|
130
|
+
inputSchema: {
|
|
131
|
+
limit: z.number().int().min(1).max(200).optional().describe('Results per page'),
|
|
132
|
+
offset: z.number().int().min(0).optional().describe('Pagination offset'),
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
name: 'walmart_get_item_quality_details',
|
|
137
|
+
description: 'Get item-level listing quality details. Shows specific quality issues per item for targeted fixes.',
|
|
138
|
+
inputSchema: {
|
|
139
|
+
category: z.string().optional().describe('Filter by category'),
|
|
140
|
+
limit: z.number().int().min(1).max(200).optional().describe('Results per page'),
|
|
141
|
+
offset: z.number().int().min(0).optional().describe('Pagination offset'),
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
];
|