ebay-mcp 1.13.2 → 1.14.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 (169) hide show
  1. package/README.de.md +3 -3
  2. package/README.es.md +3 -3
  3. package/README.fr.md +3 -3
  4. package/README.ja.md +3 -3
  5. package/README.ko.md +3 -3
  6. package/README.md +163 -41
  7. package/README.pt-BR.md +3 -3
  8. package/README.ru.md +3 -3
  9. package/README.zh-CN.md +3 -3
  10. package/build/api/account-management/account.js +633 -297
  11. package/build/api/analytics-and-report/analytics.js +111 -65
  12. package/build/api/client.js +199 -140
  13. package/build/api/clientRequestError.js +23 -0
  14. package/build/api/clientTrading.js +213 -0
  15. package/build/api/clientTradingError.js +4 -0
  16. package/build/api/communication/feedback.js +147 -59
  17. package/build/api/communication/message.js +134 -81
  18. package/build/api/communication/negotiation.js +65 -53
  19. package/build/api/communication/notification.js +458 -164
  20. package/build/api/developer/developer.js +99 -45
  21. package/build/api/index.js +23 -8
  22. package/build/api/listing-management/inventory.js +884 -338
  23. package/build/api/listing-metadata/metadata.js +416 -170
  24. package/build/api/listing-metadata/taxonomy.js +187 -42
  25. package/build/api/marketing-and-promotions/marketing.js +1392 -598
  26. package/build/api/marketing-and-promotions/recommendation.js +49 -24
  27. package/build/api/order-management/dispute.js +226 -45
  28. package/build/api/order-management/fulfillment.js +144 -71
  29. package/build/api/order-management/orderIssueHelpers.js +61 -0
  30. package/build/api/other/compliance.js +50 -38
  31. package/build/api/other/edelivery.js +603 -159
  32. package/build/api/other/finding.js +280 -0
  33. package/build/api/other/identity.js +30 -15
  34. package/build/api/other/translation.js +29 -14
  35. package/build/api/other/vero.js +113 -27
  36. package/build/api/rateLimitTracker.js +55 -0
  37. package/build/api/shared/request.js +189 -98
  38. package/build/api/trading/trading.js +154 -87
  39. package/build/auth/credentialSession.js +250 -0
  40. package/build/auth/oauth.js +298 -171
  41. package/build/auth/{oauth-metadata.js → oauthMetadata.js} +22 -6
  42. package/build/auth/oauthMiddleware.js +104 -0
  43. package/build/auth/{scope-utils.js → scopeUtils.js} +101 -28
  44. package/build/auth/tokenVerifier.js +243 -0
  45. package/build/auth/tokenVerifierError.js +21 -0
  46. package/build/config/environment.js +148 -113
  47. package/build/config/{tool-families.js → toolFamilies.js} +30 -14
  48. package/build/index.js +25 -19
  49. package/build/mcp/{http-transport.js → httpTransport.js} +102 -52
  50. package/build/mcp/readOnlyFilter.js +67 -0
  51. package/build/mcp/runtime.js +31 -13
  52. package/build/mcp/{tool-gating.js → toolGating.js} +77 -49
  53. package/build/mcp/{ui-bridge.js → uiBridge.js} +80 -23
  54. package/build/schemas/account-management/account.js +144 -6
  55. package/build/schemas/analytics/analytics.js +33 -19
  56. package/build/schemas/communication/messages.js +12 -42
  57. package/build/schemas/developer/developer.js +135 -0
  58. package/build/schemas/fulfillment/orders.js +183 -21
  59. package/build/schemas/index.js +27 -19
  60. package/build/schemas/inventory-management/inventory.js +17 -9
  61. package/build/schemas/marketing/marketing.js +480 -25
  62. package/build/schemas/metadata/metadata.js +11 -6
  63. package/build/schemas/other/finding.js +27 -0
  64. package/build/schemas/other/otherApis.js +424 -0
  65. package/build/schemas/taxonomy/taxonomy.js +11 -5
  66. package/build/scripts/{auto-setup.js → autoSetup.js} +87 -74
  67. package/build/scripts/{build-ui.js → buildUi.js} +6 -1
  68. package/build/scripts/{dev-sync.js → devSync.js} +169 -110
  69. package/build/scripts/diagnostics.js +52 -44
  70. package/build/scripts/{download-specs.js → downloadSpecs.js} +29 -21
  71. package/build/scripts/{interactive-setup.js → interactiveSetup.js} +84 -78
  72. package/build/scripts/setup.js +241 -178
  73. package/build/scripts/{setup-shared.js → setupShared.js} +29 -7
  74. package/build/scripts/skills.js +35 -27
  75. package/build/scripts/updateApiStatusDoc.js +71 -0
  76. package/build/serverHttp.js +90 -0
  77. package/build/skills/content.js +124 -118
  78. package/build/skills/index.js +22 -10
  79. package/build/skills/install.js +21 -10
  80. package/build/skills/markers.js +50 -15
  81. package/build/skills/{registry-snapshot.js → registrySnapshot.js} +8 -2
  82. package/build/skills/render.js +41 -14
  83. package/build/skills/targets.js +49 -17
  84. package/build/tools/categories/account.js +166 -264
  85. package/build/tools/categories/analytics.js +11 -22
  86. package/build/tools/categories/browse.js +17 -0
  87. package/build/tools/categories/communication.js +124 -399
  88. package/build/tools/categories/connector.js +23 -20
  89. package/build/tools/categories/developer.js +46 -159
  90. package/build/tools/categories/fulfillment.js +84 -215
  91. package/build/tools/categories/index.js +6 -14
  92. package/build/tools/categories/inventory.js +238 -293
  93. package/build/tools/categories/marketing.js +677 -39
  94. package/build/tools/categories/metadata.js +190 -117
  95. package/build/tools/categories/other.js +81 -208
  96. package/build/tools/categories/taxonomy.js +29 -20
  97. package/build/tools/categories/{token-management.js → tokenManagement.js} +187 -192
  98. package/build/tools/categories/trading.js +16 -47
  99. package/build/tools/contracts.js +34 -24
  100. package/build/tools/{define-tool.js → defineTool.js} +44 -29
  101. package/build/tools/registry.js +87 -29
  102. package/build/tools/schemas.js +3 -57
  103. package/build/tools/ui/archetypes.js +1 -0
  104. package/build/tools/ui/{map-helpers.js → mapHelpers.js} +69 -19
  105. package/build/tools/ui/maps.js +294 -80
  106. package/build/types/index.js +1 -1
  107. package/build/ui/card.html +14 -14
  108. package/build/ui/chart.html +14 -14
  109. package/build/ui/stat.html +87 -0
  110. package/build/ui/table.html +14 -14
  111. package/build/utils/apiStatusFeed.js +95 -0
  112. package/build/utils/cliOutput.js +15 -0
  113. package/build/utils/cliUi.js +108 -0
  114. package/build/utils/communication/feedback.js +57 -77
  115. package/build/utils/communication/message.js +69 -98
  116. package/build/utils/communication/negotiation.js +30 -57
  117. package/build/utils/communication/notification.js +112 -252
  118. package/build/utils/{date-converter.js → dateConverter.js} +62 -30
  119. package/build/utils/effectSchema.js +203 -0
  120. package/build/utils/effectSchemaAdapter.js +121 -0
  121. package/build/utils/effectSchemaChainMethods.js +146 -0
  122. package/build/utils/effectSchemaRefinements.js +104 -0
  123. package/build/utils/effectSchemaStringMethods.js +63 -0
  124. package/build/utils/effectSchemaTypes.js +47 -0
  125. package/build/utils/{env-parser.js → envParser.js} +10 -2
  126. package/build/utils/errors.js +7 -3
  127. package/build/utils/http.js +148 -89
  128. package/build/utils/{llm-client-detector.js → llmClientDetector.js} +295 -274
  129. package/build/utils/logger.js +127 -51
  130. package/build/utils/{oauth-helper.js → oauthHelper.js} +127 -90
  131. package/build/utils/other/compliance.js +18 -38
  132. package/build/utils/other/identity.js +2 -2
  133. package/build/utils/other/translation.js +4 -4
  134. package/build/utils/other/vero.js +36 -20
  135. package/build/utils/schemaHelpers.js +22 -0
  136. package/build/utils/scopeHelper.js +270 -0
  137. package/build/utils/securityChecker.js +316 -0
  138. package/build/utils/{setup-validator.js → setupValidator.js} +113 -94
  139. package/build/utils/{setup-wizard.js → setupWizard.js} +57 -46
  140. package/build/utils/{token-utils.js → tokenUtils.js} +2 -2
  141. package/build/utils/trading/trading.js +35 -0
  142. package/build/utils/typeGuards.js +12 -0
  143. package/build/utils/version.js +65 -29
  144. package/package.json +10 -8
  145. package/build/api/client-trading.js +0 -124
  146. package/build/api/communication/shared.js +0 -59
  147. package/build/api/shared/query-params.js +0 -16
  148. package/build/auth/credential-session.js +0 -166
  149. package/build/auth/oauth-middleware.js +0 -100
  150. package/build/auth/token-verifier.js +0 -186
  151. package/build/schemas/other/other-apis.js +0 -390
  152. package/build/scripts/update-api-status-doc.js +0 -44
  153. package/build/server-http.js +0 -85
  154. package/build/tools/definitions/marketing.js +0 -1381
  155. package/build/tools/tool-handlers/marketing.js +0 -312
  156. package/build/utils/account-management/account.js +0 -818
  157. package/build/utils/api-status-feed.js +0 -84
  158. package/build/utils/cli-ui.js +0 -47
  159. package/build/utils/order-management/dispute.js +0 -369
  160. package/build/utils/order-management/fulfillment.js +0 -205
  161. package/build/utils/other/edelivery.js +0 -235
  162. package/build/utils/schema-helpers.js +0 -13
  163. package/build/utils/scope-helper.js +0 -207
  164. package/build/utils/security-checker.js +0 -248
  165. package/build/utils/type-guards.js +0 -6
  166. /package/build/auth/{oauth-types.js → oauthTypes.js} +0 -0
  167. /package/build/{server-http.d.ts → serverHttp.d.ts} +0 -0
  168. /package/build/tools/ui/{view-models.js → viewModels.js} +0 -0
  169. /package/build/types/{ebay-enums.js → ebayEnums.js} +0 -0
@@ -2,23 +2,33 @@ import { existsSync, readFileSync } from 'node:fs';
2
2
  import { dirname, join } from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
4
  import { getUiCapability, registerAppResource, RESOURCE_MIME_TYPE, RESOURCE_URI_META_KEY, } from '@modelcontextprotocol/ext-apps/server';
5
+ import { getUiRuntimeConfig } from '../config/environment.js';
5
6
  import { uiArchetypes } from '../tools/ui/archetypes.js';
6
7
  import { serverLogger } from '../utils/logger.js';
7
8
  /**
8
9
  * Decides whether interactive views should be advertised to the connected client.
9
10
  *
10
- * Pure and injectable (capabilities + env) so the gate is unit-testable without a
11
+ * Pure and injectable (capabilities + UI flag) so the gate is unit-testable without a
11
12
  * live transport. Two independent conditions must both hold: the operator has not
12
13
  * disabled UI via `EBAY_MCP_UI=off`, and the client advertised support for the MCP
13
14
  * Apps HTML profile.
15
+ *
16
+ * @param capabilities - Client capabilities received during MCP initialization.
17
+ * @param uiEnabledByConfig - UI kill-switch value from runtime config.
18
+ * @returns True when interactive UI resources should be advertised for this client.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * const enabled = resolveUiEnabled(server.server.getClientCapabilities());
23
+ * ```
14
24
  */
15
- export function resolveUiEnabled(capabilities, env = process.env) {
16
- if (env.EBAY_MCP_UI === 'off') {
25
+ export const resolveUiEnabled = (capabilities, uiEnabledByConfig = getUiRuntimeConfig().enabled) => {
26
+ if (!uiEnabledByConfig) {
17
27
  return false;
18
28
  }
19
29
  const capability = getUiCapability(capabilities);
20
30
  return Boolean(capability?.mimeTypes?.includes(RESOURCE_MIME_TYPE));
21
- }
31
+ };
22
32
  /**
23
33
  * Builds the one-line text fallback that accompanies a rendered view.
24
34
  *
@@ -26,25 +36,41 @@ export function resolveUiEnabled(capabilities, env = process.env) {
26
36
  * plus the structured `structuredContent`. Keeping it a short summary (rather than
27
37
  * re-dumping the full JSON the view already carries) is what keeps the UI path
28
38
  * from costing more tokens than the plain path.
39
+ *
40
+ * @param view - View model produced by a tool UI mapper.
41
+ * @returns One-line text summary to include beside structured content.
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * const text = summarizeView({ archetype: 'table', title: 'Orders', columns: [], rows: [] });
46
+ * ```
29
47
  */
30
- export function summarizeView(view) {
48
+ export const summarizeView = (view) => {
31
49
  switch (view.archetype) {
32
50
  case 'table': {
33
51
  const count = view.rows.length;
34
52
  const tail = view.footnote ? ` — ${view.footnote}` : '';
35
- return `${view.title ?? 'Results'}: ${count} ${count === 1 ? 'row' : 'rows'}${tail}. Rendered as an interactive table.`;
53
+ const prefix = view.title ? `${view.title}: ` : '';
54
+ return `${prefix}${count} ${count === 1 ? 'row' : 'rows'}${tail}. Rendered as an interactive table.`;
36
55
  }
37
56
  case 'card': {
38
- const subtitle = view.subtitle ? ` — ${view.subtitle}` : '';
57
+ const heading = [view.title, view.subtitle].filter(Boolean).join(' — ');
58
+ const prefix = heading ? `${heading}: ` : '';
39
59
  const fieldCount = view.sections.reduce((total, section) => total + section.fields.length, 0);
40
- return `${view.title ?? 'Details'}${subtitle}: ${fieldCount} ${fieldCount === 1 ? 'field' : 'fields'}. Rendered as an interactive detail card.`;
60
+ return `${prefix}${fieldCount} ${fieldCount === 1 ? 'field' : 'fields'}. Rendered as an interactive detail card.`;
41
61
  }
42
62
  case 'chart': {
43
63
  const pointCount = view.series.reduce((total, series) => total + series.points.length, 0);
44
- return `${view.title ?? 'Chart'} (${view.kind}): ${view.series.length} series, ${pointCount} ${pointCount === 1 ? 'point' : 'points'}. Rendered as an interactive chart.`;
64
+ const prefix = view.title ? `${view.title} (${view.kind}): ` : '';
65
+ return `${prefix}${view.series.length} series, ${pointCount} ${pointCount === 1 ? 'point' : 'points'}. Rendered as an interactive chart.`;
66
+ }
67
+ case 'stat': {
68
+ const count = view.tiles.length;
69
+ const prefix = view.title ? `${view.title}: ` : '';
70
+ return `${prefix}${count} ${count === 1 ? 'metric' : 'metrics'}. Rendered as an interactive stat grid.`;
45
71
  }
46
72
  }
47
- }
73
+ };
48
74
  /**
49
75
  * Adapts a {@link ViewModel} to the SDK's open-record `structuredContent` type.
50
76
  *
@@ -54,28 +80,43 @@ export function summarizeView(view) {
54
80
  * preferable to polluting every view-model interface with `[key: string]: unknown`,
55
81
  * which would silently disable excess-property checks in the tool mappers.
56
82
  */
57
- function asStructuredContent(view) {
58
- return view;
59
- }
83
+ const asStructuredContent = (view) => view;
60
84
  /**
61
85
  * Projects a tool result into its view and packages it as a UI tool result: a
62
86
  * compact summary line, the view model as `structuredContent`, and the
63
87
  * `_meta.ui.resourceUri` that tells the host which app to render.
88
+ *
89
+ * @param ui - Resolved UI binding attached to the executed tool entry.
90
+ * @param result - Raw tool handler result to project into a view model.
91
+ * @returns SDK call result carrying text, structured content, and UI metadata.
92
+ *
93
+ * @example
94
+ * ```ts
95
+ * const toolResult = buildUiToolResult(entry.ui, handlerResult);
96
+ * ```
64
97
  */
65
- export function buildUiToolResult(ui, result) {
98
+ export const buildUiToolResult = (ui, result) => {
66
99
  const view = ui.map(result);
67
100
  return {
68
101
  content: [{ type: 'text', text: summarizeView(view) }],
69
102
  structuredContent: asStructuredContent(view),
70
103
  _meta: { ui: { resourceUri: ui.resourceUri } },
71
104
  };
72
- }
105
+ };
73
106
  /**
74
107
  * Walks up from `startDir` to the nearest directory containing a `package.json`.
75
108
  * Used to locate the repo root so built views resolve identically whether the
76
109
  * server runs from `build/` (prod) or `src/` via tsx (dev).
110
+ *
111
+ * @param startDir - Directory to begin walking upward from.
112
+ * @returns Repo root path, or undefined when no package.json is found.
113
+ *
114
+ * @example
115
+ * ```ts
116
+ * const root = findRepoRoot(process.cwd());
117
+ * ```
77
118
  */
78
- export function findRepoRoot(startDir) {
119
+ export const findRepoRoot = (startDir) => {
79
120
  let current = startDir;
80
121
  for (;;) {
81
122
  if (existsSync(join(current, 'package.json'))) {
@@ -83,25 +124,41 @@ export function findRepoRoot(startDir) {
83
124
  }
84
125
  const parent = dirname(current);
85
126
  if (parent === current) {
86
- return undefined;
127
+ return;
87
128
  }
88
129
  current = parent;
89
130
  }
90
- }
91
- /** Resolves the directory that holds the built archetype HTML files (`build/ui/`). */
92
- export function resolveBuiltUiDir(moduleUrl) {
131
+ };
132
+ /**
133
+ * Resolves the directory that holds the built archetype HTML files (`build/ui/`).
134
+ *
135
+ * @param moduleUrl - Module URL used to anchor the repo-root search.
136
+ * @returns Absolute directory path for built UI assets.
137
+ *
138
+ * @example
139
+ * ```ts
140
+ * const builtUiDir = resolveBuiltUiDir(import.meta.url);
141
+ * ```
142
+ */
143
+ export const resolveBuiltUiDir = (moduleUrl) => {
93
144
  const fromDir = dirname(fileURLToPath(moduleUrl));
94
145
  const root = findRepoRoot(fromDir);
95
146
  return root ? join(root, 'build', 'ui') : join(fromDir, '..', 'ui');
96
- }
147
+ };
97
148
  /**
98
149
  * Constructs the {@link UiBridge}: reads the built archetype HTML, registers each
99
150
  * found view as a `ui://` resource, and returns the runtime-facing facade.
100
151
  *
101
152
  * @param server - The MCP server the resources and gate attach to.
102
153
  * @param moduleUrl - `import.meta.url` of the caller, used to locate `build/ui/`.
154
+ * @returns UI bridge facade consumed by the MCP runtime.
155
+ *
156
+ * @example
157
+ * ```ts
158
+ * const ui = createUiBridge(server, import.meta.url);
159
+ * ```
103
160
  */
104
- export function createUiBridge(server, moduleUrl) {
161
+ export const createUiBridge = (server, moduleUrl) => {
105
162
  const builtUiDir = resolveBuiltUiDir(moduleUrl);
106
163
  const available = new Set();
107
164
  // `Object.keys` widens to `string[]`; the cast restores the manifest's key type.
@@ -148,4 +205,4 @@ export function createUiBridge(server, moduleUrl) {
148
205
  };
149
206
  },
150
207
  };
151
- }
208
+ };
@@ -1,10 +1,10 @@
1
- import { z } from 'zod';
1
+ import { z } from '../../utils/effectSchema.js';
2
2
  import { zodToJsonSchema } from 'zod-to-json-schema';
3
- import { TimeDurationUnit, RegionType, ShippingCostType, ShippingOptionType, RefundMethod, ReturnMethod, ReturnShippingCostPayer, MarketplaceId, } from '../../types/ebay-enums.js';
3
+ import { TimeDurationUnit, RegionType, ShippingCostType, ShippingOptionType, RefundMethod, ReturnMethod, ReturnShippingCostPayer, MarketplaceId, } from '../../types/ebayEnums.js';
4
4
  /**
5
5
  * Account Management API Schemas
6
6
  *
7
- * This file contains Zod schemas for all Account Management endpoints.
7
+ * This file contains Effect-backed schemas for all Account Management endpoints.
8
8
  * Schemas are organized by endpoint and include both input and output validation.
9
9
  */
10
10
  // ============================================================================
@@ -87,6 +87,15 @@ export const createCustomPolicyInputSchema = z.object({
87
87
  label: z.string().optional(),
88
88
  }),
89
89
  });
90
+ /** Validates the Account Management API get custom policy request payload. */
91
+ export const getCustomPolicyInputSchema = z.object({
92
+ customPolicyId: z.string().describe('The custom policy ID'),
93
+ });
94
+ /** Validates the Account Management API update custom policy request payload. */
95
+ export const updateCustomPolicyInputSchema = z.object({
96
+ customPolicyId: z.string().describe('The custom policy ID'),
97
+ policy: customPolicySchema.describe('Updated custom policy details'),
98
+ });
90
99
  /**
91
100
  * Validates the Account Management API create custom policy response payload.
92
101
  */
@@ -180,6 +189,24 @@ export const getFulfillmentPoliciesOutputSchema = z.object({
180
189
  export const createFulfillmentPolicyInputSchema = z.object({
181
190
  policy: fulfillmentPolicySchema,
182
191
  });
192
+ /** Validates the Account Management API get fulfillment policy request payload. */
193
+ export const getFulfillmentPolicyInputSchema = z.object({
194
+ fulfillmentPolicyId: z.string().describe('The fulfillment policy ID'),
195
+ });
196
+ /** Validates the Account Management API get fulfillment policy by name request payload. */
197
+ export const getFulfillmentPolicyByNameInputSchema = z.object({
198
+ marketplaceId: z.nativeEnum(MarketplaceId).describe('eBay marketplace ID'),
199
+ name: z.string().describe('Policy name'),
200
+ });
201
+ /** Validates the Account Management API update fulfillment policy request payload. */
202
+ export const updateFulfillmentPolicyInputSchema = z.object({
203
+ fulfillmentPolicyId: z.string().describe('The fulfillment policy ID'),
204
+ policy: fulfillmentPolicySchema.describe('Updated fulfillment policy details'),
205
+ });
206
+ /** Validates the Account Management API delete fulfillment policy request payload. */
207
+ export const deleteFulfillmentPolicyInputSchema = z.object({
208
+ fulfillmentPolicyId: z.string().describe('The fulfillment policy ID'),
209
+ });
183
210
  /**
184
211
  * Validates the Account Management API create fulfillment policy response payload.
185
212
  */
@@ -260,6 +287,24 @@ export const getPaymentPoliciesOutputSchema = z.object({
260
287
  export const createPaymentPolicyInputSchema = z.object({
261
288
  policy: paymentPolicySchema,
262
289
  });
290
+ /** Validates the Account Management API get payment policy request payload. */
291
+ export const getPaymentPolicyInputSchema = z.object({
292
+ paymentPolicyId: z.string().describe('The payment policy ID'),
293
+ });
294
+ /** Validates the Account Management API get payment policy by name request payload. */
295
+ export const getPaymentPolicyByNameInputSchema = z.object({
296
+ marketplaceId: z.nativeEnum(MarketplaceId).describe('eBay marketplace ID'),
297
+ name: z.string().describe('Policy name'),
298
+ });
299
+ /** Validates the Account Management API update payment policy request payload. */
300
+ export const updatePaymentPolicyInputSchema = z.object({
301
+ paymentPolicyId: z.string().describe('The payment policy ID'),
302
+ policy: paymentPolicySchema.describe('Updated payment policy details'),
303
+ });
304
+ /** Validates the Account Management API delete payment policy request payload. */
305
+ export const deletePaymentPolicyInputSchema = z.object({
306
+ paymentPolicyId: z.string().describe('The payment policy ID'),
307
+ });
263
308
  /**
264
309
  * Validates the Account Management API create payment policy response payload.
265
310
  */
@@ -339,6 +384,24 @@ export const getReturnPoliciesOutputSchema = z.object({
339
384
  export const createReturnPolicyInputSchema = z.object({
340
385
  policy: returnPolicySchema,
341
386
  });
387
+ /** Validates the Account Management API get return policy request payload. */
388
+ export const getReturnPolicyInputSchema = z.object({
389
+ returnPolicyId: z.string().describe('The return policy ID'),
390
+ });
391
+ /** Validates the Account Management API get return policy by name request payload. */
392
+ export const getReturnPolicyByNameInputSchema = z.object({
393
+ marketplaceId: z.nativeEnum(MarketplaceId).describe('eBay marketplace ID'),
394
+ name: z.string().describe('Policy name'),
395
+ });
396
+ /** Validates the Account Management API update return policy request payload. */
397
+ export const updateReturnPolicyInputSchema = z.object({
398
+ returnPolicyId: z.string().describe('The return policy ID'),
399
+ policy: returnPolicySchema.describe('Updated return policy details'),
400
+ });
401
+ /** Validates the Account Management API delete return policy request payload. */
402
+ export const deleteReturnPolicyInputSchema = z.object({
403
+ returnPolicyId: z.string().describe('The return policy ID'),
404
+ });
342
405
  /**
343
406
  * Validates the Account Management API create return policy response payload.
344
407
  */
@@ -365,6 +428,33 @@ export const salesTaxSchema = z.object({
365
428
  salesTaxPercentage: z.string().optional(),
366
429
  shippingAndHandlingTaxed: z.boolean().optional(),
367
430
  });
431
+ /** Validates the Account Management API create or replace sales tax request payload. */
432
+ export const createOrReplaceSalesTaxInputSchema = z.object({
433
+ countryCode: z.string().describe('Two-letter ISO 3166 country code'),
434
+ jurisdictionId: z.string().describe('Tax jurisdiction ID'),
435
+ salesTaxBase: salesTaxBaseSchema.describe('Sales tax details'),
436
+ });
437
+ /** Validates one sales tax row in a bulk create or replace request. */
438
+ export const bulkSalesTaxRequestEntrySchema = z.object({
439
+ countryCode: z.string(),
440
+ jurisdictionId: z.string(),
441
+ salesTaxBase: salesTaxBaseSchema,
442
+ });
443
+ /** Validates the Account Management API bulk create or replace sales tax request payload. */
444
+ export const bulkCreateOrReplaceSalesTaxInputSchema = z.object({
445
+ requests: z.array(bulkSalesTaxRequestEntrySchema).describe('Array of sales tax requests'),
446
+ });
447
+ /** Validates the Account Management API get sales tax request payload. */
448
+ export const getSalesTaxInputSchema = z.object({
449
+ countryCode: z.string().describe('Two-letter ISO 3166 country code'),
450
+ jurisdictionId: z.string().describe('Tax jurisdiction ID'),
451
+ });
452
+ /** Validates the Account Management API delete sales tax request payload. */
453
+ export const deleteSalesTaxInputSchema = getSalesTaxInputSchema;
454
+ /** Validates the Account Management API get sales taxes request payload. */
455
+ export const getSalesTaxesInputSchema = z.object({
456
+ countryCode: z.string().describe('Required: Two-letter ISO 3166-1 country code'),
457
+ });
368
458
  /**
369
459
  * Validates the Account Management API get sales taxes response payload.
370
460
  */
@@ -381,6 +471,16 @@ export const getSalesTaxesOutputSchema = z.object({
381
471
  export const programRequestSchema = z.object({
382
472
  programType: z.string(),
383
473
  });
474
+ /** Validates the Account Management API program opt-in request payload. */
475
+ export const optInToProgramInputSchema = z.object({
476
+ request: programRequestSchema.describe('Program opt-in request'),
477
+ });
478
+ /** Validates the Account Management API program opt-out request payload. */
479
+ export const optOutOfProgramInputSchema = z.object({
480
+ request: programRequestSchema.describe('Program opt-out request'),
481
+ });
482
+ /** Validates the Account Management API get opted-in programs request payload. */
483
+ export const getOptedInProgramsInputSchema = z.object({});
384
484
  /**
385
485
  * Validates the Account Management API programs response payload.
386
486
  */
@@ -404,6 +504,32 @@ export const kycOutputSchema = z.object({
404
504
  detailedStatus: z.string().optional(),
405
505
  warnings: z.array(errorSchema).optional(),
406
506
  });
507
+ /** Validates the Account Management API get KYC request payload. */
508
+ export const getKycInputSchema = z.object({});
509
+ /** Validates the Account Management API payments program request payload. */
510
+ export const getPaymentsProgramInputSchema = z.object({
511
+ marketplaceId: z.nativeEnum(MarketplaceId).describe('The eBay marketplace ID'),
512
+ paymentsProgramType: z.string().describe('The type of payments program'),
513
+ });
514
+ /** Validates the Account Management API payments onboarding request payload. */
515
+ export const getPaymentsProgramOnboardingInputSchema = getPaymentsProgramInputSchema;
516
+ /** Validates the Account Management API subscription request payload. */
517
+ export const getSubscriptionInputSchema = z.object({
518
+ limit: z.string().optional().describe('Optional subscription page size limit'),
519
+ continuationToken: z.string().optional().describe('Optional continuation token'),
520
+ });
521
+ /** Validates the Account Management API get rate tables request payload. */
522
+ export const getRateTablesInputSchema = z.object({});
523
+ /** Validates the Account Management API advertising eligibility request payload. */
524
+ export const getAdvertisingEligibilityInputSchema = z.object({
525
+ marketplaceId: z
526
+ .nativeEnum(MarketplaceId)
527
+ .describe('eBay marketplace ID to check eligibility for'),
528
+ programTypes: z
529
+ .string()
530
+ .optional()
531
+ .describe('Optional comma-separated list of program types to check eligibility for'),
532
+ });
407
533
  // ============================================================================
408
534
  // Privileges Schemas
409
535
  // ============================================================================
@@ -421,13 +547,21 @@ export const privilegesOutputSchema = z.object({
421
547
  sellerRegistrationCompleted: z.boolean().optional(),
422
548
  warnings: z.array(errorSchema).optional(),
423
549
  });
550
+ /** Validates the Account Management API get privileges request payload. */
551
+ export const getPrivilegesInputSchema = z.object({});
424
552
  // ============================================================================
425
553
  // JSON Schema Conversion Functions
426
554
  // ============================================================================
427
555
  /**
428
- * Convert Zod schemas to JSON Schema format for MCP tools
556
+ * Converts Account Management API Effect-backed schemas to JSON Schema format for MCP tools.
557
+ *
558
+ * @returns Account Management API JSON schemas keyed by endpoint or shared model name.
559
+ * @example
560
+ * ```ts
561
+ * const schemas = getAccountManagementJsonSchemas();
562
+ * ```
429
563
  */
430
- export function getAccountManagementJsonSchemas() {
564
+ export const getAccountManagementJsonSchemas = () => {
431
565
  return {
432
566
  // Custom Policies
433
567
  getCustomPoliciesInput: zodToJsonSchema(getCustomPoliciesInputSchema, 'getCustomPoliciesInput'),
@@ -457,9 +591,13 @@ export function getAccountManagementJsonSchemas() {
457
591
  salesTaxDetails: zodToJsonSchema(salesTaxSchema, 'salesTaxDetails'),
458
592
  // Programs
459
593
  programRequest: zodToJsonSchema(programRequestSchema, 'programRequest'),
594
+ getOptedInProgramsInput: zodToJsonSchema(getOptedInProgramsInputSchema, 'getOptedInProgramsInput'),
460
595
  programsOutput: zodToJsonSchema(programsOutputSchema, 'programsOutput'),
461
596
  // KYC & Privileges
597
+ getKycInput: zodToJsonSchema(getKycInputSchema, 'getKycInput'),
462
598
  kycOutput: zodToJsonSchema(kycOutputSchema, 'kycOutput'),
599
+ getRateTablesInput: zodToJsonSchema(getRateTablesInputSchema, 'getRateTablesInput'),
600
+ getPrivilegesInput: zodToJsonSchema(getPrivilegesInputSchema, 'getPrivilegesInput'),
463
601
  privilegesOutput: zodToJsonSchema(privilegesOutputSchema, 'privilegesOutput'),
464
602
  };
465
- }
603
+ };
@@ -1,9 +1,9 @@
1
- import { z } from 'zod';
1
+ import { z } from '../../utils/effectSchema.js';
2
2
  import { zodToJsonSchema } from 'zod-to-json-schema';
3
3
  /**
4
4
  * Analytics API Schemas
5
5
  *
6
- * This file contains Zod schemas for the Sell Analytics API.
6
+ * This file contains Effect-backed schemas for the Sell Analytics API.
7
7
  * Schemas are organized by type and include all analytics-related endpoints.
8
8
  */
9
9
  // ============================================================================
@@ -133,33 +133,47 @@ const reportSchema = z.object({
133
133
  // ============================================================================
134
134
  // Input Schemas for Operations
135
135
  // ============================================================================
136
- const getCustomerServiceMetricInputSchema = z.object({
137
- customer_service_metric_type: z.string(),
138
- evaluation_type: z.string(),
139
- evaluation_marketplace_id: z.string(),
140
- });
141
- const getSellerStandardsProfileInputSchema = z.object({
142
- program: z.string(),
143
- cycle: z.string(),
144
- });
145
- const getTrafficReportInputSchema = z.object({
146
- dimension: z.string().optional(),
147
- filter: z.string().optional(),
148
- metric: z.string().optional(),
149
- sort: z.string().optional(),
136
+ /** Input accepted by Analytics API findSellerStandardsProfiles. */
137
+ export const findSellerStandardsProfilesInputSchema = z.object({});
138
+ /** Input accepted by Analytics API getCustomerServiceMetric. */
139
+ export const getCustomerServiceMetricInputSchema = z.object({
140
+ customerServiceMetricType: z
141
+ .string()
142
+ .describe('Customer service metric type, e.g., ITEM_NOT_AS_DESCRIBED'),
143
+ evaluationType: z.string().describe('Evaluation type, e.g., CURRENT or PROJECTED'),
144
+ evaluationMarketplaceId: z.string().describe('Marketplace ID used for the evaluation'),
145
+ });
146
+ /** Input accepted by Analytics API getSellerStandardsProfile. */
147
+ export const getSellerStandardsProfileInputSchema = z.object({
148
+ program: z.string().describe('Seller standards program identifier'),
149
+ cycle: z.string().describe('Seller standards cycle, e.g., CURRENT or PROJECTED'),
150
+ });
151
+ /** Input accepted by Analytics API getTrafficReport. */
152
+ export const getTrafficReportInputSchema = z.object({
153
+ dimension: z.string().describe('Report dimension, e.g., LISTING or DAY'),
154
+ filter: z.string().describe('eBay traffic report filter expression'),
155
+ metric: z.string().describe('Comma-delimited report metrics to retrieve'),
156
+ sort: z.string().optional().describe('Optional metric sort expression'),
150
157
  });
151
158
  // ============================================================================
152
159
  // JSON Schema Conversion Functions
153
160
  // ============================================================================
154
161
  /**
155
- * Convert Zod schemas to JSON Schema format for MCP tools
162
+ * Converts Analytics API Effect-backed schemas to JSON Schema format for MCP tools.
163
+ *
164
+ * @returns Analytics API JSON schemas keyed by endpoint or shared model name.
165
+ * @example
166
+ * ```ts
167
+ * const schemas = getAnalyticsJsonSchemas();
168
+ * ```
156
169
  */
157
- export function getAnalyticsJsonSchemas() {
170
+ export const getAnalyticsJsonSchemas = () => {
158
171
  return {
159
172
  // Customer Service Metrics
160
173
  getCustomerServiceMetricInput: zodToJsonSchema(getCustomerServiceMetricInputSchema, 'getCustomerServiceMetricInput'),
161
174
  getCustomerServiceMetricOutput: zodToJsonSchema(getCustomerServiceMetricResponseSchema, 'getCustomerServiceMetricOutput'),
162
175
  // Seller Standards Profiles
176
+ findSellerStandardsProfilesInput: zodToJsonSchema(findSellerStandardsProfilesInputSchema, 'findSellerStandardsProfilesInput'),
163
177
  findSellerStandardsProfilesOutput: zodToJsonSchema(findSellerStandardsProfilesResponseSchema, 'findSellerStandardsProfilesOutput'),
164
178
  getSellerStandardsProfileInput: zodToJsonSchema(getSellerStandardsProfileInputSchema, 'getSellerStandardsProfileInput'),
165
179
  getSellerStandardsProfileOutput: zodToJsonSchema(standardsProfileSchema, 'getSellerStandardsProfileOutput'),
@@ -188,4 +202,4 @@ export function getAnalyticsJsonSchemas() {
188
202
  standardsProfile: zodToJsonSchema(standardsProfileSchema, 'standardsProfile'),
189
203
  value: zodToJsonSchema(valueSchema, 'value'),
190
204
  };
191
- }
205
+ };
@@ -1,10 +1,10 @@
1
- import { z } from 'zod';
1
+ import { z } from '../../utils/effectSchema.js';
2
2
  import { zodToJsonSchema } from 'zod-to-json-schema';
3
- import { MessageReferenceType, FeedbackRating } from '../../types/ebay-enums.js';
3
+ import { MessageReferenceType, FeedbackRating } from '../../types/ebayEnums.js';
4
4
  /**
5
5
  * Communication API Schemas - Messages, Feedback, and Notifications
6
6
  *
7
- * This file contains Zod schemas for all Communication endpoints including:
7
+ * This file contains Effect-backed schemas for all Communication endpoints including:
8
8
  * - Message API
9
9
  * - Feedback API
10
10
  * - Notification API
@@ -351,47 +351,19 @@ export const sendOfferToInterestedBuyersOutputSchema = z.object({
351
351
  offerToInterestedBuyersId: z.string().optional(),
352
352
  warnings: z.array(errorSchema).optional(),
353
353
  });
354
- /**
355
- * Validates the Communication API get offers to buyers request payload.
356
- */
357
- export const getOffersToBuyersInputSchema = z.object({
358
- filter: z.string().optional().describe('Filter criteria'),
359
- limit: z.number().optional().describe('Number of offers to return'),
360
- offset: z.number().optional().describe('Number of offers to skip'),
361
- });
362
- /**
363
- * Validates the Communication API get offers to buyers response payload.
364
- */
365
- export const getOffersToBuyersOutputSchema = z.object({
366
- offers: z
367
- .array(z.object({
368
- offerToInterestedBuyersId: z.string().optional(),
369
- offeredItems: z
370
- .array(z.object({
371
- offerId: z.string().optional(),
372
- price: amountSchema.optional(),
373
- quantity: z.number().optional(),
374
- }))
375
- .optional(),
376
- creationDate: z.string().optional(),
377
- status: z.string().optional(),
378
- }))
379
- .optional(),
380
- href: z.string().optional(),
381
- limit: z.number().optional(),
382
- next: z.string().optional(),
383
- offset: z.number().optional(),
384
- prev: z.string().optional(),
385
- total: z.number().optional(),
386
- warnings: z.array(errorSchema).optional(),
387
- });
388
354
  // ============================================================================
389
355
  // JSON Schema Conversion Functions
390
356
  // ============================================================================
391
357
  /**
392
- * Convert Zod schemas to JSON Schema format for MCP tools
358
+ * Converts Communication API Effect-backed schemas to JSON Schema format for MCP tools.
359
+ *
360
+ * @returns Communication API JSON schemas keyed by endpoint or shared model name.
361
+ * @example
362
+ * ```ts
363
+ * const schemas = getCommunicationJsonSchemas();
364
+ * ```
393
365
  */
394
- export function getCommunicationJsonSchemas() {
366
+ export const getCommunicationJsonSchemas = () => {
395
367
  return {
396
368
  // Message API
397
369
  sendMessageInput: zodToJsonSchema(sendMessageInputSchema, 'sendMessageInput'),
@@ -423,7 +395,5 @@ export function getCommunicationJsonSchemas() {
423
395
  // Negotiation API
424
396
  sendOfferToInterestedBuyersInput: zodToJsonSchema(sendOfferToInterestedBuyersInputSchema, 'sendOfferToInterestedBuyersInput'),
425
397
  sendOfferToInterestedBuyersOutput: zodToJsonSchema(sendOfferToInterestedBuyersOutputSchema, 'sendOfferToInterestedBuyersOutput'),
426
- getOffersToBuyersInput: zodToJsonSchema(getOffersToBuyersInputSchema, 'getOffersToBuyersInput'),
427
- getOffersToBuyersOutput: zodToJsonSchema(getOffersToBuyersOutputSchema, 'getOffersToBuyersOutput'),
428
398
  };
429
- }
399
+ };