ebay-mcp 1.18.0 → 1.18.2

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 (161) hide show
  1. package/README.md +24 -35
  2. package/build/api/account-management/accountV2.js +22 -22
  3. package/build/api/account-management/finances.js +10 -10
  4. package/build/api/analytics-and-report/analytics.js +1 -1
  5. package/build/api/{client.js → client/ebayApiClient.js} +37 -41
  6. package/build/api/{clientTrading.js → client/tradingApiClient.js} +22 -22
  7. package/build/api/communication/feedback.js +21 -21
  8. package/build/api/communication/message.js +23 -23
  9. package/build/api/communication/negotiation.js +7 -7
  10. package/build/api/communication/notification.js +52 -52
  11. package/build/api/developer/developer.js +3 -3
  12. package/build/api/{index.js → ebaySellerApi.js} +4 -4
  13. package/build/api/listing-management/feedReportTasks.js +6 -6
  14. package/build/api/listing-management/feedRequest.js +6 -6
  15. package/build/api/listing-management/feedSchedules.js +4 -4
  16. package/build/api/listing-management/feedTasks.js +2 -2
  17. package/build/api/listing-management/items.js +22 -22
  18. package/build/api/listing-management/locations.js +4 -4
  19. package/build/api/listing-management/media.js +14 -14
  20. package/build/api/listing-management/mediaAttach.js +14 -14
  21. package/build/api/listing-management/mediaResources.js +15 -13
  22. package/build/api/listing-management/offerFormat.js +1 -1
  23. package/build/api/listing-management/offers.js +23 -23
  24. package/build/api/listing-management/stores.js +9 -9
  25. package/build/api/listing-metadata/metadata.js +10 -10
  26. package/build/api/marketing-and-promotions/ads.js +34 -34
  27. package/build/api/marketing-and-promotions/campaigns.js +19 -19
  28. package/build/api/marketing-and-promotions/promotions.js +22 -22
  29. package/build/api/marketing-and-promotions/reports.js +7 -7
  30. package/build/api/order-management/dispute.js +11 -9
  31. package/build/api/order-management/fulfillment.js +4 -4
  32. package/build/api/order-management/logistics.js +7 -7
  33. package/build/api/other/browseMappers.js +15 -13
  34. package/build/api/other/browseValidators.js +4 -4
  35. package/build/api/other/edelivery.js +19 -19
  36. package/build/api/other/finding.js +13 -13
  37. package/build/api/other/translation.js +2 -2
  38. package/build/api/other/vero.js +2 -2
  39. package/build/api/shared/download.js +7 -7
  40. package/build/api/shared/request.js +28 -19
  41. package/build/api/trading/listingFormat.js +37 -30
  42. package/build/api/trading/trading.js +33 -33
  43. package/build/auth/credentialSession.js +5 -5
  44. package/build/auth/oauth.js +3 -3
  45. package/build/auth/oauthHelper.js +24 -24
  46. package/build/auth/oauthMetadata.js +4 -4
  47. package/build/auth/oauthMiddleware.js +16 -16
  48. package/build/auth/scopeUtils.js +2 -2
  49. package/build/auth/tokenVerifier.js +23 -23
  50. package/build/config/environment.js +4 -45
  51. package/build/config/oauthScopes.js +132 -0
  52. package/build/index.js +5 -5
  53. package/build/mcp/httpTransport.js +32 -20
  54. package/build/mcp/runtime.js +12 -12
  55. package/build/mcp/toolGating.js +6 -12
  56. package/build/mcp/uiBridge.js +3 -3
  57. package/build/schemas/account-management/account.js +2 -52
  58. package/build/schemas/account-management/accountV2.js +2 -2
  59. package/build/schemas/account-management/finances.js +1 -1
  60. package/build/schemas/analytics/analytics.js +2 -48
  61. package/build/schemas/communication/messages.js +2 -46
  62. package/build/schemas/developer/developer.js +1 -27
  63. package/build/schemas/fulfillment/logistics.js +1 -1
  64. package/build/schemas/fulfillment/orders.js +2 -47
  65. package/build/schemas/inventory-management/feed.js +1 -1
  66. package/build/schemas/inventory-management/inventory.js +2 -50
  67. package/build/schemas/inventory-management/media.js +2 -2
  68. package/build/schemas/inventory-management/mediaDocuments.js +1 -1
  69. package/build/schemas/inventory-management/stores.js +1 -1
  70. package/build/schemas/marketing/ads.js +2 -2
  71. package/build/schemas/marketing/campaigns.js +2 -2
  72. package/build/schemas/marketing/common.js +2 -2
  73. package/build/schemas/marketing/marketing.js +0 -1
  74. package/build/schemas/marketing/promotions.js +2 -2
  75. package/build/schemas/marketing/reports.js +2 -2
  76. package/build/schemas/metadata/metadata.js +2 -90
  77. package/build/schemas/metadata/shipping.js +1 -1
  78. package/build/schemas/other/browse.js +2 -2
  79. package/build/schemas/other/finding.js +2 -2
  80. package/build/schemas/other/otherApis.js +2 -114
  81. package/build/schemas/taxonomy/categoryTree.js +1 -1
  82. package/build/schemas/taxonomy/charity.js +1 -1
  83. package/build/schemas/taxonomy/taxonomy.js +2 -69
  84. package/build/scripts/autoSetup.js +3 -3
  85. package/build/scripts/{buildUi.js → buildMcpApps.js} +13 -13
  86. package/build/scripts/devSync.js +19 -68
  87. package/build/scripts/diagnostics.js +15 -16
  88. package/build/scripts/interactiveSetup.js +25 -25
  89. package/build/scripts/scopeHelper.js +2 -2
  90. package/build/scripts/securityChecker.js +20 -20
  91. package/build/scripts/setup.js +76 -76
  92. package/build/scripts/setupShared.js +5 -30
  93. package/build/scripts/setupValidator.js +9 -9
  94. package/build/scripts/setupWizard.js +23 -23
  95. package/build/scripts/skills.js +14 -17
  96. package/build/scripts/specRefs.js +1 -1
  97. package/build/scripts/specSources.js +144 -0
  98. package/build/serverHttp.js +4 -7
  99. package/build/skills/content.js +13 -13
  100. package/build/skills/install.js +9 -9
  101. package/build/skills/render.js +2 -2
  102. package/build/tools/categories/communication.js +1 -1
  103. package/build/tools/categories/connector.js +19 -16
  104. package/build/tools/categories/fulfillment.js +4 -4
  105. package/build/tools/categories/inventory.js +1 -1
  106. package/build/tools/categories/metadata.js +1 -1
  107. package/build/tools/categories/taxonomy.js +1 -1
  108. package/build/tools/categories/tokenManagement.js +8 -8
  109. package/build/tools/contracts.js +2 -2
  110. package/build/tools/defineTool.js +27 -12
  111. package/build/tools/registry.js +2 -2
  112. package/build/tools/schemas.js +2 -2
  113. package/build/tools/ui/mapHelpers.js +12 -12
  114. package/build/tools/ui/maps.js +101 -97
  115. package/build/tools/ui/viewModels.js +2 -2
  116. package/build/utils/apiStatusFeed.js +12 -12
  117. package/build/utils/communication/feedback.js +3 -3
  118. package/build/utils/communication/message.js +3 -3
  119. package/build/utils/communication/negotiation.js +3 -3
  120. package/build/utils/communication/notification.js +3 -3
  121. package/build/utils/entryModule.js +33 -0
  122. package/build/utils/envFile.js +47 -0
  123. package/build/utils/envParser.js +5 -5
  124. package/build/utils/errors.js +4 -4
  125. package/build/utils/http.js +38 -38
  126. package/build/utils/localFeedFiles.js +3 -3
  127. package/build/utils/logRedaction.js +21 -0
  128. package/build/utils/logger.js +49 -35
  129. package/build/utils/other/compliance.js +3 -3
  130. package/build/utils/other/identity.js +3 -3
  131. package/build/utils/other/translation.js +3 -3
  132. package/build/utils/other/vero.js +3 -3
  133. package/build/utils/schemaHelpers.js +2 -2
  134. package/build/utils/tokenUtils.js +2 -2
  135. package/build/utils/trading/trading.js +1 -1
  136. package/build/utils/version.js +1 -1
  137. package/build/utils/zodIssues.js +14 -0
  138. package/package.json +8 -11
  139. package/README.de.md +0 -426
  140. package/README.es.md +0 -426
  141. package/README.fr.md +0 -426
  142. package/README.ja.md +0 -426
  143. package/README.ko.md +0 -426
  144. package/README.pt-BR.md +0 -426
  145. package/README.ru.md +0 -426
  146. package/README.zh-CN.md +0 -426
  147. package/build/schemas/index.js +0 -76
  148. package/build/schemas/marketing/jsonSchemas.js +0 -118
  149. package/build/scripts/downloadSpecs.js +0 -117
  150. package/build/scripts/updateApiStatusDoc.js +0 -71
  151. package/build/utils/effectSchema.js +0 -203
  152. package/build/utils/effectSchemaAdapter.js +0 -121
  153. package/build/utils/effectSchemaChainMethods.js +0 -146
  154. package/build/utils/effectSchemaRefinements.js +0 -104
  155. package/build/utils/effectSchemaStringMethods.js +0 -63
  156. package/build/utils/effectSchemaTypes.js +0 -47
  157. package/docs/auth/production_scopes.json +0 -111
  158. package/docs/auth/sandbox_scopes.json +0 -142
  159. /package/build/api/{clientRequestError.js → client/ebayClientRequestError.js} +0 -0
  160. /package/build/api/{rateLimitTracker.js → client/rateLimitTracker.js} +0 -0
  161. /package/build/api/{clientTradingError.js → client/tradingApiFailure.js} +0 -0
@@ -1,11 +1,16 @@
1
1
  import { uiArchetypes } from '../tools/ui/archetypes.js';
2
- import { decodeEffectSchemaSync, z } from '../utils/effectSchema.js';
2
+ import { formatZodIssues } from '../utils/zodIssues.js';
3
+ import { Data } from 'effect';
4
+ import { z } from 'zod';
5
+ /** Tagged failure thrown when tool arguments do not match the tool's input schema. */
6
+ export class ToolInputError extends Data.TaggedError('ToolInputError') {
7
+ }
3
8
  /**
4
9
  * Erases the compile-time result type from a {@link ToolUiSpec} so the binding can
5
10
  * live on the non-generic {@link ToolEntry}, and resolves the archetype's
6
11
  * `resourceUri` from the single-source-of-truth {@link uiArchetypes} manifest.
7
12
  *
8
- * The `result as Result` cast is the type-erasure boundary: at runtime `map` only
13
+ * The `handlerOutput as Result` cast is the type-erasure boundary: at runtime `map` only
9
14
  * ever receives the very value its own handler returned, so the cast restores the
10
15
  * type the mapper was written and type-checked against.
11
16
  */
@@ -13,7 +18,7 @@ function resolveToolUi(ui) {
13
18
  return {
14
19
  archetype: ui.archetype,
15
20
  resourceUri: uiArchetypes[ui.archetype].uri,
16
- map: (result) => ui.map(result),
21
+ map: (handlerOutput) => ui.map(handlerOutput),
17
22
  };
18
23
  }
19
24
  /** Builds the public MCP definition from the richer tool spec. */
@@ -29,14 +34,15 @@ function toDefinition(spec) {
29
34
  };
30
35
  }
31
36
  /**
32
- * Binds a tool's Effect-backed input shape to its handler so the shape is the single
37
+ * Binds a tool's Zod input shape to its handler so the shape is the single
33
38
  * source of truth for both the advertised MCP schema and the handler's
34
39
  * compile-time argument types.
35
40
  *
36
41
  * The returned {@link ToolEntry} carries a `ToolHandler` that validates raw
37
- * arguments against the Effect schema before delegating. Re-validating on the
38
- * SDK path is intentional and cheap: input schemas contain no async refinements,
39
- * so the second decode is idempotent.
42
+ * arguments against the shape before delegating, throwing {@link ToolInputError}
43
+ * on a mismatch. The SDK already validates registered tools, but callers that
44
+ * bypass it (the dynamic-mode tool runner, `executeTool`) rely on this check.
45
+ * Input schemas contain no async refinements, so the second parse is idempotent.
40
46
  *
41
47
  * @param spec - Tool definition, input schema, handler, and optional UI projection.
42
48
  * @returns A registry entry whose handler validates args from the schema before execution.
@@ -53,10 +59,19 @@ function toDefinition(spec) {
53
59
  */
54
60
  export const defineTool = (spec) => {
55
61
  const schema = z.object(spec.inputSchema);
56
- // Non-async: Effect decode runs synchronously so invalid input rejects via
57
- // the caller's `await`, and the handler's returned promise passes straight
62
+ // Non-async: parsing runs synchronously so invalid input rejects via the
63
+ // caller's `await`, and the handler's returned promise passes straight
58
64
  // through without an extra await layer.
59
- const handler = (api, args) => spec.handler(api, decodeEffectSchemaSync(schema, args));
65
+ const handler = (api, args) => {
66
+ const parsedArgs = schema.safeParse(args);
67
+ if (!parsedArgs.success) {
68
+ throw new ToolInputError({
69
+ toolName: spec.name,
70
+ message: `Invalid arguments for ${spec.name}: ${formatZodIssues(parsedArgs.error)}`,
71
+ });
72
+ }
73
+ return spec.handler(api, parsedArgs.data);
74
+ };
60
75
  const formatResult = spec.formatResult;
61
76
  return {
62
77
  definition: toDefinition(spec),
@@ -64,7 +79,7 @@ export const defineTool = (spec) => {
64
79
  ui: spec.ui ? resolveToolUi(spec.ui) : undefined,
65
80
  // Registry erases the result/argument types; defineTool checks their relationship here.
66
81
  formatResult: formatResult
67
- ? (result, args) => formatResult(result, args)
82
+ ? (handlerOutput, args) => formatResult(handlerOutput, args)
68
83
  : undefined,
69
84
  };
70
85
  };
@@ -105,7 +120,7 @@ export const rawTool = (spec) => {
105
120
  ui: spec.ui ? resolveToolUi(spec.ui) : undefined,
106
121
  // Registry erases the result/argument types; defineTool checks their relationship here.
107
122
  formatResult: formatResult
108
- ? (result, args) => formatResult(result, args)
123
+ ? (handlerOutput, args) => formatResult(handlerOutput, args)
109
124
  : undefined,
110
125
  };
111
126
  };
@@ -106,7 +106,7 @@ export const getToolHandler = (toolName) => handlerByName[toolName];
106
106
  *
107
107
  * @example
108
108
  * ```ts
109
- * const result = await executeTool(api, 'ebay_get_custom_policies', {});
109
+ * const customPolicies = await executeTool(api, 'ebay_get_custom_policies', {});
110
110
  * ```
111
111
  */
112
112
  export const executeTool = async (api, toolName, args) => Effect.runPromise(Effect.gen(function* () {
@@ -118,7 +118,7 @@ export const executeTool = async (api, toolName, args) => Effect.runPromise(Effe
118
118
  }));
119
119
  }
120
120
  return yield* Effect.tryPromise({
121
- try: () => Promise.resolve(handler(api, args)),
121
+ try: async () => handler(api, args),
122
122
  catch: (error) => error,
123
123
  });
124
124
  }));
@@ -1,7 +1,7 @@
1
- import { z } from '../utils/effectSchema.js';
1
+ import { z } from 'zod';
2
2
  import { TimeDurationUnit, RegionType, ShippingCostType, ShippingOptionType, DepositType, RefundMethod, ReturnMethod, ReturnShippingCostPayer, Condition, LengthUnit, WeightUnit, PricingVisibility, FormatType, ListingDuration, LocationType, MerchantLocationStatus, DayOfWeek, ReasonForRefund, FundingModel, MessageReferenceType, FeedbackRating, ReportedItemType, } from '../types/ebayEnums.js';
3
3
  /**
4
- * Reusable Effect-backed schemas for eBay API tool input validation
4
+ * Reusable Zod schemas for eBay API tool input validation
5
5
  *
6
6
  * These schemas provide type-safe validation while remaining flexible
7
7
  * enough to accept the full complexity of eBay API request objects.
@@ -86,7 +86,7 @@ export const statusTone = (status) => {
86
86
  * strings) to a finite number. Missing or invalid values return `null` so chart
87
87
  * mappers can omit the point instead of inventing a zero.
88
88
  *
89
- * @param value - Analytics value leaf from an eBay report response.
89
+ * @param leaf - Analytics value leaf from an eBay report response.
90
90
  * @returns A finite number for chart points, or null for non-numeric input.
91
91
  *
92
92
  * @example
@@ -94,12 +94,12 @@ export const statusTone = (status) => {
94
94
  * toNumber('42');
95
95
  * ```
96
96
  */
97
- export const toNumber = (value) => {
98
- if (typeof value === 'number') {
99
- return Number.isFinite(value) ? value : null;
97
+ export const toNumber = (leaf) => {
98
+ if (typeof leaf === 'number') {
99
+ return Number.isFinite(leaf) ? leaf : null;
100
100
  }
101
- if (typeof value === 'string') {
102
- const parsed = Number(value);
101
+ if (typeof leaf === 'string') {
102
+ const parsed = Number(leaf);
103
103
  return Number.isFinite(parsed) ? parsed : null;
104
104
  }
105
105
  return null;
@@ -108,7 +108,7 @@ export const toNumber = (value) => {
108
108
  * Coerces an untyped JSON leaf to a chart-axis label string, returning `''` for
109
109
  * values that have no sensible textual form (objects, `null`, `undefined`).
110
110
  *
111
- * @param value - Analytics dimension leaf from an eBay report response.
111
+ * @param leaf - Analytics dimension leaf from an eBay report response.
112
112
  * @returns A primitive label string, or an empty string when no label is available.
113
113
  *
114
114
  * @example
@@ -116,12 +116,12 @@ export const toNumber = (value) => {
116
116
  * toLabel(7);
117
117
  * ```
118
118
  */
119
- export const toLabel = (value) => {
120
- if (typeof value === 'string') {
121
- return value;
119
+ export const toLabel = (leaf) => {
120
+ if (typeof leaf === 'string') {
121
+ return leaf;
122
122
  }
123
- if (typeof value === 'number' || typeof value === 'boolean') {
124
- return String(value);
123
+ if (typeof leaf === 'number' || typeof leaf === 'boolean') {
124
+ return String(leaf);
125
125
  }
126
126
  return '';
127
127
  };