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.
- package/README.md +24 -35
- package/build/api/account-management/accountV2.js +22 -22
- package/build/api/account-management/finances.js +10 -10
- package/build/api/analytics-and-report/analytics.js +1 -1
- package/build/api/{client.js → client/ebayApiClient.js} +37 -41
- package/build/api/{clientTrading.js → client/tradingApiClient.js} +22 -22
- package/build/api/communication/feedback.js +21 -21
- package/build/api/communication/message.js +23 -23
- package/build/api/communication/negotiation.js +7 -7
- package/build/api/communication/notification.js +52 -52
- package/build/api/developer/developer.js +3 -3
- package/build/api/{index.js → ebaySellerApi.js} +4 -4
- package/build/api/listing-management/feedReportTasks.js +6 -6
- package/build/api/listing-management/feedRequest.js +6 -6
- package/build/api/listing-management/feedSchedules.js +4 -4
- package/build/api/listing-management/feedTasks.js +2 -2
- package/build/api/listing-management/items.js +22 -22
- package/build/api/listing-management/locations.js +4 -4
- package/build/api/listing-management/media.js +14 -14
- package/build/api/listing-management/mediaAttach.js +14 -14
- package/build/api/listing-management/mediaResources.js +15 -13
- package/build/api/listing-management/offerFormat.js +1 -1
- package/build/api/listing-management/offers.js +23 -23
- package/build/api/listing-management/stores.js +9 -9
- package/build/api/listing-metadata/metadata.js +10 -10
- package/build/api/marketing-and-promotions/ads.js +34 -34
- package/build/api/marketing-and-promotions/campaigns.js +19 -19
- package/build/api/marketing-and-promotions/promotions.js +22 -22
- package/build/api/marketing-and-promotions/reports.js +7 -7
- package/build/api/order-management/dispute.js +11 -9
- package/build/api/order-management/fulfillment.js +4 -4
- package/build/api/order-management/logistics.js +7 -7
- package/build/api/other/browseMappers.js +15 -13
- package/build/api/other/browseValidators.js +4 -4
- package/build/api/other/edelivery.js +19 -19
- package/build/api/other/finding.js +13 -13
- package/build/api/other/translation.js +2 -2
- package/build/api/other/vero.js +2 -2
- package/build/api/shared/download.js +7 -7
- package/build/api/shared/request.js +28 -19
- package/build/api/trading/listingFormat.js +37 -30
- package/build/api/trading/trading.js +33 -33
- package/build/auth/credentialSession.js +5 -5
- package/build/auth/oauth.js +3 -3
- package/build/auth/oauthHelper.js +24 -24
- package/build/auth/oauthMetadata.js +4 -4
- package/build/auth/oauthMiddleware.js +16 -16
- package/build/auth/scopeUtils.js +2 -2
- package/build/auth/tokenVerifier.js +23 -23
- package/build/config/environment.js +4 -45
- package/build/config/oauthScopes.js +132 -0
- package/build/index.js +5 -5
- package/build/mcp/httpTransport.js +32 -20
- package/build/mcp/runtime.js +12 -12
- package/build/mcp/toolGating.js +6 -12
- package/build/mcp/uiBridge.js +3 -3
- package/build/schemas/account-management/account.js +2 -52
- package/build/schemas/account-management/accountV2.js +2 -2
- package/build/schemas/account-management/finances.js +1 -1
- package/build/schemas/analytics/analytics.js +2 -48
- package/build/schemas/communication/messages.js +2 -46
- package/build/schemas/developer/developer.js +1 -27
- package/build/schemas/fulfillment/logistics.js +1 -1
- package/build/schemas/fulfillment/orders.js +2 -47
- package/build/schemas/inventory-management/feed.js +1 -1
- package/build/schemas/inventory-management/inventory.js +2 -50
- package/build/schemas/inventory-management/media.js +2 -2
- package/build/schemas/inventory-management/mediaDocuments.js +1 -1
- package/build/schemas/inventory-management/stores.js +1 -1
- package/build/schemas/marketing/ads.js +2 -2
- package/build/schemas/marketing/campaigns.js +2 -2
- package/build/schemas/marketing/common.js +2 -2
- package/build/schemas/marketing/marketing.js +0 -1
- package/build/schemas/marketing/promotions.js +2 -2
- package/build/schemas/marketing/reports.js +2 -2
- package/build/schemas/metadata/metadata.js +2 -90
- package/build/schemas/metadata/shipping.js +1 -1
- package/build/schemas/other/browse.js +2 -2
- package/build/schemas/other/finding.js +2 -2
- package/build/schemas/other/otherApis.js +2 -114
- package/build/schemas/taxonomy/categoryTree.js +1 -1
- package/build/schemas/taxonomy/charity.js +1 -1
- package/build/schemas/taxonomy/taxonomy.js +2 -69
- package/build/scripts/autoSetup.js +3 -3
- package/build/scripts/{buildUi.js → buildMcpApps.js} +13 -13
- package/build/scripts/devSync.js +19 -68
- package/build/scripts/diagnostics.js +15 -16
- package/build/scripts/interactiveSetup.js +25 -25
- package/build/scripts/scopeHelper.js +2 -2
- package/build/scripts/securityChecker.js +20 -20
- package/build/scripts/setup.js +76 -76
- package/build/scripts/setupShared.js +5 -30
- package/build/scripts/setupValidator.js +9 -9
- package/build/scripts/setupWizard.js +23 -23
- package/build/scripts/skills.js +14 -17
- package/build/scripts/specRefs.js +1 -1
- package/build/scripts/specSources.js +144 -0
- package/build/serverHttp.js +4 -7
- package/build/skills/content.js +13 -13
- package/build/skills/install.js +9 -9
- package/build/skills/render.js +2 -2
- package/build/tools/categories/communication.js +1 -1
- package/build/tools/categories/connector.js +19 -16
- package/build/tools/categories/fulfillment.js +4 -4
- package/build/tools/categories/inventory.js +1 -1
- package/build/tools/categories/metadata.js +1 -1
- package/build/tools/categories/taxonomy.js +1 -1
- package/build/tools/categories/tokenManagement.js +8 -8
- package/build/tools/contracts.js +2 -2
- package/build/tools/defineTool.js +27 -12
- package/build/tools/registry.js +2 -2
- package/build/tools/schemas.js +2 -2
- package/build/tools/ui/mapHelpers.js +12 -12
- package/build/tools/ui/maps.js +101 -97
- package/build/tools/ui/viewModels.js +2 -2
- package/build/utils/apiStatusFeed.js +12 -12
- package/build/utils/communication/feedback.js +3 -3
- package/build/utils/communication/message.js +3 -3
- package/build/utils/communication/negotiation.js +3 -3
- package/build/utils/communication/notification.js +3 -3
- package/build/utils/entryModule.js +33 -0
- package/build/utils/envFile.js +47 -0
- package/build/utils/envParser.js +5 -5
- package/build/utils/errors.js +4 -4
- package/build/utils/http.js +38 -38
- package/build/utils/localFeedFiles.js +3 -3
- package/build/utils/logRedaction.js +21 -0
- package/build/utils/logger.js +49 -35
- package/build/utils/other/compliance.js +3 -3
- package/build/utils/other/identity.js +3 -3
- package/build/utils/other/translation.js +3 -3
- package/build/utils/other/vero.js +3 -3
- package/build/utils/schemaHelpers.js +2 -2
- package/build/utils/tokenUtils.js +2 -2
- package/build/utils/trading/trading.js +1 -1
- package/build/utils/version.js +1 -1
- package/build/utils/zodIssues.js +14 -0
- package/package.json +8 -11
- package/README.de.md +0 -426
- package/README.es.md +0 -426
- package/README.fr.md +0 -426
- package/README.ja.md +0 -426
- package/README.ko.md +0 -426
- package/README.pt-BR.md +0 -426
- package/README.ru.md +0 -426
- package/README.zh-CN.md +0 -426
- package/build/schemas/index.js +0 -76
- package/build/schemas/marketing/jsonSchemas.js +0 -118
- package/build/scripts/downloadSpecs.js +0 -117
- package/build/scripts/updateApiStatusDoc.js +0 -71
- package/build/utils/effectSchema.js +0 -203
- package/build/utils/effectSchemaAdapter.js +0 -121
- package/build/utils/effectSchemaChainMethods.js +0 -146
- package/build/utils/effectSchemaRefinements.js +0 -104
- package/build/utils/effectSchemaStringMethods.js +0 -63
- package/build/utils/effectSchemaTypes.js +0 -47
- package/docs/auth/production_scopes.json +0 -111
- package/docs/auth/sandbox_scopes.json +0 -142
- /package/build/api/{clientRequestError.js → client/ebayClientRequestError.js} +0 -0
- /package/build/api/{rateLimitTracker.js → client/rateLimitTracker.js} +0 -0
- /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 {
|
|
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 `
|
|
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: (
|
|
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
|
|
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
|
|
38
|
-
*
|
|
39
|
-
*
|
|
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:
|
|
57
|
-
//
|
|
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) =>
|
|
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
|
-
? (
|
|
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
|
-
? (
|
|
123
|
+
? (handlerOutput, args) => formatResult(handlerOutput, args)
|
|
109
124
|
: undefined,
|
|
110
125
|
};
|
|
111
126
|
};
|
package/build/tools/registry.js
CHANGED
|
@@ -106,7 +106,7 @@ export const getToolHandler = (toolName) => handlerByName[toolName];
|
|
|
106
106
|
*
|
|
107
107
|
* @example
|
|
108
108
|
* ```ts
|
|
109
|
-
* const
|
|
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: () =>
|
|
121
|
+
try: async () => handler(api, args),
|
|
122
122
|
catch: (error) => error,
|
|
123
123
|
});
|
|
124
124
|
}));
|
package/build/tools/schemas.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { z } from '
|
|
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
|
|
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
|
|
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 = (
|
|
98
|
-
if (typeof
|
|
99
|
-
return Number.isFinite(
|
|
97
|
+
export const toNumber = (leaf) => {
|
|
98
|
+
if (typeof leaf === 'number') {
|
|
99
|
+
return Number.isFinite(leaf) ? leaf : null;
|
|
100
100
|
}
|
|
101
|
-
if (typeof
|
|
102
|
-
const parsed = Number(
|
|
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
|
|
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 = (
|
|
120
|
-
if (typeof
|
|
121
|
-
return
|
|
119
|
+
export const toLabel = (leaf) => {
|
|
120
|
+
if (typeof leaf === 'string') {
|
|
121
|
+
return leaf;
|
|
122
122
|
}
|
|
123
|
-
if (typeof
|
|
124
|
-
return String(
|
|
123
|
+
if (typeof leaf === 'number' || typeof leaf === 'boolean') {
|
|
124
|
+
return String(leaf);
|
|
125
125
|
}
|
|
126
126
|
return '';
|
|
127
127
|
};
|