@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,315 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
// ---------- Shared Ad atoms ----------
|
|
3
|
+
const StatusSchema = z.enum(['enabled', 'paused', 'completed', 'archived']);
|
|
4
|
+
const CampaignTypeSchema = z.enum(['sponsoredProducts', 'sba', 'video']);
|
|
5
|
+
const TargetingTypeSchema = z.enum(['auto', 'manual']);
|
|
6
|
+
const BudgetTypeSchema = z.enum(['daily', 'total']);
|
|
7
|
+
const MatchTypeSchema = z.enum(['exact', 'phrase', 'broad']);
|
|
8
|
+
const DateOnlySchema = z
|
|
9
|
+
.string()
|
|
10
|
+
.regex(/^\d{4}-\d{2}-\d{2}$/, 'Date must be YYYY-MM-DD');
|
|
11
|
+
// Walmart Connect uses arrays at the top level for batch ops.
|
|
12
|
+
const CampaignCreateEntry = z
|
|
13
|
+
.object({
|
|
14
|
+
name: z.string().min(1).max(200),
|
|
15
|
+
campaignType: CampaignTypeSchema,
|
|
16
|
+
targetingType: TargetingTypeSchema,
|
|
17
|
+
budgetType: BudgetTypeSchema.default('daily'),
|
|
18
|
+
dailyBudget: z.number().positive(),
|
|
19
|
+
totalBudget: z.number().positive().optional(),
|
|
20
|
+
startDate: DateOnlySchema,
|
|
21
|
+
endDate: DateOnlySchema.optional(),
|
|
22
|
+
status: StatusSchema.default('enabled'),
|
|
23
|
+
})
|
|
24
|
+
.passthrough()
|
|
25
|
+
.refine((c) => !c.endDate || c.endDate >= c.startDate, {
|
|
26
|
+
message: 'endDate must be >= startDate',
|
|
27
|
+
path: ['endDate'],
|
|
28
|
+
});
|
|
29
|
+
const CampaignUpdateEntry = z
|
|
30
|
+
.object({
|
|
31
|
+
campaignId: z.number().int().positive(),
|
|
32
|
+
name: z.string().min(1).max(200).optional(),
|
|
33
|
+
status: StatusSchema.optional(),
|
|
34
|
+
dailyBudget: z.number().positive().optional(),
|
|
35
|
+
totalBudget: z.number().positive().optional(),
|
|
36
|
+
endDate: DateOnlySchema.optional(),
|
|
37
|
+
})
|
|
38
|
+
.passthrough();
|
|
39
|
+
const AdGroupCreateEntry = z
|
|
40
|
+
.object({
|
|
41
|
+
campaignId: z.number().int().positive(),
|
|
42
|
+
name: z.string().min(1).max(200),
|
|
43
|
+
status: StatusSchema.default('enabled'),
|
|
44
|
+
defaultBid: z.number().positive(),
|
|
45
|
+
})
|
|
46
|
+
.passthrough();
|
|
47
|
+
const AdGroupUpdateEntry = z
|
|
48
|
+
.object({
|
|
49
|
+
adGroupId: z.number().int().positive(),
|
|
50
|
+
name: z.string().min(1).max(200).optional(),
|
|
51
|
+
status: StatusSchema.optional(),
|
|
52
|
+
defaultBid: z.number().positive().optional(),
|
|
53
|
+
})
|
|
54
|
+
.passthrough();
|
|
55
|
+
const AdItemAddEntry = z
|
|
56
|
+
.object({
|
|
57
|
+
campaignId: z.number().int().positive(),
|
|
58
|
+
adGroupId: z.number().int().positive(),
|
|
59
|
+
itemId: z.string().min(1),
|
|
60
|
+
bid: z.number().positive(),
|
|
61
|
+
status: StatusSchema.default('enabled'),
|
|
62
|
+
})
|
|
63
|
+
.passthrough();
|
|
64
|
+
const AdItemUpdateEntry = z
|
|
65
|
+
.object({
|
|
66
|
+
adItemId: z.number().int().positive(),
|
|
67
|
+
bid: z.number().positive().optional(),
|
|
68
|
+
status: StatusSchema.optional(),
|
|
69
|
+
})
|
|
70
|
+
.passthrough();
|
|
71
|
+
const KeywordAddEntry = z
|
|
72
|
+
.object({
|
|
73
|
+
campaignId: z.number().int().positive(),
|
|
74
|
+
adGroupId: z.number().int().positive(),
|
|
75
|
+
keywordText: z.string().min(1).max(80),
|
|
76
|
+
matchType: MatchTypeSchema,
|
|
77
|
+
bid: z.number().positive(),
|
|
78
|
+
state: StatusSchema.default('enabled'),
|
|
79
|
+
})
|
|
80
|
+
.passthrough();
|
|
81
|
+
const KeywordUpdateEntry = z
|
|
82
|
+
.object({
|
|
83
|
+
keywordId: z.number().int().positive(),
|
|
84
|
+
bid: z.number().positive().optional(),
|
|
85
|
+
state: StatusSchema.optional(),
|
|
86
|
+
})
|
|
87
|
+
.passthrough();
|
|
88
|
+
const PlacementBidEntry = z
|
|
89
|
+
.object({
|
|
90
|
+
campaignId: z.number().int().positive(),
|
|
91
|
+
placement: z.string().min(1),
|
|
92
|
+
bidMultiplier: z.number().positive(),
|
|
93
|
+
})
|
|
94
|
+
.passthrough();
|
|
95
|
+
const PlatformBidEntry = z
|
|
96
|
+
.object({
|
|
97
|
+
campaignId: z.number().int().positive(),
|
|
98
|
+
platform: z.enum(['desktop', 'mobile', 'app']),
|
|
99
|
+
bidMultiplier: z.number().positive(),
|
|
100
|
+
})
|
|
101
|
+
.passthrough();
|
|
102
|
+
const ReportSnapshotCreateSchema = z
|
|
103
|
+
.object({
|
|
104
|
+
reportType: z.enum([
|
|
105
|
+
'campaign',
|
|
106
|
+
'adGroup',
|
|
107
|
+
'keyword',
|
|
108
|
+
'item',
|
|
109
|
+
'pageType',
|
|
110
|
+
'platform',
|
|
111
|
+
'placement',
|
|
112
|
+
]),
|
|
113
|
+
reportDate: DateOnlySchema,
|
|
114
|
+
format: z.enum(['JSON', 'CSV']).default('JSON'),
|
|
115
|
+
})
|
|
116
|
+
.passthrough();
|
|
117
|
+
export const advertisingTools = [
|
|
118
|
+
// ===== Campaigns =====
|
|
119
|
+
{
|
|
120
|
+
name: 'walmart_ad_get_campaigns',
|
|
121
|
+
description: 'List Walmart Connect advertising campaigns. Supports Sponsored Products (auto/keyword), Sponsored Brands, and Sponsored Videos.',
|
|
122
|
+
inputSchema: {
|
|
123
|
+
campaignId: z.number().int().optional().describe('Filter by campaign ID'),
|
|
124
|
+
status: StatusSchema.optional().describe('Filter by status'),
|
|
125
|
+
name: z.string().optional().describe('Filter by campaign name'),
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: 'walmart_ad_create_campaign',
|
|
130
|
+
description: 'Create new advertising campaign(s). Body is an ARRAY of campaign objects (Walmart Connect ' +
|
|
131
|
+
'batch API). Each: { name, campaignType, targetingType, budgetType, dailyBudget, startDate ' +
|
|
132
|
+
'(YYYY-MM-DD), endDate?, status }. Default budgetType=daily, status=enabled.',
|
|
133
|
+
inputSchema: {
|
|
134
|
+
campaignData: z.array(CampaignCreateEntry).min(1, 'Need at least 1 campaign'),
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: 'walmart_ad_update_campaign',
|
|
139
|
+
description: 'Update existing campaigns. Body is ARRAY; each entry needs campaignId; updatable: name, ' +
|
|
140
|
+
'status, dailyBudget, totalBudget, endDate.',
|
|
141
|
+
inputSchema: {
|
|
142
|
+
campaignData: z.array(CampaignUpdateEntry).min(1),
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
name: 'walmart_ad_delete_campaign',
|
|
147
|
+
description: 'Archive/delete a campaign by ID. Cannot be undone.',
|
|
148
|
+
inputSchema: {
|
|
149
|
+
campaignId: z.number().int().positive().describe('Campaign ID to delete'),
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
// ===== Ad Groups =====
|
|
153
|
+
{
|
|
154
|
+
name: 'walmart_ad_get_ad_groups',
|
|
155
|
+
description: 'List ad groups, optionally filtered by campaign.',
|
|
156
|
+
inputSchema: {
|
|
157
|
+
campaignId: z.number().int().optional().describe('Filter by campaign ID'),
|
|
158
|
+
adGroupId: z.number().int().optional().describe('Filter by ad group ID'),
|
|
159
|
+
status: StatusSchema.optional(),
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
name: 'walmart_ad_create_ad_groups',
|
|
164
|
+
description: 'Create ad groups. Body is ARRAY; each entry needs campaignId, name, defaultBid. Status ' +
|
|
165
|
+
'defaults to enabled.',
|
|
166
|
+
inputSchema: {
|
|
167
|
+
groupData: z.array(AdGroupCreateEntry).min(1),
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
name: 'walmart_ad_update_ad_groups',
|
|
172
|
+
description: 'Update ad groups. Body is ARRAY; each needs adGroupId; updatable: name, status, defaultBid.',
|
|
173
|
+
inputSchema: {
|
|
174
|
+
groupData: z.array(AdGroupUpdateEntry).min(1),
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
// ===== Ad Items =====
|
|
178
|
+
{
|
|
179
|
+
name: 'walmart_ad_get_ad_items',
|
|
180
|
+
description: 'List ad items (SKUs in ad groups).',
|
|
181
|
+
inputSchema: {
|
|
182
|
+
campaignId: z.number().int().optional(),
|
|
183
|
+
adGroupId: z.number().int().optional(),
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
name: 'walmart_ad_add_ad_items',
|
|
188
|
+
description: 'Add SKUs to an ad group. Body is ARRAY; each entry needs campaignId, adGroupId, itemId, bid.',
|
|
189
|
+
inputSchema: {
|
|
190
|
+
itemData: z.array(AdItemAddEntry).min(1),
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
name: 'walmart_ad_update_ad_items',
|
|
195
|
+
description: 'Update ad items. Body is ARRAY; each needs adItemId; updatable: bid, status.',
|
|
196
|
+
inputSchema: {
|
|
197
|
+
itemData: z.array(AdItemUpdateEntry).min(1),
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
// ===== Keywords =====
|
|
201
|
+
{
|
|
202
|
+
name: 'walmart_ad_get_keywords',
|
|
203
|
+
description: 'List keywords in an ad group.',
|
|
204
|
+
inputSchema: {
|
|
205
|
+
campaignId: z.number().int().optional(),
|
|
206
|
+
adGroupId: z.number().int().optional(),
|
|
207
|
+
state: StatusSchema.optional(),
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
name: 'walmart_ad_add_keywords',
|
|
212
|
+
description: 'Add keywords to an ad group. Body is ARRAY; each entry needs campaignId, adGroupId, ' +
|
|
213
|
+
'keywordText, matchType (exact|phrase|broad), bid.',
|
|
214
|
+
inputSchema: {
|
|
215
|
+
keywordData: z.array(KeywordAddEntry).min(1),
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
name: 'walmart_ad_update_keywords',
|
|
220
|
+
description: 'Update keywords. Body is ARRAY; each needs keywordId; updatable: bid, state.',
|
|
221
|
+
inputSchema: {
|
|
222
|
+
keywordData: z.array(KeywordUpdateEntry).min(1),
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
name: 'walmart_ad_get_keyword_analytics',
|
|
227
|
+
description: 'Get keyword performance analytics (impressions, clicks, conversions).',
|
|
228
|
+
inputSchema: {
|
|
229
|
+
campaignId: z.number().int().optional(),
|
|
230
|
+
adGroupId: z.number().int().optional(),
|
|
231
|
+
keywordId: z.number().int().optional(),
|
|
232
|
+
startDate: DateOnlySchema.optional(),
|
|
233
|
+
endDate: DateOnlySchema.optional(),
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
// ===== Placement / Platform Bids =====
|
|
237
|
+
{
|
|
238
|
+
name: 'walmart_ad_create_placement_bids',
|
|
239
|
+
description: 'Set placement-specific bid multipliers. Body is ARRAY; each entry needs campaignId, ' +
|
|
240
|
+
'placement, bidMultiplier (e.g. 1.25 for +25%).',
|
|
241
|
+
inputSchema: {
|
|
242
|
+
bidData: z.array(PlacementBidEntry).min(1),
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
name: 'walmart_ad_get_placement_bids',
|
|
247
|
+
description: 'Get current placement bids for a campaign.',
|
|
248
|
+
inputSchema: {
|
|
249
|
+
campaignId: z.number().int().describe('Campaign ID'),
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
name: 'walmart_ad_create_platform_bids',
|
|
254
|
+
description: 'Set platform-specific (desktop/mobile/app) bid multipliers. Body is ARRAY; each entry ' +
|
|
255
|
+
'needs campaignId, platform, bidMultiplier.',
|
|
256
|
+
inputSchema: {
|
|
257
|
+
bidData: z.array(PlatformBidEntry).min(1),
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
// ===== Reports / Insights =====
|
|
261
|
+
{
|
|
262
|
+
name: 'walmart_ad_create_report_snapshot',
|
|
263
|
+
description: 'Request a Walmart Connect report snapshot. reportType: campaign|adGroup|keyword|item|' +
|
|
264
|
+
'pageType|platform|placement. reportDate is YYYY-MM-DD.',
|
|
265
|
+
inputSchema: {
|
|
266
|
+
reportData: ReportSnapshotCreateSchema,
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
name: 'walmart_ad_get_report_snapshots',
|
|
271
|
+
description: 'List previously requested report snapshots.',
|
|
272
|
+
inputSchema: {
|
|
273
|
+
reportType: z.string().optional(),
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
name: 'walmart_ad_get_realtime_stats',
|
|
278
|
+
description: 'Get realtime campaign stats (latency ~1-5 min, partial data).',
|
|
279
|
+
inputSchema: {
|
|
280
|
+
campaignId: z.number().int().optional(),
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
name: 'walmart_ad_get_latest_report_date',
|
|
285
|
+
description: 'Get the latest available data date for analytic reports.',
|
|
286
|
+
inputSchema: {},
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
name: 'walmart_ad_get_item_recommendations',
|
|
290
|
+
description: 'Get item recommendations to add to a campaign based on performance.',
|
|
291
|
+
inputSchema: {
|
|
292
|
+
campaignId: z.number().int().describe('Campaign ID'),
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
name: 'walmart_ad_get_keyword_recommendations',
|
|
297
|
+
description: 'Get keyword suggestions for an ad group based on indexed items.',
|
|
298
|
+
inputSchema: {
|
|
299
|
+
adGroupId: z.number().int().describe('Ad group ID'),
|
|
300
|
+
campaignId: z.number().int().optional(),
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
name: 'walmart_ad_get_search_trends',
|
|
305
|
+
description: 'Get top search trends on Walmart.com to inform keyword strategy.',
|
|
306
|
+
inputSchema: {
|
|
307
|
+
category: z.string().optional(),
|
|
308
|
+
},
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
name: 'walmart_ad_get_sba_profile',
|
|
312
|
+
description: 'Get Sponsored Brands (SBA) advertiser profile. Shows eligibility, brand info, and account status.',
|
|
313
|
+
inputSchema: {},
|
|
314
|
+
},
|
|
315
|
+
];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const discoveryTools: ({
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
method: z.ZodEnum<["GET", "POST", "PUT", "DELETE", "PATCH"]>;
|
|
7
|
+
path: z.ZodString;
|
|
8
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
9
|
+
body: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
10
|
+
query?: undefined;
|
|
11
|
+
limit?: undefined;
|
|
12
|
+
};
|
|
13
|
+
} | {
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
inputSchema: {
|
|
17
|
+
query: z.ZodString;
|
|
18
|
+
limit: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
19
|
+
method?: undefined;
|
|
20
|
+
path?: undefined;
|
|
21
|
+
params?: undefined;
|
|
22
|
+
body?: undefined;
|
|
23
|
+
};
|
|
24
|
+
})[];
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Discovery-pattern escape hatch for Walmart Marketplace endpoints not covered
|
|
4
|
+
* by a dedicated wrapped tool. The 127 wrapped tools cover ~90 % of common
|
|
5
|
+
* seller workflows, but Walmart ships new endpoints frequently and the long
|
|
6
|
+
* tail (esoteric report types, partner-only beta endpoints, etc.) can be
|
|
7
|
+
* reached via this single meta-tool until a dedicated wrapper is added.
|
|
8
|
+
*
|
|
9
|
+
* Trade-offs vs a wrapped tool:
|
|
10
|
+
* - No business-rule validation (LLM must build the payload).
|
|
11
|
+
* - No known-issues hint specific to the call (still gets the generic
|
|
12
|
+
* endpoint + tool fields in error responses).
|
|
13
|
+
* - Auth headers + rate limiting + retry still applied — the call goes
|
|
14
|
+
* through the same WalmartApiClient.
|
|
15
|
+
*
|
|
16
|
+
* Use sparingly. If you find yourself calling the same custom endpoint
|
|
17
|
+
* repeatedly, open an issue requesting a wrapped tool.
|
|
18
|
+
*/
|
|
19
|
+
const MethodSchema = z
|
|
20
|
+
.enum(['GET', 'POST', 'PUT', 'DELETE', 'PATCH'])
|
|
21
|
+
.describe('HTTP method, uppercase.');
|
|
22
|
+
const PathSchema = z
|
|
23
|
+
.string()
|
|
24
|
+
.regex(/^\/v\d+\//, "path must start with /v<digit>/ (e.g. '/v3/items')")
|
|
25
|
+
.max(500, 'path too long');
|
|
26
|
+
const QueryParamsSchema = z
|
|
27
|
+
.record(z.string(), z.union([z.string(), z.number(), z.boolean()]))
|
|
28
|
+
.optional()
|
|
29
|
+
.describe('Optional query string parameters.');
|
|
30
|
+
const BodySchema = z
|
|
31
|
+
.record(z.string(), z.unknown())
|
|
32
|
+
.optional()
|
|
33
|
+
.describe('Optional request body. Use a plain JSON object — the MCP serializes it to JSON. ' +
|
|
34
|
+
'Walmart will respond with its own validation error if fields are missing.');
|
|
35
|
+
export const discoveryTools = [
|
|
36
|
+
{
|
|
37
|
+
name: 'walmart_call_endpoint',
|
|
38
|
+
description: 'Discovery escape hatch: call any Walmart Marketplace endpoint by method + path. Auth, ' +
|
|
39
|
+
'correlation ID, rate limiting, and 401/429/5xx retry are still applied — this is NOT a ' +
|
|
40
|
+
'raw socket. The response is wrapped with the same EXTERNAL DATA marker as wrapped tools. ' +
|
|
41
|
+
'Use this only for endpoints not covered by a dedicated walmart_* tool. If you call the ' +
|
|
42
|
+
'same endpoint repeatedly, open an issue requesting a wrapped tool with a strict schema. ' +
|
|
43
|
+
"Example: walmart_call_endpoint({ method: 'GET', path: '/v3/items', params: { limit: 5 } }).",
|
|
44
|
+
inputSchema: {
|
|
45
|
+
method: MethodSchema,
|
|
46
|
+
path: PathSchema,
|
|
47
|
+
params: QueryParamsSchema,
|
|
48
|
+
body: BodySchema,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'walmart_search_endpoints',
|
|
53
|
+
description: 'Search known Walmart Marketplace endpoint patterns by keyword. Returns suggestions for ' +
|
|
54
|
+
'the dedicated wrapped tool to use (if any), plus the raw method + path so you can fall ' +
|
|
55
|
+
'back to walmart_call_endpoint. Use this when you do not know which tool wraps a given ' +
|
|
56
|
+
'Walmart capability.',
|
|
57
|
+
inputSchema: {
|
|
58
|
+
query: z
|
|
59
|
+
.string()
|
|
60
|
+
.min(2, 'query too short')
|
|
61
|
+
.describe("Search keyword, e.g. 'feed status', 'return refund', 'lag time'."),
|
|
62
|
+
limit: z.number().int().min(1).max(20).default(10).optional(),
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
];
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const feedTools: ({
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
feedType: z.ZodOptional<z.ZodString>;
|
|
9
|
+
feedId?: undefined;
|
|
10
|
+
feedData?: undefined;
|
|
11
|
+
maxWaitSeconds?: undefined;
|
|
12
|
+
};
|
|
13
|
+
} | {
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
inputSchema: {
|
|
17
|
+
feedId: z.ZodString;
|
|
18
|
+
limit?: undefined;
|
|
19
|
+
offset?: undefined;
|
|
20
|
+
feedType?: undefined;
|
|
21
|
+
feedData?: undefined;
|
|
22
|
+
maxWaitSeconds?: undefined;
|
|
23
|
+
};
|
|
24
|
+
} | {
|
|
25
|
+
name: string;
|
|
26
|
+
description: string;
|
|
27
|
+
inputSchema: {
|
|
28
|
+
feedType: z.ZodString;
|
|
29
|
+
feedData: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
30
|
+
limit?: undefined;
|
|
31
|
+
offset?: undefined;
|
|
32
|
+
feedId?: undefined;
|
|
33
|
+
maxWaitSeconds?: undefined;
|
|
34
|
+
};
|
|
35
|
+
} | {
|
|
36
|
+
name: string;
|
|
37
|
+
description: string;
|
|
38
|
+
inputSchema: {
|
|
39
|
+
feedId: z.ZodString;
|
|
40
|
+
maxWaitSeconds: z.ZodOptional<z.ZodNumber>;
|
|
41
|
+
limit?: undefined;
|
|
42
|
+
offset?: undefined;
|
|
43
|
+
feedType?: undefined;
|
|
44
|
+
feedData?: undefined;
|
|
45
|
+
};
|
|
46
|
+
})[];
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const feedTools = [
|
|
3
|
+
{
|
|
4
|
+
name: 'walmart_get_all_feed_statuses',
|
|
5
|
+
description: 'Get status of all feeds with optional filtering. Returns feedId, feedType, status, and timestamps.',
|
|
6
|
+
inputSchema: {
|
|
7
|
+
limit: z.number().int().min(1).max(50).optional().describe('Results per page (default 50)'),
|
|
8
|
+
offset: z.number().int().min(0).optional().describe('Pagination offset'),
|
|
9
|
+
feedType: z.string().optional().describe('Filter by feed type (e.g., item, inventory, price)'),
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: 'walmart_get_feed_status',
|
|
14
|
+
description: 'Get the status of a specific feed by feedId. Returns overall feed status: RECEIVED, INPROGRESS, PROCESSED, or ERROR.',
|
|
15
|
+
inputSchema: {
|
|
16
|
+
feedId: z.string().describe('Feed ID returned from a feed submission'),
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: 'walmart_get_feed_item_status',
|
|
21
|
+
description: 'Get per-item results for a feed. Shows SUCCESS, DATA_ERROR, SYSTEM_ERROR, or TIMEOUT_ERROR for each item in the feed.',
|
|
22
|
+
inputSchema: {
|
|
23
|
+
feedId: z.string().describe('Feed ID to get item-level details for'),
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'walmart_submit_generic_feed',
|
|
28
|
+
description: 'Submit a feed of any type. Use specific feed tools (walmart_submit_item_feed, etc.) when possible. This is for custom feed types.',
|
|
29
|
+
inputSchema: {
|
|
30
|
+
feedType: z.string().describe('Feed type (e.g., item, MP_MAINTENANCE, inventory, price, PROMO_PRICE, LAGTIME)'),
|
|
31
|
+
feedData: z.record(z.string(), z.unknown()).describe('Feed payload data'),
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'walmart_poll_feed_until_complete',
|
|
36
|
+
description: 'Poll a feed status until it completes (PROCESSED or ERROR) or times out. Uses progressive polling intervals: 15s, 30s, 1m, 2m, then every 4m. Max wait: 2 hours.',
|
|
37
|
+
inputSchema: {
|
|
38
|
+
feedId: z.string().describe('Feed ID to poll'),
|
|
39
|
+
maxWaitSeconds: z.number().int().min(30).max(7200).optional().describe('Max wait time in seconds (default 7200 = 2 hours)'),
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
];
|