@solidcommerce/mcp-server 2.0.0-alpha.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.
- package/README.md +74 -0
- package/bin/solidcommerce-mcp.js +8 -0
- package/dist/audit/auditClient.d.ts +51 -0
- package/dist/audit/auditClient.d.ts.map +1 -0
- package/dist/audit/auditClient.js +93 -0
- package/dist/audit/auditClient.js.map +1 -0
- package/dist/auth/apiKey.d.ts +44 -0
- package/dist/auth/apiKey.d.ts.map +1 -0
- package/dist/auth/apiKey.js +80 -0
- package/dist/auth/apiKey.js.map +1 -0
- package/dist/auth/oauth.d.ts +108 -0
- package/dist/auth/oauth.d.ts.map +1 -0
- package/dist/auth/oauth.js +300 -0
- package/dist/auth/oauth.js.map +1 -0
- package/dist/generator/fromOpenApi.d.ts +54 -0
- package/dist/generator/fromOpenApi.d.ts.map +1 -0
- package/dist/generator/fromOpenApi.js +411 -0
- package/dist/generator/fromOpenApi.js.map +1 -0
- package/dist/generator/schemaToZod.d.ts +81 -0
- package/dist/generator/schemaToZod.d.ts.map +1 -0
- package/dist/generator/schemaToZod.js +277 -0
- package/dist/generator/schemaToZod.js.map +1 -0
- package/dist/generator/scopeInference.d.ts +26 -0
- package/dist/generator/scopeInference.d.ts.map +1 -0
- package/dist/generator/scopeInference.js +91 -0
- package/dist/generator/scopeInference.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +106 -0
- package/dist/index.js.map +1 -0
- package/dist/server/buildServer.d.ts +35 -0
- package/dist/server/buildServer.d.ts.map +1 -0
- package/dist/server/buildServer.js +104 -0
- package/dist/server/buildServer.js.map +1 -0
- package/dist/server/dispatcher.d.ts +14 -0
- package/dist/server/dispatcher.d.ts.map +1 -0
- package/dist/server/dispatcher.js +190 -0
- package/dist/server/dispatcher.js.map +1 -0
- package/dist/session.d.ts +9 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +11 -0
- package/dist/session.js.map +1 -0
- package/dist/telemetry/hostName.d.ts +26 -0
- package/dist/telemetry/hostName.d.ts.map +1 -0
- package/dist/telemetry/hostName.js +80 -0
- package/dist/telemetry/hostName.js.map +1 -0
- package/dist/tools/contract.d.ts +125 -0
- package/dist/tools/contract.d.ts.map +1 -0
- package/dist/tools/contract.js +101 -0
- package/dist/tools/contract.js.map +1 -0
- package/dist/tools/foundation/catalog_amazon_items_list.d.ts +4 -0
- package/dist/tools/foundation/catalog_amazon_items_list.d.ts.map +1 -0
- package/dist/tools/foundation/catalog_amazon_items_list.js +47 -0
- package/dist/tools/foundation/catalog_amazon_items_list.js.map +1 -0
- package/dist/tools/foundation/catalog_attribute_filters_list.d.ts +4 -0
- package/dist/tools/foundation/catalog_attribute_filters_list.d.ts.map +1 -0
- package/dist/tools/foundation/catalog_attribute_filters_list.js +47 -0
- package/dist/tools/foundation/catalog_attribute_filters_list.js.map +1 -0
- package/dist/tools/foundation/catalog_attribute_tags_list.d.ts +4 -0
- package/dist/tools/foundation/catalog_attribute_tags_list.d.ts.map +1 -0
- package/dist/tools/foundation/catalog_attribute_tags_list.js +47 -0
- package/dist/tools/foundation/catalog_attribute_tags_list.js.map +1 -0
- package/dist/tools/foundation/catalog_attributes_list.d.ts +4 -0
- package/dist/tools/foundation/catalog_attributes_list.d.ts.map +1 -0
- package/dist/tools/foundation/catalog_attributes_list.js +57 -0
- package/dist/tools/foundation/catalog_attributes_list.js.map +1 -0
- package/dist/tools/foundation/catalog_column_views_default_list.d.ts +4 -0
- package/dist/tools/foundation/catalog_column_views_default_list.d.ts.map +1 -0
- package/dist/tools/foundation/catalog_column_views_default_list.js +47 -0
- package/dist/tools/foundation/catalog_column_views_default_list.js.map +1 -0
- package/dist/tools/foundation/catalog_column_views_list.d.ts +4 -0
- package/dist/tools/foundation/catalog_column_views_list.d.ts.map +1 -0
- package/dist/tools/foundation/catalog_column_views_list.js +47 -0
- package/dist/tools/foundation/catalog_column_views_list.js.map +1 -0
- package/dist/tools/foundation/catalog_ebay_categories_list.d.ts +4 -0
- package/dist/tools/foundation/catalog_ebay_categories_list.d.ts.map +1 -0
- package/dist/tools/foundation/catalog_ebay_categories_list.js +56 -0
- package/dist/tools/foundation/catalog_ebay_categories_list.js.map +1 -0
- package/dist/tools/foundation/catalog_ebay_category_specifics_list.d.ts +4 -0
- package/dist/tools/foundation/catalog_ebay_category_specifics_list.d.ts.map +1 -0
- package/dist/tools/foundation/catalog_ebay_category_specifics_list.js +56 -0
- package/dist/tools/foundation/catalog_ebay_category_specifics_list.js.map +1 -0
- package/dist/tools/foundation/catalog_ebay_listing_templates_list.d.ts +4 -0
- package/dist/tools/foundation/catalog_ebay_listing_templates_list.d.ts.map +1 -0
- package/dist/tools/foundation/catalog_ebay_listing_templates_list.js +47 -0
- package/dist/tools/foundation/catalog_ebay_listing_templates_list.js.map +1 -0
- package/dist/tools/foundation/catalog_ebay_product_search_list.d.ts +4 -0
- package/dist/tools/foundation/catalog_ebay_product_search_list.d.ts.map +1 -0
- package/dist/tools/foundation/catalog_ebay_product_search_list.js +56 -0
- package/dist/tools/foundation/catalog_ebay_product_search_list.js.map +1 -0
- package/dist/tools/foundation/catalog_ebay_template_fields_list.d.ts +4 -0
- package/dist/tools/foundation/catalog_ebay_template_fields_list.d.ts.map +1 -0
- package/dist/tools/foundation/catalog_ebay_template_fields_list.js +47 -0
- package/dist/tools/foundation/catalog_ebay_template_fields_list.js.map +1 -0
- package/dist/tools/foundation/catalog_ebay_variation_groups_list.d.ts +4 -0
- package/dist/tools/foundation/catalog_ebay_variation_groups_list.d.ts.map +1 -0
- package/dist/tools/foundation/catalog_ebay_variation_groups_list.js +56 -0
- package/dist/tools/foundation/catalog_ebay_variation_groups_list.js.map +1 -0
- package/dist/tools/foundation/catalog_inventory_sources_list.d.ts +4 -0
- package/dist/tools/foundation/catalog_inventory_sources_list.d.ts.map +1 -0
- package/dist/tools/foundation/catalog_inventory_sources_list.js +47 -0
- package/dist/tools/foundation/catalog_inventory_sources_list.js.map +1 -0
- package/dist/tools/foundation/catalog_listing_rules_list.d.ts +4 -0
- package/dist/tools/foundation/catalog_listing_rules_list.d.ts.map +1 -0
- package/dist/tools/foundation/catalog_listing_rules_list.js +47 -0
- package/dist/tools/foundation/catalog_listing_rules_list.js.map +1 -0
- package/dist/tools/foundation/catalog_listing_templates_list.d.ts +4 -0
- package/dist/tools/foundation/catalog_listing_templates_list.d.ts.map +1 -0
- package/dist/tools/foundation/catalog_listing_templates_list.js +47 -0
- package/dist/tools/foundation/catalog_listing_templates_list.js.map +1 -0
- package/dist/tools/foundation/catalog_manufacturers_all_list.d.ts +4 -0
- package/dist/tools/foundation/catalog_manufacturers_all_list.d.ts.map +1 -0
- package/dist/tools/foundation/catalog_manufacturers_all_list.js +47 -0
- package/dist/tools/foundation/catalog_manufacturers_all_list.js.map +1 -0
- package/dist/tools/foundation/catalog_manufacturers_list.d.ts +4 -0
- package/dist/tools/foundation/catalog_manufacturers_list.d.ts.map +1 -0
- package/dist/tools/foundation/catalog_manufacturers_list.js +47 -0
- package/dist/tools/foundation/catalog_manufacturers_list.js.map +1 -0
- package/dist/tools/foundation/catalog_market_lists_list.d.ts +4 -0
- package/dist/tools/foundation/catalog_market_lists_list.d.ts.map +1 -0
- package/dist/tools/foundation/catalog_market_lists_list.js +47 -0
- package/dist/tools/foundation/catalog_market_lists_list.js.map +1 -0
- package/dist/tools/foundation/catalog_product_usage_filters_list.d.ts +4 -0
- package/dist/tools/foundation/catalog_product_usage_filters_list.d.ts.map +1 -0
- package/dist/tools/foundation/catalog_product_usage_filters_list.js +47 -0
- package/dist/tools/foundation/catalog_product_usage_filters_list.js.map +1 -0
- package/dist/tools/foundation/catalog_product_usage_list.d.ts +4 -0
- package/dist/tools/foundation/catalog_product_usage_list.d.ts.map +1 -0
- package/dist/tools/foundation/catalog_product_usage_list.js +61 -0
- package/dist/tools/foundation/catalog_product_usage_list.js.map +1 -0
- package/dist/tools/foundation/catalog_product_usage_totals_list.d.ts +4 -0
- package/dist/tools/foundation/catalog_product_usage_totals_list.d.ts.map +1 -0
- package/dist/tools/foundation/catalog_product_usage_totals_list.js +58 -0
- package/dist/tools/foundation/catalog_product_usage_totals_list.js.map +1 -0
- package/dist/tools/foundation/catalog_products_generate_sku_list.d.ts +4 -0
- package/dist/tools/foundation/catalog_products_generate_sku_list.d.ts.map +1 -0
- package/dist/tools/foundation/catalog_products_generate_sku_list.js +47 -0
- package/dist/tools/foundation/catalog_products_generate_sku_list.js.map +1 -0
- package/dist/tools/foundation/catalog_products_list.d.ts +4 -0
- package/dist/tools/foundation/catalog_products_list.d.ts.map +1 -0
- package/dist/tools/foundation/catalog_products_list.js +60 -0
- package/dist/tools/foundation/catalog_products_list.js.map +1 -0
- package/dist/tools/foundation/catalog_taxonomy_channels_list.d.ts +4 -0
- package/dist/tools/foundation/catalog_taxonomy_channels_list.d.ts.map +1 -0
- package/dist/tools/foundation/catalog_taxonomy_channels_list.js +47 -0
- package/dist/tools/foundation/catalog_taxonomy_channels_list.js.map +1 -0
- package/dist/tools/foundation/catalog_taxonomy_mappings_list.d.ts +4 -0
- package/dist/tools/foundation/catalog_taxonomy_mappings_list.d.ts.map +1 -0
- package/dist/tools/foundation/catalog_taxonomy_mappings_list.js +56 -0
- package/dist/tools/foundation/catalog_taxonomy_mappings_list.js.map +1 -0
- package/dist/tools/foundation/catalog_taxonomy_product_values_list.d.ts +4 -0
- package/dist/tools/foundation/catalog_taxonomy_product_values_list.d.ts.map +1 -0
- package/dist/tools/foundation/catalog_taxonomy_product_values_list.js +57 -0
- package/dist/tools/foundation/catalog_taxonomy_product_values_list.js.map +1 -0
- package/dist/tools/foundation/catalog_tree_list.d.ts +4 -0
- package/dist/tools/foundation/catalog_tree_list.d.ts.map +1 -0
- package/dist/tools/foundation/catalog_tree_list.js +47 -0
- package/dist/tools/foundation/catalog_tree_list.js.map +1 -0
- package/dist/tools/foundation/crm_customers_list.d.ts +4 -0
- package/dist/tools/foundation/crm_customers_list.d.ts.map +1 -0
- package/dist/tools/foundation/crm_customers_list.js +59 -0
- package/dist/tools/foundation/crm_customers_list.js.map +1 -0
- package/dist/tools/foundation/fulfillment_manifests_list.d.ts +4 -0
- package/dist/tools/foundation/fulfillment_manifests_list.d.ts.map +1 -0
- package/dist/tools/foundation/fulfillment_manifests_list.js +47 -0
- package/dist/tools/foundation/fulfillment_manifests_list.js.map +1 -0
- package/dist/tools/foundation/fulfillment_ship_now_addresses_list.d.ts +4 -0
- package/dist/tools/foundation/fulfillment_ship_now_addresses_list.d.ts.map +1 -0
- package/dist/tools/foundation/fulfillment_ship_now_addresses_list.js +47 -0
- package/dist/tools/foundation/fulfillment_ship_now_addresses_list.js.map +1 -0
- package/dist/tools/foundation/fulfillment_ship_now_dictionaries_list.d.ts +4 -0
- package/dist/tools/foundation/fulfillment_ship_now_dictionaries_list.d.ts.map +1 -0
- package/dist/tools/foundation/fulfillment_ship_now_dictionaries_list.js +56 -0
- package/dist/tools/foundation/fulfillment_ship_now_dictionaries_list.js.map +1 -0
- package/dist/tools/foundation/index.d.ts +8 -0
- package/dist/tools/foundation/index.d.ts.map +1 -0
- package/dist/tools/foundation/index.js +93 -0
- package/dist/tools/foundation/index.js.map +1 -0
- package/dist/tools/foundation/inventory_alert_rules_list.d.ts +4 -0
- package/dist/tools/foundation/inventory_alert_rules_list.d.ts.map +1 -0
- package/dist/tools/foundation/inventory_alert_rules_list.js +47 -0
- package/dist/tools/foundation/inventory_alert_rules_list.js.map +1 -0
- package/dist/tools/foundation/inventory_alert_settings_list.d.ts +4 -0
- package/dist/tools/foundation/inventory_alert_settings_list.d.ts.map +1 -0
- package/dist/tools/foundation/inventory_alert_settings_list.js +47 -0
- package/dist/tools/foundation/inventory_alert_settings_list.js.map +1 -0
- package/dist/tools/foundation/inventory_analytics_alert_count_list.d.ts +4 -0
- package/dist/tools/foundation/inventory_analytics_alert_count_list.d.ts.map +1 -0
- package/dist/tools/foundation/inventory_analytics_alert_count_list.js +47 -0
- package/dist/tools/foundation/inventory_analytics_alert_count_list.js.map +1 -0
- package/dist/tools/foundation/inventory_rules_list.d.ts +4 -0
- package/dist/tools/foundation/inventory_rules_list.d.ts.map +1 -0
- package/dist/tools/foundation/inventory_rules_list.js +47 -0
- package/dist/tools/foundation/inventory_rules_list.js.map +1 -0
- package/dist/tools/foundation/inventory_rules_periods_list.d.ts +4 -0
- package/dist/tools/foundation/inventory_rules_periods_list.d.ts.map +1 -0
- package/dist/tools/foundation/inventory_rules_periods_list.js +47 -0
- package/dist/tools/foundation/inventory_rules_periods_list.js.map +1 -0
- package/dist/tools/foundation/inventory_seasonal_factors_list.d.ts +4 -0
- package/dist/tools/foundation/inventory_seasonal_factors_list.d.ts.map +1 -0
- package/dist/tools/foundation/inventory_seasonal_factors_list.js +47 -0
- package/dist/tools/foundation/inventory_seasonal_factors_list.js.map +1 -0
- package/dist/tools/foundation/inventory_warehouses_list.d.ts +4 -0
- package/dist/tools/foundation/inventory_warehouses_list.d.ts.map +1 -0
- package/dist/tools/foundation/inventory_warehouses_list.js +47 -0
- package/dist/tools/foundation/inventory_warehouses_list.js.map +1 -0
- package/dist/tools/foundation/listings_dictionary_marketplace_locales_list.d.ts +4 -0
- package/dist/tools/foundation/listings_dictionary_marketplace_locales_list.d.ts.map +1 -0
- package/dist/tools/foundation/listings_dictionary_marketplace_locales_list.js +56 -0
- package/dist/tools/foundation/listings_dictionary_marketplace_locales_list.js.map +1 -0
- package/dist/tools/foundation/listings_dictionary_marketplaces_list.d.ts +4 -0
- package/dist/tools/foundation/listings_dictionary_marketplaces_list.d.ts.map +1 -0
- package/dist/tools/foundation/listings_dictionary_marketplaces_list.js +47 -0
- package/dist/tools/foundation/listings_dictionary_marketplaces_list.js.map +1 -0
- package/dist/tools/tasks/bulk_update_prices.d.ts +4 -0
- package/dist/tools/tasks/bulk_update_prices.d.ts.map +1 -0
- package/dist/tools/tasks/bulk_update_prices.js +96 -0
- package/dist/tools/tasks/bulk_update_prices.js.map +1 -0
- package/dist/tools/tasks/cancel_order_with_reason.d.ts +4 -0
- package/dist/tools/tasks/cancel_order_with_reason.d.ts.map +1 -0
- package/dist/tools/tasks/cancel_order_with_reason.js +117 -0
- package/dist/tools/tasks/cancel_order_with_reason.js.map +1 -0
- package/dist/tools/tasks/check_listing_health.d.ts +4 -0
- package/dist/tools/tasks/check_listing_health.d.ts.map +1 -0
- package/dist/tools/tasks/check_listing_health.js +123 -0
- package/dist/tools/tasks/check_listing_health.js.map +1 -0
- package/dist/tools/tasks/create_and_submit_purchase_order.d.ts +4 -0
- package/dist/tools/tasks/create_and_submit_purchase_order.d.ts.map +1 -0
- package/dist/tools/tasks/create_and_submit_purchase_order.js +142 -0
- package/dist/tools/tasks/create_and_submit_purchase_order.js.map +1 -0
- package/dist/tools/tasks/find_product_by_sku.d.ts +4 -0
- package/dist/tools/tasks/find_product_by_sku.d.ts.map +1 -0
- package/dist/tools/tasks/find_product_by_sku.js +68 -0
- package/dist/tools/tasks/find_product_by_sku.js.map +1 -0
- package/dist/tools/tasks/fulfill_order.d.ts +4 -0
- package/dist/tools/tasks/fulfill_order.d.ts.map +1 -0
- package/dist/tools/tasks/fulfill_order.js +121 -0
- package/dist/tools/tasks/fulfill_order.js.map +1 -0
- package/dist/tools/tasks/get_inventory_across_warehouses.d.ts +4 -0
- package/dist/tools/tasks/get_inventory_across_warehouses.d.ts.map +1 -0
- package/dist/tools/tasks/get_inventory_across_warehouses.js +118 -0
- package/dist/tools/tasks/get_inventory_across_warehouses.js.map +1 -0
- package/dist/tools/tasks/index.d.ts +14 -0
- package/dist/tools/tasks/index.d.ts.map +1 -0
- package/dist/tools/tasks/index.js +32 -0
- package/dist/tools/tasks/index.js.map +1 -0
- package/dist/tools/tasks/publish_product_to_channels.d.ts +4 -0
- package/dist/tools/tasks/publish_product_to_channels.d.ts.map +1 -0
- package/dist/tools/tasks/publish_product_to_channels.js +109 -0
- package/dist/tools/tasks/publish_product_to_channels.js.map +1 -0
- package/dist/tools/tasks/reply_to_buyer_message.d.ts +4 -0
- package/dist/tools/tasks/reply_to_buyer_message.d.ts.map +1 -0
- package/dist/tools/tasks/reply_to_buyer_message.js +72 -0
- package/dist/tools/tasks/reply_to_buyer_message.js.map +1 -0
- package/dist/tools/tasks/reprice_listing.d.ts +4 -0
- package/dist/tools/tasks/reprice_listing.d.ts.map +1 -0
- package/dist/tools/tasks/reprice_listing.js +74 -0
- package/dist/tools/tasks/reprice_listing.js.map +1 -0
- package/dist/transports/stdio.d.ts +12 -0
- package/dist/transports/stdio.d.ts.map +1 -0
- package/dist/transports/stdio.js +30 -0
- package/dist/transports/stdio.js.map +1 -0
- package/dist/transports/streamableHttp.d.ts +33 -0
- package/dist/transports/streamableHttp.d.ts.map +1 -0
- package/dist/transports/streamableHttp.js +237 -0
- package/dist/transports/streamableHttp.js.map +1 -0
- package/package.json +47 -0
- package/vendor/openapi.snapshot.json +19887 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inventory_rules_list.d.ts","sourceRoot":"","sources":["../../../src/tools/foundation/inventory_rules_list.ts"],"names":[],"mappings":"AASA,OAAO,EAGL,KAAK,UAAU,EAEhB,MAAM,gBAAgB,CAAC;AAuCxB,QAAA,MAAM,IAAI,EAAE,UAUX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// AUTO-GENERATED — DO NOT EDIT BY HAND.
|
|
3
|
+
// Regenerate via: npm run regen-foundation-tools
|
|
4
|
+
// Source: vendor/openapi.snapshot.json (W4 frozen).
|
|
5
|
+
// =============================================================================
|
|
6
|
+
// Tier: tier1 HTTP: GET /v1/inventory/rules
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
import { mapSdkErrorToToolResult, } from "../contract.js";
|
|
9
|
+
const inputSchema = z.object({});
|
|
10
|
+
async function handle(args, ctx) {
|
|
11
|
+
let parsed;
|
|
12
|
+
try {
|
|
13
|
+
parsed = inputSchema.parse(args);
|
|
14
|
+
}
|
|
15
|
+
catch (err) {
|
|
16
|
+
return mapSdkErrorToToolResult(err);
|
|
17
|
+
}
|
|
18
|
+
void parsed; // referenced below when the operation declares params/body.
|
|
19
|
+
try {
|
|
20
|
+
const raw = ctx.client.raw;
|
|
21
|
+
const fn = raw["GET"];
|
|
22
|
+
if (typeof fn !== "function") {
|
|
23
|
+
return mapSdkErrorToToolResult(new Error("SDK client missing method GET"));
|
|
24
|
+
}
|
|
25
|
+
const result = await fn("/v1/inventory/rules", {});
|
|
26
|
+
if (result.error !== undefined && result.error !== null) {
|
|
27
|
+
return mapSdkErrorToToolResult(result.error);
|
|
28
|
+
}
|
|
29
|
+
return { content: [{ type: "json", json: result.data ?? null }] };
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
return mapSdkErrorToToolResult(err);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const tool = {
|
|
36
|
+
name: "inventory_rules_list",
|
|
37
|
+
kind: "foundation",
|
|
38
|
+
description: "Requires scope: inventory:inventory_rules:read.",
|
|
39
|
+
required_scope: "inventory:inventory_rules:read",
|
|
40
|
+
// HTTP verb → Claude UI annotation. GET → readOnlyHint; write verbs →
|
|
41
|
+
// destructiveHint. Enforced by test/tools/annotations.test.ts.
|
|
42
|
+
readOnlyHint: true,
|
|
43
|
+
inputSchema,
|
|
44
|
+
handle,
|
|
45
|
+
};
|
|
46
|
+
export default tool;
|
|
47
|
+
//# sourceMappingURL=inventory_rules_list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inventory_rules_list.js","sourceRoot":"","sources":["../../../src/tools/foundation/inventory_rules_list.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,wCAAwC;AACxC,iDAAiD;AACjD,oDAAoD;AACpD,gFAAgF;AAEhF,6CAA6C;AAC7C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,uBAAuB,GAIxB,MAAM,gBAAgB,CAAC;AAExB,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IACtE,+DAA+D;IAC/D,YAAY,EAAE,IAAI;IAClB,WAAW;IACX,MAAM;CACP,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inventory_rules_periods_list.d.ts","sourceRoot":"","sources":["../../../src/tools/foundation/inventory_rules_periods_list.ts"],"names":[],"mappings":"AASA,OAAO,EAGL,KAAK,UAAU,EAEhB,MAAM,gBAAgB,CAAC;AAuCxB,QAAA,MAAM,IAAI,EAAE,UAUX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// AUTO-GENERATED — DO NOT EDIT BY HAND.
|
|
3
|
+
// Regenerate via: npm run regen-foundation-tools
|
|
4
|
+
// Source: vendor/openapi.snapshot.json (W4 frozen).
|
|
5
|
+
// =============================================================================
|
|
6
|
+
// Tier: tier1 HTTP: GET /v1/inventory/rules/periods
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
import { mapSdkErrorToToolResult, } from "../contract.js";
|
|
9
|
+
const inputSchema = z.object({});
|
|
10
|
+
async function handle(args, ctx) {
|
|
11
|
+
let parsed;
|
|
12
|
+
try {
|
|
13
|
+
parsed = inputSchema.parse(args);
|
|
14
|
+
}
|
|
15
|
+
catch (err) {
|
|
16
|
+
return mapSdkErrorToToolResult(err);
|
|
17
|
+
}
|
|
18
|
+
void parsed; // referenced below when the operation declares params/body.
|
|
19
|
+
try {
|
|
20
|
+
const raw = ctx.client.raw;
|
|
21
|
+
const fn = raw["GET"];
|
|
22
|
+
if (typeof fn !== "function") {
|
|
23
|
+
return mapSdkErrorToToolResult(new Error("SDK client missing method GET"));
|
|
24
|
+
}
|
|
25
|
+
const result = await fn("/v1/inventory/rules/periods", {});
|
|
26
|
+
if (result.error !== undefined && result.error !== null) {
|
|
27
|
+
return mapSdkErrorToToolResult(result.error);
|
|
28
|
+
}
|
|
29
|
+
return { content: [{ type: "json", json: result.data ?? null }] };
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
return mapSdkErrorToToolResult(err);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const tool = {
|
|
36
|
+
name: "inventory_rules_periods_list",
|
|
37
|
+
kind: "foundation",
|
|
38
|
+
description: "Requires scope: inventory:seasonal_factors:read.",
|
|
39
|
+
required_scope: "inventory:seasonal_factors:read",
|
|
40
|
+
// HTTP verb → Claude UI annotation. GET → readOnlyHint; write verbs →
|
|
41
|
+
// destructiveHint. Enforced by test/tools/annotations.test.ts.
|
|
42
|
+
readOnlyHint: true,
|
|
43
|
+
inputSchema,
|
|
44
|
+
handle,
|
|
45
|
+
};
|
|
46
|
+
export default tool;
|
|
47
|
+
//# sourceMappingURL=inventory_rules_periods_list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inventory_rules_periods_list.js","sourceRoot":"","sources":["../../../src/tools/foundation/inventory_rules_periods_list.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,wCAAwC;AACxC,iDAAiD;AACjD,oDAAoD;AACpD,gFAAgF;AAEhF,qDAAqD;AACrD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,uBAAuB,GAIxB,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAIjC,KAAK,UAAU,MAAM,CAAC,IAAa,EAAE,GAAgB;IACnD,IAAI,MAAY,CAAC;IACjB,IAAI,CAAC;QACH,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,IAAI,CAAS,CAAC;IAC3C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,uBAAuB,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC;IACD,KAAK,MAAM,CAAC,CAAC,4DAA4D;IACzE,IAAI,CAAC;QAQH,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,GAAyC,CAAC;QACjE,MAAM,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC;QACtB,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE,CAAC;YAC7B,OAAO,uBAAuB,CAC5B,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAC3C,CAAC;QACJ,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,6BAA6B,EAAE,EAAE,CAAC,CAAC;QAC3D,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;YACxD,OAAO,uBAAuB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC/C,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC,EAAE,CAAC;IACpE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,uBAAuB,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC;AACH,CAAC;AAED,MAAM,IAAI,GAAe;IACvB,IAAI,EAAE,8BAA8B;IACpC,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,kDAAkD;IAC/D,cAAc,EAAE,iCAAiC;IACjD,sEAAsE;IACtE,+DAA+D;IAC/D,YAAY,EAAE,IAAI;IAClB,WAAW;IACX,MAAM;CACP,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inventory_seasonal_factors_list.d.ts","sourceRoot":"","sources":["../../../src/tools/foundation/inventory_seasonal_factors_list.ts"],"names":[],"mappings":"AASA,OAAO,EAGL,KAAK,UAAU,EAEhB,MAAM,gBAAgB,CAAC;AAuCxB,QAAA,MAAM,IAAI,EAAE,UAUX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// AUTO-GENERATED — DO NOT EDIT BY HAND.
|
|
3
|
+
// Regenerate via: npm run regen-foundation-tools
|
|
4
|
+
// Source: vendor/openapi.snapshot.json (W4 frozen).
|
|
5
|
+
// =============================================================================
|
|
6
|
+
// Tier: tier1 HTTP: GET /v1/inventory/seasonal-factors
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
import { mapSdkErrorToToolResult, } from "../contract.js";
|
|
9
|
+
const inputSchema = z.object({});
|
|
10
|
+
async function handle(args, ctx) {
|
|
11
|
+
let parsed;
|
|
12
|
+
try {
|
|
13
|
+
parsed = inputSchema.parse(args);
|
|
14
|
+
}
|
|
15
|
+
catch (err) {
|
|
16
|
+
return mapSdkErrorToToolResult(err);
|
|
17
|
+
}
|
|
18
|
+
void parsed; // referenced below when the operation declares params/body.
|
|
19
|
+
try {
|
|
20
|
+
const raw = ctx.client.raw;
|
|
21
|
+
const fn = raw["GET"];
|
|
22
|
+
if (typeof fn !== "function") {
|
|
23
|
+
return mapSdkErrorToToolResult(new Error("SDK client missing method GET"));
|
|
24
|
+
}
|
|
25
|
+
const result = await fn("/v1/inventory/seasonal-factors", {});
|
|
26
|
+
if (result.error !== undefined && result.error !== null) {
|
|
27
|
+
return mapSdkErrorToToolResult(result.error);
|
|
28
|
+
}
|
|
29
|
+
return { content: [{ type: "json", json: result.data ?? null }] };
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
return mapSdkErrorToToolResult(err);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const tool = {
|
|
36
|
+
name: "inventory_seasonal_factors_list",
|
|
37
|
+
kind: "foundation",
|
|
38
|
+
description: "Requires scope: inventory:seasonal_factors:read.",
|
|
39
|
+
required_scope: "inventory:seasonal_factors:read",
|
|
40
|
+
// HTTP verb → Claude UI annotation. GET → readOnlyHint; write verbs →
|
|
41
|
+
// destructiveHint. Enforced by test/tools/annotations.test.ts.
|
|
42
|
+
readOnlyHint: true,
|
|
43
|
+
inputSchema,
|
|
44
|
+
handle,
|
|
45
|
+
};
|
|
46
|
+
export default tool;
|
|
47
|
+
//# sourceMappingURL=inventory_seasonal_factors_list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inventory_seasonal_factors_list.js","sourceRoot":"","sources":["../../../src/tools/foundation/inventory_seasonal_factors_list.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,wCAAwC;AACxC,iDAAiD;AACjD,oDAAoD;AACpD,gFAAgF;AAEhF,wDAAwD;AACxD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,uBAAuB,GAIxB,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAIjC,KAAK,UAAU,MAAM,CAAC,IAAa,EAAE,GAAgB;IACnD,IAAI,MAAY,CAAC;IACjB,IAAI,CAAC;QACH,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,IAAI,CAAS,CAAC;IAC3C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,uBAAuB,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC;IACD,KAAK,MAAM,CAAC,CAAC,4DAA4D;IACzE,IAAI,CAAC;QAQH,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,GAAyC,CAAC;QACjE,MAAM,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC;QACtB,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE,CAAC;YAC7B,OAAO,uBAAuB,CAC5B,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAC3C,CAAC;QACJ,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,gCAAgC,EAAE,EAAE,CAAC,CAAC;QAC9D,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;YACxD,OAAO,uBAAuB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC/C,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC,EAAE,CAAC;IACpE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,uBAAuB,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC;AACH,CAAC;AAED,MAAM,IAAI,GAAe;IACvB,IAAI,EAAE,iCAAiC;IACvC,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,kDAAkD;IAC/D,cAAc,EAAE,iCAAiC;IACjD,sEAAsE;IACtE,+DAA+D;IAC/D,YAAY,EAAE,IAAI;IAClB,WAAW;IACX,MAAM;CACP,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inventory_warehouses_list.d.ts","sourceRoot":"","sources":["../../../src/tools/foundation/inventory_warehouses_list.ts"],"names":[],"mappings":"AASA,OAAO,EAGL,KAAK,UAAU,EAEhB,MAAM,gBAAgB,CAAC;AAuCxB,QAAA,MAAM,IAAI,EAAE,UAUX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// AUTO-GENERATED — DO NOT EDIT BY HAND.
|
|
3
|
+
// Regenerate via: npm run regen-foundation-tools
|
|
4
|
+
// Source: vendor/openapi.snapshot.json (W4 frozen).
|
|
5
|
+
// =============================================================================
|
|
6
|
+
// Tier: tier1 HTTP: GET /v1/inventory/warehouses
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
import { mapSdkErrorToToolResult, } from "../contract.js";
|
|
9
|
+
const inputSchema = z.object({});
|
|
10
|
+
async function handle(args, ctx) {
|
|
11
|
+
let parsed;
|
|
12
|
+
try {
|
|
13
|
+
parsed = inputSchema.parse(args);
|
|
14
|
+
}
|
|
15
|
+
catch (err) {
|
|
16
|
+
return mapSdkErrorToToolResult(err);
|
|
17
|
+
}
|
|
18
|
+
void parsed; // referenced below when the operation declares params/body.
|
|
19
|
+
try {
|
|
20
|
+
const raw = ctx.client.raw;
|
|
21
|
+
const fn = raw["GET"];
|
|
22
|
+
if (typeof fn !== "function") {
|
|
23
|
+
return mapSdkErrorToToolResult(new Error("SDK client missing method GET"));
|
|
24
|
+
}
|
|
25
|
+
const result = await fn("/v1/inventory/warehouses", {});
|
|
26
|
+
if (result.error !== undefined && result.error !== null) {
|
|
27
|
+
return mapSdkErrorToToolResult(result.error);
|
|
28
|
+
}
|
|
29
|
+
return { content: [{ type: "json", json: result.data ?? null }] };
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
return mapSdkErrorToToolResult(err);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const tool = {
|
|
36
|
+
name: "inventory_warehouses_list",
|
|
37
|
+
kind: "foundation",
|
|
38
|
+
description: "Requires scope: inventory:warehouses:read.",
|
|
39
|
+
required_scope: "inventory:warehouses:read",
|
|
40
|
+
// HTTP verb → Claude UI annotation. GET → readOnlyHint; write verbs →
|
|
41
|
+
// destructiveHint. Enforced by test/tools/annotations.test.ts.
|
|
42
|
+
readOnlyHint: true,
|
|
43
|
+
inputSchema,
|
|
44
|
+
handle,
|
|
45
|
+
};
|
|
46
|
+
export default tool;
|
|
47
|
+
//# sourceMappingURL=inventory_warehouses_list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inventory_warehouses_list.js","sourceRoot":"","sources":["../../../src/tools/foundation/inventory_warehouses_list.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,wCAAwC;AACxC,iDAAiD;AACjD,oDAAoD;AACpD,gFAAgF;AAEhF,kDAAkD;AAClD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,uBAAuB,GAIxB,MAAM,gB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;IAC3C,sEAAsE;IACtE,+DAA+D;IAC/D,YAAY,EAAE,IAAI;IAClB,WAAW;IACX,MAAM;CACP,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listings_dictionary_marketplace_locales_list.d.ts","sourceRoot":"","sources":["../../../src/tools/foundation/listings_dictionary_marketplace_locales_list.ts"],"names":[],"mappings":"AASA,OAAO,EAGL,KAAK,UAAU,EAEhB,MAAM,gBAAgB,CAAC;AAgDxB,QAAA,MAAM,IAAI,EAAE,UAUX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// AUTO-GENERATED — DO NOT EDIT BY HAND.
|
|
3
|
+
// Regenerate via: npm run regen-foundation-tools
|
|
4
|
+
// Source: vendor/openapi.snapshot.json (W4 frozen).
|
|
5
|
+
// =============================================================================
|
|
6
|
+
// Tier: tier1 HTTP: GET /v1/listings/dictionary/marketplace-locales
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
import { mapSdkErrorToToolResult, } from "../contract.js";
|
|
9
|
+
const inputSchema = z.object({
|
|
10
|
+
query: z.object({
|
|
11
|
+
marketplace_id: z.number().int().optional()
|
|
12
|
+
}).optional()
|
|
13
|
+
});
|
|
14
|
+
async function handle(args, ctx) {
|
|
15
|
+
let parsed;
|
|
16
|
+
try {
|
|
17
|
+
parsed = inputSchema.parse(args);
|
|
18
|
+
}
|
|
19
|
+
catch (err) {
|
|
20
|
+
return mapSdkErrorToToolResult(err);
|
|
21
|
+
}
|
|
22
|
+
void parsed; // referenced below when the operation declares params/body.
|
|
23
|
+
try {
|
|
24
|
+
const requestParams = {
|
|
25
|
+
query: parsed.query,
|
|
26
|
+
};
|
|
27
|
+
const raw = ctx.client.raw;
|
|
28
|
+
const fn = raw["GET"];
|
|
29
|
+
if (typeof fn !== "function") {
|
|
30
|
+
return mapSdkErrorToToolResult(new Error("SDK client missing method GET"));
|
|
31
|
+
}
|
|
32
|
+
const result = await fn("/v1/listings/dictionary/marketplace-locales", {
|
|
33
|
+
params: requestParams,
|
|
34
|
+
});
|
|
35
|
+
if (result.error !== undefined && result.error !== null) {
|
|
36
|
+
return mapSdkErrorToToolResult(result.error);
|
|
37
|
+
}
|
|
38
|
+
return { content: [{ type: "json", json: result.data ?? null }] };
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
return mapSdkErrorToToolResult(err);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const tool = {
|
|
45
|
+
name: "listings_dictionary_marketplace_locales_list",
|
|
46
|
+
kind: "foundation",
|
|
47
|
+
description: "Requires scope: listings:listing_templates:read.",
|
|
48
|
+
required_scope: "listings:listing_templates:read",
|
|
49
|
+
// HTTP verb → Claude UI annotation. GET → readOnlyHint; write verbs →
|
|
50
|
+
// destructiveHint. Enforced by test/tools/annotations.test.ts.
|
|
51
|
+
readOnlyHint: true,
|
|
52
|
+
inputSchema,
|
|
53
|
+
handle,
|
|
54
|
+
};
|
|
55
|
+
export default tool;
|
|
56
|
+
//# sourceMappingURL=listings_dictionary_marketplace_locales_list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listings_dictionary_marketplace_locales_list.js","sourceRoot":"","sources":["../../../src/tools/foundation/listings_dictionary_marketplace_locales_list.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,wCAAwC;AACxC,iDAAiD;AACjD,oDAAoD;AACpD,gFAAgF;AAEhF,qEAAqE;AACrE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,uBAAuB,GAIxB,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QAChB,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,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,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,kDAAkD;IAC/D,cAAc,EAAE,iCAAiC;IACjD,sEAAsE;IACtE,+DAA+D;IAC/D,YAAY,EAAE,IAAI;IAClB,WAAW;IACX,MAAM;CACP,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listings_dictionary_marketplaces_list.d.ts","sourceRoot":"","sources":["../../../src/tools/foundation/listings_dictionary_marketplaces_list.ts"],"names":[],"mappings":"AASA,OAAO,EAGL,KAAK,UAAU,EAEhB,MAAM,gBAAgB,CAAC;AAuCxB,QAAA,MAAM,IAAI,EAAE,UAUX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// AUTO-GENERATED — DO NOT EDIT BY HAND.
|
|
3
|
+
// Regenerate via: npm run regen-foundation-tools
|
|
4
|
+
// Source: vendor/openapi.snapshot.json (W4 frozen).
|
|
5
|
+
// =============================================================================
|
|
6
|
+
// Tier: tier1 HTTP: GET /v1/listings/dictionary/marketplaces
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
import { mapSdkErrorToToolResult, } from "../contract.js";
|
|
9
|
+
const inputSchema = z.object({});
|
|
10
|
+
async function handle(args, ctx) {
|
|
11
|
+
let parsed;
|
|
12
|
+
try {
|
|
13
|
+
parsed = inputSchema.parse(args);
|
|
14
|
+
}
|
|
15
|
+
catch (err) {
|
|
16
|
+
return mapSdkErrorToToolResult(err);
|
|
17
|
+
}
|
|
18
|
+
void parsed; // referenced below when the operation declares params/body.
|
|
19
|
+
try {
|
|
20
|
+
const raw = ctx.client.raw;
|
|
21
|
+
const fn = raw["GET"];
|
|
22
|
+
if (typeof fn !== "function") {
|
|
23
|
+
return mapSdkErrorToToolResult(new Error("SDK client missing method GET"));
|
|
24
|
+
}
|
|
25
|
+
const result = await fn("/v1/listings/dictionary/marketplaces", {});
|
|
26
|
+
if (result.error !== undefined && result.error !== null) {
|
|
27
|
+
return mapSdkErrorToToolResult(result.error);
|
|
28
|
+
}
|
|
29
|
+
return { content: [{ type: "json", json: result.data ?? null }] };
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
return mapSdkErrorToToolResult(err);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const tool = {
|
|
36
|
+
name: "listings_dictionary_marketplaces_list",
|
|
37
|
+
kind: "foundation",
|
|
38
|
+
description: "Requires scope: listings:listing_templates:read.",
|
|
39
|
+
required_scope: "listings:listing_templates:read",
|
|
40
|
+
// HTTP verb → Claude UI annotation. GET → readOnlyHint; write verbs →
|
|
41
|
+
// destructiveHint. Enforced by test/tools/annotations.test.ts.
|
|
42
|
+
readOnlyHint: true,
|
|
43
|
+
inputSchema,
|
|
44
|
+
handle,
|
|
45
|
+
};
|
|
46
|
+
export default tool;
|
|
47
|
+
//# sourceMappingURL=listings_dictionary_marketplaces_list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listings_dictionary_marketplaces_list.js","sourceRoot":"","sources":["../../../src/tools/foundation/listings_dictionary_marketplaces_list.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,wCAAwC;AACxC,iDAAiD;AACjD,oDAAoD;AACpD,gFAAgF;AAEhF,8DAA8D;AAC9D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,uBAAuB,GAIxB,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAIjC,KAAK,UAAU,MAAM,CAAC,IAAa,EAAE,GAAgB;IACnD,IAAI,MAAY,CAAC;IACjB,IAAI,CAAC;QACH,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,IAAI,CAAS,CAAC;IAC3C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,uBAAuB,CAAC,GAAG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BxB,QAAA,MAAM,gBAAgB,EAAE,UAwEvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// src/tools/tasks/bulk_update_prices.ts
|
|
3
|
+
// Wave: W6 — Stream B (task-shaped MCP tools)
|
|
4
|
+
//
|
|
5
|
+
// Endpoint mapping note:
|
|
6
|
+
// We use the same PATCH /v1/listings/list-items/{listItemId}/automation
|
|
7
|
+
// endpoint that `reprice_listing` uses, called once per rule. Per-rule
|
|
8
|
+
// failures are folded into a result array rather than aborting.
|
|
9
|
+
// =============================================================================
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
import { mapSdkErrorToToolResult, } from "../contract.js";
|
|
12
|
+
const inputSchema = z.object({
|
|
13
|
+
rules: z
|
|
14
|
+
.array(z.object({
|
|
15
|
+
listing_id: z
|
|
16
|
+
.string()
|
|
17
|
+
.min(1)
|
|
18
|
+
.describe("List-item id to update."),
|
|
19
|
+
new_price: z
|
|
20
|
+
.number()
|
|
21
|
+
.nonnegative()
|
|
22
|
+
.describe("Target list price."),
|
|
23
|
+
reason: z
|
|
24
|
+
.string()
|
|
25
|
+
.min(1)
|
|
26
|
+
.max(500)
|
|
27
|
+
.optional()
|
|
28
|
+
.describe("Optional reason recorded for this row."),
|
|
29
|
+
}))
|
|
30
|
+
.min(1)
|
|
31
|
+
.max(500, "Bulk price update is capped at 500 rules per call"),
|
|
32
|
+
});
|
|
33
|
+
const bulkUpdatePrices = {
|
|
34
|
+
name: "bulk_update_prices",
|
|
35
|
+
kind: "task",
|
|
36
|
+
// Writes to many listings at once; high blast radius → destructive.
|
|
37
|
+
destructiveHint: true,
|
|
38
|
+
description: "Applies many list-price changes in one call. For each rule {listing_id, new_price, reason?} issues PATCH /v1/listings/list-items/{listItemId}/automation. Returns a per-rule outcome. Failures on individual rules do NOT mark the whole tool errored — the LLM gets a structured table of which rows succeeded. Use this when the user pastes or describes a bulk re-pricing intent (e.g. 'mark down everything in collection X by 10%' once the LLM has resolved that into concrete listing ids and prices).",
|
|
39
|
+
required_scope: "listings:write",
|
|
40
|
+
inputSchema,
|
|
41
|
+
async handle(args, ctx) {
|
|
42
|
+
const parsed = inputSchema.parse(args);
|
|
43
|
+
const results = [];
|
|
44
|
+
for (const rule of parsed.rules) {
|
|
45
|
+
try {
|
|
46
|
+
const body = { list_price: rule.new_price };
|
|
47
|
+
if (rule.reason) {
|
|
48
|
+
body["metadata"] = { price_change_reason: rule.reason };
|
|
49
|
+
}
|
|
50
|
+
const res = await ctx.client.raw.PATCH("/v1/listings/list-items/{listItemId}/automation", {
|
|
51
|
+
params: { path: { listItemId: rule.listing_id } },
|
|
52
|
+
body,
|
|
53
|
+
});
|
|
54
|
+
if (res.error)
|
|
55
|
+
throw res.error;
|
|
56
|
+
results.push({
|
|
57
|
+
listing_id: rule.listing_id,
|
|
58
|
+
status: "ok",
|
|
59
|
+
new_price: rule.new_price,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
const e = err;
|
|
64
|
+
if (e?.type === "permission_denied" || e?.type === "authentication_error") {
|
|
65
|
+
return mapSdkErrorToToolResult(err);
|
|
66
|
+
}
|
|
67
|
+
results.push({
|
|
68
|
+
listing_id: rule.listing_id,
|
|
69
|
+
status: "failed",
|
|
70
|
+
new_price: rule.new_price,
|
|
71
|
+
error: {
|
|
72
|
+
type: e?.type ?? "transport",
|
|
73
|
+
...(e?.message ? { message: e.message } : {}),
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
content: [
|
|
80
|
+
{
|
|
81
|
+
type: "json",
|
|
82
|
+
json: {
|
|
83
|
+
results,
|
|
84
|
+
summary: {
|
|
85
|
+
total: results.length,
|
|
86
|
+
ok: results.filter((r) => r.status === "ok").length,
|
|
87
|
+
failed: results.filter((r) => r.status === "failed").length,
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
};
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
export default bulkUpdatePrices;
|
|
96
|
+
//# sourceMappingURL=bulk_update_prices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bulk_update_prices.js","sourceRoot":"","sources":["../../../src/tools/tasks/bulk_update_prices.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,wCAAwC;AACxC,8CAA8C;AAC9C,EAAE;AACF,yBAAyB;AACzB,0EAA0E;AAC1E,yEAAyE;AACzE,kEAAkE;AAClE,gFAAgF;AAEhF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,uBAAuB,GAGxB,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,KAAK,EAAE,CAAC;SACL,KAAK,CACJ,CAAC,CAAC,MAAM,CAAC;QACP,UAAU,EAAE,CAAC;aACV,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CAAC,yBAAyB,CAAC;QACtC,SAAS,EAAE,CAAC;aACT,MAAM,EAAE;aACR,WAAW,EAAE;aACb,QAAQ,CAAC,oBAAoB,CAAC;QACjC,MAAM,EAAE,CAAC;aACN,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,GAAG,CAAC,GAAG,CAAC;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,wCAAwC,CAAC;KACtD,CAAC,CACH;SACA,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,GAAG,EAAE,mDAAmD,CAAC;CACjE,CAAC,CAAC;AAEH,MAAM,gBAAgB,GAAe;IACnC,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,MAAM;IACZ,oEAAoE;IACpE,eAAe,EAAE,IAAI;IACrB,WAAW,EACT,gfAAgf;IAClf,cAAc,EAAE,gBAAgB;IACh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IAAI,CAAC,SAAS;oBACzB,KAAK,EAAE;wBACL,IAAI,EAAE,CAAC,EAAE,IAAI,IAAI,WAAW;wBAC5B,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;qBAC9C;iBACF,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE;wBACJ,OAAO;wBACP,OAAO,EAAE;4BACP,KAAK,EAAE,OAAO,CAAC,MAAM;4BACrB,EAAE,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,MAAM;4BACnD,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,MAAM;yBAC5D;qBACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancel_order_with_reason.d.ts","sourceRoot":"","sources":["../../../src/tools/tasks/cancel_order_with_reason.ts"],"names":[],"mappings":"AAYA,OAAO,EAEL,KAAK,UAAU,EAEhB,MAAM,gBAAgB,CAAC;AAiBxB,QAAA,MAAM,qBAAqB,EAAE,UAwG5B,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// src/tools/tasks/cancel_order_with_reason.ts
|
|
3
|
+
// Wave: W6 — Stream B (task-shaped MCP tools)
|
|
4
|
+
//
|
|
5
|
+
// Endpoint mapping note:
|
|
6
|
+
// The snapshot has no /v1/orders/{id}/cancel; cancellations are line-level
|
|
7
|
+
// via POST /v1/orders/{id}/items/{itemId}/cancel. We GET /v1/orders/{id}
|
|
8
|
+
// first to enumerate items, then iterate each item posting a cancel with
|
|
9
|
+
// the supplied reason. Per-item failures are folded into the response.
|
|
10
|
+
// =============================================================================
|
|
11
|
+
import { z } from "zod";
|
|
12
|
+
import { mapSdkErrorToToolResult, } from "../contract.js";
|
|
13
|
+
const inputSchema = z.object({
|
|
14
|
+
order_id: z.string().min(1).describe("Order id to cancel."),
|
|
15
|
+
reason: z
|
|
16
|
+
.string()
|
|
17
|
+
.min(1)
|
|
18
|
+
.max(500)
|
|
19
|
+
.describe("Required cancellation reason — recorded against every order item."),
|
|
20
|
+
});
|
|
21
|
+
const cancelOrderWithReason = {
|
|
22
|
+
name: "cancel_order_with_reason",
|
|
23
|
+
kind: "task",
|
|
24
|
+
// Cancellation refunds the buyer and notifies the marketplace; irreversible.
|
|
25
|
+
destructiveHint: true,
|
|
26
|
+
description: "Cancels every open line item on an order with a single reason. Reads the order via GET /v1/orders/{id}, then for each item posts /v1/orders/{id}/items/{itemId}/cancel with the supplied reason. Returns a per-item summary plus aggregate counts. Use this when the user wants to 'cancel order X' — the platform tracks cancellations at the item level, so this tool fans out the operation while preserving the user's single-reason intent.",
|
|
27
|
+
required_scope: "orders:write",
|
|
28
|
+
inputSchema,
|
|
29
|
+
async handle(args, ctx) {
|
|
30
|
+
const parsed = inputSchema.parse(args);
|
|
31
|
+
try {
|
|
32
|
+
// 1) Fetch the order to enumerate items.
|
|
33
|
+
const orderRes = await ctx.client.raw.GET("/v1/orders/{id}", {
|
|
34
|
+
params: { path: { id: parsed.order_id } },
|
|
35
|
+
});
|
|
36
|
+
if (orderRes.error)
|
|
37
|
+
throw orderRes.error;
|
|
38
|
+
const order = (orderRes.data ?? {});
|
|
39
|
+
const items = order.items ?? [];
|
|
40
|
+
if (items.length === 0) {
|
|
41
|
+
return {
|
|
42
|
+
content: [
|
|
43
|
+
{
|
|
44
|
+
type: "json",
|
|
45
|
+
json: {
|
|
46
|
+
order_id: parsed.order_id,
|
|
47
|
+
items: [],
|
|
48
|
+
summary: { total: 0, cancelled: 0, failed: 0 },
|
|
49
|
+
note: "Order has no items to cancel.",
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
// 2) Cancel each item with the reason.
|
|
56
|
+
const results = [];
|
|
57
|
+
for (const item of items) {
|
|
58
|
+
const itemId = item.id ?? item.item_id;
|
|
59
|
+
if (itemId === undefined || itemId === null) {
|
|
60
|
+
results.push({
|
|
61
|
+
item_id: "(unknown)",
|
|
62
|
+
status: "failed",
|
|
63
|
+
error: { type: "invalid_request", message: "Item has no id" },
|
|
64
|
+
});
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
try {
|
|
68
|
+
const res = await ctx.client.raw.POST("/v1/orders/{id}/items/{itemId}/cancel", {
|
|
69
|
+
params: {
|
|
70
|
+
path: { id: parsed.order_id, itemId: String(itemId) },
|
|
71
|
+
},
|
|
72
|
+
body: { reason: parsed.reason },
|
|
73
|
+
});
|
|
74
|
+
if (res.error)
|
|
75
|
+
throw res.error;
|
|
76
|
+
results.push({ item_id: String(itemId), status: "ok" });
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
const e = err;
|
|
80
|
+
if (e?.type === "permission_denied" || e?.type === "authentication_error") {
|
|
81
|
+
return mapSdkErrorToToolResult(err);
|
|
82
|
+
}
|
|
83
|
+
results.push({
|
|
84
|
+
item_id: String(itemId),
|
|
85
|
+
status: "failed",
|
|
86
|
+
error: {
|
|
87
|
+
type: e?.type ?? "transport",
|
|
88
|
+
...(e?.message ? { message: e.message } : {}),
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
content: [
|
|
95
|
+
{
|
|
96
|
+
type: "json",
|
|
97
|
+
json: {
|
|
98
|
+
order_id: parsed.order_id,
|
|
99
|
+
reason: parsed.reason,
|
|
100
|
+
items: results,
|
|
101
|
+
summary: {
|
|
102
|
+
total: results.length,
|
|
103
|
+
cancelled: results.filter((r) => r.status === "ok").length,
|
|
104
|
+
failed: results.filter((r) => r.status === "failed").length,
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
catch (err) {
|
|
112
|
+
return mapSdkErrorToToolResult(err);
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
export default cancelOrderWithReason;
|
|
117
|
+
//# sourceMappingURL=cancel_order_with_reason.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancel_order_with_reason.js","sourceRoot":"","sources":["../../../src/tools/tasks/cancel_order_with_reason.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,8CAA8C;AAC9C,8CAA8C;AAC9C,EAAE;AACF,yBAAyB;AACzB,6EAA6E;AAC7E,2EAA2E;AAC3E,2EAA2E;AAC3E,yEAAyE;AACzE,gFAAgF;AAEhF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,uBAAuB,GAGxB,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IAC3D,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,GAAG,CAAC;SACR,QAAQ,CAAC,mEAAmE,CAAC;CACjF,CAAC,CAAC;AAQH,MAAM,qBAAqB,GAAe;IACxC,IAAI,EAAE,0BAA0B;IAChC,IAAI,EAAE,MAAM;IACZ,6EAA6E;IAC7E,eAAe,EAAE,IAAI;IACrB,WAAW,EACT,kbAAkb;IACp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