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,1200 @@
1
+ import { getOAuthAuthorizationUrl, validateScopes } from '../config/environment.js';
2
+ import { accountTools, analyticsTools, communicationTools, developerTools, fulfillmentTools, inventoryTools, marketingTools, metadataTools, otherApiTools, taxonomyTools, tradingTools, tokenManagementTools, } from '../tools/definitions/index.js';
3
+ import { chatGptTools } from '../tools/tool-definitions.js';
4
+ import { getApiStatusFeed } from '../utils/api-status-feed.js';
5
+ import { convertToTimestamp, validateTokenExpiry } from '../utils/date-converter.js';
6
+ // Import Zod schemas for input validation
7
+ import { getAwaitingFeedbackSchema, getFeedbackRatingSummarySchema, getFeedbackSchema, leaveFeedbackForBuyerSchema, respondToFeedbackSchema, } from '../utils/communication/feedback.js';
8
+ import { bulkUpdateConversationSchema, getConversationSchema, getConversationsSchema, sendMessageSchema, updateConversationSchema, } from '../utils/communication/message.js';
9
+ import { findEligibleItemsSchema, getOffersToBuyersSchema, sendOfferToInterestedBuyersSchema, } from '../utils/communication/negotiation.js';
10
+ import { createDestinationSchema, createSubscriptionFilterSchema, createSubscriptionSchema, deleteDestinationSchema, deleteSubscriptionFilterSchema, deleteSubscriptionSchema, disableSubscriptionSchema, enableSubscriptionSchema, getConfigSchema, getDestinationSchema, getPublicKeySchema, getSubscriptionFilterSchema, getSubscriptionSchema, getSubscriptionsSchema, getTopicSchema, getTopicsSchema, testSubscriptionSchema, updateConfigSchema, updateDestinationSchema, updateSubscriptionSchema, } from '../utils/communication/notification.js';
11
+ /**
12
+ * Get all tool definitions for the MCP server
13
+ */
14
+ export function getToolDefinitions() {
15
+ const chatConnectorTools = chatGptTools.filter((tool) => tool.name === 'search' || tool.name === 'fetch');
16
+ return [
17
+ ...chatConnectorTools,
18
+ ...tokenManagementTools,
19
+ ...accountTools,
20
+ ...inventoryTools,
21
+ ...fulfillmentTools,
22
+ ...marketingTools,
23
+ ...analyticsTools,
24
+ ...metadataTools,
25
+ ...taxonomyTools,
26
+ ...communicationTools,
27
+ ...otherApiTools,
28
+ ...developerTools,
29
+ ...tradingTools,
30
+ ];
31
+ }
32
+ /**
33
+ * Execute a tool based on its name
34
+ */
35
+ export async function executeTool(api, toolName, args) {
36
+ switch (toolName) {
37
+ // ChatGPT Connector Tools
38
+ case 'search': {
39
+ // For this example, we'll treat the query as a search for inventory items.
40
+ // A more robust implementation might search across different types of content.
41
+ const requestedLimitRaw = args.limit;
42
+ const limit = typeof requestedLimitRaw === 'number' && Number.isFinite(requestedLimitRaw)
43
+ ? Math.max(Math.floor(requestedLimitRaw), 1)
44
+ : 10;
45
+ const query = args.query?.toLowerCase().trim();
46
+ const pageSize = query ? Math.min(Math.max(limit, 50), 200) : limit;
47
+ const matches = [];
48
+ let offset = 0;
49
+ while (matches.length < limit) {
50
+ const response = await api.inventory.getInventoryItems(pageSize, offset);
51
+ const pageItems = response.inventoryItems ?? [];
52
+ if (pageItems.length === 0) {
53
+ break;
54
+ }
55
+ // Filter to only include items with valid SKUs (required for getInventoryItem calls)
56
+ const itemsWithSku = pageItems.filter((item) => typeof item.sku === 'string' && item.sku.trim() !== '');
57
+ const filtered = query
58
+ ? itemsWithSku.filter((item) => (item.product?.title ?? '').toLowerCase().includes(query))
59
+ : itemsWithSku;
60
+ matches.push(...filtered);
61
+ offset += pageSize;
62
+ const total = response.total;
63
+ if (typeof total === 'number' && offset >= total) {
64
+ break;
65
+ }
66
+ if (!query || pageItems.length < pageSize) {
67
+ break;
68
+ }
69
+ }
70
+ const results = matches.slice(0, limit).map((item) => ({
71
+ id: item.sku,
72
+ title: item.product?.title ?? 'No Title',
73
+ // The URL should be a canonical link to the item, which we don't have here.
74
+ // We'll use a placeholder.
75
+ url: `https://www.ebay.com/`, // Placeholder URL
76
+ }));
77
+ // Format the response as required by the ChatGPT connector spec.
78
+ return {
79
+ content: [
80
+ {
81
+ type: 'text',
82
+ text: JSON.stringify({ results }),
83
+ },
84
+ ],
85
+ };
86
+ }
87
+ case 'fetch': {
88
+ const sku = args.id;
89
+ const item = await api.inventory.getInventoryItem(sku);
90
+ // Format the response as required by the ChatGPT connector spec.
91
+ const result = {
92
+ id: sku,
93
+ title: item.product?.title ?? 'No Title',
94
+ text: item.product?.description ?? 'No description available.',
95
+ url: `https://www.ebay.com/`, // Placeholder URL
96
+ metadata: {
97
+ source: 'ebay_inventory',
98
+ aspects: item.product?.aspects,
99
+ condition: item.condition,
100
+ },
101
+ };
102
+ return {
103
+ content: [
104
+ {
105
+ type: 'text',
106
+ text: JSON.stringify(result),
107
+ },
108
+ ],
109
+ };
110
+ }
111
+ case 'ebay_get_oauth_url': {
112
+ // Get config from environment
113
+ const clientId = process.env.EBAY_CLIENT_ID ?? '';
114
+ const environment = (process.env.EBAY_ENVIRONMENT ?? 'sandbox');
115
+ const envRedirectUri = process.env.EBAY_REDIRECT_URI;
116
+ // Use redirectUri from args if provided, otherwise use from .env
117
+ const redirectUri = args.redirectUri ?? envRedirectUri;
118
+ const scopes = args.scopes;
119
+ const state = args.state;
120
+ if (!clientId) {
121
+ throw new Error('EBAY_CLIENT_ID environment variable is required to generate OAuth URL');
122
+ }
123
+ if (!redirectUri) {
124
+ throw new Error('Redirect URI is required. Either provide it as a parameter or set EBAY_REDIRECT_URI in your .env file.');
125
+ }
126
+ // Validate scopes if custom scopes are provided
127
+ let scopeWarnings = [];
128
+ let validatedScopes = scopes;
129
+ if (scopes && scopes.length > 0) {
130
+ const validation = validateScopes(scopes, environment);
131
+ scopeWarnings = validation.warnings;
132
+ validatedScopes = validation.validScopes;
133
+ }
134
+ const authUrl = getOAuthAuthorizationUrl(clientId, redirectUri, environment, validatedScopes, state);
135
+ const result = {
136
+ authorizationUrl: authUrl,
137
+ redirectUri,
138
+ instructions: 'Open this URL in a browser to authorize the application. After authorization, you will be redirected to your redirect URI with an authorization code that can be exchanged for an access token.',
139
+ environment,
140
+ scopes: scopes ?? 'default (all Sell API scopes)',
141
+ };
142
+ // Include warnings if any scopes are invalid for the environment
143
+ if (scopeWarnings.length > 0) {
144
+ result.warnings = scopeWarnings;
145
+ }
146
+ return result;
147
+ }
148
+ case 'ebay_set_user_tokens': {
149
+ const accessToken = args.accessToken;
150
+ const refreshToken = args.refreshToken;
151
+ if (!accessToken || !refreshToken) {
152
+ throw new Error('Both accessToken and refreshToken are required');
153
+ }
154
+ await api.setUserTokens(accessToken, refreshToken);
155
+ return {
156
+ success: true,
157
+ message: 'User tokens successfully stored. These tokens will be used for all subsequent API requests and will be automatically refreshed when needed.',
158
+ tokenInfo: api.getTokenInfo(),
159
+ };
160
+ }
161
+ case 'ebay_get_token_status': {
162
+ const tokenInfo = api.getTokenInfo();
163
+ const hasUserTokens = api.hasUserTokens();
164
+ return {
165
+ hasUserToken: tokenInfo.hasUserToken,
166
+ hasAppAccessToken: tokenInfo.hasAppAccessToken,
167
+ authenticated: api.isAuthenticated(),
168
+ currentTokenType: tokenInfo.hasUserToken
169
+ ? 'user_token (10,000-50,000 req/day)'
170
+ : tokenInfo.hasAppAccessToken
171
+ ? 'app_access_token (1,000 req/day)'
172
+ : 'none',
173
+ message: hasUserTokens
174
+ ? 'Using user access token with automatic refresh'
175
+ : 'Using app access token from client credentials flow (lower rate limits). Consider setting user tokens for higher rate limits.',
176
+ };
177
+ }
178
+ case 'ebay_clear_tokens': {
179
+ const authClient = api.getAuthClient().getOAuthClient();
180
+ authClient.clearAllTokens();
181
+ return {
182
+ success: true,
183
+ message: 'All tokens cleared successfully. You will need to re-authenticate for subsequent API calls.',
184
+ };
185
+ }
186
+ case 'ebay_convert_date_to_timestamp': {
187
+ const dateInput = args.dateInput;
188
+ try {
189
+ const timestamp = convertToTimestamp(dateInput);
190
+ return {
191
+ success: true,
192
+ timestamp,
193
+ input: dateInput,
194
+ formattedDate: new Date(timestamp).toISOString(),
195
+ message: `Successfully converted to timestamp: ${timestamp}ms (${new Date(timestamp).toISOString()})`,
196
+ };
197
+ }
198
+ catch (error) {
199
+ throw new Error(`Failed to convert date: ${error instanceof Error ? error.message : String(error)}`);
200
+ }
201
+ }
202
+ case 'ebay_validate_token_expiry': {
203
+ const accessTokenExpiry = args.accessTokenExpiry;
204
+ const refreshTokenExpiry = args.refreshTokenExpiry;
205
+ try {
206
+ // Convert to timestamps
207
+ const accessExpiry = convertToTimestamp(accessTokenExpiry);
208
+ const refreshExpiry = convertToTimestamp(refreshTokenExpiry);
209
+ // Validate
210
+ const validation = validateTokenExpiry(accessExpiry, refreshExpiry);
211
+ return {
212
+ ...validation,
213
+ accessTokenExpiryTimestamp: accessExpiry,
214
+ refreshTokenExpiryTimestamp: refreshExpiry,
215
+ accessTokenExpiryDate: new Date(accessExpiry).toISOString(),
216
+ refreshTokenExpiryDate: new Date(refreshExpiry).toISOString(),
217
+ };
218
+ }
219
+ catch (error) {
220
+ throw new Error(`Failed to validate token expiry: ${error instanceof Error ? error.message : String(error)}`);
221
+ }
222
+ }
223
+ case 'ebay_set_user_tokens_with_expiry': {
224
+ const accessToken = args.accessToken;
225
+ const refreshToken = args.refreshToken;
226
+ const accessTokenExpiry = args.accessTokenExpiry;
227
+ const refreshTokenExpiry = args.refreshTokenExpiry;
228
+ const autoRefresh = args.autoRefresh ?? true;
229
+ if (!accessToken || !refreshToken) {
230
+ throw new Error('Both accessToken and refreshToken are required');
231
+ }
232
+ try {
233
+ // Convert expiry times to timestamps if provided
234
+ let accessExpiry;
235
+ let refreshExpiry;
236
+ if (accessTokenExpiry !== undefined) {
237
+ accessExpiry = convertToTimestamp(accessTokenExpiry);
238
+ }
239
+ if (refreshTokenExpiry !== undefined) {
240
+ refreshExpiry = convertToTimestamp(refreshTokenExpiry);
241
+ }
242
+ // Set tokens (will use defaults if expiry times not provided)
243
+ await api.setUserTokens(accessToken, refreshToken, accessExpiry, refreshExpiry);
244
+ // If autoRefresh is enabled, attempt to get a fresh access token
245
+ // (The OAuth client will handle refresh internally if needed)
246
+ if (autoRefresh) {
247
+ try {
248
+ const authClient = api.getAuthClient().getOAuthClient();
249
+ await authClient.getAccessToken();
250
+ return {
251
+ success: true,
252
+ message: 'User tokens stored successfully in memory. Access token validated and refreshed if needed. To persist tokens, update EBAY_USER_REFRESH_TOKEN in .env file.',
253
+ tokenInfo: api.getTokenInfo(),
254
+ refreshed: true,
255
+ };
256
+ }
257
+ catch (refreshError) {
258
+ return {
259
+ success: true,
260
+ message: 'User tokens stored, but failed to validate/refresh access token. You may need to re-authorize.',
261
+ tokenInfo: api.getTokenInfo(),
262
+ refreshed: false,
263
+ refreshError: refreshError instanceof Error ? refreshError.message : 'Unknown error',
264
+ };
265
+ }
266
+ }
267
+ return {
268
+ success: true,
269
+ message: 'User tokens successfully stored in memory. These tokens will be used for all subsequent API requests and will be automatically refreshed when needed. To persist tokens, update EBAY_USER_REFRESH_TOKEN in .env file.',
270
+ tokenInfo: api.getTokenInfo(),
271
+ refreshed: false,
272
+ };
273
+ }
274
+ catch (error) {
275
+ throw new Error(`Failed to set user tokens: ${error instanceof Error ? error.message : String(error)}`);
276
+ }
277
+ }
278
+ case 'ebay_display_credentials': {
279
+ // Get configuration from environment
280
+ const clientId = process.env.EBAY_CLIENT_ID ?? '';
281
+ const clientSecret = process.env.EBAY_CLIENT_SECRET ?? '';
282
+ const environment = process.env.EBAY_ENVIRONMENT ?? 'sandbox';
283
+ const redirectUri = process.env.EBAY_REDIRECT_URI ?? '';
284
+ const refreshToken = process.env.EBAY_USER_REFRESH_TOKEN ?? '';
285
+ // Get current token info from API
286
+ const tokenInfo = api.getTokenInfo();
287
+ const authClient = api.getAuthClient().getOAuthClient();
288
+ // Helper function to mask sensitive tokens
289
+ const maskToken = (token) => {
290
+ if (!token || token.length < 12)
291
+ return '***';
292
+ return `${token.substring(0, 6)}...${token.substring(token.length - 6)}`;
293
+ };
294
+ // Get internal token details from the auth client
295
+ const internalTokens = authClient.getUserTokens();
296
+ const appToken = authClient.getCachedAppAccessToken();
297
+ const appTokenExpiry = authClient.getCachedAppAccessTokenExpiry();
298
+ return {
299
+ credentials: {
300
+ clientId: clientId ? maskToken(clientId) : 'Not set',
301
+ clientSecret: clientSecret ? '****** (set)' : 'Not set',
302
+ environment,
303
+ redirectUri: redirectUri || 'Not set',
304
+ },
305
+ tokens: {
306
+ refreshToken: refreshToken ? maskToken(refreshToken) : 'Not set (in .env)',
307
+ accessToken: internalTokens?.userAccessToken
308
+ ? maskToken(internalTokens.userAccessToken)
309
+ : 'Not available',
310
+ accessTokenExpiry: internalTokens?.userAccessTokenExpiry
311
+ ? {
312
+ timestamp: internalTokens.userAccessTokenExpiry,
313
+ date: new Date(internalTokens.userAccessTokenExpiry).toISOString(),
314
+ expired: Date.now() >= internalTokens.userAccessTokenExpiry,
315
+ }
316
+ : 'Not available',
317
+ refreshTokenExpiry: internalTokens?.userRefreshTokenExpiry
318
+ ? {
319
+ timestamp: internalTokens.userRefreshTokenExpiry,
320
+ date: new Date(internalTokens.userRefreshTokenExpiry).toISOString(),
321
+ expired: Date.now() >= internalTokens.userRefreshTokenExpiry,
322
+ }
323
+ : 'Not available',
324
+ appToken: appToken ? maskToken(appToken) : 'Not cached',
325
+ appTokenExpiry: appTokenExpiry
326
+ ? {
327
+ timestamp: appTokenExpiry,
328
+ date: new Date(appTokenExpiry).toISOString(),
329
+ expired: Date.now() >= appTokenExpiry,
330
+ }
331
+ : 'Not available',
332
+ },
333
+ status: {
334
+ hasUserToken: tokenInfo.hasUserToken,
335
+ hasAppAccessToken: tokenInfo.hasAppAccessToken,
336
+ authenticated: api.isAuthenticated(),
337
+ currentTokenType: tokenInfo.hasUserToken
338
+ ? 'user_token (10,000-50,000 req/day)'
339
+ : tokenInfo.hasAppAccessToken
340
+ ? 'app_access_token (1,000 req/day)'
341
+ : 'none',
342
+ },
343
+ scopes: internalTokens?.scope ? internalTokens.scope.split(' ') : [],
344
+ };
345
+ }
346
+ case 'ebay_exchange_authorization_code': {
347
+ const code = args.code;
348
+ if (!code) {
349
+ throw new Error('Authorization code is required');
350
+ }
351
+ try {
352
+ // URL-decode the code if it's URL-encoded (contains % characters)
353
+ const decodedCode = code.includes('%') ? decodeURIComponent(code) : code;
354
+ // Get the OAuth client
355
+ const authClient = api.getAuthClient().getOAuthClient();
356
+ // Exchange the authorization code for tokens
357
+ const tokenData = await authClient.exchangeCodeForToken(decodedCode);
358
+ return {
359
+ success: true,
360
+ message: 'Authorization code successfully exchanged for tokens. Tokens have been stored and will be used for subsequent API requests.',
361
+ tokenData: {
362
+ accessToken: `${tokenData.access_token.substring(0, 20)}...${tokenData.access_token.slice(-10)}`,
363
+ refreshToken: `${tokenData.refresh_token.substring(0, 20)}...${tokenData.refresh_token.slice(-10)}`,
364
+ expiresIn: tokenData.expires_in,
365
+ refreshTokenExpiresIn: tokenData.refresh_token_expires_in,
366
+ tokenType: tokenData.token_type,
367
+ scope: tokenData.scope,
368
+ },
369
+ note: 'The refresh token has been saved to your .env file for future use.',
370
+ };
371
+ }
372
+ catch (error) {
373
+ throw new Error(`Failed to exchange authorization code: ${error instanceof Error ? error.message : String(error)}`);
374
+ }
375
+ }
376
+ case 'ebay_refresh_access_token': {
377
+ const authClient = api.getAuthClient().getOAuthClient();
378
+ // Check if user tokens are available
379
+ if (!api.hasUserTokens()) {
380
+ throw new Error('No user tokens available. Please set user tokens first using ebay_set_user_tokens_with_expiry or add EBAY_USER_REFRESH_TOKEN to your .env file.');
381
+ }
382
+ try {
383
+ // Call the public refreshUserToken method
384
+ await authClient.refreshUserToken();
385
+ // Get updated token info
386
+ const internalTokens = authClient.getUserTokens();
387
+ return {
388
+ success: true,
389
+ message: 'Access token refreshed successfully',
390
+ accessToken: internalTokens?.userAccessToken
391
+ ? `${internalTokens.userAccessToken.substring(0, 6)}...${internalTokens.userAccessToken.substring(internalTokens.userAccessToken.length - 6)}`
392
+ : 'Not available',
393
+ accessTokenExpiry: internalTokens?.userAccessTokenExpiry
394
+ ? {
395
+ timestamp: internalTokens.userAccessTokenExpiry,
396
+ date: new Date(internalTokens.userAccessTokenExpiry).toISOString(),
397
+ expiresInSeconds: Math.floor((internalTokens.userAccessTokenExpiry - Date.now()) / 1000),
398
+ }
399
+ : 'Not available',
400
+ tokenInfo: api.getTokenInfo(),
401
+ };
402
+ }
403
+ catch (error) {
404
+ throw new Error(`Failed to refresh access token: ${error instanceof Error ? error.message : String(error)}`);
405
+ }
406
+ }
407
+ // Account Management
408
+ case 'ebay_get_custom_policies':
409
+ return await api.account.getCustomPolicies(args.policyTypes);
410
+ case 'ebay_get_fulfillment_policies':
411
+ return await api.account.getFulfillmentPolicies(args.marketplaceId);
412
+ case 'ebay_get_payment_policies':
413
+ return await api.account.getPaymentPolicies(args.marketplaceId);
414
+ case 'ebay_get_return_policies':
415
+ return await api.account.getReturnPolicies(args.marketplaceId);
416
+ // Fulfillment Policy CRUD
417
+ case 'ebay_create_fulfillment_policy':
418
+ return await api.account.createFulfillmentPolicy(args.policy);
419
+ case 'ebay_get_fulfillment_policy':
420
+ return await api.account.getFulfillmentPolicy(args.fulfillmentPolicyId);
421
+ case 'ebay_get_fulfillment_policy_by_name':
422
+ return await api.account.getFulfillmentPolicyByName(args.marketplaceId, args.name);
423
+ case 'ebay_update_fulfillment_policy':
424
+ return await api.account.updateFulfillmentPolicy(args.fulfillmentPolicyId, args.policy);
425
+ case 'ebay_delete_fulfillment_policy':
426
+ return await api.account.deleteFulfillmentPolicy(args.fulfillmentPolicyId);
427
+ // Payment Policy CRUD
428
+ case 'ebay_create_payment_policy':
429
+ return await api.account.createPaymentPolicy(args.policy);
430
+ case 'ebay_get_payment_policy':
431
+ return await api.account.getPaymentPolicy(args.paymentPolicyId);
432
+ case 'ebay_get_payment_policy_by_name':
433
+ return await api.account.getPaymentPolicyByName(args.marketplaceId, args.name);
434
+ case 'ebay_update_payment_policy':
435
+ return await api.account.updatePaymentPolicy(args.paymentPolicyId, args.policy);
436
+ case 'ebay_delete_payment_policy':
437
+ return await api.account.deletePaymentPolicy(args.paymentPolicyId);
438
+ // Return Policy CRUD
439
+ case 'ebay_create_return_policy':
440
+ return await api.account.createReturnPolicy(args.policy);
441
+ case 'ebay_get_return_policy':
442
+ return await api.account.getReturnPolicy(args.returnPolicyId);
443
+ case 'ebay_get_return_policy_by_name':
444
+ return await api.account.getReturnPolicyByName(args.marketplaceId, args.name);
445
+ case 'ebay_update_return_policy':
446
+ return await api.account.updateReturnPolicy(args.returnPolicyId, args.policy);
447
+ case 'ebay_delete_return_policy':
448
+ return await api.account.deleteReturnPolicy(args.returnPolicyId);
449
+ // Custom Policy CRUD
450
+ case 'ebay_create_custom_policy':
451
+ return await api.account.createCustomPolicy(args.policy);
452
+ case 'ebay_get_custom_policy':
453
+ return await api.account.getCustomPolicy(args.customPolicyId);
454
+ case 'ebay_update_custom_policy':
455
+ return await api.account.updateCustomPolicy(args.customPolicyId, args.policy);
456
+ case 'ebay_delete_custom_policy':
457
+ return await api.account.deleteCustomPolicy(args.customPolicyId);
458
+ // KYC, Payments, Programs, Sales Tax, Subscription
459
+ case 'ebay_get_kyc':
460
+ return await api.account.getKyc();
461
+ case 'ebay_opt_in_to_payments_program':
462
+ return await api.account.optInToPaymentsProgram(args.marketplaceId, args.paymentsProgramType);
463
+ case 'ebay_get_payments_program_status':
464
+ return await api.account.getPaymentsProgramStatus(args.marketplaceId, args.paymentsProgramType);
465
+ case 'ebay_get_rate_tables':
466
+ return await api.account.getRateTables();
467
+ case 'ebay_create_or_replace_sales_tax':
468
+ return await api.account.createOrReplaceSalesTax(args.countryCode, args.jurisdictionId, args.salesTaxBase);
469
+ case 'ebay_bulk_create_or_replace_sales_tax':
470
+ return await api.account.bulkCreateOrReplaceSalesTax(args.requests);
471
+ case 'ebay_delete_sales_tax':
472
+ return await api.account.deleteSalesTax(args.countryCode, args.jurisdictionId);
473
+ case 'ebay_get_sales_tax':
474
+ return await api.account.getSalesTax(args.countryCode, args.jurisdictionId);
475
+ case 'ebay_get_sales_taxes':
476
+ return await api.account.getSalesTaxes(args.countryCode);
477
+ case 'ebay_get_subscription':
478
+ return await api.account.getSubscription(args.limitType);
479
+ case 'ebay_opt_in_to_program':
480
+ return await api.account.optInToProgram(args.request);
481
+ case 'ebay_opt_out_of_program':
482
+ return await api.account.optOutOfProgram(args.request);
483
+ case 'ebay_get_opted_in_programs':
484
+ return await api.account.getOptedInPrograms();
485
+ case 'ebay_get_privileges':
486
+ return await api.account.getPrivileges();
487
+ case 'ebay_get_advertising_eligibility':
488
+ return await api.account.getAdvertisingEligibility(args.marketplaceId, args.programTypes);
489
+ case 'ebay_get_payments_program':
490
+ return await api.account.getPaymentsProgram(args.marketplaceId, args.paymentsProgramType);
491
+ case 'ebay_get_payments_program_onboarding':
492
+ return await api.account.getPaymentsProgramOnboarding(args.marketplaceId, args.paymentsProgramType);
493
+ // Inventory Management
494
+ case 'ebay_get_inventory_items':
495
+ return await api.inventory.getInventoryItems(args.limit, args.offset);
496
+ case 'ebay_get_inventory_item':
497
+ return await api.inventory.getInventoryItem(args.sku);
498
+ case 'ebay_create_inventory_item':
499
+ return await api.inventory.createOrReplaceInventoryItem(args.sku, args.inventoryItem);
500
+ case 'ebay_delete_inventory_item':
501
+ return await api.inventory.deleteInventoryItem(args.sku);
502
+ // Bulk Operations
503
+ case 'ebay_bulk_create_or_replace_inventory_item':
504
+ return await api.inventory.bulkCreateOrReplaceInventoryItem(args.requests);
505
+ case 'ebay_bulk_get_inventory_item':
506
+ return await api.inventory.bulkGetInventoryItem(args.requests);
507
+ case 'ebay_bulk_update_price_quantity':
508
+ return await api.inventory.bulkUpdatePriceQuantity(args.requests);
509
+ // Product Compatibility
510
+ case 'ebay_get_product_compatibility':
511
+ return await api.inventory.getProductCompatibility(args.sku);
512
+ case 'ebay_create_or_replace_product_compatibility':
513
+ return await api.inventory.createOrReplaceProductCompatibility(args.sku, args.compatibility);
514
+ case 'ebay_delete_product_compatibility':
515
+ return await api.inventory.deleteProductCompatibility(args.sku);
516
+ // Inventory Item Groups
517
+ case 'ebay_get_inventory_item_group':
518
+ return await api.inventory.getInventoryItemGroup(args.inventoryItemGroupKey);
519
+ case 'ebay_create_or_replace_inventory_item_group':
520
+ return await api.inventory.createOrReplaceInventoryItemGroup(args.inventoryItemGroupKey, args.inventoryItemGroup);
521
+ case 'ebay_delete_inventory_item_group':
522
+ return await api.inventory.deleteInventoryItemGroup(args.inventoryItemGroupKey);
523
+ // Location Management
524
+ case 'ebay_get_inventory_locations':
525
+ return await api.inventory.getInventoryLocations(args.limit, args.offset);
526
+ case 'ebay_get_inventory_location':
527
+ return await api.inventory.getInventoryLocation(args.merchantLocationKey);
528
+ case 'ebay_create_or_replace_inventory_location':
529
+ return await api.inventory.createOrReplaceInventoryLocation(args.merchantLocationKey, args.location);
530
+ case 'ebay_delete_inventory_location':
531
+ return await api.inventory.deleteInventoryLocation(args.merchantLocationKey);
532
+ case 'ebay_disable_inventory_location':
533
+ return await api.inventory.disableInventoryLocation(args.merchantLocationKey);
534
+ case 'ebay_enable_inventory_location':
535
+ return await api.inventory.enableInventoryLocation(args.merchantLocationKey);
536
+ case 'ebay_update_location_details':
537
+ return await api.inventory.updateLocationDetails(args.merchantLocationKey, args.locationDetails);
538
+ // Offer Management
539
+ case 'ebay_get_offers':
540
+ return await api.inventory.getOffers(args.sku, args.marketplaceId, args.limit);
541
+ case 'ebay_get_offer':
542
+ return await api.inventory.getOffer(args.offerId);
543
+ case 'ebay_create_offer':
544
+ return await api.inventory.createOffer(args.offer);
545
+ case 'ebay_update_offer':
546
+ return await api.inventory.updateOffer(args.offerId, args.offer);
547
+ case 'ebay_delete_offer':
548
+ return await api.inventory.deleteOffer(args.offerId);
549
+ case 'ebay_publish_offer':
550
+ return await api.inventory.publishOffer(args.offerId);
551
+ case 'ebay_withdraw_offer':
552
+ return await api.inventory.withdrawOffer(args.offerId);
553
+ case 'ebay_bulk_create_offer':
554
+ return await api.inventory.bulkCreateOffer(args.requests);
555
+ case 'ebay_bulk_publish_offer':
556
+ return await api.inventory.bulkPublishOffer(args.requests);
557
+ case 'ebay_get_listing_fees':
558
+ return await api.inventory.getListingFees(args.offers);
559
+ // Listing Migration
560
+ case 'ebay_bulk_migrate_listing':
561
+ return await api.inventory.bulkMigrateListing(args.requests);
562
+ case 'ebay_get_listing_locations':
563
+ return await api.inventory.getListingLocations(args.listingId, args.sku);
564
+ case 'ebay_create_or_replace_sku_location_mapping':
565
+ return await api.inventory.createOrReplaceSkuLocationMapping(args.listingId, args.sku, args.locationMapping);
566
+ case 'ebay_delete_sku_location_mapping':
567
+ return await api.inventory.deleteSkuLocationMapping(args.listingId, args.sku);
568
+ case 'ebay_publish_offer_by_inventory_item_group':
569
+ return await api.inventory.publishOfferByInventoryItemGroup(args.request);
570
+ case 'ebay_withdraw_offer_by_inventory_item_group':
571
+ return await api.inventory.withdrawOfferByInventoryItemGroup(args.request);
572
+ // Order Management
573
+ case 'ebay_get_orders':
574
+ return await api.fulfillment.getOrders(args.filter, args.limit, args.offset);
575
+ case 'ebay_get_order':
576
+ return await api.fulfillment.getOrder(args.orderId);
577
+ case 'ebay_create_shipping_fulfillment':
578
+ return await api.fulfillment.createShippingFulfillment(args.orderId, args.fulfillment);
579
+ case 'ebay_issue_refund':
580
+ return await api.fulfillment.issueRefund(args.orderId, args.refundData);
581
+ case 'ebay_get_shipping_fulfillments':
582
+ return await api.fulfillment.getShippingFulfillments(args.orderId);
583
+ case 'ebay_get_shipping_fulfillment':
584
+ return await api.fulfillment.getShippingFulfillment(args.orderId, args.fulfillmentId);
585
+ case 'ebay_get_payment_dispute_summaries':
586
+ return await api.dispute.getPaymentDisputeSummaries({
587
+ order_id: args.orderFilter,
588
+ buyer_username: args.buyerFilter,
589
+ payment_dispute_status: args.openFilter ? 'OPEN' : undefined,
590
+ limit: args.limit,
591
+ offset: args.offset,
592
+ });
593
+ case 'ebay_get_payment_dispute':
594
+ return await api.dispute.getPaymentDispute(args.paymentDisputeId);
595
+ case 'ebay_get_payment_dispute_activities':
596
+ return await api.dispute.getActivities(args.paymentDisputeId);
597
+ case 'ebay_accept_payment_dispute':
598
+ return await api.dispute.acceptPaymentDispute(args.paymentDisputeId, args.returnAddress);
599
+ case 'ebay_contest_payment_dispute':
600
+ return await api.dispute.contestPaymentDispute(args.paymentDisputeId, args.returnAddress);
601
+ case 'ebay_add_payment_dispute_evidence':
602
+ return await api.dispute.addEvidence(args.paymentDisputeId, args);
603
+ case 'ebay_update_payment_dispute_evidence':
604
+ return await api.dispute.updateEvidence(args.paymentDisputeId, args);
605
+ case 'ebay_upload_payment_dispute_evidence_file':
606
+ return await api.dispute.uploadEvidenceFile(args.paymentDisputeId, args.file);
607
+ case 'ebay_fetch_payment_dispute_evidence_content':
608
+ return await api.dispute.fetchEvidenceContent(args.paymentDisputeId, args.evidenceId, args.fileId);
609
+ // Marketing - Campaign Management
610
+ case 'ebay_get_campaigns':
611
+ return await api.marketing.getCampaigns(args.campaignStatus, args.marketplaceId, args.limit);
612
+ case 'ebay_get_campaign':
613
+ return await api.marketing.getCampaign(args.campaignId);
614
+ case 'ebay_get_campaign_by_name':
615
+ return await api.marketing.getCampaignByName(args.campaignName);
616
+ case 'ebay_create_campaign':
617
+ return await api.marketing.createCampaign(args.campaign);
618
+ case 'ebay_clone_campaign':
619
+ return await api.marketing.cloneCampaign(args.campaignId, args.cloneData);
620
+ case 'ebay_pause_campaign':
621
+ return await api.marketing.pauseCampaign(args.campaignId);
622
+ case 'ebay_resume_campaign':
623
+ return await api.marketing.resumeCampaign(args.campaignId);
624
+ case 'ebay_end_campaign':
625
+ return await api.marketing.endCampaign(args.campaignId);
626
+ case 'ebay_update_campaign_identification':
627
+ return await api.marketing.updateCampaignIdentification(args.campaignId, args.updateData);
628
+ // Marketing - Ad Operations (Bulk)
629
+ case 'ebay_bulk_create_ads_by_inventory_reference':
630
+ return await api.marketing.bulkCreateAdsByInventoryReference(args.campaignId, args.ads);
631
+ case 'ebay_bulk_create_ads_by_listing_id':
632
+ return await api.marketing.bulkCreateAdsByListingId(args.campaignId, args.ads);
633
+ case 'ebay_bulk_delete_ads_by_inventory_reference':
634
+ return await api.marketing.bulkDeleteAdsByInventoryReference(args.campaignId, args.ads);
635
+ case 'ebay_delete_ads_by_inventory_reference':
636
+ return await api.marketing.deleteAdsByInventoryReference(args.campaignId, {
637
+ inventoryReferenceId: args.inventoryReferenceId,
638
+ inventoryReferenceType: args.inventoryReferenceType,
639
+ });
640
+ case 'ebay_bulk_delete_ads_by_listing_id':
641
+ return await api.marketing.bulkDeleteAdsByListingId(args.campaignId, args.ads);
642
+ case 'ebay_bulk_update_ads_bid_by_inventory_reference':
643
+ return await api.marketing.bulkUpdateAdsBidByInventoryReference(args.campaignId, args.ads);
644
+ case 'ebay_bulk_update_ads_bid_by_listing_id':
645
+ return await api.marketing.bulkUpdateAdsBidByListingId(args.campaignId, args.ads);
646
+ case 'ebay_bulk_update_ads_status':
647
+ return await api.marketing.bulkUpdateAdsStatus(args.campaignId, args.ads);
648
+ case 'ebay_bulk_update_ads_status_by_listing_id':
649
+ return await api.marketing.bulkUpdateAdsStatusByListingId(args.campaignId, args.ads);
650
+ // Marketing - Ad Operations (Single)
651
+ case 'ebay_create_ad':
652
+ return await api.marketing.createAd(args.campaignId, args.ad);
653
+ case 'ebay_create_ads_by_inventory_reference':
654
+ return await api.marketing.createAdsByInventoryReference(args.campaignId, args.ads);
655
+ case 'ebay_get_ad':
656
+ return await api.marketing.getAd(args.campaignId, args.adId);
657
+ case 'ebay_get_ads':
658
+ return await api.marketing.getAds(args.campaignId, args.adGroupIds, args.adStatus, args.limit, args.listingIds, args.offset);
659
+ case 'ebay_get_ads_by_inventory_reference':
660
+ return await api.marketing.getAdsByInventoryReference(args.campaignId, args.inventoryReferenceId, args.inventoryReferenceType);
661
+ case 'ebay_get_ads_by_listing_id':
662
+ return await api.marketing.getAdsByListingId(args.campaignId, args.listingId);
663
+ case 'ebay_delete_ad':
664
+ return await api.marketing.deleteAd(args.campaignId, args.adId);
665
+ case 'ebay_clone_ad':
666
+ return await api.marketing.cloneAd(args.campaignId, args.adId, args.ad);
667
+ case 'ebay_update_ad_bid':
668
+ return await api.marketing.updateBid(args.campaignId, args.adId, args.bidData);
669
+ // Marketing - Ad Group Management
670
+ case 'ebay_create_ad_group':
671
+ return await api.marketing.createAdGroup(args.campaignId, args.adGroup);
672
+ case 'ebay_get_ad_group':
673
+ return await api.marketing.getAdGroup(args.campaignId, args.adGroupId);
674
+ case 'ebay_get_ad_groups':
675
+ return await api.marketing.getAdGroups(args.campaignId, args.adGroupStatus, args.limit, args.offset);
676
+ case 'ebay_clone_ad_group':
677
+ return await api.marketing.cloneAdGroup(args.campaignId, args.adGroupId, args.adGroup);
678
+ case 'ebay_update_ad_group_bids':
679
+ return await api.marketing.updateAdGroupBids(args.campaignId, args.adGroupId, args.bidsData);
680
+ case 'ebay_update_ad_group_keywords':
681
+ return await api.marketing.updateAdGroupKeywords(args.campaignId, args.adGroupId, args.keywordsData);
682
+ // Marketing - Keyword Management
683
+ case 'ebay_create_keyword':
684
+ return await api.marketing.createKeyword(args.campaignId, args.adGroupId, args.keyword);
685
+ case 'ebay_get_keyword':
686
+ return await api.marketing.getKeyword(args.campaignId, args.adGroupId, args.keywordId);
687
+ case 'ebay_get_keywords':
688
+ return await api.marketing.getKeywords(args.campaignId, args.adGroupId, args.keywordStatus, args.limit, args.offset);
689
+ case 'ebay_delete_keyword':
690
+ return await api.marketing.deleteKeyword(args.campaignId, args.adGroupId, args.keywordId);
691
+ case 'ebay_update_keyword_bid':
692
+ return await api.marketing.updateKeywordBid(args.campaignId, args.adGroupId, args.keywordId, args.bidData);
693
+ case 'ebay_bulk_create_keywords':
694
+ return await api.marketing.bulkCreateKeywords(args.campaignId, args.adGroupId, args.keywords);
695
+ case 'ebay_bulk_delete_keywords':
696
+ return await api.marketing.bulkDeleteKeywords(args.campaignId, args.adGroupId, args.keywords);
697
+ case 'ebay_bulk_update_keyword_bids':
698
+ return await api.marketing.bulkUpdateKeywordBids(args.campaignId, args.adGroupId, args.keywords);
699
+ // Marketing - Negative Keywords (Campaign Level)
700
+ case 'ebay_create_negative_keyword':
701
+ return await api.marketing.createNegativeKeyword(args.campaignId, args.negativeKeyword);
702
+ case 'ebay_get_negative_keyword':
703
+ return await api.marketing.getNegativeKeyword(args.campaignId, args.negativeKeywordId);
704
+ case 'ebay_get_negative_keywords':
705
+ return await api.marketing.getNegativeKeywords(args.campaignId, args.limit, args.offset);
706
+ case 'ebay_delete_negative_keyword':
707
+ return await api.marketing.deleteNegativeKeyword(args.campaignId, args.negativeKeywordId);
708
+ case 'ebay_update_negative_keyword':
709
+ return await api.marketing.updateNegativeKeyword(args.campaignId, args.negativeKeywordId, args.negativeKeyword);
710
+ case 'ebay_bulk_create_negative_keywords':
711
+ return await api.marketing.bulkCreateNegativeKeywords(args.campaignId, args.negativeKeywords);
712
+ case 'ebay_bulk_update_negative_keywords':
713
+ return await api.marketing.bulkUpdateNegativeKeywords(args.campaignId, args.negativeKeywords);
714
+ case 'ebay_bulk_delete_negative_keywords':
715
+ return await api.marketing.bulkDeleteNegativeKeywords(args.campaignId, args.negativeKeywords);
716
+ // Marketing - Negative Keywords (Ad Group Level)
717
+ case 'ebay_create_negative_keyword_for_ad_group':
718
+ return await api.marketing.createNegativeKeywordForAdGroup(args.adGroupId, args.negativeKeyword);
719
+ case 'ebay_get_negative_keyword_for_ad_group':
720
+ return await api.marketing.getNegativeKeywordForAdGroup(args.adGroupId, args.negativeKeywordId);
721
+ case 'ebay_get_negative_keywords_for_ad_group':
722
+ return await api.marketing.getNegativeKeywordsForAdGroup(args.adGroupId, args.limit, args.offset);
723
+ case 'ebay_delete_negative_keyword_for_ad_group':
724
+ return await api.marketing.deleteNegativeKeywordForAdGroup(args.adGroupId, args.negativeKeywordId);
725
+ case 'ebay_update_negative_keyword_for_ad_group':
726
+ return await api.marketing.updateNegativeKeywordForAdGroup(args.adGroupId, args.negativeKeywordId, args.negativeKeyword);
727
+ case 'ebay_bulk_create_negative_keywords_for_ad_group':
728
+ return await api.marketing.bulkCreateNegativeKeywordsForAdGroup(args.adGroupId, args.negativeKeywords);
729
+ case 'ebay_bulk_update_negative_keywords_for_ad_group':
730
+ return await api.marketing.bulkUpdateNegativeKeywordsForAdGroup(args.adGroupId, args.negativeKeywords);
731
+ case 'ebay_bulk_delete_negative_keywords_for_ad_group':
732
+ return await api.marketing.bulkDeleteNegativeKeywordsForAdGroup(args.adGroupId, args.negativeKeywords);
733
+ // Marketing - Targeting
734
+ case 'ebay_create_targeting':
735
+ return await api.marketing.createTargeting(args.campaignId, args.targeting);
736
+ case 'ebay_get_targeting':
737
+ return await api.marketing.getTargeting(args.campaignId);
738
+ case 'ebay_update_targeting':
739
+ return await api.marketing.updateTargeting(args.campaignId, args.targeting);
740
+ // Marketing - Suggestions
741
+ case 'ebay_suggest_bids':
742
+ return await api.marketing.suggestBids(args.campaignId, args.adGroupId);
743
+ case 'ebay_suggest_keywords':
744
+ return await api.marketing.suggestKeywords(args.campaignId, args.adGroupId, args.suggestion);
745
+ // Marketing - Reporting
746
+ case 'ebay_create_report_task':
747
+ return await api.marketing.createReportTask(args.reportTask);
748
+ case 'ebay_get_report_task':
749
+ return await api.marketing.getReportTask(args.reportTaskId);
750
+ case 'ebay_get_report_tasks':
751
+ return await api.marketing.getReportTasks(args.reportTaskStatuses, args.limit, args.offset);
752
+ case 'ebay_get_ad_report':
753
+ return await api.marketing.getAdReport(args.dimension, args.metric, args.reportStartDate, args.reportEndDate, args.sort, args.listingIds, args.marketplaceId);
754
+ case 'ebay_get_ad_report_metadata':
755
+ return await api.marketing.getAdReportMetadata();
756
+ case 'ebay_get_ad_report_metadata_for_report_type':
757
+ return await api.marketing.getAdReportMetadataForReportType(args.reportType);
758
+ // Marketing - Promotions (Item Promotion)
759
+ case 'ebay_get_promotions':
760
+ return await api.marketing.getPromotions(args.marketplaceId, args.limit);
761
+ case 'ebay_get_item_promotion':
762
+ return await api.marketing.getItemPromotion(args.promotionId);
763
+ case 'ebay_create_item_promotion':
764
+ return await api.marketing.createPromotion(args.promotion);
765
+ case 'ebay_update_item_promotion':
766
+ return await api.marketing.updateItemPromotion(args.promotionId, args.promotion);
767
+ case 'ebay_delete_item_promotion':
768
+ return await api.marketing.deleteItemPromotion(args.promotionId);
769
+ case 'ebay_pause_item_promotion':
770
+ return await api.marketing.pauseItemPromotion(args.promotionId);
771
+ case 'ebay_resume_item_promotion':
772
+ return await api.marketing.resumeItemPromotion(args.promotionId);
773
+ case 'ebay_get_promotion_report':
774
+ return await api.marketing.getPromotionReport(args.marketplaceId, args.promotionStatus, args.limit, args.offset);
775
+ case 'ebay_get_promotion_summary_report':
776
+ return await api.marketing.getPromotionSummaryReport(args.marketplaceId);
777
+ case 'ebay_delete_campaign':
778
+ return await api.marketing.deleteCampaign(args.campaignId);
779
+ case 'ebay_launch_campaign':
780
+ return await api.marketing.launchCampaign(args.campaignId);
781
+ case 'ebay_find_campaign_by_ad_reference':
782
+ return await api.marketing.findCampaignByAdReference(args.inventoryReferenceId, args.inventoryReferenceType, args.listingId);
783
+ case 'ebay_setup_quick_campaign':
784
+ return await api.marketing.setupQuickCampaign(args.quickCampaign);
785
+ case 'ebay_suggest_budget':
786
+ return await api.marketing.suggestBudget(args.campaignId);
787
+ case 'ebay_suggest_items':
788
+ return await api.marketing.suggestItems(args.campaignId);
789
+ case 'ebay_suggest_max_cpc':
790
+ return await api.marketing.suggestMaxCpc(args.suggestionRequest);
791
+ case 'ebay_update_ad_rate_strategy':
792
+ return await api.marketing.updateAdRateStrategy(args.campaignId, args.strategy);
793
+ case 'ebay_update_bidding_strategy':
794
+ return await api.marketing.updateBiddingStrategy(args.campaignId, args.strategy);
795
+ case 'ebay_update_campaign_budget':
796
+ return await api.marketing.updateCampaignBudget(args.campaignId, args.budget);
797
+ case 'ebay_update_ad_group':
798
+ return await api.marketing.updateAdGroup(args.campaignId, args.adGroupId, args.updateData);
799
+ case 'ebay_update_keyword':
800
+ return await api.marketing.updateKeyword(args.campaignId, args.keywordId, args.updateData);
801
+ case 'ebay_bulk_create_campaign_keyword':
802
+ return await api.marketing.bulkCreateKeyword(args.campaignId, args.keywords);
803
+ case 'ebay_bulk_update_campaign_keyword':
804
+ return await api.marketing.bulkUpdateKeyword(args.campaignId, args.keywords);
805
+ case 'ebay_get_report':
806
+ return await api.marketing.getReport(args.reportId);
807
+ case 'ebay_delete_report_task':
808
+ return await api.marketing.deleteReportTask(args.reportTaskId);
809
+ case 'ebay_create_item_price_markdown_promotion':
810
+ return await api.marketing.createItemPriceMarkdownPromotion(args.promotion);
811
+ case 'ebay_get_item_price_markdown_promotion':
812
+ return await api.marketing.getItemPriceMarkdownPromotion(args.promotionId);
813
+ case 'ebay_update_item_price_markdown_promotion':
814
+ return await api.marketing.updateItemPriceMarkdownPromotion(args.promotionId, args.promotion);
815
+ case 'ebay_delete_item_price_markdown_promotion':
816
+ return await api.marketing.deleteItemPriceMarkdownPromotion(args.promotionId);
817
+ case 'ebay_get_listing_set':
818
+ return await api.marketing.getListingSet(args.promotionId);
819
+ case 'ebay_pause_promotion':
820
+ return await api.marketing.pausePromotion(args.promotionId);
821
+ case 'ebay_resume_promotion':
822
+ return await api.marketing.resumePromotion(args.promotionId);
823
+ case 'ebay_get_email_campaigns':
824
+ return await api.marketing.getEmailCampaigns(args.limit, args.offset);
825
+ case 'ebay_create_email_campaign':
826
+ return await api.marketing.createEmailCampaign(args.emailCampaign);
827
+ case 'ebay_get_email_campaign':
828
+ return await api.marketing.getEmailCampaign(args.emailCampaignId);
829
+ case 'ebay_update_email_campaign':
830
+ return await api.marketing.updateEmailCampaign(args.emailCampaignId, args.emailCampaign);
831
+ case 'ebay_delete_email_campaign':
832
+ return await api.marketing.deleteEmailCampaign(args.emailCampaignId);
833
+ case 'ebay_get_email_audiences':
834
+ return await api.marketing.getAudiences();
835
+ case 'ebay_get_email_preview':
836
+ return await api.marketing.getEmailPreview(args.emailCampaignId);
837
+ case 'ebay_get_email_report':
838
+ return await api.marketing.getEmailReport(args.limit, args.offset);
839
+ // Recommendation
840
+ case 'ebay_find_listing_recommendations':
841
+ return await api.recommendation.findListingRecommendations(args.listingIds ? { listingIds: args.listingIds } : undefined, args.filter, args.limit, args.offset, args.marketplaceId);
842
+ // Analytics
843
+ case 'ebay_get_traffic_report':
844
+ return await api.analytics.getTrafficReport(args.dimension, args.filter, args.metric, args.sort);
845
+ case 'ebay_find_seller_standards_profiles':
846
+ return await api.analytics.findSellerStandardsProfiles();
847
+ case 'ebay_get_seller_standards_profile':
848
+ return await api.analytics.getSellerStandardsProfile(args.program, args.cycle);
849
+ case 'ebay_get_customer_service_metric':
850
+ return await api.analytics.getCustomerServiceMetric(args.customerServiceMetricType, args.evaluationType, args.evaluationMarketplaceId);
851
+ // Metadata
852
+ case 'ebay_get_automotive_parts_compatibility_policies':
853
+ return await api.metadata.getAutomotivePartsCompatibilityPolicies(args.marketplaceId, args.filter);
854
+ case 'ebay_get_category_policies':
855
+ return await api.metadata.getCategoryPolicies(args.marketplaceId, args.filter);
856
+ case 'ebay_get_extended_producer_responsibility_policies':
857
+ return await api.metadata.getExtendedProducerResponsibilityPolicies(args.marketplaceId, args.filter);
858
+ case 'ebay_get_hazardous_materials_labels':
859
+ return await api.metadata.getHazardousMaterialsLabels(args.marketplaceId);
860
+ case 'ebay_get_item_condition_policies':
861
+ return await api.metadata.getItemConditionPolicies(args.marketplaceId, args.filter);
862
+ case 'ebay_get_listing_structure_policies':
863
+ return await api.metadata.getListingStructurePolicies(args.marketplaceId, args.filter);
864
+ case 'ebay_get_negotiated_price_policies':
865
+ return await api.metadata.getNegotiatedPricePolicies(args.marketplaceId, args.filter);
866
+ case 'ebay_get_product_safety_labels':
867
+ return await api.metadata.getProductSafetyLabels(args.marketplaceId);
868
+ case 'ebay_get_regulatory_policies':
869
+ return await api.metadata.getRegulatoryPolicies(args.marketplaceId, args.filter);
870
+ case 'ebay_get_return_policy_metadata':
871
+ return await api.metadata.getReturnPolicies(args.marketplaceId, args.filter);
872
+ case 'ebay_get_shipping_cost_type_policies':
873
+ return await api.metadata.getShippingCostTypePolicies(args.marketplaceId, args.filter);
874
+ case 'ebay_get_classified_ad_policies':
875
+ return await api.metadata.getClassifiedAdPolicies(args.marketplaceId, args.filter);
876
+ case 'ebay_get_currencies':
877
+ return await api.metadata.getCurrencies(args.marketplaceId);
878
+ case 'ebay_get_listing_type_policies':
879
+ return await api.metadata.getListingTypePolicies(args.marketplaceId, args.filter);
880
+ case 'ebay_get_motors_listing_policies':
881
+ return await api.metadata.getMotorsListingPolicies(args.marketplaceId, args.filter);
882
+ case 'ebay_get_shipping_policies':
883
+ return await api.metadata.getShippingPolicies(args.marketplaceId, args.filter);
884
+ case 'ebay_get_site_visibility_policies':
885
+ return await api.metadata.getSiteVisibilityPolicies(args.marketplaceId, args.filter);
886
+ case 'ebay_get_compatibilities_by_specification':
887
+ return await api.metadata.getCompatibilitiesBySpecification(args.specification);
888
+ case 'ebay_get_compatibility_property_names':
889
+ return await api.metadata.getCompatibilityPropertyNames(args.data);
890
+ case 'ebay_get_compatibility_property_values':
891
+ return await api.metadata.getCompatibilityPropertyValues(args.data);
892
+ case 'ebay_get_multi_compatibility_property_values':
893
+ return await api.metadata.getMultiCompatibilityPropertyValues(args.data);
894
+ case 'ebay_get_product_compatibilities':
895
+ return await api.metadata.getProductCompatibilities(args.data);
896
+ case 'ebay_get_sales_tax_jurisdictions':
897
+ return await api.metadata.getSalesTaxJurisdictions(args.countryCode);
898
+ // Taxonomy
899
+ case 'ebay_get_default_category_tree_id':
900
+ return await api.taxonomy.getDefaultCategoryTreeId(args.marketplaceId);
901
+ case 'ebay_get_category_tree':
902
+ return await api.taxonomy.getCategoryTree(args.categoryTreeId);
903
+ case 'ebay_get_category_suggestions':
904
+ return await api.taxonomy.getCategorySuggestions(args.categoryTreeId, args.query);
905
+ case 'ebay_get_item_aspects_for_category':
906
+ return await api.taxonomy.getItemAspectsForCategory(args.categoryTreeId, args.categoryId);
907
+ // Communication - Negotiation
908
+ case 'ebay_get_offers_to_buyers': {
909
+ const validated = getOffersToBuyersSchema.parse(args);
910
+ return await api.negotiation.getOffersToBuyers(validated.filter, validated.limit ? Number(validated.limit) : undefined, validated.offset ? Number(validated.offset) : undefined);
911
+ }
912
+ case 'ebay_send_offer_to_interested_buyers': {
913
+ const validated = sendOfferToInterestedBuyersSchema.parse(args);
914
+ return await api.negotiation.sendOfferToInterestedBuyers(validated);
915
+ }
916
+ case 'ebay_find_eligible_items': {
917
+ const validated = findEligibleItemsSchema.parse(args);
918
+ return await api.negotiation.findEligibleItems(validated.marketplace_id, validated.limit ? Number(validated.limit) : undefined, validated.offset ? Number(validated.offset) : undefined);
919
+ }
920
+ // Communication - Message
921
+ case 'ebay_search_messages': {
922
+ const validated = getConversationsSchema.parse(args);
923
+ return await api.message.searchMessages(undefined, validated.limit ? Number(validated.limit) : undefined, validated.offset ? Number(validated.offset) : undefined);
924
+ }
925
+ case 'ebay_get_message': {
926
+ const validated = getConversationSchema.parse(args);
927
+ return await api.message.getMessage(validated.conversation_id);
928
+ }
929
+ case 'ebay_send_message': {
930
+ const validated = sendMessageSchema.parse(args);
931
+ return await api.message.sendMessage(validated);
932
+ }
933
+ case 'ebay_reply_to_message': {
934
+ // This is a deprecated method that maps to sendMessage
935
+ // We'll validate with a simple schema
936
+ if (!args.messageId || !args.messageContent) {
937
+ throw new Error('messageId and messageContent are required');
938
+ }
939
+ return await api.message.replyToMessage(args.messageId, args.messageContent);
940
+ }
941
+ case 'ebay_get_conversations': {
942
+ const validated = getConversationsSchema.parse(args);
943
+ return await api.message.getConversations(undefined, validated.limit ? Number(validated.limit) : undefined, validated.offset ? Number(validated.offset) : undefined);
944
+ }
945
+ case 'ebay_get_conversation': {
946
+ const validated = getConversationSchema.parse(args);
947
+ return await api.message.getConversation(validated.conversation_id);
948
+ }
949
+ case 'ebay_bulk_update_conversation': {
950
+ const validated = bulkUpdateConversationSchema.parse(args);
951
+ return await api.message.bulkUpdateConversation(validated);
952
+ }
953
+ case 'ebay_update_conversation': {
954
+ const validated = updateConversationSchema.parse(args);
955
+ return await api.message.updateConversation(validated);
956
+ }
957
+ // Communication - Notification
958
+ case 'ebay_get_notification_config': {
959
+ getConfigSchema.parse(args); // Validate empty args
960
+ return await api.notification.getConfig();
961
+ }
962
+ case 'ebay_update_notification_config': {
963
+ const validated = updateConfigSchema.parse(args);
964
+ return await api.notification.updateConfig(validated);
965
+ }
966
+ case 'ebay_get_notification_destinations':
967
+ return await api.notification.getDestinations(args.limit, args.continuationToken);
968
+ case 'ebay_create_notification_destination': {
969
+ const validated = createDestinationSchema.parse(args);
970
+ return await api.notification.createDestination(validated);
971
+ }
972
+ case 'ebay_get_notification_destination': {
973
+ const validated = getDestinationSchema.parse(args);
974
+ return await api.notification.getDestination(validated.destination_id);
975
+ }
976
+ case 'ebay_update_notification_destination': {
977
+ const validated = updateDestinationSchema.parse(args);
978
+ return await api.notification.updateDestination(validated.destination_id, validated);
979
+ }
980
+ case 'ebay_delete_notification_destination': {
981
+ const validated = deleteDestinationSchema.parse(args);
982
+ return await api.notification.deleteDestination(validated.destination_id);
983
+ }
984
+ case 'ebay_get_notification_subscriptions': {
985
+ const validated = getSubscriptionsSchema.parse(args);
986
+ return await api.notification.getSubscriptions(validated.limit ? Number(validated.limit) : undefined, validated.continuation_token);
987
+ }
988
+ case 'ebay_create_notification_subscription': {
989
+ const validated = createSubscriptionSchema.parse(args);
990
+ return await api.notification.createSubscription(validated);
991
+ }
992
+ case 'ebay_get_notification_subscription': {
993
+ const validated = getSubscriptionSchema.parse(args);
994
+ return await api.notification.getSubscription(validated.subscription_id);
995
+ }
996
+ case 'ebay_update_notification_subscription': {
997
+ const validated = updateSubscriptionSchema.parse(args);
998
+ return await api.notification.updateSubscription(validated.subscription_id, validated);
999
+ }
1000
+ case 'ebay_delete_notification_subscription': {
1001
+ const validated = deleteSubscriptionSchema.parse(args);
1002
+ return await api.notification.deleteSubscription(validated.subscription_id);
1003
+ }
1004
+ case 'ebay_disable_notification_subscription': {
1005
+ const validated = disableSubscriptionSchema.parse(args);
1006
+ return await api.notification.disableSubscription(validated.subscription_id);
1007
+ }
1008
+ case 'ebay_enable_notification_subscription': {
1009
+ const validated = enableSubscriptionSchema.parse(args);
1010
+ return await api.notification.enableSubscription(validated.subscription_id);
1011
+ }
1012
+ case 'ebay_test_notification_subscription': {
1013
+ const validated = testSubscriptionSchema.parse(args);
1014
+ return await api.notification.testSubscription(validated.subscription_id);
1015
+ }
1016
+ case 'ebay_get_notification_topic': {
1017
+ const validated = getTopicSchema.parse(args);
1018
+ return await api.notification.getTopic(validated.topic_id);
1019
+ }
1020
+ case 'ebay_get_notification_topics': {
1021
+ const validated = getTopicsSchema.parse(args);
1022
+ return await api.notification.getTopics(validated.limit ? Number(validated.limit) : undefined, validated.continuation_token);
1023
+ }
1024
+ case 'ebay_create_notification_subscription_filter': {
1025
+ const validated = createSubscriptionFilterSchema.parse(args);
1026
+ return await api.notification.createSubscriptionFilter(validated.subscription_id, validated);
1027
+ }
1028
+ case 'ebay_get_notification_subscription_filter': {
1029
+ const validated = getSubscriptionFilterSchema.parse(args);
1030
+ return await api.notification.getSubscriptionFilter(validated.subscription_id, validated.filter_id);
1031
+ }
1032
+ case 'ebay_delete_notification_subscription_filter': {
1033
+ const validated = deleteSubscriptionFilterSchema.parse(args);
1034
+ return await api.notification.deleteSubscriptionFilter(validated.subscription_id, validated.filter_id);
1035
+ }
1036
+ case 'ebay_get_notification_public_key': {
1037
+ const validated = getPublicKeySchema.parse(args);
1038
+ return await api.notification.getPublicKey(validated.public_key_id);
1039
+ }
1040
+ // Communication - Feedback
1041
+ case 'ebay_get_feedback': {
1042
+ const validated = getFeedbackSchema.parse(args);
1043
+ return await api.feedback.getFeedback(validated.transaction_id ?? '');
1044
+ }
1045
+ case 'ebay_leave_feedback_for_buyer': {
1046
+ const validated = leaveFeedbackForBuyerSchema.parse(args);
1047
+ return await api.feedback.leaveFeedbackForBuyer(validated);
1048
+ }
1049
+ case 'ebay_get_feedback_summary': {
1050
+ getFeedbackRatingSummarySchema.parse(args); // Validate empty args
1051
+ return await api.feedback.getFeedbackSummary();
1052
+ }
1053
+ case 'ebay_get_awaiting_feedback': {
1054
+ const validated = getAwaitingFeedbackSchema.parse(args);
1055
+ return await api.feedback.getAwaitingFeedback(validated.filter, validated.limit ? Number(validated.limit) : undefined, validated.offset ? Number(validated.offset) : undefined);
1056
+ }
1057
+ case 'ebay_respond_to_feedback': {
1058
+ const validated = respondToFeedbackSchema.parse(args);
1059
+ return await api.feedback.respondToFeedback(validated.feedback_id ?? '', validated.response_text ?? '');
1060
+ }
1061
+ // Other APIs - Identity
1062
+ case 'ebay_get_user':
1063
+ return await api.identity.getUser();
1064
+ // Other APIs - Compliance
1065
+ case 'ebay_get_listing_violations':
1066
+ return await api.compliance.getListingViolations(args.complianceType, args.offset, args.limit);
1067
+ case 'ebay_get_listing_violations_summary':
1068
+ return await api.compliance.getListingViolationsSummary(args.complianceType);
1069
+ case 'ebay_suppress_violation':
1070
+ return await api.compliance.suppressViolation(args.listingViolationId);
1071
+ // Other APIs - VERO
1072
+ case 'ebay_create_vero_report':
1073
+ return await api.vero.createVeroReport(args.reportData);
1074
+ case 'ebay_get_vero_report':
1075
+ return await api.vero.getVeroReport(args.veroReportId);
1076
+ case 'ebay_get_vero_report_items':
1077
+ return await api.vero.getVeroReportItems(args.filter, args.limit, args.offset);
1078
+ case 'ebay_get_vero_reason_code':
1079
+ return await api.vero.getVeroReasonCode(args.veroReasonCodeId);
1080
+ case 'ebay_get_vero_reason_codes':
1081
+ return await api.vero.getVeroReasonCodes();
1082
+ // Other APIs - Translation
1083
+ case 'ebay_translate':
1084
+ return await api.translation.translate(args.from, args.to, args.translationContext, args.text);
1085
+ // Other APIs - eDelivery
1086
+ case 'ebay_create_shipping_quote':
1087
+ return await api.edelivery.createShippingQuote(args.shippingQuoteRequest);
1088
+ case 'ebay_get_shipping_quote':
1089
+ return await api.edelivery.getShippingQuote(args.shippingQuoteId);
1090
+ // eDelivery - Cost & Preferences
1091
+ case 'ebay_get_actual_costs':
1092
+ return await api.edelivery.getActualCosts(args.params);
1093
+ case 'ebay_get_address_preferences':
1094
+ return await api.edelivery.getAddressPreferences();
1095
+ case 'ebay_create_address_preference':
1096
+ return await api.edelivery.createAddressPreference(args.addressPreference);
1097
+ case 'ebay_get_consign_preferences':
1098
+ return await api.edelivery.getConsignPreferences();
1099
+ case 'ebay_create_consign_preference':
1100
+ return await api.edelivery.createConsignPreference(args.consignPreference);
1101
+ // eDelivery - Agents & Services
1102
+ case 'ebay_get_agents':
1103
+ return await api.edelivery.getAgents(args.params);
1104
+ case 'ebay_get_battery_qualifications':
1105
+ return await api.edelivery.getBatteryQualifications(args.params);
1106
+ case 'ebay_get_dropoff_sites':
1107
+ return await api.edelivery.getDropoffSites(args.params);
1108
+ case 'ebay_get_shipping_services':
1109
+ return await api.edelivery.getShippingServices(args.params);
1110
+ // eDelivery - Bundles
1111
+ case 'ebay_create_bundle':
1112
+ return await api.edelivery.createBundle(args.bundleRequest);
1113
+ case 'ebay_get_bundle':
1114
+ return await api.edelivery.getBundle(args.bundleId);
1115
+ case 'ebay_cancel_bundle':
1116
+ return await api.edelivery.cancelBundle(args.bundleId);
1117
+ case 'ebay_get_bundle_label':
1118
+ return await api.edelivery.getBundleLabel(args.bundleId);
1119
+ // eDelivery - Packages (Single)
1120
+ case 'ebay_create_package':
1121
+ return await api.edelivery.createPackage(args.packageRequest);
1122
+ case 'ebay_get_package':
1123
+ return await api.edelivery.getPackage(args.packageId);
1124
+ case 'ebay_delete_package':
1125
+ return await api.edelivery.deletePackage(args.packageId);
1126
+ case 'ebay_get_package_by_order_line_item':
1127
+ return await api.edelivery.getPackageByOrderLineItem(args.orderLineItemId);
1128
+ case 'ebay_cancel_package':
1129
+ return await api.edelivery.cancelPackage(args.packageId);
1130
+ case 'ebay_clone_package':
1131
+ return await api.edelivery.clonePackage(args.packageId);
1132
+ case 'ebay_confirm_package':
1133
+ return await api.edelivery.confirmPackage(args.packageId);
1134
+ // eDelivery - Packages (Bulk)
1135
+ case 'ebay_bulk_cancel_packages':
1136
+ return await api.edelivery.bulkCancelPackages(args.bulkCancelRequest);
1137
+ case 'ebay_bulk_confirm_packages':
1138
+ return await api.edelivery.bulkConfirmPackages(args.bulkConfirmRequest);
1139
+ case 'ebay_bulk_delete_packages':
1140
+ return await api.edelivery.bulkDeletePackages(args.bulkDeleteRequest);
1141
+ // eDelivery - Labels & Tracking
1142
+ case 'ebay_get_labels':
1143
+ return await api.edelivery.getLabels(args.params);
1144
+ case 'ebay_get_handover_sheet':
1145
+ return await api.edelivery.getHandoverSheet(args.params);
1146
+ case 'ebay_get_tracking':
1147
+ return await api.edelivery.getTracking(args.params);
1148
+ // eDelivery - Other
1149
+ case 'ebay_create_complaint':
1150
+ return await api.edelivery.createComplaint(args.complaintRequest);
1151
+ case 'SearchClaudeCodeDocs':
1152
+ return {
1153
+ content: [
1154
+ {
1155
+ type: 'text',
1156
+ text: `Tool 'SearchClaudeCodeDocs' called with query: ${args.query}. This tool is not yet fully implemented.`,
1157
+ },
1158
+ ],
1159
+ };
1160
+ // Developer API - API Status (public RSS feed)
1161
+ case 'ebay_get_api_status': {
1162
+ const result = await getApiStatusFeed({
1163
+ limit: args.limit,
1164
+ status: args.status,
1165
+ api: args.api,
1166
+ });
1167
+ return { items: result.items, ...(result.error && { error: result.error }) };
1168
+ }
1169
+ // Developer API - Rate Limits
1170
+ case 'ebay_get_rate_limits':
1171
+ return await api.developer.getRateLimits(args.apiContext, args.apiName);
1172
+ case 'ebay_get_user_rate_limits':
1173
+ return await api.developer.getUserRateLimits(args.apiContext, args.apiName);
1174
+ // Developer API - Client Registration
1175
+ case 'ebay_register_client':
1176
+ return await api.developer.registerClient(args.clientSettings);
1177
+ // Developer API - Signing Keys
1178
+ case 'ebay_get_signing_keys':
1179
+ return await api.developer.getSigningKeys();
1180
+ case 'ebay_create_signing_key':
1181
+ return await api.developer.createSigningKey(args.signingKeyCipher ? { signingKeyCipher: args.signingKeyCipher } : undefined);
1182
+ case 'ebay_get_signing_key':
1183
+ return await api.developer.getSigningKey(args.signingKeyId);
1184
+ // Trading API - Listing Management
1185
+ case 'ebay_get_active_listings':
1186
+ return await api.trading.getActiveListings(args.page, args.entriesPerPage);
1187
+ case 'ebay_get_listing':
1188
+ return await api.trading.getListing(args.itemId);
1189
+ case 'ebay_create_listing':
1190
+ return await api.trading.createListing(args.item);
1191
+ case 'ebay_revise_listing':
1192
+ return await api.trading.reviseListing(args.itemId, args.fields);
1193
+ case 'ebay_end_listing':
1194
+ return await api.trading.endListing(args.itemId, args.reason);
1195
+ case 'ebay_relist_item':
1196
+ return await api.trading.relistItem(args.itemId, args.modifications);
1197
+ default:
1198
+ throw new Error(`Unknown tool: ${toolName}`);
1199
+ }
1200
+ }