ebay-mcp-remote-edition 1.0.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 +755 -0
- package/build/api/account-management/account.js +301 -0
- package/build/api/analytics-and-report/analytics.js +102 -0
- package/build/api/client-trading.js +96 -0
- package/build/api/client.js +173 -0
- package/build/api/communication/feedback.js +119 -0
- package/build/api/communication/message.js +131 -0
- package/build/api/communication/negotiation.js +97 -0
- package/build/api/communication/notification.js +373 -0
- package/build/api/developer/developer.js +81 -0
- package/build/api/index.js +109 -0
- package/build/api/listing-management/inventory.js +640 -0
- package/build/api/listing-metadata/metadata.js +485 -0
- package/build/api/listing-metadata/taxonomy.js +58 -0
- package/build/api/marketing-and-promotions/marketing.js +768 -0
- package/build/api/marketing-and-promotions/recommendation.js +32 -0
- package/build/api/order-management/dispute.js +69 -0
- package/build/api/order-management/fulfillment.js +89 -0
- package/build/api/other/compliance.js +47 -0
- package/build/api/other/edelivery.js +219 -0
- package/build/api/other/identity.js +24 -0
- package/build/api/other/translation.js +22 -0
- package/build/api/other/vero.js +48 -0
- package/build/api/trading/trading.js +78 -0
- package/build/auth/kv-store.js +40 -0
- package/build/auth/multi-user-store.js +120 -0
- package/build/auth/oauth-metadata.js +59 -0
- package/build/auth/oauth-middleware.js +99 -0
- package/build/auth/oauth-types.js +4 -0
- package/build/auth/oauth.js +235 -0
- package/build/auth/scope-utils.js +304 -0
- package/build/auth/token-store.js +46 -0
- package/build/auth/token-verifier.js +172 -0
- package/build/config/environment.js +297 -0
- package/build/index.d.ts +1 -0
- package/build/index.js +129 -0
- package/build/schemas/account-management/account.js +375 -0
- package/build/schemas/analytics/analytics.js +191 -0
- package/build/schemas/communication/messages.js +345 -0
- package/build/schemas/fulfillment/orders.js +338 -0
- package/build/schemas/index.js +68 -0
- package/build/schemas/inventory-management/inventory.js +471 -0
- package/build/schemas/marketing/marketing.js +1103 -0
- package/build/schemas/metadata/metadata.js +618 -0
- package/build/schemas/other/other-apis.js +390 -0
- package/build/schemas/taxonomy/taxonomy.js +575 -0
- package/build/scripts/auto-setup.js +364 -0
- package/build/scripts/dev-sync.js +512 -0
- package/build/scripts/diagnostics.js +301 -0
- package/build/scripts/download-specs.js +116 -0
- package/build/scripts/interactive-setup.js +757 -0
- package/build/scripts/setup.js +1515 -0
- package/build/scripts/update-api-status-doc.js +44 -0
- package/build/server-http.d.ts +1 -0
- package/build/server-http.js +581 -0
- package/build/tools/definitions/account-with-schemas.js +170 -0
- package/build/tools/definitions/account.js +428 -0
- package/build/tools/definitions/analytics.js +66 -0
- package/build/tools/definitions/communication.js +394 -0
- package/build/tools/definitions/developer.js +195 -0
- package/build/tools/definitions/fulfillment.js +326 -0
- package/build/tools/definitions/index.js +41 -0
- package/build/tools/definitions/inventory.js +464 -0
- package/build/tools/definitions/marketing.js +1486 -0
- package/build/tools/definitions/metadata.js +188 -0
- package/build/tools/definitions/other.js +309 -0
- package/build/tools/definitions/taxonomy.js +64 -0
- package/build/tools/definitions/token-management.js +148 -0
- package/build/tools/definitions/trading.js +71 -0
- package/build/tools/index.js +1200 -0
- package/build/tools/schemas.js +667 -0
- package/build/tools/tool-definitions.js +3534 -0
- package/build/types/application-settings/developerAnalyticsV1BetaOas3.js +5 -0
- package/build/types/application-settings/developerClientRegistrationV1Oas3.js +5 -0
- package/build/types/application-settings/developerKeyManagementV1Oas3.js +5 -0
- package/build/types/ebay-enums.js +1330 -0
- package/build/types/ebay.js +123 -0
- package/build/types/index.js +10 -0
- package/build/types/sell-apps/account-management/sellAccountV1Oas3.js +5 -0
- package/build/types/sell-apps/analytics-and-report/sellAnalyticsV1Oas3.js +5 -0
- package/build/types/sell-apps/communication/commerceFeedbackV1BetaOas3.js +5 -0
- package/build/types/sell-apps/communication/commerceMessageV1Oas3.js +5 -0
- package/build/types/sell-apps/communication/commerceNotificationV1Oas3.js +5 -0
- package/build/types/sell-apps/communication/sellNegotiationV1Oas3.js +5 -0
- package/build/types/sell-apps/listing-management/sellInventoryV1Oas3.js +5 -0
- package/build/types/sell-apps/listing-metadata/sellMetadataV1Oas3.js +5 -0
- package/build/types/sell-apps/markeitng-and-promotions/sellMarketingV1Oas3.js +5 -0
- package/build/types/sell-apps/markeitng-and-promotions/sellRecommendationV1Oas3.js +5 -0
- package/build/types/sell-apps/order-management/sellFulfillmentV1Oas3.js +5 -0
- package/build/types/sell-apps/other-apis/commerceIdentityV1Oas3.js +5 -0
- package/build/types/sell-apps/other-apis/commerceTranslationV1BetaOas3.js +5 -0
- package/build/types/sell-apps/other-apis/commerceVeroV1Oas3.js +5 -0
- package/build/types/sell-apps/other-apis/sellComplianceV1Oas3.js +5 -0
- package/build/types/sell-apps/other-apis/sellEdeliveryInternationalShippingOas3.js +5 -0
- package/build/types/sell-apps/other-apis/sellMarketingV1Oas3.js +5 -0
- package/build/types/sell-apps/other-apis/sellRecommendationV1Oas3.js +5 -0
- package/build/utils/account-management/account.js +831 -0
- package/build/utils/api-status-feed.js +83 -0
- package/build/utils/communication/feedback.js +216 -0
- package/build/utils/communication/message.js +242 -0
- package/build/utils/communication/negotiation.js +150 -0
- package/build/utils/communication/notification.js +369 -0
- package/build/utils/date-converter.js +160 -0
- package/build/utils/llm-client-detector.js +758 -0
- package/build/utils/logger.js +198 -0
- package/build/utils/oauth-helper.js +315 -0
- package/build/utils/order-management/dispute.js +369 -0
- package/build/utils/order-management/fulfillment.js +205 -0
- package/build/utils/other/compliance.js +76 -0
- package/build/utils/other/edelivery.js +241 -0
- package/build/utils/other/identity.js +13 -0
- package/build/utils/other/translation.js +41 -0
- package/build/utils/other/vero.js +90 -0
- package/build/utils/scope-helper.js +207 -0
- package/build/utils/security-checker.js +248 -0
- package/build/utils/setup-validator.js +305 -0
- package/build/utils/token-utils.js +40 -0
- package/build/utils/version.js +56 -0
- package/docs/auth/production_scopes.json +111 -0
- package/docs/auth/sandbox_scopes.json +142 -0
- package/package.json +122 -0
- package/public/icons/1024x1024.png +0 -0
- package/public/icons/128x128.png +0 -0
- package/public/icons/16x16.png +0 -0
- package/public/icons/256x256.png +0 -0
- package/public/icons/32x32.png +0 -0
- package/public/icons/48x48.png +0 -0
- package/public/icons/512x512.png +0 -0
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { zodToJsonSchema } from 'zod-to-json-schema';
|
|
3
|
+
import { TimeDurationUnit, RegionType, ShippingCostType, ShippingOptionType, RefundMethod, ReturnMethod, ReturnShippingCostPayer, MarketplaceId, } from '../../types/ebay-enums.js';
|
|
4
|
+
/**
|
|
5
|
+
* Account Management API Schemas
|
|
6
|
+
*
|
|
7
|
+
* This file contains Zod schemas for all Account Management endpoints.
|
|
8
|
+
* Schemas are organized by endpoint and include both input and output validation.
|
|
9
|
+
*/
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// Common/Shared Response Schemas
|
|
12
|
+
// ============================================================================
|
|
13
|
+
const errorSchema = z.object({
|
|
14
|
+
errorId: z.number().optional(),
|
|
15
|
+
domain: z.string().optional(),
|
|
16
|
+
category: z.string().optional(),
|
|
17
|
+
message: z.string().optional(),
|
|
18
|
+
longMessage: z.string().optional(),
|
|
19
|
+
parameters: z
|
|
20
|
+
.array(z.object({
|
|
21
|
+
name: z.string().optional(),
|
|
22
|
+
value: z.string().optional(),
|
|
23
|
+
}))
|
|
24
|
+
.optional(),
|
|
25
|
+
});
|
|
26
|
+
const timeDurationSchema = z.object({
|
|
27
|
+
unit: z.nativeEnum(TimeDurationUnit).optional(),
|
|
28
|
+
value: z.number().optional(),
|
|
29
|
+
});
|
|
30
|
+
const amountSchema = z.object({
|
|
31
|
+
currency: z.string().optional(),
|
|
32
|
+
value: z.string().optional(),
|
|
33
|
+
});
|
|
34
|
+
const regionSchema = z.object({
|
|
35
|
+
regionName: z.string().optional(),
|
|
36
|
+
regionType: z.nativeEnum(RegionType).optional(),
|
|
37
|
+
});
|
|
38
|
+
const regionSetSchema = z.object({
|
|
39
|
+
regionIncluded: z.array(regionSchema).optional(),
|
|
40
|
+
regionExcluded: z.array(regionSchema).optional(),
|
|
41
|
+
});
|
|
42
|
+
// ============================================================================
|
|
43
|
+
// Custom Policy Schemas
|
|
44
|
+
// ============================================================================
|
|
45
|
+
// Input
|
|
46
|
+
export const getCustomPoliciesInputSchema = z.object({
|
|
47
|
+
policyTypes: z
|
|
48
|
+
.string()
|
|
49
|
+
.optional()
|
|
50
|
+
.describe('Comma-delimited list of policy types to retrieve (e.g., PRODUCT_COMPLIANCE, TAKE_BACK)'),
|
|
51
|
+
});
|
|
52
|
+
// Output
|
|
53
|
+
export const customPolicySchema = z.object({
|
|
54
|
+
customPolicyId: z.string().optional(),
|
|
55
|
+
label: z.string().optional(),
|
|
56
|
+
name: z.string().optional(),
|
|
57
|
+
description: z.string().optional(),
|
|
58
|
+
policyType: z.string().optional(),
|
|
59
|
+
});
|
|
60
|
+
export const customPolicyResponseSchema = z.object({
|
|
61
|
+
customPolicies: z.array(customPolicySchema).optional(),
|
|
62
|
+
href: z.string().optional(),
|
|
63
|
+
limit: z.number().optional(),
|
|
64
|
+
next: z.string().optional(),
|
|
65
|
+
offset: z.number().optional(),
|
|
66
|
+
prev: z.string().optional(),
|
|
67
|
+
total: z.number().optional(),
|
|
68
|
+
warnings: z.array(errorSchema).optional(),
|
|
69
|
+
});
|
|
70
|
+
export const createCustomPolicyInputSchema = z.object({
|
|
71
|
+
policy: z.object({
|
|
72
|
+
name: z.string(),
|
|
73
|
+
description: z.string().optional(),
|
|
74
|
+
policyType: z.string(),
|
|
75
|
+
label: z.string().optional(),
|
|
76
|
+
}),
|
|
77
|
+
});
|
|
78
|
+
export const createCustomPolicyOutputSchema = customPolicySchema;
|
|
79
|
+
// ============================================================================
|
|
80
|
+
// Fulfillment Policy Schemas
|
|
81
|
+
// ============================================================================
|
|
82
|
+
const categoryTypeSchema = z.object({
|
|
83
|
+
name: z.string().optional(),
|
|
84
|
+
default: z.boolean().optional(),
|
|
85
|
+
});
|
|
86
|
+
const shippingServiceSchema = z.object({
|
|
87
|
+
additionalShippingCost: amountSchema.optional(),
|
|
88
|
+
buyerResponsibleForPickup: z.boolean().optional(),
|
|
89
|
+
buyerResponsibleForShipping: z.boolean().optional(),
|
|
90
|
+
freeShipping: z.boolean().optional(),
|
|
91
|
+
shippingCarrierCode: z.string().optional(),
|
|
92
|
+
shippingCost: amountSchema.optional(),
|
|
93
|
+
shippingServiceCode: z.string().optional(),
|
|
94
|
+
shipToLocations: regionSetSchema.optional(),
|
|
95
|
+
sortOrder: z.number().optional(),
|
|
96
|
+
surcharge: amountSchema.optional(), // DEPRECATED but still in API
|
|
97
|
+
});
|
|
98
|
+
const shippingOptionSchema = z.object({
|
|
99
|
+
costType: z.nativeEnum(ShippingCostType).optional(),
|
|
100
|
+
optionType: z.nativeEnum(ShippingOptionType).optional(),
|
|
101
|
+
insuranceFee: amountSchema.optional(), // DEPRECATED but in API
|
|
102
|
+
insuranceOffered: z.boolean().optional(), // DEPRECATED but in API
|
|
103
|
+
packageHandlingCost: amountSchema.optional(),
|
|
104
|
+
rateTableId: z.string().optional(),
|
|
105
|
+
shippingDiscountProfileId: z.string().optional(),
|
|
106
|
+
shippingPromotionOffered: z.boolean().optional(),
|
|
107
|
+
shippingServices: z.array(shippingServiceSchema).optional(),
|
|
108
|
+
});
|
|
109
|
+
export const fulfillmentPolicySchema = z.object({
|
|
110
|
+
name: z.string(),
|
|
111
|
+
marketplaceId: z.nativeEnum(MarketplaceId),
|
|
112
|
+
categoryTypes: z.array(categoryTypeSchema).optional(),
|
|
113
|
+
description: z.string().optional(),
|
|
114
|
+
freightShipping: z.boolean().optional(),
|
|
115
|
+
globalShipping: z.boolean().optional(),
|
|
116
|
+
handlingTime: timeDurationSchema.optional(),
|
|
117
|
+
localPickup: z.boolean().optional(),
|
|
118
|
+
pickupDropOff: z.boolean().optional(),
|
|
119
|
+
shippingOptions: z.array(shippingOptionSchema).optional(),
|
|
120
|
+
shipToLocations: regionSetSchema.optional(),
|
|
121
|
+
});
|
|
122
|
+
export const fulfillmentPolicyResponseSchema = z.object({
|
|
123
|
+
fulfillmentPolicyId: z.string().optional(),
|
|
124
|
+
categoryTypes: z.array(categoryTypeSchema).optional(),
|
|
125
|
+
description: z.string().optional(),
|
|
126
|
+
freightShipping: z.boolean().optional(),
|
|
127
|
+
globalShipping: z.boolean().optional(),
|
|
128
|
+
handlingTime: timeDurationSchema.optional(),
|
|
129
|
+
localPickup: z.boolean().optional(),
|
|
130
|
+
marketplaceId: z.string().optional(),
|
|
131
|
+
name: z.string().optional(),
|
|
132
|
+
pickupDropOff: z.boolean().optional(),
|
|
133
|
+
shippingOptions: z.array(shippingOptionSchema).optional(),
|
|
134
|
+
shipToLocations: regionSetSchema.optional(),
|
|
135
|
+
warnings: z.array(errorSchema).optional(),
|
|
136
|
+
});
|
|
137
|
+
export const getFulfillmentPoliciesInputSchema = z.object({
|
|
138
|
+
marketplaceId: z.nativeEnum(MarketplaceId).describe('eBay marketplace ID (e.g., EBAY_US)'),
|
|
139
|
+
});
|
|
140
|
+
export const getFulfillmentPoliciesOutputSchema = z.object({
|
|
141
|
+
fulfillmentPolicies: z.array(fulfillmentPolicyResponseSchema).optional(),
|
|
142
|
+
href: z.string().optional(),
|
|
143
|
+
limit: z.number().optional(),
|
|
144
|
+
next: z.string().optional(),
|
|
145
|
+
offset: z.number().optional(),
|
|
146
|
+
prev: z.string().optional(),
|
|
147
|
+
total: z.number().optional(),
|
|
148
|
+
warnings: z.array(errorSchema).optional(),
|
|
149
|
+
});
|
|
150
|
+
export const createFulfillmentPolicyInputSchema = z.object({
|
|
151
|
+
policy: fulfillmentPolicySchema,
|
|
152
|
+
});
|
|
153
|
+
export const createFulfillmentPolicyOutputSchema = z.object({
|
|
154
|
+
fulfillmentPolicyId: z.string().optional(),
|
|
155
|
+
warnings: z.array(errorSchema).optional(),
|
|
156
|
+
});
|
|
157
|
+
// ============================================================================
|
|
158
|
+
// Payment Policy Schemas
|
|
159
|
+
// ============================================================================
|
|
160
|
+
const paymentMethodSchema = z.object({
|
|
161
|
+
paymentMethodType: z.string().optional(),
|
|
162
|
+
brands: z.array(z.string()).optional(), // DEPRECATED
|
|
163
|
+
recipientAccountReference: z
|
|
164
|
+
.object({
|
|
165
|
+
referenceId: z.string().optional(),
|
|
166
|
+
referenceType: z.string().optional(),
|
|
167
|
+
})
|
|
168
|
+
.optional(), // DEPRECATED
|
|
169
|
+
});
|
|
170
|
+
const depositSchema = z.object({
|
|
171
|
+
amount: amountSchema.optional(), // Fixed from depositAmount
|
|
172
|
+
dueIn: timeDurationSchema.optional(),
|
|
173
|
+
paymentMethods: z.array(paymentMethodSchema).optional(), // DEPRECATED but in API
|
|
174
|
+
});
|
|
175
|
+
export const paymentPolicySchema = z.object({
|
|
176
|
+
name: z.string(),
|
|
177
|
+
marketplaceId: z.nativeEnum(MarketplaceId),
|
|
178
|
+
categoryTypes: z.array(categoryTypeSchema).optional(),
|
|
179
|
+
description: z.string().optional(),
|
|
180
|
+
deposit: depositSchema.optional(),
|
|
181
|
+
fullPaymentDueIn: timeDurationSchema.optional(),
|
|
182
|
+
immediatePay: z.boolean().optional(),
|
|
183
|
+
paymentInstructions: z.string().optional(),
|
|
184
|
+
paymentMethods: z.array(paymentMethodSchema).optional(),
|
|
185
|
+
});
|
|
186
|
+
export const paymentPolicyResponseSchema = z.object({
|
|
187
|
+
paymentPolicyId: z.string().optional(),
|
|
188
|
+
categoryTypes: z.array(categoryTypeSchema).optional(),
|
|
189
|
+
deposit: depositSchema.optional(),
|
|
190
|
+
description: z.string().optional(),
|
|
191
|
+
fullPaymentDueIn: timeDurationSchema.optional(),
|
|
192
|
+
immediatePay: z.boolean().optional(),
|
|
193
|
+
marketplaceId: z.string().optional(),
|
|
194
|
+
name: z.string().optional(),
|
|
195
|
+
paymentInstructions: z.string().optional(),
|
|
196
|
+
paymentMethods: z.array(paymentMethodSchema).optional(),
|
|
197
|
+
warnings: z.array(errorSchema).optional(),
|
|
198
|
+
});
|
|
199
|
+
export const getPaymentPoliciesInputSchema = z.object({
|
|
200
|
+
marketplaceId: z.nativeEnum(MarketplaceId).describe('eBay marketplace ID'),
|
|
201
|
+
});
|
|
202
|
+
export const getPaymentPoliciesOutputSchema = z.object({
|
|
203
|
+
paymentPolicies: z.array(paymentPolicyResponseSchema).optional(),
|
|
204
|
+
href: z.string().optional(),
|
|
205
|
+
limit: z.number().optional(),
|
|
206
|
+
next: z.string().optional(),
|
|
207
|
+
offset: z.number().optional(),
|
|
208
|
+
prev: z.string().optional(),
|
|
209
|
+
total: z.number().optional(),
|
|
210
|
+
warnings: z.array(errorSchema).optional(),
|
|
211
|
+
});
|
|
212
|
+
export const createPaymentPolicyInputSchema = z.object({
|
|
213
|
+
policy: paymentPolicySchema,
|
|
214
|
+
});
|
|
215
|
+
export const createPaymentPolicyOutputSchema = z.object({
|
|
216
|
+
paymentPolicyId: z.string().optional(),
|
|
217
|
+
warnings: z.array(errorSchema).optional(),
|
|
218
|
+
});
|
|
219
|
+
// ============================================================================
|
|
220
|
+
// Return Policy Schemas
|
|
221
|
+
// ============================================================================
|
|
222
|
+
export const returnPolicySchema = z.object({
|
|
223
|
+
name: z.string(),
|
|
224
|
+
marketplaceId: z.nativeEnum(MarketplaceId),
|
|
225
|
+
categoryTypes: z.array(categoryTypeSchema).optional(),
|
|
226
|
+
description: z.string().optional(),
|
|
227
|
+
extendedHolidayReturnsOffered: z.boolean().optional(),
|
|
228
|
+
refundMethod: z.nativeEnum(RefundMethod).optional(),
|
|
229
|
+
restockingFeePercentage: z.string().optional(),
|
|
230
|
+
returnInstructions: z.string().optional(),
|
|
231
|
+
returnMethod: z.nativeEnum(ReturnMethod).optional(),
|
|
232
|
+
returnPeriod: timeDurationSchema.optional(),
|
|
233
|
+
returnsAccepted: z.boolean().optional(),
|
|
234
|
+
returnShippingCostPayer: z.nativeEnum(ReturnShippingCostPayer).optional(),
|
|
235
|
+
});
|
|
236
|
+
export const returnPolicyResponseSchema = z.object({
|
|
237
|
+
returnPolicyId: z.string().optional(),
|
|
238
|
+
categoryTypes: z.array(categoryTypeSchema).optional(),
|
|
239
|
+
description: z.string().optional(),
|
|
240
|
+
extendedHolidayReturnsOffered: z.boolean().optional(),
|
|
241
|
+
internationalOverride: z
|
|
242
|
+
.object({
|
|
243
|
+
returnMethod: z.string().optional(),
|
|
244
|
+
returnPeriod: timeDurationSchema.optional(),
|
|
245
|
+
returnsAccepted: z.boolean().optional(),
|
|
246
|
+
returnShippingCostPayer: z.string().optional(),
|
|
247
|
+
})
|
|
248
|
+
.optional(),
|
|
249
|
+
marketplaceId: z.string().optional(),
|
|
250
|
+
name: z.string().optional(),
|
|
251
|
+
refundMethod: z.string().optional(),
|
|
252
|
+
restockingFeePercentage: z.string().optional(), // DEPRECATED
|
|
253
|
+
returnInstructions: z.string().optional(),
|
|
254
|
+
returnMethod: z.string().optional(),
|
|
255
|
+
returnPeriod: timeDurationSchema.optional(),
|
|
256
|
+
returnsAccepted: z.boolean().optional(),
|
|
257
|
+
returnShippingCostPayer: z.string().optional(),
|
|
258
|
+
warnings: z.array(errorSchema).optional(),
|
|
259
|
+
});
|
|
260
|
+
export const getReturnPoliciesInputSchema = z.object({
|
|
261
|
+
marketplaceId: z.nativeEnum(MarketplaceId).describe('eBay marketplace ID'),
|
|
262
|
+
});
|
|
263
|
+
export const getReturnPoliciesOutputSchema = z.object({
|
|
264
|
+
returnPolicies: z.array(returnPolicyResponseSchema).optional(),
|
|
265
|
+
href: z.string().optional(),
|
|
266
|
+
limit: z.number().optional(),
|
|
267
|
+
next: z.string().optional(),
|
|
268
|
+
offset: z.number().optional(),
|
|
269
|
+
prev: z.string().optional(),
|
|
270
|
+
total: z.number().optional(),
|
|
271
|
+
warnings: z.array(errorSchema).optional(),
|
|
272
|
+
});
|
|
273
|
+
export const createReturnPolicyInputSchema = z.object({
|
|
274
|
+
policy: returnPolicySchema,
|
|
275
|
+
});
|
|
276
|
+
export const createReturnPolicyOutputSchema = z.object({
|
|
277
|
+
returnPolicyId: z.string().optional(),
|
|
278
|
+
warnings: z.array(errorSchema).optional(),
|
|
279
|
+
});
|
|
280
|
+
// ============================================================================
|
|
281
|
+
// Sales Tax Schemas
|
|
282
|
+
// ============================================================================
|
|
283
|
+
export const salesTaxBaseSchema = z.object({
|
|
284
|
+
salesTaxPercentage: z.string(),
|
|
285
|
+
shippingAndHandlingTaxed: z.boolean().optional(),
|
|
286
|
+
});
|
|
287
|
+
export const salesTaxSchema = z.object({
|
|
288
|
+
countryCode: z.string().optional(),
|
|
289
|
+
jurisdictionId: z.string().optional(),
|
|
290
|
+
salesTaxPercentage: z.string().optional(),
|
|
291
|
+
shippingAndHandlingTaxed: z.boolean().optional(),
|
|
292
|
+
});
|
|
293
|
+
export const getSalesTaxesOutputSchema = z.object({
|
|
294
|
+
salesTaxes: z.array(salesTaxSchema).optional(),
|
|
295
|
+
warnings: z.array(errorSchema).optional(),
|
|
296
|
+
});
|
|
297
|
+
// ============================================================================
|
|
298
|
+
// Program Schemas
|
|
299
|
+
// ============================================================================
|
|
300
|
+
export const programRequestSchema = z.object({
|
|
301
|
+
programType: z.string(),
|
|
302
|
+
});
|
|
303
|
+
export const programsOutputSchema = z.object({
|
|
304
|
+
programs: z
|
|
305
|
+
.array(z.object({
|
|
306
|
+
programType: z.string().optional(),
|
|
307
|
+
programStatus: z.string().optional(),
|
|
308
|
+
}))
|
|
309
|
+
.optional(),
|
|
310
|
+
warnings: z.array(errorSchema).optional(),
|
|
311
|
+
});
|
|
312
|
+
// ============================================================================
|
|
313
|
+
// KYC Schemas
|
|
314
|
+
// ============================================================================
|
|
315
|
+
export const kycOutputSchema = z.object({
|
|
316
|
+
kycCheck: z.string().optional(),
|
|
317
|
+
detailedStatus: z.string().optional(),
|
|
318
|
+
warnings: z.array(errorSchema).optional(),
|
|
319
|
+
});
|
|
320
|
+
// ============================================================================
|
|
321
|
+
// Privileges Schemas
|
|
322
|
+
// ============================================================================
|
|
323
|
+
export const privilegesOutputSchema = z.object({
|
|
324
|
+
sellingLimit: z
|
|
325
|
+
.object({
|
|
326
|
+
amount: amountSchema.optional(),
|
|
327
|
+
quantity: z.number().optional(),
|
|
328
|
+
})
|
|
329
|
+
.optional(),
|
|
330
|
+
qualifiesForSelling: z.boolean().optional(),
|
|
331
|
+
sellerRegistrationCompleted: z.boolean().optional(),
|
|
332
|
+
warnings: z.array(errorSchema).optional(),
|
|
333
|
+
});
|
|
334
|
+
// ============================================================================
|
|
335
|
+
// JSON Schema Conversion Functions
|
|
336
|
+
// ============================================================================
|
|
337
|
+
/**
|
|
338
|
+
* Convert Zod schemas to JSON Schema format for MCP tools
|
|
339
|
+
*/
|
|
340
|
+
export function getAccountManagementJsonSchemas() {
|
|
341
|
+
return {
|
|
342
|
+
// Custom Policies
|
|
343
|
+
getCustomPoliciesInput: zodToJsonSchema(getCustomPoliciesInputSchema, 'getCustomPoliciesInput'),
|
|
344
|
+
getCustomPoliciesOutput: zodToJsonSchema(customPolicyResponseSchema, 'getCustomPoliciesOutput'),
|
|
345
|
+
createCustomPolicyInput: zodToJsonSchema(createCustomPolicyInputSchema, 'createCustomPolicyInput'),
|
|
346
|
+
createCustomPolicyOutput: zodToJsonSchema(createCustomPolicyOutputSchema, 'createCustomPolicyOutput'),
|
|
347
|
+
// Fulfillment Policies
|
|
348
|
+
getFulfillmentPoliciesInput: zodToJsonSchema(getFulfillmentPoliciesInputSchema, 'getFulfillmentPoliciesInput'),
|
|
349
|
+
getFulfillmentPoliciesOutput: zodToJsonSchema(getFulfillmentPoliciesOutputSchema, 'getFulfillmentPoliciesOutput'),
|
|
350
|
+
createFulfillmentPolicyInput: zodToJsonSchema(createFulfillmentPolicyInputSchema, 'createFulfillmentPolicyInput'),
|
|
351
|
+
createFulfillmentPolicyOutput: zodToJsonSchema(createFulfillmentPolicyOutputSchema, 'createFulfillmentPolicyOutput'),
|
|
352
|
+
fulfillmentPolicyDetails: zodToJsonSchema(fulfillmentPolicyResponseSchema, 'fulfillmentPolicyDetails'),
|
|
353
|
+
// Payment Policies
|
|
354
|
+
getPaymentPoliciesInput: zodToJsonSchema(getPaymentPoliciesInputSchema, 'getPaymentPoliciesInput'),
|
|
355
|
+
getPaymentPoliciesOutput: zodToJsonSchema(getPaymentPoliciesOutputSchema, 'getPaymentPoliciesOutput'),
|
|
356
|
+
createPaymentPolicyInput: zodToJsonSchema(createPaymentPolicyInputSchema, 'createPaymentPolicyInput'),
|
|
357
|
+
createPaymentPolicyOutput: zodToJsonSchema(createPaymentPolicyOutputSchema, 'createPaymentPolicyOutput'),
|
|
358
|
+
paymentPolicyDetails: zodToJsonSchema(paymentPolicyResponseSchema, 'paymentPolicyDetails'),
|
|
359
|
+
// Return Policies
|
|
360
|
+
getReturnPoliciesInput: zodToJsonSchema(getReturnPoliciesInputSchema, 'getReturnPoliciesInput'),
|
|
361
|
+
getReturnPoliciesOutput: zodToJsonSchema(getReturnPoliciesOutputSchema, 'getReturnPoliciesOutput'),
|
|
362
|
+
createReturnPolicyInput: zodToJsonSchema(createReturnPolicyInputSchema, 'createReturnPolicyInput'),
|
|
363
|
+
createReturnPolicyOutput: zodToJsonSchema(createReturnPolicyOutputSchema, 'createReturnPolicyOutput'),
|
|
364
|
+
returnPolicyDetails: zodToJsonSchema(returnPolicyResponseSchema, 'returnPolicyDetails'),
|
|
365
|
+
// Sales Tax
|
|
366
|
+
getSalesTaxesOutput: zodToJsonSchema(getSalesTaxesOutputSchema, 'getSalesTaxesOutput'),
|
|
367
|
+
salesTaxDetails: zodToJsonSchema(salesTaxSchema, 'salesTaxDetails'),
|
|
368
|
+
// Programs
|
|
369
|
+
programRequest: zodToJsonSchema(programRequestSchema, 'programRequest'),
|
|
370
|
+
programsOutput: zodToJsonSchema(programsOutputSchema, 'programsOutput'),
|
|
371
|
+
// KYC & Privileges
|
|
372
|
+
kycOutput: zodToJsonSchema(kycOutputSchema, 'kycOutput'),
|
|
373
|
+
privilegesOutput: zodToJsonSchema(privilegesOutputSchema, 'privilegesOutput'),
|
|
374
|
+
};
|
|
375
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { zodToJsonSchema } from 'zod-to-json-schema';
|
|
3
|
+
/**
|
|
4
|
+
* Analytics API Schemas
|
|
5
|
+
*
|
|
6
|
+
* This file contains Zod schemas for the Sell Analytics API.
|
|
7
|
+
* Schemas are organized by type and include all analytics-related endpoints.
|
|
8
|
+
*/
|
|
9
|
+
// ============================================================================
|
|
10
|
+
// Common Schemas
|
|
11
|
+
// ============================================================================
|
|
12
|
+
const errorParameterSchema = z.object({
|
|
13
|
+
name: z.string().optional(),
|
|
14
|
+
value: z.string().optional(),
|
|
15
|
+
});
|
|
16
|
+
const errorSchema = z.object({
|
|
17
|
+
category: z.string().optional(),
|
|
18
|
+
domain: z.string().optional(),
|
|
19
|
+
errorId: z.number().int().optional(),
|
|
20
|
+
inputRefIds: z.array(z.string()).optional(),
|
|
21
|
+
longMessage: z.string().optional(),
|
|
22
|
+
message: z.string().optional(),
|
|
23
|
+
outputRefIds: z.array(z.string()).optional(),
|
|
24
|
+
parameters: z.array(errorParameterSchema).optional(),
|
|
25
|
+
subdomain: z.string().optional(),
|
|
26
|
+
});
|
|
27
|
+
const valueSchema = z.object({
|
|
28
|
+
applicable: z.boolean().optional(),
|
|
29
|
+
value: z.record(z.never()).optional(),
|
|
30
|
+
});
|
|
31
|
+
// ============================================================================
|
|
32
|
+
// Customer Service Metric Schemas
|
|
33
|
+
// ============================================================================
|
|
34
|
+
const benchmarkMetadataSchema = z.object({
|
|
35
|
+
average: z.string().optional(),
|
|
36
|
+
});
|
|
37
|
+
const metricBenchmarkSchema = z.object({
|
|
38
|
+
adjustment: z.string().optional(),
|
|
39
|
+
basis: z.string().optional(),
|
|
40
|
+
metadata: benchmarkMetadataSchema.optional(),
|
|
41
|
+
rating: z.string().optional(),
|
|
42
|
+
});
|
|
43
|
+
const distributionSchema = z.object({
|
|
44
|
+
name: z.string().optional(),
|
|
45
|
+
value: z.string().optional(),
|
|
46
|
+
});
|
|
47
|
+
const metricDistributionSchema = z.object({
|
|
48
|
+
basis: z.string().optional(),
|
|
49
|
+
data: z.array(distributionSchema).optional(),
|
|
50
|
+
});
|
|
51
|
+
const metricSchema = z.object({
|
|
52
|
+
benchmark: metricBenchmarkSchema.optional(),
|
|
53
|
+
distributions: z.array(metricDistributionSchema).optional(),
|
|
54
|
+
metricKey: z.string().optional(),
|
|
55
|
+
value: z.string().optional(),
|
|
56
|
+
});
|
|
57
|
+
const dimensionSchema = z.object({
|
|
58
|
+
dimensionKey: z.string().optional(),
|
|
59
|
+
name: z.string().optional(),
|
|
60
|
+
value: z.string().optional(),
|
|
61
|
+
});
|
|
62
|
+
const dimensionMetricSchema = z.object({
|
|
63
|
+
dimension: dimensionSchema.optional(),
|
|
64
|
+
metrics: z.array(metricSchema).optional(),
|
|
65
|
+
});
|
|
66
|
+
const evaluationCycleSchema = z.object({
|
|
67
|
+
endDate: z.string().optional(),
|
|
68
|
+
evaluationDate: z.string().optional(),
|
|
69
|
+
evaluationType: z.string().optional(),
|
|
70
|
+
startDate: z.string().optional(),
|
|
71
|
+
});
|
|
72
|
+
const getCustomerServiceMetricResponseSchema = z.object({
|
|
73
|
+
dimensionMetrics: z.array(dimensionMetricSchema).optional(),
|
|
74
|
+
evaluationCycle: evaluationCycleSchema.optional(),
|
|
75
|
+
marketplaceId: z.string().optional(),
|
|
76
|
+
});
|
|
77
|
+
// ============================================================================
|
|
78
|
+
// Seller Standards Profile Schemas
|
|
79
|
+
// ============================================================================
|
|
80
|
+
const cycleSchema = z.object({
|
|
81
|
+
cycleType: z.string().optional(),
|
|
82
|
+
evaluationDate: z.string().optional(),
|
|
83
|
+
evaluationMonth: z.string().optional(),
|
|
84
|
+
});
|
|
85
|
+
const standardsProfileSchema = z.object({
|
|
86
|
+
cycle: cycleSchema.optional(),
|
|
87
|
+
defaultProgram: z.boolean().optional(),
|
|
88
|
+
evaluationReason: z.string().optional(),
|
|
89
|
+
metrics: z.array(metricSchema).optional(),
|
|
90
|
+
program: z.string().optional(),
|
|
91
|
+
standardsLevel: z.string().optional(),
|
|
92
|
+
});
|
|
93
|
+
const findSellerStandardsProfilesResponseSchema = z.object({
|
|
94
|
+
standardsProfiles: z.array(standardsProfileSchema).optional(),
|
|
95
|
+
});
|
|
96
|
+
// ============================================================================
|
|
97
|
+
// Traffic Report Schemas
|
|
98
|
+
// ============================================================================
|
|
99
|
+
const definitionSchema = z.object({
|
|
100
|
+
dataType: z.string().optional(),
|
|
101
|
+
key: z.string().optional(),
|
|
102
|
+
localizedName: z.string().optional(),
|
|
103
|
+
});
|
|
104
|
+
const headerSchema = z.object({
|
|
105
|
+
dimensionKeys: z.array(definitionSchema).optional(),
|
|
106
|
+
metrics: z.array(definitionSchema).optional(),
|
|
107
|
+
});
|
|
108
|
+
const recordSchema = z.object({
|
|
109
|
+
dimensionValues: z.array(valueSchema).optional(),
|
|
110
|
+
metricValues: z.array(valueSchema).optional(),
|
|
111
|
+
});
|
|
112
|
+
const metadataHeaderSchema = z.object({
|
|
113
|
+
key: z.string().optional(),
|
|
114
|
+
metadataKeys: z.array(definitionSchema).optional(),
|
|
115
|
+
});
|
|
116
|
+
const metadataRecordSchema = z.object({
|
|
117
|
+
metadataValues: z.array(valueSchema).optional(),
|
|
118
|
+
value: valueSchema.optional(),
|
|
119
|
+
});
|
|
120
|
+
const metadataSchema = z.object({
|
|
121
|
+
metadataHeader: metadataHeaderSchema.optional(),
|
|
122
|
+
metadataRecords: z.array(metadataRecordSchema).optional(),
|
|
123
|
+
});
|
|
124
|
+
const reportSchema = z.object({
|
|
125
|
+
dimensionMetadata: z.array(metadataSchema).optional(),
|
|
126
|
+
endDate: z.string().optional(),
|
|
127
|
+
header: headerSchema.optional(),
|
|
128
|
+
lastUpdatedDate: z.string().optional(),
|
|
129
|
+
records: z.array(recordSchema).optional(),
|
|
130
|
+
startDate: z.string().optional(),
|
|
131
|
+
warnings: z.array(errorSchema).optional(),
|
|
132
|
+
});
|
|
133
|
+
// ============================================================================
|
|
134
|
+
// Input Schemas for Operations
|
|
135
|
+
// ============================================================================
|
|
136
|
+
const getCustomerServiceMetricInputSchema = z.object({
|
|
137
|
+
customer_service_metric_type: z.string(),
|
|
138
|
+
evaluation_type: z.string(),
|
|
139
|
+
evaluation_marketplace_id: z.string(),
|
|
140
|
+
});
|
|
141
|
+
const getSellerStandardsProfileInputSchema = z.object({
|
|
142
|
+
program: z.string(),
|
|
143
|
+
cycle: z.string(),
|
|
144
|
+
});
|
|
145
|
+
const getTrafficReportInputSchema = z.object({
|
|
146
|
+
dimension: z.string().optional(),
|
|
147
|
+
filter: z.string().optional(),
|
|
148
|
+
metric: z.string().optional(),
|
|
149
|
+
sort: z.string().optional(),
|
|
150
|
+
});
|
|
151
|
+
// ============================================================================
|
|
152
|
+
// JSON Schema Conversion Functions
|
|
153
|
+
// ============================================================================
|
|
154
|
+
/**
|
|
155
|
+
* Convert Zod schemas to JSON Schema format for MCP tools
|
|
156
|
+
*/
|
|
157
|
+
export function getAnalyticsJsonSchemas() {
|
|
158
|
+
return {
|
|
159
|
+
// Customer Service Metrics
|
|
160
|
+
getCustomerServiceMetricInput: zodToJsonSchema(getCustomerServiceMetricInputSchema, 'getCustomerServiceMetricInput'),
|
|
161
|
+
getCustomerServiceMetricOutput: zodToJsonSchema(getCustomerServiceMetricResponseSchema, 'getCustomerServiceMetricOutput'),
|
|
162
|
+
// Seller Standards Profiles
|
|
163
|
+
findSellerStandardsProfilesOutput: zodToJsonSchema(findSellerStandardsProfilesResponseSchema, 'findSellerStandardsProfilesOutput'),
|
|
164
|
+
getSellerStandardsProfileInput: zodToJsonSchema(getSellerStandardsProfileInputSchema, 'getSellerStandardsProfileInput'),
|
|
165
|
+
getSellerStandardsProfileOutput: zodToJsonSchema(standardsProfileSchema, 'getSellerStandardsProfileOutput'),
|
|
166
|
+
// Traffic Reports
|
|
167
|
+
getTrafficReportInput: zodToJsonSchema(getTrafficReportInputSchema, 'getTrafficReportInput'),
|
|
168
|
+
getTrafficReportOutput: zodToJsonSchema(reportSchema, 'getTrafficReportOutput'),
|
|
169
|
+
// Common Types
|
|
170
|
+
benchmarkMetadata: zodToJsonSchema(benchmarkMetadataSchema, 'benchmarkMetadata'),
|
|
171
|
+
cycle: zodToJsonSchema(cycleSchema, 'cycle'),
|
|
172
|
+
definition: zodToJsonSchema(definitionSchema, 'definition'),
|
|
173
|
+
dimension: zodToJsonSchema(dimensionSchema, 'dimension'),
|
|
174
|
+
dimensionMetric: zodToJsonSchema(dimensionMetricSchema, 'dimensionMetric'),
|
|
175
|
+
distribution: zodToJsonSchema(distributionSchema, 'distribution'),
|
|
176
|
+
error: zodToJsonSchema(errorSchema, 'error'),
|
|
177
|
+
errorParameter: zodToJsonSchema(errorParameterSchema, 'errorParameter'),
|
|
178
|
+
evaluationCycle: zodToJsonSchema(evaluationCycleSchema, 'evaluationCycle'),
|
|
179
|
+
header: zodToJsonSchema(headerSchema, 'header'),
|
|
180
|
+
metadata: zodToJsonSchema(metadataSchema, 'metadata'),
|
|
181
|
+
metadataHeader: zodToJsonSchema(metadataHeaderSchema, 'metadataHeader'),
|
|
182
|
+
metadataRecord: zodToJsonSchema(metadataRecordSchema, 'metadataRecord'),
|
|
183
|
+
metric: zodToJsonSchema(metricSchema, 'metric'),
|
|
184
|
+
metricBenchmark: zodToJsonSchema(metricBenchmarkSchema, 'metricBenchmark'),
|
|
185
|
+
metricDistribution: zodToJsonSchema(metricDistributionSchema, 'metricDistribution'),
|
|
186
|
+
record: zodToJsonSchema(recordSchema, 'record'),
|
|
187
|
+
report: zodToJsonSchema(reportSchema, 'report'),
|
|
188
|
+
standardsProfile: zodToJsonSchema(standardsProfileSchema, 'standardsProfile'),
|
|
189
|
+
value: zodToJsonSchema(valueSchema, 'value'),
|
|
190
|
+
};
|
|
191
|
+
}
|