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.
Files changed (129) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +755 -0
  3. package/build/api/account-management/account.js +301 -0
  4. package/build/api/analytics-and-report/analytics.js +102 -0
  5. package/build/api/client-trading.js +96 -0
  6. package/build/api/client.js +173 -0
  7. package/build/api/communication/feedback.js +119 -0
  8. package/build/api/communication/message.js +131 -0
  9. package/build/api/communication/negotiation.js +97 -0
  10. package/build/api/communication/notification.js +373 -0
  11. package/build/api/developer/developer.js +81 -0
  12. package/build/api/index.js +109 -0
  13. package/build/api/listing-management/inventory.js +640 -0
  14. package/build/api/listing-metadata/metadata.js +485 -0
  15. package/build/api/listing-metadata/taxonomy.js +58 -0
  16. package/build/api/marketing-and-promotions/marketing.js +768 -0
  17. package/build/api/marketing-and-promotions/recommendation.js +32 -0
  18. package/build/api/order-management/dispute.js +69 -0
  19. package/build/api/order-management/fulfillment.js +89 -0
  20. package/build/api/other/compliance.js +47 -0
  21. package/build/api/other/edelivery.js +219 -0
  22. package/build/api/other/identity.js +24 -0
  23. package/build/api/other/translation.js +22 -0
  24. package/build/api/other/vero.js +48 -0
  25. package/build/api/trading/trading.js +78 -0
  26. package/build/auth/kv-store.js +40 -0
  27. package/build/auth/multi-user-store.js +120 -0
  28. package/build/auth/oauth-metadata.js +59 -0
  29. package/build/auth/oauth-middleware.js +99 -0
  30. package/build/auth/oauth-types.js +4 -0
  31. package/build/auth/oauth.js +235 -0
  32. package/build/auth/scope-utils.js +304 -0
  33. package/build/auth/token-store.js +46 -0
  34. package/build/auth/token-verifier.js +172 -0
  35. package/build/config/environment.js +297 -0
  36. package/build/index.d.ts +1 -0
  37. package/build/index.js +129 -0
  38. package/build/schemas/account-management/account.js +375 -0
  39. package/build/schemas/analytics/analytics.js +191 -0
  40. package/build/schemas/communication/messages.js +345 -0
  41. package/build/schemas/fulfillment/orders.js +338 -0
  42. package/build/schemas/index.js +68 -0
  43. package/build/schemas/inventory-management/inventory.js +471 -0
  44. package/build/schemas/marketing/marketing.js +1103 -0
  45. package/build/schemas/metadata/metadata.js +618 -0
  46. package/build/schemas/other/other-apis.js +390 -0
  47. package/build/schemas/taxonomy/taxonomy.js +575 -0
  48. package/build/scripts/auto-setup.js +364 -0
  49. package/build/scripts/dev-sync.js +512 -0
  50. package/build/scripts/diagnostics.js +301 -0
  51. package/build/scripts/download-specs.js +116 -0
  52. package/build/scripts/interactive-setup.js +757 -0
  53. package/build/scripts/setup.js +1515 -0
  54. package/build/scripts/update-api-status-doc.js +44 -0
  55. package/build/server-http.d.ts +1 -0
  56. package/build/server-http.js +581 -0
  57. package/build/tools/definitions/account-with-schemas.js +170 -0
  58. package/build/tools/definitions/account.js +428 -0
  59. package/build/tools/definitions/analytics.js +66 -0
  60. package/build/tools/definitions/communication.js +394 -0
  61. package/build/tools/definitions/developer.js +195 -0
  62. package/build/tools/definitions/fulfillment.js +326 -0
  63. package/build/tools/definitions/index.js +41 -0
  64. package/build/tools/definitions/inventory.js +464 -0
  65. package/build/tools/definitions/marketing.js +1486 -0
  66. package/build/tools/definitions/metadata.js +188 -0
  67. package/build/tools/definitions/other.js +309 -0
  68. package/build/tools/definitions/taxonomy.js +64 -0
  69. package/build/tools/definitions/token-management.js +148 -0
  70. package/build/tools/definitions/trading.js +71 -0
  71. package/build/tools/index.js +1200 -0
  72. package/build/tools/schemas.js +667 -0
  73. package/build/tools/tool-definitions.js +3534 -0
  74. package/build/types/application-settings/developerAnalyticsV1BetaOas3.js +5 -0
  75. package/build/types/application-settings/developerClientRegistrationV1Oas3.js +5 -0
  76. package/build/types/application-settings/developerKeyManagementV1Oas3.js +5 -0
  77. package/build/types/ebay-enums.js +1330 -0
  78. package/build/types/ebay.js +123 -0
  79. package/build/types/index.js +10 -0
  80. package/build/types/sell-apps/account-management/sellAccountV1Oas3.js +5 -0
  81. package/build/types/sell-apps/analytics-and-report/sellAnalyticsV1Oas3.js +5 -0
  82. package/build/types/sell-apps/communication/commerceFeedbackV1BetaOas3.js +5 -0
  83. package/build/types/sell-apps/communication/commerceMessageV1Oas3.js +5 -0
  84. package/build/types/sell-apps/communication/commerceNotificationV1Oas3.js +5 -0
  85. package/build/types/sell-apps/communication/sellNegotiationV1Oas3.js +5 -0
  86. package/build/types/sell-apps/listing-management/sellInventoryV1Oas3.js +5 -0
  87. package/build/types/sell-apps/listing-metadata/sellMetadataV1Oas3.js +5 -0
  88. package/build/types/sell-apps/markeitng-and-promotions/sellMarketingV1Oas3.js +5 -0
  89. package/build/types/sell-apps/markeitng-and-promotions/sellRecommendationV1Oas3.js +5 -0
  90. package/build/types/sell-apps/order-management/sellFulfillmentV1Oas3.js +5 -0
  91. package/build/types/sell-apps/other-apis/commerceIdentityV1Oas3.js +5 -0
  92. package/build/types/sell-apps/other-apis/commerceTranslationV1BetaOas3.js +5 -0
  93. package/build/types/sell-apps/other-apis/commerceVeroV1Oas3.js +5 -0
  94. package/build/types/sell-apps/other-apis/sellComplianceV1Oas3.js +5 -0
  95. package/build/types/sell-apps/other-apis/sellEdeliveryInternationalShippingOas3.js +5 -0
  96. package/build/types/sell-apps/other-apis/sellMarketingV1Oas3.js +5 -0
  97. package/build/types/sell-apps/other-apis/sellRecommendationV1Oas3.js +5 -0
  98. package/build/utils/account-management/account.js +831 -0
  99. package/build/utils/api-status-feed.js +83 -0
  100. package/build/utils/communication/feedback.js +216 -0
  101. package/build/utils/communication/message.js +242 -0
  102. package/build/utils/communication/negotiation.js +150 -0
  103. package/build/utils/communication/notification.js +369 -0
  104. package/build/utils/date-converter.js +160 -0
  105. package/build/utils/llm-client-detector.js +758 -0
  106. package/build/utils/logger.js +198 -0
  107. package/build/utils/oauth-helper.js +315 -0
  108. package/build/utils/order-management/dispute.js +369 -0
  109. package/build/utils/order-management/fulfillment.js +205 -0
  110. package/build/utils/other/compliance.js +76 -0
  111. package/build/utils/other/edelivery.js +241 -0
  112. package/build/utils/other/identity.js +13 -0
  113. package/build/utils/other/translation.js +41 -0
  114. package/build/utils/other/vero.js +90 -0
  115. package/build/utils/scope-helper.js +207 -0
  116. package/build/utils/security-checker.js +248 -0
  117. package/build/utils/setup-validator.js +305 -0
  118. package/build/utils/token-utils.js +40 -0
  119. package/build/utils/version.js +56 -0
  120. package/docs/auth/production_scopes.json +111 -0
  121. package/docs/auth/sandbox_scopes.json +142 -0
  122. package/package.json +122 -0
  123. package/public/icons/1024x1024.png +0 -0
  124. package/public/icons/128x128.png +0 -0
  125. package/public/icons/16x16.png +0 -0
  126. package/public/icons/256x256.png +0 -0
  127. package/public/icons/32x32.png +0 -0
  128. package/public/icons/48x48.png +0 -0
  129. package/public/icons/512x512.png +0 -0
@@ -0,0 +1,345 @@
1
+ import { z } from 'zod';
2
+ import { zodToJsonSchema } from 'zod-to-json-schema';
3
+ import { MessageReferenceType, FeedbackRating } from '../../types/ebay-enums.js';
4
+ /**
5
+ * Communication API Schemas - Messages, Feedback, and Notifications
6
+ *
7
+ * This file contains Zod schemas for all Communication endpoints including:
8
+ * - Message API
9
+ * - Feedback API
10
+ * - Notification API
11
+ */
12
+ // ============================================================================
13
+ // Common Schemas
14
+ // ============================================================================
15
+ const errorSchema = z.object({
16
+ errorId: z.number().optional(),
17
+ domain: z.string().optional(),
18
+ category: z.string().optional(),
19
+ message: z.string().optional(),
20
+ longMessage: z.string().optional(),
21
+ parameters: z
22
+ .array(z.object({
23
+ name: z.string().optional(),
24
+ value: z.string().optional(),
25
+ }))
26
+ .optional(),
27
+ });
28
+ const amountSchema = z.object({
29
+ currency: z.string(),
30
+ value: z.string(),
31
+ });
32
+ // ============================================================================
33
+ // Message API Schemas
34
+ // ============================================================================
35
+ const messageReferenceSchema = z.object({
36
+ referenceId: z.string().optional(),
37
+ referenceType: z.nativeEnum(MessageReferenceType).optional(),
38
+ });
39
+ const messageMediaSchema = z.object({
40
+ mediaUrl: z.string().optional(),
41
+ mediaType: z.string().optional(),
42
+ });
43
+ export const sendMessageInputSchema = z.object({
44
+ messageText: z.string().describe('The text content of the message'),
45
+ conversationId: z
46
+ .string()
47
+ .optional()
48
+ .describe('The ID of the conversation to send the message in'),
49
+ otherPartyUsername: z
50
+ .string()
51
+ .optional()
52
+ .describe('The username of the other party (required if conversationId not provided)'),
53
+ reference: messageReferenceSchema
54
+ .optional()
55
+ .describe('Reference information for the message (e.g., item or order ID)'),
56
+ messageMedia: z
57
+ .array(messageMediaSchema)
58
+ .optional()
59
+ .describe('Media attachments for the message'),
60
+ emailCopyToSender: z.boolean().optional().describe('Whether to send an email copy to the sender'),
61
+ });
62
+ export const sendMessageOutputSchema = z.object({
63
+ messageId: z.string().optional(),
64
+ conversationId: z.string().optional(),
65
+ warnings: z.array(errorSchema).optional(),
66
+ });
67
+ const messageSchema = z.object({
68
+ messageId: z.string().optional(),
69
+ messageText: z.string().optional(),
70
+ creationDate: z.string().optional(),
71
+ senderUsername: z.string().optional(),
72
+ recipientUsername: z.string().optional(),
73
+ messageType: z.string().optional(),
74
+ messageMedia: z.array(messageMediaSchema).optional(),
75
+ });
76
+ export const getConversationsInputSchema = z.object({
77
+ limit: z.number().optional().describe('Number of conversations to return'),
78
+ offset: z.number().optional().describe('Number of conversations to skip'),
79
+ status: z.string().optional().describe('Filter by conversation status'),
80
+ });
81
+ export const getConversationsOutputSchema = z.object({
82
+ conversations: z
83
+ .array(z.object({
84
+ conversationId: z.string().optional(),
85
+ creationDate: z.string().optional(),
86
+ lastMessageDate: z.string().optional(),
87
+ subject: z.string().optional(),
88
+ otherPartyUsername: z.string().optional(),
89
+ unreadMessageCount: z.number().optional(),
90
+ status: z.string().optional(),
91
+ }))
92
+ .optional(),
93
+ href: z.string().optional(),
94
+ limit: z.number().optional(),
95
+ next: z.string().optional(),
96
+ offset: z.number().optional(),
97
+ prev: z.string().optional(),
98
+ total: z.number().optional(),
99
+ warnings: z.array(errorSchema).optional(),
100
+ });
101
+ export const getConversationInputSchema = z.object({
102
+ conversationId: z.string().describe('The unique identifier of the conversation'),
103
+ });
104
+ export const getConversationOutputSchema = z.object({
105
+ conversationId: z.string().optional(),
106
+ messages: z.array(messageSchema).optional(),
107
+ otherPartyUsername: z.string().optional(),
108
+ subject: z.string().optional(),
109
+ creationDate: z.string().optional(),
110
+ warnings: z.array(errorSchema).optional(),
111
+ });
112
+ // ============================================================================
113
+ // Feedback API Schemas
114
+ // ============================================================================
115
+ export const leaveFeedbackInputSchema = z.object({
116
+ orderLineItemId: z.string().describe('The unique identifier of the order line item'),
117
+ rating: z
118
+ .nativeEnum(FeedbackRating)
119
+ .describe('The feedback rating (POSITIVE, NEGATIVE, NEUTRAL)'),
120
+ feedbackText: z.string().optional().describe('The feedback comment text'),
121
+ });
122
+ export const leaveFeedbackOutputSchema = z.object({
123
+ feedbackId: z.string().optional(),
124
+ transactionId: z.string().optional(),
125
+ warnings: z.array(errorSchema).optional(),
126
+ });
127
+ export const getFeedbackInputSchema = z.object({
128
+ transactionId: z.string().describe('The transaction ID'),
129
+ });
130
+ const feedbackDetailSchema = z.object({
131
+ feedbackId: z.string().optional(),
132
+ rating: z.string().optional(),
133
+ feedbackText: z.string().optional(),
134
+ commentingUser: z.string().optional(),
135
+ creationDate: z.string().optional(),
136
+ itemId: z.string().optional(),
137
+ transactionId: z.string().optional(),
138
+ orderLineItemId: z.string().optional(),
139
+ });
140
+ export const getFeedbackOutputSchema = z.object({
141
+ feedback: feedbackDetailSchema.optional(),
142
+ warnings: z.array(errorSchema).optional(),
143
+ });
144
+ export const getFeedbackSummaryOutputSchema = z.object({
145
+ positiveFeedbackPercent: z.string().optional(),
146
+ uniquePositiveFeedbackCount: z.number().optional(),
147
+ uniqueNegativeFeedbackCount: z.number().optional(),
148
+ uniqueNeutralFeedbackCount: z.number().optional(),
149
+ averageFeedbackRating: z.string().optional(),
150
+ warnings: z.array(errorSchema).optional(),
151
+ });
152
+ export const getAwaitingFeedbackInputSchema = z.object({
153
+ filter: z.string().optional().describe('Filter criteria for awaiting feedback'),
154
+ limit: z.number().optional().describe('Number of items to return'),
155
+ offset: z.number().optional().describe('Number of items to skip'),
156
+ });
157
+ export const getAwaitingFeedbackOutputSchema = z.object({
158
+ items: z
159
+ .array(z.object({
160
+ orderLineItemId: z.string().optional(),
161
+ transactionId: z.string().optional(),
162
+ itemId: z.string().optional(),
163
+ title: z.string().optional(),
164
+ buyer: z.string().optional(),
165
+ transactionDate: z.string().optional(),
166
+ transactionPrice: amountSchema.optional(),
167
+ }))
168
+ .optional(),
169
+ href: z.string().optional(),
170
+ limit: z.number().optional(),
171
+ next: z.string().optional(),
172
+ offset: z.number().optional(),
173
+ prev: z.string().optional(),
174
+ total: z.number().optional(),
175
+ warnings: z.array(errorSchema).optional(),
176
+ });
177
+ export const respondToFeedbackInputSchema = z.object({
178
+ feedbackId: z.string().describe('The unique identifier of the feedback'),
179
+ responseText: z.string().describe('The response text'),
180
+ });
181
+ export const respondToFeedbackOutputSchema = z.object({
182
+ responseId: z.string().optional(),
183
+ warnings: z.array(errorSchema).optional(),
184
+ });
185
+ // ============================================================================
186
+ // Notification API Schemas
187
+ // ============================================================================
188
+ const deliveryConfigSchema = z.object({
189
+ endpoint: z.string().optional(),
190
+ format: z.string().optional(),
191
+ });
192
+ export const createNotificationDestinationInputSchema = z.object({
193
+ name: z.string().describe('The name of the notification destination'),
194
+ endpoint: z.string().describe('The endpoint URL for notifications'),
195
+ verificationToken: z.string().optional().describe('Verification token for the endpoint'),
196
+ });
197
+ export const createNotificationDestinationOutputSchema = z.object({
198
+ destinationId: z.string().optional(),
199
+ warnings: z.array(errorSchema).optional(),
200
+ });
201
+ export const getNotificationDestinationsInputSchema = z.object({
202
+ limit: z.number().optional().describe('Number of destinations to return'),
203
+ continuationToken: z.string().optional().describe('Token for pagination'),
204
+ });
205
+ export const getNotificationDestinationsOutputSchema = z.object({
206
+ destinations: z
207
+ .array(z.object({
208
+ destinationId: z.string().optional(),
209
+ name: z.string().optional(),
210
+ endpoint: z.string().optional(),
211
+ status: z.string().optional(),
212
+ }))
213
+ .optional(),
214
+ limit: z.number().optional(),
215
+ next: z.string().optional(),
216
+ total: z.number().optional(),
217
+ warnings: z.array(errorSchema).optional(),
218
+ });
219
+ export const createNotificationSubscriptionInputSchema = z.object({
220
+ topicId: z.string().describe('The topic ID to subscribe to'),
221
+ destinationId: z.string().describe('The destination ID for notifications'),
222
+ deliveryConfig: deliveryConfigSchema.optional().describe('Delivery configuration'),
223
+ });
224
+ export const createNotificationSubscriptionOutputSchema = z.object({
225
+ subscriptionId: z.string().optional(),
226
+ warnings: z.array(errorSchema).optional(),
227
+ });
228
+ export const getNotificationSubscriptionsInputSchema = z.object({
229
+ limit: z.number().optional().describe('Number of subscriptions to return'),
230
+ continuationToken: z.string().optional().describe('Token for pagination'),
231
+ });
232
+ export const getNotificationSubscriptionsOutputSchema = z.object({
233
+ subscriptions: z
234
+ .array(z.object({
235
+ subscriptionId: z.string().optional(),
236
+ topicId: z.string().optional(),
237
+ destinationId: z.string().optional(),
238
+ status: z.string().optional(),
239
+ enabled: z.boolean().optional(),
240
+ }))
241
+ .optional(),
242
+ limit: z.number().optional(),
243
+ next: z.string().optional(),
244
+ total: z.number().optional(),
245
+ warnings: z.array(errorSchema).optional(),
246
+ });
247
+ export const getNotificationTopicsOutputSchema = z.object({
248
+ topics: z
249
+ .array(z.object({
250
+ topicId: z.string().optional(),
251
+ description: z.string().optional(),
252
+ category: z.string().optional(),
253
+ }))
254
+ .optional(),
255
+ warnings: z.array(errorSchema).optional(),
256
+ });
257
+ // ============================================================================
258
+ // Negotiation API Schemas
259
+ // ============================================================================
260
+ export const sendOfferToInterestedBuyersInputSchema = z.object({
261
+ allowCounterOffer: z.boolean().optional().describe('Whether to allow counter offers'),
262
+ message: z.string().optional().describe('Message to send with the offer'),
263
+ offeredItems: z
264
+ .array(z.object({
265
+ offerId: z.string().optional(),
266
+ availableQuantity: z.number().optional(),
267
+ price: amountSchema.optional(),
268
+ }))
269
+ .optional()
270
+ .describe('Items to include in the offer'),
271
+ });
272
+ export const sendOfferToInterestedBuyersOutputSchema = z.object({
273
+ offerToInterestedBuyersId: z.string().optional(),
274
+ warnings: z.array(errorSchema).optional(),
275
+ });
276
+ export const getOffersToBuyersInputSchema = z.object({
277
+ filter: z.string().optional().describe('Filter criteria'),
278
+ limit: z.number().optional().describe('Number of offers to return'),
279
+ offset: z.number().optional().describe('Number of offers to skip'),
280
+ });
281
+ export const getOffersToBuyersOutputSchema = z.object({
282
+ offers: z
283
+ .array(z.object({
284
+ offerToInterestedBuyersId: z.string().optional(),
285
+ offeredItems: z
286
+ .array(z.object({
287
+ offerId: z.string().optional(),
288
+ price: amountSchema.optional(),
289
+ quantity: z.number().optional(),
290
+ }))
291
+ .optional(),
292
+ creationDate: z.string().optional(),
293
+ status: z.string().optional(),
294
+ }))
295
+ .optional(),
296
+ href: z.string().optional(),
297
+ limit: z.number().optional(),
298
+ next: z.string().optional(),
299
+ offset: z.number().optional(),
300
+ prev: z.string().optional(),
301
+ total: z.number().optional(),
302
+ warnings: z.array(errorSchema).optional(),
303
+ });
304
+ // ============================================================================
305
+ // JSON Schema Conversion Functions
306
+ // ============================================================================
307
+ /**
308
+ * Convert Zod schemas to JSON Schema format for MCP tools
309
+ */
310
+ export function getCommunicationJsonSchemas() {
311
+ return {
312
+ // Message API
313
+ sendMessageInput: zodToJsonSchema(sendMessageInputSchema, 'sendMessageInput'),
314
+ sendMessageOutput: zodToJsonSchema(sendMessageOutputSchema, 'sendMessageOutput'),
315
+ getConversationsInput: zodToJsonSchema(getConversationsInputSchema, 'getConversationsInput'),
316
+ getConversationsOutput: zodToJsonSchema(getConversationsOutputSchema, 'getConversationsOutput'),
317
+ getConversationInput: zodToJsonSchema(getConversationInputSchema, 'getConversationInput'),
318
+ getConversationOutput: zodToJsonSchema(getConversationOutputSchema, 'getConversationOutput'),
319
+ // Feedback API
320
+ leaveFeedbackInput: zodToJsonSchema(leaveFeedbackInputSchema, 'leaveFeedbackInput'),
321
+ leaveFeedbackOutput: zodToJsonSchema(leaveFeedbackOutputSchema, 'leaveFeedbackOutput'),
322
+ getFeedbackInput: zodToJsonSchema(getFeedbackInputSchema, 'getFeedbackInput'),
323
+ getFeedbackOutput: zodToJsonSchema(getFeedbackOutputSchema, 'getFeedbackOutput'),
324
+ getFeedbackSummaryOutput: zodToJsonSchema(getFeedbackSummaryOutputSchema, 'getFeedbackSummaryOutput'),
325
+ getAwaitingFeedbackInput: zodToJsonSchema(getAwaitingFeedbackInputSchema, 'getAwaitingFeedbackInput'),
326
+ getAwaitingFeedbackOutput: zodToJsonSchema(getAwaitingFeedbackOutputSchema, 'getAwaitingFeedbackOutput'),
327
+ respondToFeedbackInput: zodToJsonSchema(respondToFeedbackInputSchema, 'respondToFeedbackInput'),
328
+ respondToFeedbackOutput: zodToJsonSchema(respondToFeedbackOutputSchema, 'respondToFeedbackOutput'),
329
+ // Notification API
330
+ createNotificationDestinationInput: zodToJsonSchema(createNotificationDestinationInputSchema, 'createNotificationDestinationInput'),
331
+ createNotificationDestinationOutput: zodToJsonSchema(createNotificationDestinationOutputSchema, 'createNotificationDestinationOutput'),
332
+ getNotificationDestinationsInput: zodToJsonSchema(getNotificationDestinationsInputSchema, 'getNotificationDestinationsInput'),
333
+ getNotificationDestinationsOutput: zodToJsonSchema(getNotificationDestinationsOutputSchema, 'getNotificationDestinationsOutput'),
334
+ createNotificationSubscriptionInput: zodToJsonSchema(createNotificationSubscriptionInputSchema, 'createNotificationSubscriptionInput'),
335
+ createNotificationSubscriptionOutput: zodToJsonSchema(createNotificationSubscriptionOutputSchema, 'createNotificationSubscriptionOutput'),
336
+ getNotificationSubscriptionsInput: zodToJsonSchema(getNotificationSubscriptionsInputSchema, 'getNotificationSubscriptionsInput'),
337
+ getNotificationSubscriptionsOutput: zodToJsonSchema(getNotificationSubscriptionsOutputSchema, 'getNotificationSubscriptionsOutput'),
338
+ getNotificationTopicsOutput: zodToJsonSchema(getNotificationTopicsOutputSchema, 'getNotificationTopicsOutput'),
339
+ // Negotiation API
340
+ sendOfferToInterestedBuyersInput: zodToJsonSchema(sendOfferToInterestedBuyersInputSchema, 'sendOfferToInterestedBuyersInput'),
341
+ sendOfferToInterestedBuyersOutput: zodToJsonSchema(sendOfferToInterestedBuyersOutputSchema, 'sendOfferToInterestedBuyersOutput'),
342
+ getOffersToBuyersInput: zodToJsonSchema(getOffersToBuyersInputSchema, 'getOffersToBuyersInput'),
343
+ getOffersToBuyersOutput: zodToJsonSchema(getOffersToBuyersOutputSchema, 'getOffersToBuyersOutput'),
344
+ };
345
+ }
@@ -0,0 +1,338 @@
1
+ import { z } from 'zod';
2
+ import { zodToJsonSchema } from 'zod-to-json-schema';
3
+ import { ReasonForRefund } from '../../types/ebay-enums.js';
4
+ /**
5
+ * Fulfillment/Order Management API Schemas
6
+ *
7
+ * This file contains Zod schemas for all Order Management and Fulfillment endpoints.
8
+ */
9
+ // ============================================================================
10
+ // Common Schemas
11
+ // ============================================================================
12
+ const errorSchema = z.object({
13
+ errorId: z.number().optional(),
14
+ domain: z.string().optional(),
15
+ category: z.string().optional(),
16
+ message: z.string().optional(),
17
+ longMessage: z.string().optional(),
18
+ parameters: z
19
+ .array(z.object({
20
+ name: z.string().optional(),
21
+ value: z.string().optional(),
22
+ }))
23
+ .optional(),
24
+ });
25
+ const amountSchema = z.object({
26
+ currency: z.string(),
27
+ value: z.string(),
28
+ convertedFromCurrency: z.string().optional(),
29
+ convertedFromValue: z.string().optional(),
30
+ exchangeRate: z.string().optional(),
31
+ });
32
+ const addressSchema = z.object({
33
+ addressLine1: z.string().optional(),
34
+ addressLine2: z.string().optional(),
35
+ city: z.string().optional(),
36
+ stateOrProvince: z.string().optional(),
37
+ postalCode: z.string().optional(),
38
+ countryCode: z.string().optional(),
39
+ });
40
+ // ============================================================================
41
+ // Order Schemas
42
+ // ============================================================================
43
+ const buyerSchema = z.object({
44
+ username: z.string().optional(),
45
+ taxAddress: addressSchema.optional(),
46
+ taxIdentifier: z
47
+ .object({
48
+ taxpayerId: z.string().optional(),
49
+ taxIdentifierType: z.string().optional(),
50
+ issuingCountry: z.string().optional(),
51
+ })
52
+ .optional(),
53
+ });
54
+ const lineItemSchema = z.object({
55
+ lineItemId: z.string().optional(),
56
+ legacyItemId: z.string().optional(),
57
+ legacyVariationId: z.string().optional(),
58
+ sku: z.string().optional(),
59
+ title: z.string().optional(),
60
+ quantity: z.number().optional(),
61
+ lineItemCost: amountSchema.optional(),
62
+ lineItemFulfillmentStatus: z.string().optional(),
63
+ lineItemFulfillmentInstructions: z
64
+ .object({
65
+ guaranteedDelivery: z.boolean().optional(),
66
+ minEstimatedDeliveryDate: z.string().optional(),
67
+ maxEstimatedDeliveryDate: z.string().optional(),
68
+ shipByDate: z.string().optional(),
69
+ })
70
+ .optional(),
71
+ total: amountSchema.optional(),
72
+ deliveryCost: amountSchema.optional(),
73
+ taxes: z
74
+ .array(z.object({
75
+ taxType: z.string().optional(),
76
+ amount: amountSchema.optional(),
77
+ }))
78
+ .optional(),
79
+ itemLocation: addressSchema.optional(),
80
+ properties: z
81
+ .object({
82
+ soldViaAdCampaign: z.boolean().optional(),
83
+ buyerProtection: z.boolean().optional(),
84
+ })
85
+ .optional(),
86
+ purchaseMarketplaceId: z.string().optional(),
87
+ });
88
+ const shippingFulfillmentSchema = z.object({
89
+ fulfillmentId: z.string().optional(),
90
+ lineItems: z
91
+ .array(z.object({
92
+ lineItemId: z.string().optional(),
93
+ quantity: z.number().optional(),
94
+ }))
95
+ .optional(),
96
+ shippedDate: z.string().optional(),
97
+ shippingCarrierCode: z.string().optional(),
98
+ trackingNumber: z.string().optional(),
99
+ });
100
+ const orderSchema = z.object({
101
+ orderId: z.string().optional(),
102
+ legacyOrderId: z.string().optional(),
103
+ creationDate: z.string().optional(),
104
+ lastModifiedDate: z.string().optional(),
105
+ orderFulfillmentStatus: z.string().optional(),
106
+ orderPaymentStatus: z.string().optional(),
107
+ sellerId: z.string().optional(),
108
+ buyer: buyerSchema.optional(),
109
+ pricingSummary: z
110
+ .object({
111
+ priceSubtotal: amountSchema.optional(),
112
+ deliveryCost: amountSchema.optional(),
113
+ deliveryDiscount: amountSchema.optional(),
114
+ tax: amountSchema.optional(),
115
+ total: amountSchema.optional(),
116
+ })
117
+ .optional(),
118
+ cancelStatus: z
119
+ .object({
120
+ cancelState: z.string().optional(),
121
+ cancelRequests: z
122
+ .array(z.object({
123
+ cancelCompletedDate: z.string().optional(),
124
+ cancelInitiator: z.string().optional(),
125
+ cancelReason: z.string().optional(),
126
+ cancelRequestedDate: z.string().optional(),
127
+ cancelRequestId: z.string().optional(),
128
+ cancelRequestState: z.string().optional(),
129
+ }))
130
+ .optional(),
131
+ })
132
+ .optional(),
133
+ lineItems: z.array(lineItemSchema).optional(),
134
+ fulfillmentStartInstructions: z
135
+ .array(z.object({
136
+ fulfillmentInstructionsType: z.string().optional(),
137
+ minEstimatedDeliveryDate: z.string().optional(),
138
+ maxEstimatedDeliveryDate: z.string().optional(),
139
+ shipByDate: z.string().optional(),
140
+ shippingStep: z
141
+ .object({
142
+ shipTo: addressSchema.optional(),
143
+ shipToReferenceId: z.string().optional(),
144
+ shippingCarrierCode: z.string().optional(),
145
+ shippingServiceCode: z.string().optional(),
146
+ })
147
+ .optional(),
148
+ }))
149
+ .optional(),
150
+ fulfillmentHrefs: z.array(z.string()).optional(),
151
+ paymentSummary: z
152
+ .object({
153
+ payments: z
154
+ .array(z.object({
155
+ paymentDate: z.string().optional(),
156
+ paymentMethod: z.string().optional(),
157
+ paymentReferenceId: z.string().optional(),
158
+ paymentStatus: z.string().optional(),
159
+ amount: amountSchema.optional(),
160
+ }))
161
+ .optional(),
162
+ refunds: z
163
+ .array(z.object({
164
+ refundDate: z.string().optional(),
165
+ refundId: z.string().optional(),
166
+ refundReferenceId: z.string().optional(),
167
+ refundStatus: z.string().optional(),
168
+ amount: amountSchema.optional(),
169
+ }))
170
+ .optional(),
171
+ totalDueSeller: amountSchema.optional(),
172
+ })
173
+ .optional(),
174
+ salesRecordReference: z.string().optional(),
175
+ totalFeeBasisAmount: amountSchema.optional(),
176
+ totalMarketplaceFee: amountSchema.optional(),
177
+ });
178
+ export const getOrdersInputSchema = z.object({
179
+ filter: z
180
+ .string()
181
+ .optional()
182
+ .describe('Filter criteria for orders (e.g., creationdate:[2024-01-01..2024-12-31])'),
183
+ limit: z.number().optional().describe('Number of orders to return per page'),
184
+ offset: z.number().optional().describe('Number of orders to skip for pagination'),
185
+ orderIds: z.string().optional().describe('Comma-separated list of order IDs'),
186
+ });
187
+ export const getOrdersOutputSchema = z.object({
188
+ orders: z.array(orderSchema).optional(),
189
+ href: z.string().optional(),
190
+ limit: z.number().optional(),
191
+ next: z.string().optional(),
192
+ offset: z.number().optional(),
193
+ prev: z.string().optional(),
194
+ total: z.number().optional(),
195
+ warnings: z.array(errorSchema).optional(),
196
+ });
197
+ export const getOrderInputSchema = z.object({
198
+ orderId: z.string().describe('The unique identifier of the order'),
199
+ });
200
+ export const getOrderOutputSchema = orderSchema.extend({
201
+ warnings: z.array(errorSchema).optional(),
202
+ });
203
+ // ============================================================================
204
+ // Shipping Fulfillment Schemas
205
+ // ============================================================================
206
+ export const createShippingFulfillmentInputSchema = z.object({
207
+ orderId: z.string().describe('The unique identifier of the order'),
208
+ fulfillment: z.object({
209
+ lineItems: z
210
+ .array(z.object({
211
+ lineItemId: z.string(),
212
+ quantity: z.number().optional(),
213
+ }))
214
+ .describe('Line items to fulfill'),
215
+ shippedDate: z.string().optional().describe('Date the items were shipped (ISO 8601 format)'),
216
+ shippingCarrierCode: z.string().optional().describe('Shipping carrier code'),
217
+ trackingNumber: z.string().optional().describe('Tracking number for the shipment'),
218
+ }),
219
+ });
220
+ export const createShippingFulfillmentOutputSchema = z.object({
221
+ fulfillmentId: z.string().optional(),
222
+ warnings: z.array(errorSchema).optional(),
223
+ });
224
+ export const getShippingFulfillmentsInputSchema = z.object({
225
+ orderId: z.string().describe('The unique identifier of the order'),
226
+ });
227
+ export const getShippingFulfillmentsOutputSchema = z.object({
228
+ fulfillments: z.array(shippingFulfillmentSchema).optional(),
229
+ warnings: z.array(errorSchema).optional(),
230
+ });
231
+ // ============================================================================
232
+ // Refund Schemas
233
+ // ============================================================================
234
+ const lineItemRefundSchema = z.object({
235
+ lineItemId: z.string(),
236
+ refundAmount: amountSchema.optional(),
237
+ legacyReference: z
238
+ .object({
239
+ legacyItemId: z.string().optional(),
240
+ legacyTransactionId: z.string().optional(),
241
+ })
242
+ .optional(),
243
+ });
244
+ export const issueRefundInputSchema = z.object({
245
+ orderId: z.string().describe('The unique identifier of the order'),
246
+ refundData: z.object({
247
+ reasonForRefund: z.nativeEnum(ReasonForRefund).describe('Reason for issuing the refund'),
248
+ comment: z.string().optional().describe('Optional comment about the refund'),
249
+ refundItems: z.array(lineItemRefundSchema).optional().describe('Line items to refund'),
250
+ orderLevelRefundAmount: amountSchema
251
+ .optional()
252
+ .describe('Order-level refund amount (for partial refunds)'),
253
+ }),
254
+ });
255
+ export const issueRefundOutputSchema = z.object({
256
+ refundId: z.string().optional(),
257
+ refundStatus: z.string().optional(),
258
+ warnings: z.array(errorSchema).optional(),
259
+ });
260
+ // ============================================================================
261
+ // Payment Dispute Schemas
262
+ // ============================================================================
263
+ const paymentDisputeSchema = z.object({
264
+ paymentDisputeId: z.string().optional(),
265
+ orderId: z.string().optional(),
266
+ openDate: z.string().optional(),
267
+ respondByDate: z.string().optional(),
268
+ status: z.string().optional(),
269
+ reason: z.string().optional(),
270
+ amount: amountSchema.optional(),
271
+ buyer: buyerSchema.optional(),
272
+ lineItems: z.array(lineItemSchema).optional(),
273
+ evidence: z
274
+ .array(z.object({
275
+ evidenceId: z.string().optional(),
276
+ evidenceType: z.string().optional(),
277
+ files: z
278
+ .array(z.object({
279
+ fileId: z.string().optional(),
280
+ name: z.string().optional(),
281
+ uploadedDate: z.string().optional(),
282
+ }))
283
+ .optional(),
284
+ lineItems: z
285
+ .array(z.object({
286
+ lineItemId: z.string().optional(),
287
+ }))
288
+ .optional(),
289
+ }))
290
+ .optional(),
291
+ });
292
+ export const getPaymentDisputesInputSchema = z.object({
293
+ orderIds: z.string().optional().describe('Comma-separated list of order IDs'),
294
+ buyerUsername: z.string().optional().describe('Filter by buyer username'),
295
+ openDateFrom: z.string().optional().describe('Start date for dispute open date filter'),
296
+ openDateTo: z.string().optional().describe('End date for dispute open date filter'),
297
+ limit: z.number().optional().describe('Number of disputes to return'),
298
+ offset: z.number().optional().describe('Number of disputes to skip'),
299
+ });
300
+ export const getPaymentDisputesOutputSchema = z.object({
301
+ paymentDisputes: z.array(paymentDisputeSchema).optional(),
302
+ href: z.string().optional(),
303
+ limit: z.number().optional(),
304
+ next: z.string().optional(),
305
+ offset: z.number().optional(),
306
+ prev: z.string().optional(),
307
+ total: z.number().optional(),
308
+ warnings: z.array(errorSchema).optional(),
309
+ });
310
+ // ============================================================================
311
+ // JSON Schema Conversion Functions
312
+ // ============================================================================
313
+ /**
314
+ * Convert Zod schemas to JSON Schema format for MCP tools
315
+ */
316
+ export function getFulfillmentJsonSchemas() {
317
+ return {
318
+ // Orders
319
+ getOrdersInput: zodToJsonSchema(getOrdersInputSchema, 'getOrdersInput'),
320
+ getOrdersOutput: zodToJsonSchema(getOrdersOutputSchema, 'getOrdersOutput'),
321
+ getOrderInput: zodToJsonSchema(getOrderInputSchema, 'getOrderInput'),
322
+ getOrderOutput: zodToJsonSchema(getOrderOutputSchema, 'getOrderOutput'),
323
+ orderDetails: zodToJsonSchema(orderSchema, 'orderDetails'),
324
+ // Shipping Fulfillment
325
+ createShippingFulfillmentInput: zodToJsonSchema(createShippingFulfillmentInputSchema, 'createShippingFulfillmentInput'),
326
+ createShippingFulfillmentOutput: zodToJsonSchema(createShippingFulfillmentOutputSchema, 'createShippingFulfillmentOutput'),
327
+ getShippingFulfillmentsInput: zodToJsonSchema(getShippingFulfillmentsInputSchema, 'getShippingFulfillmentsInput'),
328
+ getShippingFulfillmentsOutput: zodToJsonSchema(getShippingFulfillmentsOutputSchema, 'getShippingFulfillmentsOutput'),
329
+ shippingFulfillmentDetails: zodToJsonSchema(shippingFulfillmentSchema, 'shippingFulfillmentDetails'),
330
+ // Refunds
331
+ issueRefundInput: zodToJsonSchema(issueRefundInputSchema, 'issueRefundInput'),
332
+ issueRefundOutput: zodToJsonSchema(issueRefundOutputSchema, 'issueRefundOutput'),
333
+ // Payment Disputes
334
+ getPaymentDisputesInput: zodToJsonSchema(getPaymentDisputesInputSchema, 'getPaymentDisputesInput'),
335
+ getPaymentDisputesOutput: zodToJsonSchema(getPaymentDisputesOutputSchema, 'getPaymentDisputesOutput'),
336
+ paymentDisputeDetails: zodToJsonSchema(paymentDisputeSchema, 'paymentDisputeDetails'),
337
+ };
338
+ }