@commercetools/tools-core 0.0.1 → 0.0.4
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/dist/index.cjs +11290 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +889 -0
- package/dist/index.d.ts +889 -5
- package/dist/index.js +7137 -1
- package/package.json +16 -11
- package/dist/decorators/test/tool.decorator.test.d.ts +0 -1
- package/dist/decorators/tool.decorator.d.ts +0 -26
- package/dist/handlers/base.handler.d.ts +0 -34
- package/dist/handlers/commercetools.handler.d.ts +0 -16
- package/dist/handlers/test/base.handler.test.d.ts +0 -1
- package/dist/handlers/test/commercetools.handler.test.d.ts +0 -1
- package/dist/handlers/test/fixtures.d.ts +0 -24
- package/dist/resources/customer/customer.handler.d.ts +0 -22
- package/dist/resources/customer/customer.prompt.d.ts +0 -4
- package/dist/resources/customer/customer.schema.d.ts +0 -281
- package/dist/resources/customer/test/customer.hander.test.d.ts +0 -1
- package/dist/resources/customer/test/fixtures.d.ts +0 -2
- package/dist/resources/project/project.handler.d.ts +0 -26
- package/dist/resources/project/project.prompt.d.ts +0 -2
- package/dist/resources/project/project.schema.d.ts +0 -454
- package/dist/resources/project/test/fixtures.d.ts +0 -2
- package/dist/resources/project/test/project.handler.test.d.ts +0 -1
- package/dist/shared/client/client.base.d.ts +0 -9
- package/dist/shared/client/sdk.commercetools.d.ts +0 -31
- package/dist/shared/errors/tool.error.d.ts +0 -34
- package/dist/shared/index.d.ts +0 -5
- package/dist/shared/types/interface.d.ts +0 -57
- package/dist/shared/types/types.d.ts +0 -4
- package/dist/utils/constants.d.ts +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/mcp-tools/mcp-tools/packages/core/dist/index.cjs","../src/index.ts","../src/utils/constants.ts","../src/handlers/base.handler.ts","../src/decorators/tool.decorator.ts","../src/resources/attribute-groups/attribute-groups.schema.ts","../src/resources/attribute-groups/attribute-groups.prompt.ts","../src/shared/errors/tool.error.ts","../src/shared/client/sdk.commercetools.ts","../src/shared/client/client.base.ts","../src/handlers/commercetools.handler.ts","../src/resources/attribute-groups/attribute-groups.handler.ts","../src/resources/categories/categories.schema.ts","../src/resources/categories/categories.prompt.ts","../src/resources/categories/categories.handler.ts","../src/resources/carts/carts.schema.ts","../src/resources/carts/carts.prompt.ts","../src/resources/carts/carts.handler.ts","../src/resources/channels/channels.handler.ts","../src/resources/channels/channels.schema.ts","../src/resources/channels/channels.prompt.ts","../src/resources/custom-objects/custom-objects.schema.ts","../src/resources/custom-objects/custom-objects.prompt.ts","../src/resources/custom-objects/custom-objects.handler.ts","../src/resources/customers/customers.schema.ts","../src/resources/customers/customers.prompt.ts","../src/resources/customers/customers.handler.ts","../src/resources/customer-groups/customer-groups.schema.ts","../src/resources/customer-groups/customer-groups.prompt.ts","../src/resources/customer-groups/customer-groups.handler.ts","../src/resources/customer-search/customer-search.schema.ts","../src/resources/customer-search/customer-search.prompt.ts","../src/resources/customer-search/customer-search.handler.ts","../src/resources/discount-codes/discount-codes.schema.ts","../src/resources/discount-codes/discount-codes.prompt.ts","../src/resources/discount-codes/discount-codes.handler.ts","../src/resources/extensions/extensions.schema.ts","../src/resources/extensions/extensions.prompt.ts","../src/resources/extensions/extensions.handler.ts","../src/resources/inventory/inventory.schema.ts","../src/resources/inventory/inventory.prompt.ts","../src/resources/inventory/inventory.handler.ts","../src/resources/messages/messages.schema.ts","../src/resources/messages/messages.prompt.ts","../src/resources/messages/messages.handler.ts","../src/resources/product-discounts/product-discounts.schema.ts","../src/resources/product-discounts/product-discounts.prompt.ts","../src/resources/product-discounts/product-discounts.handler.ts","../src/resources/product-projections/product-projections.schema.ts","../src/resources/product-projections/product-projections.prompt.ts","../src/resources/product-projections/product-projections.handler.ts","../src/resources/product-search/product-search.schema.ts","../src/resources/product-search/product-search.prompt.ts","../src/resources/product-search/product-search.handler.ts","../src/resources/product-selections/product-selections.schema.ts","../src/resources/product-selections/product-selections.prompt.ts","../src/resources/product-selections/product-selections.handler.ts","../src/resources/product-tailoring/product-tailoring.schema.ts","../src/resources/product-tailoring/product-tailoring.prompt.ts","../src/resources/product-tailoring/product-tailoring.handler.ts","../src/resources/product-types/product-types.schema.ts","../src/resources/product-types/product-types.prompt.ts","../src/resources/product-types/product-types.handler.ts","../src/resources/products/products.schema.ts","../src/resources/products/products.prompt.ts","../src/resources/products/products.handler.ts","../src/resources/project/project.handler.ts","../src/resources/project/project.schema.ts","../src/resources/project/project.prompt.ts","../src/resources/reviews/reviews.schema.ts","../src/resources/reviews/reviews.prompt.ts","../src/resources/reviews/reviews.handler.ts","../src/resources/standalone-prices/standalone-prices.schema.ts","../src/resources/standalone-prices/standalone-prices.prompt.ts","../src/resources/standalone-prices/standalone-prices.handler.ts","../src/resources/states/states.schema.ts","../src/resources/states/states.prompt.ts","../src/resources/states/states.handler.ts","../src/resources/stores/stores.schema.ts","../src/resources/stores/stores.prompt.ts","../src/resources/stores/stores.handler.ts","../src/resources/subscriptions/subscriptions.schema.ts","../src/resources/subscriptions/subscriptions.prompt.ts","../src/resources/subscriptions/subscriptions.handler.ts","../src/resources/tax-categories/tax-categories.schema.ts","../src/resources/tax-categories/tax-categories.prompt.ts","../src/resources/tax-categories/tax-categories.handler.ts","../src/resources/types/types.schema.ts","../src/resources/types/types.prompt.ts","../src/resources/types/types.handler.ts","../src/resources/zones/zones.schema.ts","../src/resources/zones/zones.prompt.ts","../src/resources/zones/zones.handler.ts"],"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__defNormalProp","obj","key","value","enumerable","configurable","writable","__export","target","all","name","get","__copyProps","to","from","except","desc","call","__toCommonJS","mod","__publicField","index_exports","ApiClientFactory","AttributeGroupsHandler","BaseResourceHandler","CartsHandler","CategoriesHandler","ChannelsHandler","CommercetoolsAPIClient","CustomObjectsHandler","CustomerGroupsHandler","CustomerSearchHandler","CustomersHandler","DEFAULT_API_URL","DiscountCodesHandler","ExtensionsHandler","InventoryHandler","MessagesHandler","OPERATIONS","ProductDiscountsHandler","ProductProjectionsHandler","ProductSearchHandler","ProductSelectionsHandler","ProductTailoringHandler","ProductTypesHandler","ProductsHandler","ProjectHandler","ReviewsHandler","StandalonePricesHandler","StatesHandler","StoresHandler","SubscriptionsHandler","TOOL_NAME_PREFIX","TaxCategoriesHandler","ToolExecutionError","ToolHandler","TypesHandler","ZonesHandler","createAttributeGroups","createCarts","createCategories","createChannels","createCustomObjects","createCustomerGroups","createCustomerSearch","createCustomers","createDiscountCodes","createExtensions","createInventory","createMessages","createProductDiscounts","createProductProjections","createProductSearch","createProductSelections","createProductTailoring","createProductTypes","createProducts","createReviews","createStandalonePrices","createStates","createStores","createSubscriptions","createTaxCategories","createTypes","createZones","deleteAttributeGroups","deleteCarts","deleteCategories","deleteChannels","deleteCustomObjects","deleteCustomerGroups","deleteCustomerSearch","deleteCustomers","deleteDiscountCodes","deleteExtensions","deleteInventory","deleteMessages","deleteProductDiscounts","deleteProductProjections","deleteProductSearch","deleteProductSelections","deleteProductTailoring","deleteProductTypes","deleteProducts","deleteReviews","deleteStandalonePrices","deleteStates","deleteStores","deleteSubscriptions","deleteTaxCategories","deleteTypes","deleteZones","getDecoratorRegisteredHandlers","readAttributeGroups","readCarts","readCategories","readChannels","readCustomObjects","readCustomerGroups","readCustomerSearch","readCustomers","readDiscountCodes","readExtensions","readInventory","readMessages","readProductDiscounts","readProductProjections","readProductSearch","readProductSelections","readProductTailoring","readProductTypes","readProducts","readProject","readReviews","readStandalonePrices","readStates","readStores","readSubscriptions","readTaxCategories","readTypes","readZones","updateAttributeGroups","updateCarts","updateCategories","updateChannels","updateCustomObjects","updateCustomerGroups","updateCustomerSearch","updateCustomers","updateDiscountCodes","updateExtensions","updateInventory","updateMessages","updateProductDiscounts","updateProductProjections","updateProductSearch","updateProductSelections","updateProductTailoring","updateProductTypes","updateProducts","updateProject","updateReviews","updateStandalonePrices","updateStates","updateStores","updateSubscriptions","updateTaxCategories","updateTypes","updateZones","module","exports","getToolName","operation","prefix","metadata","toolNamePrefix","namespace","getOperation","toolName","escapedPrefix","replace","regEx","RegExp","match","execute","context","schema","validatedParams","validatedContext","Error","schemas","parse","parameters","read","create","update","delete","getAllToolNames","map","op","getToolDefinition","description","inputSchema","getAllToolDefinitions","decoratorRegistry","constructor","handler","push","import_zod","require","readAttributeGroupsParameters","z","object","id","string","optional","where","array","sort","limit","number","int","min","max","offset","expand","createAttributeGroupsParameters","body","record","any","updateAttributeGroupsParameters","version","actions","deleteAttributeGroupsParameters","readAttributeGroupsPrompt","createAttributeGroupsPrompt","updateAttributeGroupsPrompt","deleteAttributeGroupsPrompt","_ToolExecutionError","message","originalError","extractOperation","projectKey","configuration","sessionId","timestamp","Date","captureStackTrace","toJSON","toISOString","stack","import_ts_client","import_platform_sdk","authToken","client","createClient","apiRoot","createApiBuilderFromCtpClient","getApiRoot","fn","baseUri","getClient","contructApiRoot","httpMiddlewareOptions","host","ClientBuilder","withHttpMiddleware","withConcurrentModificationMiddleware","withCorrelationIdMiddleware","generate","correlationId","withUserAgentMiddleware","libraryName","libraryVersion","withExistingTokenFlow","force","build","createApiClient","apiClient","CommercetoolsResourceHandler","apiClientFactory","prompts","getAttributeGroupsApi","api","attributeGroups","params","res","err","withProjectKey","withId","ID","withKey","queryArgs","created","post","currentVersion","s","updated","readCategoriesParameters","import_zod2","describe","createCategoriesParameters","slug","parent","typeId","literal","orderHint","externalId","metaTitle","metaDescription","metaKeywords","assets","custom","type","fields","updateCategoriesParameters","action","and","deleteCategoriesParameters","readCategoriesPrompt","createCategoriesPrompt","updateCategoriesPrompt","deleteCategoriesPrompt","getCategoriesApi","categories","category","error","categoryId","updatedCategory","readCartParameters","import_zod3","storeKey","createCartParameters","updateCartParameters","deleteCartParameters","dataErasure","boolean","readCartPrompt","createCartPrompt","updateCartPrompt","deleteCartPrompt","getCartsApi","inStoreKeyWithStoreKeyValue","carts","cartsApi","cartId","readChannelsParameters","import_zod4","createChannelsParameters","updateChannelsParameters","deleteChannelsParameters","readChannelsPrompt","createChannelsPrompt","updateChannelsPrompt","import_zod5","getChannelsApi","channels","channelId","readCustomObjectsParameters","import_zod6","container","createCustomObjectsParameters","updateCustomObjectsParameters","deleteCustomObjectsParameters","readCustomObjectsPrompt","createCustomObjectsPrompt","updateCustomObjectsPrompt","deleteCustomObjectsPrompt","getCustomObjectsApi","customObjects","withContainerAndKey","withContainer","readCustomerParameters","import_zod7","createCustomerParameters","email","password","firstName","lastName","middleName","title","dateOfBirth","companyName","vatId","addresses","streetName","streetNumber","additionalStreetInfo","postalCode","city","region","state","country","company","department","building","apartment","pOBox","phone","mobile","fax","additionalAddressInfo","defaultShippingAddress","defaultBillingAddress","shippingAddresses","billingAddresses","isEmailVerified","customerGroup","locale","salutation","updateCustomerParameters","deleteCustomerParameters","readCustomerPrompt","createCustomerPrompt","updateCustomerPrompt","deleteCustomerPrompt","getCustomersApi","customers","customer","updatedCustomer","readCustomerGroupsParameters","import_zod8","createCustomerGroupsParameters","groupName","updateCustomerGroupsParameters","deleteCustomerGroupsParameters","readCustomerGroupsPrompt","createCustomerGroupsPrompt","updateCustomerGroupsPrompt","deleteCustomerGroupsPrompt","getCustomerGroupsApi","customerGroups","apiResource","groupId","readCustomerSearchParameters","import_zod9","query","createCustomerSearchParameters","updateCustomerSearchParameters","deleteCustomerSearchParameters","readCustomerSearchPrompt","createCustomerSearchPrompt","updateCustomerSearchPrompt","deleteCustomerSearchPrompt","getCustomerSearchApi","search","searchResponse","readDiscountCodesParameters","import_zod10","createDiscountCodesParameters","code","cartDiscounts","cartPredicate","isActive","maxApplications","maxApplicationsPerCustomer","groups","validFrom","validUntil","updateDiscountCodesParameters","deleteDiscountCodesParameters","readDiscountCodesPrompt","createDiscountCodesPrompt","updateDiscountCodesPrompt","deleteDiscountCodesPrompt","getDiscountCodesApi","discountCodes","discountCode","discountCodeId","updatedDiscountCode","readExtensionsParameters","import_zod11","createExtensionsParameters","destination","enum","url","arn","accessKey","accessSecret","authentication","headerValue","connectionString","uri","triggers","resourceTypeId","condition","timeoutInMs","updateExtensionsParameters","deleteExtensionsParameters","readExtensionsPrompt","createExtensionsPrompt","updateExtensionsPrompt","deleteExtensionsPrompt","getExtensionsApi","extensions","extension","extensionId","updatedExtension","readInventoryParameters","import_zod12","sku","createInventoryParameters","quantityOnStock","supplyChannel","expectedDelivery","restockableInDays","updateInventoryParameters","unknown","deleteInventoryParameters","readInventoryPrompt","createInventoryPrompt","updateInventoryPrompt","deleteInventoryPrompt","getInventoryApi","inventory","inventoryEntry","inventoryEntries","inventoryEntryId","updateActions","updatedInventoryEntry","filter","readMessagesParameters","import_zod13","createMessagesParameters","updateMessagesParameters","deleteMessagesParameters","readMessagesPrompt","createMessagesPrompt","updateMessagesPrompt","deleteMessagesPrompt","getMessagesApi","messages","_context","readProductDiscountsParameters","import_zod14","createProductDiscountsParameters","predicate","sortOrder","references","updateProductDiscountsParameters","deleteProductDiscountsParameters","readProductDiscountsPrompt","createProductDiscountsPrompt","updateProductDiscountsPrompt","deleteProductDiscountsPrompt","getProductDiscountsApi","productDiscounts","productDiscount","productDiscountId","updatedProductDiscount","readProductProjectionsParameters","import_zod15","fuzzy","createProductProjectionsParameters","updateProductProjectionsParameters","deleteProductProjectionsParameters","readProductProjectionsPrompt","createProductProjectionsPrompt","updateProductProjectionsPrompt","deleteProductProjectionsPrompt","getProductProjectionsApi","productProjections","readProductSearchParameters","import_zod16","facet","markMatchingVariants","priceCurrency","priceCountry","priceCustomerGroup","priceChannel","localeProjection","storeProjection","createProductSearchParameters","updateProductSearchParameters","deleteProductSearchParameters","readProductSearchPrompt","createProductSearchPrompt","updateProductSearchPrompt","deleteProductSearchPrompt","getProductSearchApi","products","readProductSelectionsParameters","import_zod17","createProductSelectionsParameters","mode","updateProductSelectionsParameters","deleteProductSelectionsParameters","readProductSelectionsPrompt","createProductSelectionsPrompt","updateProductSelectionsPrompt","deleteProductSelectionsPrompt","getProductSelectionsApi","productSelections","productSelection","productSelectionId","updatedProductSelection","readProductTailoringParameters","import_zod18","productId","productKey","createProductTailoringParameters","variantTailoring","images","attributes","updateProductTailoringParameters","deleteProductTailoringParameters","readProductTailoringPrompt","createProductTailoringPrompt","updateProductTailoringPrompt","deleteProductTailoringPrompt","getProductTailoringApi","productTailoring","productTailorings","withProductId","productID","withProductKey","response","readProductTypesParameters","import_zod19","createProductTypesParameters","label","isRequired","isSearchable","attributeConstraint","inputHint","inputTip","updateProductTypesParameters","deleteProductTypesParameters","readProductTypesPrompt","createProductTypesPrompt","updateProductTypesPrompt","deleteProductTypesPrompt","getProductTypesApi","productTypes","productType","productTypeId","updatedProductType","readProductsParameters","import_zod20","createProductsParameters","categoryOrderHints","masterVariant","variants","taxCategory","reviewRatingStatistics","publish","priceMode","updateProductsParameters","deleteProductsParameters","readProductsPrompt","createProductsPrompt","updateProductsPrompt","deleteProductsPrompt","getProductsApi","product","updatedProduct","readProjectParameters","import_zod21","messagesConfigurationDraftSchema","enabled","deleteDaysAfterCreation","cartsConfigurationSchema","deleteDaysAfterLastModification","countryTaxRateFallbackEnabled","shoppingListsConfigurationSchema","customFieldLocalizedEnumValueSchema","shippingRateInputTypeSchema","discriminatedUnion","values","score","externalOAuthSchema","authorizationHeader","customerSearchStatusSchema","businessUnitSearchStatusSchema","orderSearchStatusSchema","productSearchIndexingModeSchema","businessUnitConfigurationStatusSchema","associateRoleResourceIdentifierSchema","changeNameSchema","changeCountriesSchema","countries","changeCurrenciesSchema","currencies","changeLanguagesSchema","languages","changeMessagesConfigurationSchema","messagesConfiguration","changeCartsConfigurationSchema","cartsConfiguration","changeCountryTaxRateFallbackEnabledSchema","changeShoppingListsConfigurationSchema","shoppingListsConfiguration","changeMyBusinessUnitStatusOnCreationSchema","status","setMyBusinessUnitAssociateRoleOnCreationSchema","associateRole","setShippingRateInputTypeSchema","shippingRateInputType","setExternalOAuthSchema","externalOAuth","changeProductSearchIndexingEnabledSchema","changeOrderSearchStatusSchema","changeCustomerSearchStatusSchema","changeBusinessUnitSearchStatusSchema","updateActionSchema","updateProjectParameters","readProjectPrompt","updateProjectPrompt","import_zod22","project","readReviewsParameters","import_zod23","createReviewsParameters","uniquenessValue","authorName","text","rating","updateReviewsParameters","deleteReviewsParameters","readReviewsPrompt","createReviewsPrompt","updateReviewsPrompt","deleteReviewsPrompt","getReviewsApi","reviews","review","reviewId","updatedReview","readStandalonePricesParameters","import_zod24","createStandalonePricesParameters","updateStandalonePricesParameters","deleteStandalonePricesParameters","readStandalonePricesPrompt","createStandalonePricesPrompt","updateStandalonePricesPrompt","deleteStandalonePricesPrompt","getStandalonePricesApi","standalonePrices","readStatesParameters","import_zod25","withTotal","createStatesParameters","updateStatesParameters","deleteStatesParameters","readStatesPrompt","createStatesPrompt","updateStatesPrompt","deleteStatesPrompt","getStatesApi","states","stateId","readStoresParameters","import_zod26","createStoresParameters","updateStoresParameters","deleteStoresParameters","readStoresPrompt","createStoresPrompt","updateStoresPrompt","deleteStoresPrompt","getStoresApi","stores","storeId","readSubscriptionsParameters","import_zod27","createSubscriptionsParameters","updateSubscriptionsParameters","deleteSubscriptionsParameters","readSubscriptionsPrompt","createSubscriptionsPrompt","updateSubscriptionsPrompt","deleteSubscriptionsPrompt","getSubscriptionsApi","subscriptions","readTaxCategoriesParameters","import_zod28","createTaxCategoriesParameters","rates","amount","includedInPrice","subRates","updateTaxCategoriesParameters","deleteTaxCategoriesParameters","readTaxCategoriesPrompt","createTaxCategoriesPrompt","updateTaxCategoriesPrompt","deleteTaxCategoriesPrompt","getTaxCategoriesApi","taxCategories","taxCategoryId","updatedTaxCategory","readTypesParameters","import_zod29","createTypesParameters","resourceTypeIds","fieldDefinitions","required","updateTypesParameters","deleteTypesParameters","readTypesPrompt","createTypesPrompt","updateTypesPrompt","deleteTypesPrompt","getTypesApi","types","updatedType","readZonesParameters","import_zod30","createZonesParameters","locations","updateZonesParameters","deleteZonesParameters","readZonesPrompt","createZonesPrompt","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BAAAA;IACAC,oBAAAA;IACAC,gBAAAA;IACAC,eAAAA;IACAC,eAAAA;IACAC,wBAAAA;IACAC,cAAAA;IACAC,cAAAA;IACAC,qBAAAA;IACAC,qBAAAA;IACAC,aAAAA;IACAC,aAAAA;AACF,CAAA","sourcesContent":["var __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n\n// src/index.ts\nvar index_exports = {};\n__export(index_exports, {\n ApiClientFactory: () => ApiClientFactory,\n AttributeGroupsHandler: () => AttributeGroupsHandler,\n BaseResourceHandler: () => BaseResourceHandler,\n CartsHandler: () => CartsHandler,\n CategoriesHandler: () => CategoriesHandler,\n ChannelsHandler: () => ChannelsHandler,\n CommercetoolsAPIClient: () => CommercetoolsAPIClient,\n CustomObjectsHandler: () => CustomObjectsHandler,\n CustomerGroupsHandler: () => CustomerGroupsHandler,\n CustomerSearchHandler: () => CustomerSearchHandler,\n CustomersHandler: () => CustomersHandler,\n DEFAULT_API_URL: () => DEFAULT_API_URL,\n DiscountCodesHandler: () => DiscountCodesHandler,\n ExtensionsHandler: () => ExtensionsHandler,\n InventoryHandler: () => InventoryHandler,\n MessagesHandler: () => MessagesHandler,\n OPERATIONS: () => OPERATIONS,\n ProductDiscountsHandler: () => ProductDiscountsHandler,\n ProductProjectionsHandler: () => ProductProjectionsHandler,\n ProductSearchHandler: () => ProductSearchHandler,\n ProductSelectionsHandler: () => ProductSelectionsHandler,\n ProductTailoringHandler: () => ProductTailoringHandler,\n ProductTypesHandler: () => ProductTypesHandler,\n ProductsHandler: () => ProductsHandler,\n ProjectHandler: () => ProjectHandler,\n ReviewsHandler: () => ReviewsHandler,\n StandalonePricesHandler: () => StandalonePricesHandler,\n StatesHandler: () => StatesHandler,\n StoresHandler: () => StoresHandler,\n SubscriptionsHandler: () => SubscriptionsHandler,\n TOOL_NAME_PREFIX: () => TOOL_NAME_PREFIX,\n TaxCategoriesHandler: () => TaxCategoriesHandler,\n ToolExecutionError: () => ToolExecutionError,\n ToolHandler: () => ToolHandler,\n TypesHandler: () => TypesHandler,\n ZonesHandler: () => ZonesHandler,\n createAttributeGroups: () => createAttributeGroups,\n createCarts: () => createCarts,\n createCategories: () => createCategories,\n createChannels: () => createChannels,\n createCustomObjects: () => createCustomObjects,\n createCustomerGroups: () => createCustomerGroups,\n createCustomerSearch: () => createCustomerSearch,\n createCustomers: () => createCustomers,\n createDiscountCodes: () => createDiscountCodes,\n createExtensions: () => createExtensions,\n createInventory: () => createInventory,\n createMessages: () => createMessages,\n createProductDiscounts: () => createProductDiscounts,\n createProductProjections: () => createProductProjections,\n createProductSearch: () => createProductSearch,\n createProductSelections: () => createProductSelections,\n createProductTailoring: () => createProductTailoring,\n createProductTypes: () => createProductTypes,\n createProducts: () => createProducts,\n createReviews: () => createReviews,\n createStandalonePrices: () => createStandalonePrices,\n createStates: () => createStates,\n createStores: () => createStores,\n createSubscriptions: () => createSubscriptions,\n createTaxCategories: () => createTaxCategories,\n createTypes: () => createTypes,\n createZones: () => createZones,\n deleteAttributeGroups: () => deleteAttributeGroups,\n deleteCarts: () => deleteCarts,\n deleteCategories: () => deleteCategories,\n deleteChannels: () => deleteChannels,\n deleteCustomObjects: () => deleteCustomObjects,\n deleteCustomerGroups: () => deleteCustomerGroups,\n deleteCustomerSearch: () => deleteCustomerSearch,\n deleteCustomers: () => deleteCustomers,\n deleteDiscountCodes: () => deleteDiscountCodes,\n deleteExtensions: () => deleteExtensions,\n deleteInventory: () => deleteInventory,\n deleteMessages: () => deleteMessages,\n deleteProductDiscounts: () => deleteProductDiscounts,\n deleteProductProjections: () => deleteProductProjections,\n deleteProductSearch: () => deleteProductSearch,\n deleteProductSelections: () => deleteProductSelections,\n deleteProductTailoring: () => deleteProductTailoring,\n deleteProductTypes: () => deleteProductTypes,\n deleteProducts: () => deleteProducts,\n deleteReviews: () => deleteReviews,\n deleteStandalonePrices: () => deleteStandalonePrices,\n deleteStates: () => deleteStates,\n deleteStores: () => deleteStores,\n deleteSubscriptions: () => deleteSubscriptions,\n deleteTaxCategories: () => deleteTaxCategories,\n deleteTypes: () => deleteTypes,\n deleteZones: () => deleteZones,\n getDecoratorRegisteredHandlers: () => getDecoratorRegisteredHandlers,\n readAttributeGroups: () => readAttributeGroups,\n readCarts: () => readCarts,\n readCategories: () => readCategories,\n readChannels: () => readChannels,\n readCustomObjects: () => readCustomObjects,\n readCustomerGroups: () => readCustomerGroups,\n readCustomerSearch: () => readCustomerSearch,\n readCustomers: () => readCustomers,\n readDiscountCodes: () => readDiscountCodes,\n readExtensions: () => readExtensions,\n readInventory: () => readInventory,\n readMessages: () => readMessages,\n readProductDiscounts: () => readProductDiscounts,\n readProductProjections: () => readProductProjections,\n readProductSearch: () => readProductSearch,\n readProductSelections: () => readProductSelections,\n readProductTailoring: () => readProductTailoring,\n readProductTypes: () => readProductTypes,\n readProducts: () => readProducts,\n readProject: () => readProject,\n readReviews: () => readReviews,\n readStandalonePrices: () => readStandalonePrices,\n readStates: () => readStates,\n readStores: () => readStores,\n readSubscriptions: () => readSubscriptions,\n readTaxCategories: () => readTaxCategories,\n readTypes: () => readTypes,\n readZones: () => readZones,\n updateAttributeGroups: () => updateAttributeGroups,\n updateCarts: () => updateCarts,\n updateCategories: () => updateCategories,\n updateChannels: () => updateChannels,\n updateCustomObjects: () => updateCustomObjects,\n updateCustomerGroups: () => updateCustomerGroups,\n updateCustomerSearch: () => updateCustomerSearch,\n updateCustomers: () => updateCustomers,\n updateDiscountCodes: () => updateDiscountCodes,\n updateExtensions: () => updateExtensions,\n updateInventory: () => updateInventory,\n updateMessages: () => updateMessages,\n updateProductDiscounts: () => updateProductDiscounts,\n updateProductProjections: () => updateProductProjections,\n updateProductSearch: () => updateProductSearch,\n updateProductSelections: () => updateProductSelections,\n updateProductTailoring: () => updateProductTailoring,\n updateProductTypes: () => updateProductTypes,\n updateProducts: () => updateProducts,\n updateProject: () => updateProject,\n updateReviews: () => updateReviews,\n updateStandalonePrices: () => updateStandalonePrices,\n updateStates: () => updateStates,\n updateStores: () => updateStores,\n updateSubscriptions: () => updateSubscriptions,\n updateTaxCategories: () => updateTaxCategories,\n updateTypes: () => updateTypes,\n updateZones: () => updateZones\n});\nmodule.exports = __toCommonJS(index_exports);\n\n// src/utils/constants.ts\nvar TOOL_NAME_PREFIX = \"\";\nvar OPERATIONS = [\"read\", \"create\", \"update\", \"delete\"];\nvar DEFAULT_API_URL = \"https://api.europe-west1.gcp.commercetools.com\";\n\n// src/handlers/base.handler.ts\nvar BaseResourceHandler = class {\n // Generic tool name generation\n // Pattern: {namespace}.{operation}\n // Examples: \"products.read\", \"product-discount.create\"\n getToolName(operation) {\n const prefix = this.metadata.toolNamePrefix || \"\";\n return `${prefix}${this.metadata.namespace}.${operation}`;\n }\n // Generic operation extraction\n // Pattern: {prefix}{namespace}.{operation}\n // Examples: \"products.read\", \"product-discount.create\", \"mcp_products.read\"\n getOperation(toolName) {\n const prefix = this.metadata.toolNamePrefix || \"\";\n const escapedPrefix = prefix.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const regEx = new RegExp(\n `^${escapedPrefix}(.+)\\\\.(read|create|update|delete)$`\n );\n const match = toolName.match(regEx);\n if (match && match[1] === this.metadata.namespace) {\n return match[2];\n }\n return null;\n }\n // Generic execution routing (no API client assumptions)\n async execute(context) {\n const { toolName } = context;\n const operation = this.getOperation(toolName);\n if (!operation) {\n throw new Error(`Unknown ${this.metadata.namespace} tool: ${toolName}`);\n }\n const schema = this.metadata.schemas[operation];\n const validatedParams = schema.parse(context.parameters);\n const validatedContext = {\n ...context,\n parameters: validatedParams\n };\n switch (operation) {\n case \"read\":\n return this.read(validatedContext);\n case \"create\":\n return this.create(validatedContext);\n case \"update\":\n return this.update(validatedContext);\n case \"delete\":\n return this.delete(validatedContext);\n default:\n throw new Error(`Unsupported operation: ${operation}`);\n }\n }\n getAllToolNames() {\n return OPERATIONS.map((op) => this.getToolName(op));\n }\n getToolDefinition(operation) {\n return {\n name: this.getToolName(operation),\n description: `${operation} ${this.metadata.namespace}`,\n inputSchema: this.metadata.schemas[operation]\n };\n }\n getAllToolDefinitions() {\n return OPERATIONS.map(\n (op) => this.getToolDefinition(op)\n );\n }\n};\n\n// src/decorators/tool.decorator.ts\nvar decoratorRegistry = [];\nfunction ToolHandler() {\n return function(constructor) {\n const handler = new constructor();\n decoratorRegistry.push(handler);\n return constructor;\n };\n}\nfunction getDecoratorRegisteredHandlers() {\n return [...decoratorRegistry];\n}\n\n// src/resources/attribute-groups/attribute-groups.schema.ts\nvar import_zod = require(\"zod\");\nvar readAttributeGroupsParameters = import_zod.z.object({\n id: import_zod.z.string().optional(),\n key: import_zod.z.string().optional(),\n where: import_zod.z.array(import_zod.z.string()).optional(),\n sort: import_zod.z.array(import_zod.z.string()).optional(),\n limit: import_zod.z.number().int().min(1).max(500).optional(),\n offset: import_zod.z.number().int().optional(),\n expand: import_zod.z.array(import_zod.z.string()).optional()\n});\nvar createAttributeGroupsParameters = import_zod.z.object({\n body: import_zod.z.record(import_zod.z.any())\n});\nvar updateAttributeGroupsParameters = import_zod.z.object({\n id: import_zod.z.string().optional(),\n key: import_zod.z.string().optional(),\n version: import_zod.z.number().optional(),\n actions: import_zod.z.array(import_zod.z.record(import_zod.z.any())).optional()\n});\nvar deleteAttributeGroupsParameters = import_zod.z.object({\n id: import_zod.z.string().optional(),\n key: import_zod.z.string().optional(),\n version: import_zod.z.number().optional()\n});\n\n// src/resources/attribute-groups/attribute-groups.prompt.ts\nvar readAttributeGroupsPrompt = \"Read attribute groups parameters\";\nvar createAttributeGroupsPrompt = \"Create attribute group parameters\";\nvar updateAttributeGroupsPrompt = \"Update attribute group parameters\";\nvar deleteAttributeGroupsPrompt = \"Delete attribute group parameters\";\n\n// src/shared/errors/tool.error.ts\nvar ToolExecutionError = class _ToolExecutionError extends Error {\n constructor(message, context, originalError) {\n super(message);\n __publicField(this, \"toolName\");\n __publicField(this, \"operation\");\n __publicField(this, \"projectKey\");\n __publicField(this, \"sessionId\");\n __publicField(this, \"parameters\");\n __publicField(this, \"originalError\");\n __publicField(this, \"timestamp\");\n this.name = \"ToolExecutionError\";\n this.toolName = context.toolName;\n this.operation = this.extractOperation(context.toolName);\n this.projectKey = context.configuration.projectKey;\n this.sessionId = context.sessionId;\n this.parameters = context.parameters;\n this.originalError = originalError;\n this.timestamp = /* @__PURE__ */ new Date();\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, _ToolExecutionError);\n }\n }\n /**\n * Extract operation from tool name\n */\n extractOperation(toolName) {\n const match = toolName.match(\n /^mcp_commercetools_(read|create|update|delete)_(.+)$/\n );\n return match && match[1] ? match[1] : \"unknown\";\n }\n /**\n * Get error details for logging/debugging\n */\n toJSON() {\n return {\n name: this.name,\n message: this.message,\n toolName: this.toolName,\n operation: this.operation,\n projectKey: this.projectKey,\n sessionId: this.sessionId,\n parameters: this.parameters,\n timestamp: this.timestamp.toISOString(),\n originalError: this.originalError instanceof Error ? {\n name: this.originalError.name,\n message: this.originalError.message,\n stack: this.originalError.stack\n } : this.originalError,\n stack: this.stack\n };\n }\n};\n\n// src/shared/client/sdk.commercetools.ts\nvar import_ts_client = require(\"@commercetools/ts-client\");\nvar import_platform_sdk = require(\"@commercetools/platform-sdk\");\nvar CommercetoolsAPIClient = class {\n constructor(configuration, authToken) {\n __publicField(this, \"client\");\n __publicField(this, \"apiRoot\");\n __publicField(this, \"configuration\");\n __publicField(this, \"authToken\");\n this.authToken = authToken;\n this.client = this.createClient();\n this.configuration = configuration;\n if (!this.client) {\n throw new Error(\"Failed to create commercetools client\");\n }\n this.apiRoot = (0, import_platform_sdk.createApiBuilderFromCtpClient)(this.client);\n }\n /**\n * Get the API root instance\n */\n getApiRoot(fn, baseUri) {\n if (fn && typeof fn === \"function\") {\n return fn(this.client, baseUri);\n }\n return this.apiRoot;\n }\n /**\n * Get the client instance\n */\n getClient() {\n return this.client;\n }\n /**\n * Construct an apiRoot\n */\n contructApiRoot(client, fn, baseUri) {\n return fn(client, baseUri);\n }\n /**\n * Create commercetools client\n */\n createClient() {\n const httpMiddlewareOptions = {\n host: DEFAULT_API_URL\n };\n const client = new import_ts_client.ClientBuilder().withHttpMiddleware(httpMiddlewareOptions).withConcurrentModificationMiddleware().withCorrelationIdMiddleware({\n generate: () => this.configuration.correlationId\n }).withUserAgentMiddleware({\n libraryName: \"multitenant-mcp-service\",\n libraryVersion: \"1.0.0\"\n });\n if (!this.authToken) {\n throw new Error(\"Authentication token is required\");\n }\n return client.withExistingTokenFlow(`Bearer ${this.authToken}`, { force: true }).build();\n }\n};\n\n// src/shared/client/client.base.ts\nvar ApiClientFactory = class {\n createApiClient(configuration, authToken) {\n const apiClient = new CommercetoolsAPIClient(\n configuration,\n authToken\n );\n return apiClient.getApiRoot();\n }\n getApiRoot(configuration, authToken) {\n return new CommercetoolsAPIClient(\n configuration,\n authToken\n );\n }\n};\n\n// src/handlers/commercetools.handler.ts\nvar CommercetoolsResourceHandler = class extends BaseResourceHandler {\n constructor(apiClientFactory) {\n super();\n __publicField(this, \"apiClientFactory\");\n this.apiClientFactory = apiClientFactory || new ApiClientFactory();\n }\n /**\n * Get the API root instance for commercetools\n */\n getApiRoot(context) {\n return this.apiClientFactory.createApiClient(\n context.configuration,\n context.authToken\n );\n }\n};\n\n// src/resources/attribute-groups/attribute-groups.handler.ts\nvar AttributeGroupsHandler = class extends CommercetoolsResourceHandler {\n constructor(apiClientFactory) {\n super(apiClientFactory);\n __publicField(this, \"metadata\", {\n namespace: \"attribute-groups\",\n description: \"Manage attribute groups in commercetools\",\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readAttributeGroupsParameters,\n create: createAttributeGroupsParameters,\n update: updateAttributeGroupsParameters,\n delete: deleteAttributeGroupsParameters\n }\n });\n }\n getToolDefinition(operation) {\n const prompts = {\n read: readAttributeGroupsPrompt,\n create: createAttributeGroupsPrompt,\n update: updateAttributeGroupsPrompt,\n delete: deleteAttributeGroupsPrompt\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation]\n };\n }\n getAttributeGroupsApi(api) {\n return api.attributeGroups();\n }\n async read(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n if (params?.id) {\n const res = await this.getAttributeGroupsApi(api).withId({ ID: params.id }).get().execute();\n return res.body;\n } else if (params?.key) {\n const res = await this.getAttributeGroupsApi(api).withKey({ key: params.key }).get().execute();\n return res.body;\n } else {\n const res = await this.getAttributeGroupsApi(api).get({\n queryArgs: {\n ...params.limit && { limit: params.limit },\n ...params.offset && { offset: params.offset }\n }\n }).execute();\n return res.body;\n }\n } catch (err) {\n throw new ToolExecutionError(\n \"Failed to read attribute groups\",\n context,\n err\n );\n }\n }\n async create(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n const created = await this.getAttributeGroupsApi(api).post({ body: params }).execute();\n return created.body;\n } catch (err) {\n throw new ToolExecutionError(\n \"Failed to create attribute group\",\n context,\n err\n );\n }\n }\n async update(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n let currentVersion = params.version;\n let id = params.id;\n if (!id && params.key) {\n const s = await this.getAttributeGroupsApi(api).withKey({ key: params.key }).get().execute();\n id = s.body.id;\n currentVersion = s.body.version;\n }\n if (!id)\n throw new ToolExecutionError(\n \"Either id or key must be provided\",\n context\n );\n const updated = await this.getAttributeGroupsApi(api).withId({ ID: id }).post({\n body: {\n version: currentVersion,\n actions: params.actions\n }\n }).execute();\n return updated.body;\n } catch (err) {\n throw new ToolExecutionError(\n \"Failed to update attribute group\",\n context,\n err\n );\n }\n }\n async delete(context) {\n throw new ToolExecutionError(\n \"Delete not supported for attribute groups\",\n context\n );\n }\n};\nasync function readAttributeGroups(context, apiClientFactory) {\n const handler = new AttributeGroupsHandler(apiClientFactory);\n return handler.read(context);\n}\nasync function createAttributeGroups(context, apiClientFactory) {\n const handler = new AttributeGroupsHandler(apiClientFactory);\n return handler.create(context);\n}\nasync function updateAttributeGroups(context, apiClientFactory) {\n const handler = new AttributeGroupsHandler(apiClientFactory);\n return handler.update(context);\n}\nasync function deleteAttributeGroups(context, apiClientFactory) {\n const handler = new AttributeGroupsHandler(apiClientFactory);\n return handler.delete(context);\n}\n\n// src/resources/categories/categories.schema.ts\nvar import_zod2 = require(\"zod\");\nvar readCategoriesParameters = import_zod2.z.object({\n id: import_zod2.z.string().optional().describe(\"Category ID\"),\n key: import_zod2.z.string().optional().describe(\"Category key\"),\n where: import_zod2.z.array(import_zod2.z.string()).optional().describe(\n 'Query predicates specified as strings. Example: [\"key = \\\\\"my-category\\\\\"\"]'\n ),\n sort: import_zod2.z.array(import_zod2.z.string()).optional().describe(\n 'Sort criteria for the results. Example: [\"key asc\", \"createdAt desc\"]'\n ),\n limit: import_zod2.z.number().int().min(1).max(500).optional().describe(\n \"A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\"\n ),\n offset: import_zod2.z.number().int().min(0).optional().describe(\n \"The number of items to skip before starting to collect the result set.\"\n ),\n expand: import_zod2.z.array(import_zod2.z.string()).optional().describe('Fields to expand. Example: [\"parent\", \"ancestors[*]\"]')\n});\nvar createCategoriesParameters = import_zod2.z.object({\n key: import_zod2.z.string().min(2).max(256).optional().describe(\"User-defined unique identifier for the category\"),\n name: import_zod2.z.record(import_zod2.z.string()).describe(\"Category name (localized string)\"),\n slug: import_zod2.z.record(import_zod2.z.string()).describe(\"Category slug (localized string)\"),\n description: import_zod2.z.record(import_zod2.z.string()).optional().describe(\"Category description (localized string)\"),\n parent: import_zod2.z.object({\n id: import_zod2.z.string().optional(),\n key: import_zod2.z.string().optional(),\n typeId: import_zod2.z.literal(\"category\")\n }).optional().describe(\"Parent category reference\"),\n orderHint: import_zod2.z.string().optional().describe(\"String value used to order categories\"),\n externalId: import_zod2.z.string().optional().describe(\"External ID for integration with external systems\"),\n metaTitle: import_zod2.z.record(import_zod2.z.string()).optional().describe(\"Meta title (localized string)\"),\n metaDescription: import_zod2.z.record(import_zod2.z.string()).optional().describe(\"Meta description (localized string)\"),\n metaKeywords: import_zod2.z.record(import_zod2.z.string()).optional().describe(\"Meta keywords (localized string)\"),\n assets: import_zod2.z.array(import_zod2.z.any()).optional().describe(\"Assets for the category\"),\n custom: import_zod2.z.object({\n type: import_zod2.z.object({\n id: import_zod2.z.string(),\n typeId: import_zod2.z.literal(\"type\")\n }).optional(),\n fields: import_zod2.z.record(import_zod2.z.string(), import_zod2.z.any()).optional()\n }).optional().describe(\"Custom fields for the category\")\n});\nvar updateCategoriesParameters = import_zod2.z.object({\n id: import_zod2.z.string().optional().describe(\"The ID of the category to update\"),\n key: import_zod2.z.string().optional().describe(\"The key of the category to update\"),\n version: import_zod2.z.number().int().describe(\"The current version of the category\"),\n actions: import_zod2.z.array(\n import_zod2.z.object({\n action: import_zod2.z.string().describe(\"The name of the update action to perform\")\n }).and(import_zod2.z.record(import_zod2.z.string(), import_zod2.z.any()).optional()).describe(\n 'Array of update actions to perform on the category. Each action should have an \"action\" field and other fields specific to that action type.'\n )\n ).describe(\"Update actions\")\n});\nvar deleteCategoriesParameters = import_zod2.z.object({\n id: import_zod2.z.string().optional().describe(\"Category ID\"),\n key: import_zod2.z.string().optional().describe(\"Category key\"),\n version: import_zod2.z.number().int().describe(\"Current version (for optimistic locking)\")\n});\n\n// src/resources/categories/categories.prompt.ts\nvar readCategoriesPrompt = `\nThis tool will fetch a Category by ID or key (if provided) from commercetools or query all available categories in a commercetools project if no arguments or parameters are provided.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the category to fetch.\n- key (string, optional): The key of the category to fetch.\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"key = \\\\\"my-category\\\\\"\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"key asc\", \"createdAt desc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- expand (array of strings, optional): Fields to expand. Example: [\"parent\", \"ancestors[*]\"]\n`;\nvar createCategoriesPrompt = `\nThis tool will create a new Category in commercetools.\n\nIt takes these required arguments:\n- name (object): Category name (localized string, object with language codes as keys). Example: {\"en\": \"Electronics\", \"de\": \"Elektronik\"}\n- slug (object): Category slug (localized string, object with language codes as keys). Example: {\"en\": \"electronics\", \"de\": \"elektronik\"}\n\nIt takes these optional arguments:\n- key (string, optional): User-defined unique identifier for the category (2-256 characters, alphanumeric with underscores/hyphens).\n- description (object, optional): Category description (localized string, object with language codes as keys).\n- parent (object, optional): Parent category reference. Must have typeId \"category\" and either id or key.\n- orderHint (string, optional): String value used to order categories.\n- externalId (string, optional): External ID for integration with external systems.\n- metaTitle (object, optional): Meta title (localized string).\n- metaDescription (object, optional): Meta description (localized string).\n- metaKeywords (object, optional): Meta keywords (localized string).\n- assets (array, optional): Assets for the category.\n- custom (object, optional): Custom fields for the category.\n`;\nvar updateCategoriesPrompt = `\nThis tool will update a Category in commercetools using update actions from the commercetools API.\n\nIt takes these required arguments:\n- version (integer): The current version of the category.\n- actions (array): An array of update actions to perform on the category. Each action should have an \"action\" field indicating the action type.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the category to update (required if key is not provided).\n- key (string, optional): The key of the category to update (required if id is not provided).\n\nExample actions from commercetools API include:\n- addAsset\n- changeAssetName\n- changeAssetOrder\n- changeName\n- changeOrderHint\n- changeParent\n- changeSlug\n- removeAsset\n- setAssetCustomField\n- setAssetCustomType\n- setAssetDescription\n- setAssetKey\n- setAssetSources\n- setAssetTags\n- setCustomField\n- setCustomType\n- setDescription\n- setExternalId\n- setKey\n- setMetaDescription\n- setMetaKeywords\n- setMetaTitle\n\nEach action type requires specific fields according to the commercetools API.\n`;\nvar deleteCategoriesPrompt = `\nThis tool will delete a Category from commercetools.\n\nIt takes these required arguments:\n- version (integer): The current version of the category (for optimistic locking).\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the category to delete (required if key is not provided).\n- key (string, optional): The key of the category to delete (required if id is not provided).\n`;\n\n// src/resources/categories/categories.handler.ts\nvar CategoriesHandler = class extends CommercetoolsResourceHandler {\n constructor(apiClientFactory) {\n super(apiClientFactory);\n __publicField(this, \"metadata\", {\n namespace: \"categories\",\n description: \"Manage categories in commercetools\",\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readCategoriesParameters,\n create: createCategoriesParameters,\n update: updateCategoriesParameters,\n delete: deleteCategoriesParameters\n }\n });\n }\n getToolDefinition(operation) {\n const prompts = {\n read: readCategoriesPrompt,\n create: createCategoriesPrompt,\n update: updateCategoriesPrompt,\n delete: deleteCategoriesPrompt\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation]\n };\n }\n getCategoriesApi(api) {\n return api.categories();\n }\n async read(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n if (params?.id) {\n const category = await this.getCategoriesApi(api).withId({ ID: params.id }).get({\n queryArgs: {\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return category.body;\n } else if (params?.key) {\n const category = await this.getCategoriesApi(api).withKey({ key: params.key }).get({\n queryArgs: {\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return category.body;\n } else {\n const categories = await this.getCategoriesApi(api).get({\n queryArgs: {\n limit: params.limit || 20,\n ...params.offset && { offset: params.offset },\n ...params.sort && { sort: params.sort },\n ...params.where && { where: params.where },\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return categories.body;\n }\n } catch (err) {\n throw new ToolExecutionError(\n err.message || \"Failed to read categories\",\n context,\n err\n );\n }\n }\n async create(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n const category = await this.getCategoriesApi(api).post({\n body: params\n }).execute();\n return category.body;\n } catch (error) {\n throw new ToolExecutionError(\"Failed to create category\", context, error);\n }\n }\n async update(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n let currentVersion;\n let categoryId;\n if (params.id) {\n const category = await this.getCategoriesApi(api).withId({ ID: params.id }).get().execute();\n currentVersion = category.body.version;\n categoryId = params.id;\n } else if (params.key) {\n const category = await this.getCategoriesApi(api).withKey({ key: params.key }).get().execute();\n currentVersion = category.body.version;\n categoryId = category.body.id;\n } else {\n throw new ToolExecutionError(\n \"Either id or key must be provided\",\n context\n );\n }\n const updatedCategory = await this.getCategoriesApi(api).withId({ ID: categoryId }).post({\n body: {\n version: currentVersion,\n actions: params.actions\n }\n }).execute();\n return updatedCategory.body;\n } catch (error) {\n throw new ToolExecutionError(\"Failed to update category\", context, error);\n }\n }\n async delete(context) {\n throw new ToolExecutionError(\"Not implemented\", context);\n }\n};\nasync function readCategories(context, apiClientFactory) {\n const handler = new CategoriesHandler(apiClientFactory);\n return handler.read(context);\n}\nasync function createCategories(context, apiClientFactory) {\n const handler = new CategoriesHandler(apiClientFactory);\n return handler.create(context);\n}\nasync function updateCategories(context, apiClientFactory) {\n const handler = new CategoriesHandler(apiClientFactory);\n return handler.update(context);\n}\nasync function deleteCategories(context, apiClientFactory) {\n const handler = new CategoriesHandler(apiClientFactory);\n return handler.delete(context);\n}\n\n// src/resources/carts/carts.schema.ts\nvar import_zod3 = require(\"zod\");\nvar readCartParameters = import_zod3.z.object({\n id: import_zod3.z.string().optional().describe(\"Cart ID\"),\n key: import_zod3.z.string().optional().describe(\"Cart key (user-defined unique identifier)\"),\n storeKey: import_zod3.z.string().optional().describe(\n \"Store key. When provided, the request is executed in the context of that store (store-specific carts). Omit for project-level carts.\"\n ),\n where: import_zod3.z.array(import_zod3.z.string()).optional().describe(\n 'Query predicates specified as strings. Example: [\"customerId = \\\\\"customer-123\\\\\"\"] or [\"key = \\\\\"cart-key-1\\\\\"\"]'\n ),\n sort: import_zod3.z.array(import_zod3.z.string()).optional().describe(\n 'Sort criteria for the results. Example: [\"createdAt desc\", \"lastModifiedAt desc\"]'\n ),\n limit: import_zod3.z.number().int().min(1).max(500).optional().describe(\n \"A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\"\n ),\n offset: import_zod3.z.number().int().min(0).optional().describe(\n \"The number of items to skip before starting to collect the result set.\"\n ),\n expand: import_zod3.z.array(import_zod3.z.string()).optional().describe(\n 'Fields to expand. Example: [\"lineItems[*].variant\", \"shippingInfo.shippingMethod\", \"discountCodes[*]\"]'\n )\n});\nvar createCartParameters = import_zod3.z.object({\n storeKey: import_zod3.z.string().optional().describe(\n \"Store key. When provided, the cart is created in the context of that store. Omit for project-level carts.\"\n ),\n body: import_zod3.z.record(import_zod3.z.any()).describe(\n \"Cart draft (CartDraft). Required fields typically include: currency (string, ISO 4217), and optionally: country (string, ISO 3166-1 alpha-2), key, customerId, customerEmail, inventoryMode (Single|None), lineItems (array), customLineItems (array), shippingAddress (Address), billingAddress (Address), shippingMethod (ResourceIdentifier), store (ResourceIdentifier), locale, taxMode (Platform|External), taxRoundingMode, taxCalculationMode, externalTaxRateForShippingMethod, discountCodes (array of strings), custom (type + fields), deleteDaysAfterLastModification, itemShippingAddresses (array of Address), etc. See commercetools API docs for CartDraft for full structure.\"\n )\n});\nvar updateCartParameters = import_zod3.z.object({\n id: import_zod3.z.string().optional().describe(\"The ID of the cart to update\"),\n key: import_zod3.z.string().optional().describe(\"The key of the cart to update\"),\n storeKey: import_zod3.z.string().optional().describe(\"Store key when the cart is store-specific\"),\n version: import_zod3.z.number().int().describe(\"The current version of the cart (for optimistic locking)\"),\n actions: import_zod3.z.array(import_zod3.z.record(import_zod3.z.any())).optional().describe(\n 'Update actions. Each action must have an \"action\" field (e.g. addLineItem, setShippingAddress, addDiscountCode, recalculate, etc.) and fields specific to that action. See commercetools Cart update actions documentation.'\n )\n});\nvar deleteCartParameters = import_zod3.z.object({\n id: import_zod3.z.string().optional().describe(\"Cart ID (required if key is not provided)\"),\n key: import_zod3.z.string().optional().describe(\"Cart key (required if id is not provided)\"),\n storeKey: import_zod3.z.string().optional().describe(\"Store key when the cart is store-specific\"),\n version: import_zod3.z.number().int().describe(\"Current version of the cart (for optimistic locking)\"),\n dataErasure: import_zod3.z.boolean().optional().describe(\n \"When true, personal data (e.g. email, addresses) associated with the cart is deleted. Default is false.\"\n )\n});\n\n// src/resources/carts/carts.prompt.ts\nvar readCartPrompt = `\nThis tool will fetch a Cart by ID or key (if provided) from commercetools, optionally in a store context, or query carts in the project (or in a store when storeKey is provided).\n\nCarts hold line items, custom line items, shipping and billing addresses, and can be converted to orders. They can be project-level or store-specific.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the cart to fetch.\n- key (string, optional): The key of the cart to fetch (user-defined unique identifier).\n- storeKey (string, optional): The key of the store. When provided, the request is executed in the context of that store (for store-specific carts). Omit for project-level carts.\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"customerId = \\\\\"customer-123\\\\\"\"] or [\"key = \\\\\"cart-key-1\\\\\"\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"createdAt desc\", \"lastModifiedAt desc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- expand (array of strings, optional): Fields to expand. Example: [\"lineItems[*].variant\", \"shippingInfo.shippingMethod\", \"discountCodes[*]\"]\n`;\nvar createCartPrompt = `\nThis tool will create a new Cart in commercetools (optionally in a store when storeKey is provided).\n\nA cart requires at least a currency (and often a country for shipping/tax). You can add line items, shipping address, discount codes, and more at creation or in a follow-up update.\n\nIt takes these required arguments:\n- body (object): Cart draft (CartDraft). Must include at least:\n - currency (string): ISO 4217 currency code (e.g. \"USD\", \"EUR\").\n\nIt takes these optional arguments:\n- storeKey (string, optional): The key of the store. When provided, the cart is created in the context of that store. Omit for project-level carts.\n- body fields (all optional except currency): country (string, ISO 3166-1 alpha-2), key (string), customerId (string), customerEmail (string), inventoryMode (\"Single\" or \"None\"), lineItems (array of LineItemDraft: productId, variantId, quantity, supplyChannel, distributionChannel, custom, etc.), customLineItems (array of CustomLineItemDraft), shippingAddress (Address), billingAddress (Address), shippingMethod (ResourceIdentifier to ShippingMethod), store (ResourceIdentifier to Store), locale (string), taxMode (\"Platform\" or \"External\"), taxRoundingMode, taxCalculationMode, externalTaxRateForShippingMethod (ExternalTaxRateDraft), discountCodes (array of discount code strings), custom (type + fields), deleteDaysAfterLastModification (number), itemShippingAddresses (array of Address), origin (Customer or Merchant), etc. See the commercetools API documentation for CartDraft for the complete structure and nested types.\n`;\nvar updateCartPrompt = `\nThis tool will update a Cart in commercetools using update actions.\n\nIt takes these required arguments:\n- version (integer): The current version of the cart (for optimistic locking).\n- Either id or key must be provided to identify the cart.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the cart to update (required if key is not provided).\n- key (string, optional): The key of the cart to update (required if id is not provided).\n- storeKey (string, optional): The key of the store when the cart is store-specific.\n- actions (array, optional): An array of update actions. Each action must have an \"action\" field indicating the action type and any required fields for that action.\n\nExample actions from the commercetools Cart API include:\n- addLineItem: Add a line item. Fields: productId, variantId?, sku?, quantity?, supplyChannel?, distributionChannel?, custom?, addedAt?, shippingDetails?\n- removeLineItem: Remove a line item. Fields: lineItemId, quantity?\n- changeLineItemQuantity: Change line item quantity. Fields: lineItemId, quantity\n- setLineItemShippingDetails: Set shipping details for a line item. Fields: lineItemId, shippingDetails?\n- addCustomLineItem: Add a custom line item. Fields: name (LocalizedString), quantity, money, slug, taxCategory?, externalTaxRate?, custom?\n- removeCustomLineItem: Remove a custom line item. Fields: customLineItemId\n- setShippingAddress: Set shipping address. Fields: address?\n- setBillingAddress: Set billing address. Fields: address?\n- setShippingMethod: Set shipping method. Fields: shippingMethod?, externalTaxRate?\n- addDiscountCode: Add a discount code. Fields: code\n- removeDiscountCode: Remove a discount code. Fields: discountCode (Reference)\n- recalculate: Recalculate cart (prices, taxes, totals). Fields: updateProductData?\n- setKey: Set cart key. Fields: key?\n- setCustomerId: Set customer ID. Fields: customerId?\n- setCustomerEmail: Set customer email. Fields: email?\n- setCustomType: Set custom type. Fields: type?, fields?\n- setCustomField: Set custom field. Fields: name, value?\n- setLocale: Set locale. Fields: locale?\n- setDeleteDaysAfterLastModification: Set delete days. Fields: deleteDaysAfterLastModification?\n- setItemShippingAddress: Set item shipping address. Fields: addressKey, address?\n- addItemShippingAddress: Add item shipping address. Fields: address\n- removeItemShippingAddress: Remove item shipping address. Fields: addressKey\n\nEach action type requires specific fields according to the commercetools API documentation.\n`;\nvar deleteCartPrompt = `\nThis tool will delete a Cart from commercetools.\n\nIt takes these required arguments:\n- version (integer): The current version of the cart (for optimistic locking).\n- Either id or key must be provided to identify the cart.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the cart to delete (required if key is not provided).\n- key (string, optional): The key of the cart to delete (required if id is not provided).\n- storeKey (string, optional): The key of the store when the cart is store-specific.\n- dataErasure (boolean, optional): When true, personal data (e.g. email, addresses) associated with the cart is deleted. Default is false.\n`;\n\n// src/resources/carts/carts.handler.ts\nvar CartsHandler = class extends CommercetoolsResourceHandler {\n constructor(apiClientFactory) {\n super(apiClientFactory);\n __publicField(this, \"metadata\", {\n namespace: \"carts\",\n description: \"Manage carts in commercetools\",\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readCartParameters,\n create: createCartParameters,\n update: updateCartParameters,\n delete: deleteCartParameters\n }\n });\n }\n getToolDefinition(operation) {\n const prompts = {\n read: readCartPrompt,\n create: createCartPrompt,\n update: updateCartPrompt,\n delete: deleteCartPrompt\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation]\n };\n }\n getCartsApi(api, storeKey) {\n return storeKey ? api.inStoreKeyWithStoreKeyValue({ storeKey }).carts() : api.carts();\n }\n async read(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n const cartsApi = this.getCartsApi(api, params.storeKey);\n if (params?.id) {\n const res2 = await cartsApi.withId({ ID: params.id }).get({\n queryArgs: { ...params.expand && { expand: params.expand } }\n }).execute();\n return res2.body;\n }\n if (params?.key) {\n const res2 = await cartsApi.withKey({ key: params.key }).get({\n queryArgs: { ...params.expand && { expand: params.expand } }\n }).execute();\n return res2.body;\n }\n const res = await cartsApi.get({\n queryArgs: {\n limit: params.limit ?? 20,\n ...params.offset != null && { offset: params.offset },\n ...params.sort && { sort: params.sort },\n ...params.where && { where: params.where },\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return res.body;\n } catch (err) {\n throw new ToolExecutionError(\"Failed to read cart\", context, err);\n }\n }\n async create(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n const cartsApi = this.getCartsApi(api, params.storeKey);\n const created = await cartsApi.post({\n body: params.body\n }).execute();\n return created.body;\n } catch (err) {\n throw new ToolExecutionError(\"Failed to create cart\", context, err);\n }\n }\n async update(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n const cartsApi = this.getCartsApi(api, params.storeKey);\n let cartId;\n let version = params.version;\n if (params.id) {\n cartId = params.id;\n } else if (params.key) {\n const res = await cartsApi.withKey({ key: params.key }).get().execute();\n cartId = res.body.id;\n version = res.body.version;\n } else {\n throw new ToolExecutionError(\n \"Either id or key must be provided\",\n context\n );\n }\n const updated = await cartsApi.withId({ ID: cartId }).post({\n body: {\n version,\n actions: params.actions ?? []\n }\n }).execute();\n return updated.body;\n } catch (err) {\n throw new ToolExecutionError(\"Failed to update cart\", context, err);\n }\n }\n async delete(context) {\n throw new ToolExecutionError(\n \"Delete operation not implemented for carts\",\n context\n );\n }\n};\nasync function readCarts(context, apiClientFactory) {\n const handler = new CartsHandler(apiClientFactory);\n return handler.read(context);\n}\nasync function createCarts(context, apiClientFactory) {\n const handler = new CartsHandler(apiClientFactory);\n return handler.create(context);\n}\nasync function updateCarts(context, apiClientFactory) {\n const handler = new CartsHandler(apiClientFactory);\n return handler.update(context);\n}\nasync function deleteCarts(context, apiClientFactory) {\n const handler = new CartsHandler(apiClientFactory);\n return handler.delete(context);\n}\n\n// src/resources/channels/channels.handler.ts\nvar import_zod5 = require(\"zod\");\n\n// src/resources/channels/channels.schema.ts\nvar import_zod4 = require(\"zod\");\nvar readChannelsParameters = import_zod4.z.object({\n id: import_zod4.z.string().optional(),\n key: import_zod4.z.string().optional(),\n where: import_zod4.z.array(import_zod4.z.string()).optional(),\n sort: import_zod4.z.array(import_zod4.z.string()).optional(),\n limit: import_zod4.z.number().int().min(1).max(500).optional(),\n offset: import_zod4.z.number().int().optional(),\n expand: import_zod4.z.array(import_zod4.z.string()).optional()\n});\nvar createChannelsParameters = import_zod4.z.object({\n body: import_zod4.z.record(import_zod4.z.any())\n});\nvar updateChannelsParameters = import_zod4.z.object({\n id: import_zod4.z.string().optional(),\n key: import_zod4.z.string().optional(),\n version: import_zod4.z.number().optional(),\n actions: import_zod4.z.array(import_zod4.z.record(import_zod4.z.any())).optional()\n});\nvar deleteChannelsParameters = import_zod4.z.object({\n id: import_zod4.z.string().optional(),\n key: import_zod4.z.string().optional(),\n version: import_zod4.z.number().optional()\n});\n\n// src/resources/channels/channels.prompt.ts\nvar readChannelsPrompt = `\nThis tool will fetch information about commercetools channels.\n\nIt can be used in three ways:\n1. To fetch a single channel by its ID\n2. To fetch a single channel by its key\n3. To query multiple channels based on criteria\n\nIt takes these parameters:\n- id (string, optional): The ID of the channel to fetch\n- key (string, optional): The key of the channel to fetch\n- where (string array, optional): Query predicates for filtering channels. Example: [\"roles contains any \\\\\"InventorySupply\\\\\",\\\\\"ProductDistribution\\\\\"\"]\n- limit (int, optional): The number of channels to return (default: 20, range: 1-500)\n- offset (int, optional): The number of items to skip before starting to collect the result set\n- sort (string array, optional): Sort criteria for the results. Example: [\"name.en asc\", \"createdAt desc\"]\n- expand (string array, optional): An array of field paths to expand. Example: [\"custom.type\"]\n\nIf both id and key are not provided, it will fetch a list of channels using query parameters.\n`;\nvar createChannelsPrompt = `\nThis tool will create a new Channel in commercetools.\n\nIt takes these required arguments:\n- key (string): User-defined unique identifier for the Channel\n- roles (array): Roles of the Channel. Each channel must have at least one role.\n Available roles: \"InventorySupply\", \"ProductDistribution\", \"OrderExport\", \"OrderImport\", \"Primary\"\n\nIt takes these optional arguments:\n- name (object, optional): Localized name of the Channel (record mapping locale to string)\n- description (object, optional): Localized description of the Channel (record mapping locale to string)\n- address (object, optional): Address where the Channel is located\n- geoLocation (object, optional): GeoJSON Point encoding the geo location of the Channel\n- custom (object, optional): Custom fields for the Channel\n\nExample name and description format:\n{\n \"en\": \"Main Warehouse\",\n \"de\": \"Hauptlager\"\n}\n\nExample geoLocation format:\n{\n \"type\": \"Point\",\n \"coordinates\": [13.377704, 52.516275]\n}\n`;\nvar updateChannelsPrompt = `\nThis tool will update a Channel in commercetools using update actions from the commercetools API.\n\nIt takes these required arguments:\n- version (integer): The current version of the channel\n- actions (array): An array of update actions to perform on the channel. Each action should have an \"action\" field indicating the action type\n\nIt also requires ONE of these identifiers:\n- id (string, optional): The ID of the channel to update\n- key (string, optional): The key of the channel to update\n\nExample actions from commercetools API include:\n- changeKey: Change the key of the channel\n- changeName: Change the localized name of the channel\n- changeDescription: Change the localized description of the channel\n- setRoles: Set the roles of the channel\n- addRoles: Add roles to the channel\n- removeRoles: Remove roles from the channel\n- setAddress: Set the address of the channel\n- setGeoLocation: Set the geo location of the channel\n- setCustomType: Set the custom type for the channel\n- setCustomField: Set a custom field for the channel\n\nEach action type requires specific fields according to the commercetools API.\n`;\n\n// src/resources/channels/channels.handler.ts\nvar ChannelsHandler = class extends CommercetoolsResourceHandler {\n constructor(apiClientFactory) {\n super(apiClientFactory);\n __publicField(this, \"metadata\", {\n namespace: \"channels\",\n description: \"Manage channels in commercetools\",\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readChannelsParameters,\n create: createChannelsParameters,\n update: updateChannelsParameters,\n delete: import_zod5.z.object({})\n }\n });\n }\n getToolDefinition(operation) {\n const prompts = {\n read: readChannelsPrompt,\n create: createChannelsPrompt,\n update: updateChannelsPrompt\n // delete: deleteChannelsPrompt,\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation]\n };\n }\n getChannelsApi(api) {\n return api.channels();\n }\n async read(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n if (params?.id) {\n const res = await this.getChannelsApi(api).withId({ ID: params.id }).get().execute();\n return res.body;\n } else if (params?.key) {\n const res = await this.getChannelsApi(api).withKey({ key: params.key }).get().execute();\n return res.body;\n } else {\n const res = await this.getChannelsApi(api).get({\n queryArgs: {\n ...params.limit && { limit: params.limit },\n ...params.offset && { offset: params.offset }\n }\n }).execute();\n return res.body;\n }\n } catch (err) {\n throw new ToolExecutionError(\"Failed to read channels\", context, err);\n }\n }\n async create(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n const created = await this.getChannelsApi(api).post({ body: params }).execute();\n return created.body;\n } catch (err) {\n throw new ToolExecutionError(\"Failed to create channel\", context, err);\n }\n }\n async update(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n let currentVersion = params.version;\n let channelId = params.id;\n if (!channelId && params.key) {\n const s = await this.getChannelsApi(api).withKey({ key: params.key }).get().execute();\n channelId = s.body.id;\n currentVersion = s.body.version;\n }\n if (!channelId)\n throw new ToolExecutionError(\n \"Either id or key must be provided\",\n context\n );\n const updated = await this.getChannelsApi(api).withId({ ID: channelId }).post({\n body: {\n version: currentVersion,\n actions: params.actions\n }\n }).execute();\n return updated.body;\n } catch (err) {\n throw new ToolExecutionError(\"Failed to update channel\", context, err);\n }\n }\n async delete(context) {\n throw new ToolExecutionError(\"Delete not supported for channels\", context);\n }\n};\nasync function readChannels(context, apiClientFactory) {\n const handler = new ChannelsHandler(apiClientFactory);\n return handler.read(context);\n}\nasync function createChannels(context, apiClientFactory) {\n const handler = new ChannelsHandler(apiClientFactory);\n return handler.create(context);\n}\nasync function updateChannels(context, apiClientFactory) {\n const handler = new ChannelsHandler(apiClientFactory);\n return handler.update(context);\n}\nasync function deleteChannels(context, apiClientFactory) {\n const handler = new ChannelsHandler(apiClientFactory);\n return handler.delete(context);\n}\n\n// src/resources/custom-objects/custom-objects.schema.ts\nvar import_zod6 = require(\"zod\");\nvar readCustomObjectsParameters = import_zod6.z.object({\n container: import_zod6.z.string().optional(),\n key: import_zod6.z.string().optional(),\n id: import_zod6.z.string().optional(),\n where: import_zod6.z.array(import_zod6.z.string()).optional(),\n sort: import_zod6.z.array(import_zod6.z.string()).optional(),\n limit: import_zod6.z.number().int().min(1).max(500).optional(),\n offset: import_zod6.z.number().int().optional(),\n expand: import_zod6.z.array(import_zod6.z.string()).optional()\n});\nvar createCustomObjectsParameters = import_zod6.z.object({\n container: import_zod6.z.string().describe(\"Container name (namespace)\"),\n key: import_zod6.z.string().describe(\"User-defined key\"),\n value: import_zod6.z.any().describe(\"JSON-serializable value\")\n});\nvar updateCustomObjectsParameters = import_zod6.z.object({\n container: import_zod6.z.string().optional(),\n key: import_zod6.z.string().optional(),\n id: import_zod6.z.string().optional(),\n version: import_zod6.z.number().optional(),\n value: import_zod6.z.any().optional()\n});\nvar deleteCustomObjectsParameters = import_zod6.z.object({\n container: import_zod6.z.string().optional(),\n key: import_zod6.z.string().optional(),\n id: import_zod6.z.string().optional(),\n version: import_zod6.z.number().optional()\n});\n\n// src/resources/custom-objects/custom-objects.prompt.ts\nvar readCustomObjectsPrompt = `\nRead custom objects from the commercetools platform. You can:\n- Get a single custom object by providing its container and key\n- List multiple custom objects in a container with optional filtering, sorting, and pagination\n\nParameters:\n- container: Container of the custom object to retrieve (required)\n- key: Key of the custom object to retrieve (optional)\n- limit: Number of results requested when listing (default: 20, max: 500)\n- offset: Number of elements to skip when listing (default: 0, max: 10000)\n- sort: Sort criteria for listing results (e.g., [\"createdAt desc\", \"key asc\"])\n- where: Query predicates for filtering when listing (e.g., [\"container=\\\\\"myContainer\\\\\"\"])\n- expand: Reference paths to expand (e.g., [\"value.order\"])\n\nExamples:\n// Get by container and key\ncustomObjects.read({\n container: \"myContainer\",\n key: \"myKey\"\n})\n\n// List all custom objects in a container\ncustomObjects.read({\n container: \"myContainer\",\n limit: 10\n})\n\n// List with filtering\ncustomObjects.read({\n container: \"myContainer\",\n where: [\"key=\\\\\"specific-key\\\\\"\"]\n})\n`;\nvar createCustomObjectsPrompt = `\nCreate a new custom object in the commercetools platform.\n\nParameters:\n- container: Namespace to group custom objects (required)\n- key: User-defined unique identifier within the container (required)\n- value: Can be any JSON standard type, such as number, string, boolean, array, object, or a common API data type (required)\n\nExample:\ncustomObjects.create({\n container: \"myContainer\",\n key: \"myKey\",\n value: {\n \"text\": {\n \"de\": \"Das ist ein Text\",\n \"en\": \"This is a text\"\n },\n \"order\": {\n \"typeId\": \"order\",\n \"id\": \"<order-id>\"\n }\n }\n})\n`;\nvar updateCustomObjectsPrompt = `\nUpdate a custom object in the commercetools platform. You must identify the object using container and key.\n\nParameters:\n- container: Container of the custom object to update (required)\n- key: Key of the custom object to update (required)\n- version: Expected version of the custom object (required)\n- actions: Array of update actions (required)\n\nAvailable update actions:\n- setValue: Set a new value for the custom object\n\nExamples:\n// Update by container and key\ncustomObjects.update({\n container: \"myContainer\",\n key: \"myKey\",\n version: 1,\n actions: [\n {\n action: \"setValue\",\n value: {\n \"updatedText\": \"New value\",\n \"timestamp\": \"2024-01-01T00:00:00Z\"\n }\n }\n ]\n})\n`;\nvar deleteCustomObjectsPrompt = `\nDelete a custom object in the commercetools platform. You must identify the object using container and key.\n\nParameters:\n- container: Container of the custom object to delete (required)\n- key: Key of the custom object to delete (required)\n- version: Expected version of the custom object (required)\n\nExamples:\n// Delete by container and key\ncustomObjects.delete({\n container: \"myContainer\",\n key: \"myKey\",\n version: 1,\n})\n`;\n\n// src/resources/custom-objects/custom-objects.handler.ts\nvar CustomObjectsHandler = class extends CommercetoolsResourceHandler {\n constructor(apiClientFactory) {\n super(apiClientFactory);\n __publicField(this, \"metadata\", {\n namespace: \"custom-objects\",\n description: \"Manage custom objects in commercetools\",\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readCustomObjectsParameters,\n create: createCustomObjectsParameters,\n update: updateCustomObjectsParameters,\n delete: deleteCustomObjectsParameters\n }\n });\n }\n getToolDefinition(operation) {\n const prompts = {\n read: readCustomObjectsPrompt,\n create: createCustomObjectsPrompt,\n update: updateCustomObjectsPrompt,\n delete: deleteCustomObjectsPrompt\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation]\n };\n }\n getCustomObjectsApi(api) {\n return api.customObjects();\n }\n async read(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n if (params?.container && params?.key) {\n const res = await this.getCustomObjectsApi(api).withContainerAndKey({ container: params.container, key: params.key }).get().execute();\n return res.body;\n } else if (params?.container) {\n const res = await this.getCustomObjectsApi(api).withContainer({ container: params.container }).get({\n queryArgs: {\n ...params.limit && { limit: params.limit },\n ...params.offset && { offset: params.offset },\n ...params.sort && { sort: params.sort },\n ...params.where && { where: params.where },\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return res.body;\n } else {\n const res = await this.getCustomObjectsApi(api).get({\n queryArgs: {\n ...params.limit && { limit: params.limit },\n ...params.offset && { offset: params.offset },\n ...params.sort && { sort: params.sort },\n ...params.where && { where: params.where },\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return res.body;\n }\n } catch (err) {\n throw new ToolExecutionError(\n \"Failed to read custom objects\",\n context,\n err\n );\n }\n }\n async create(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n const created = await this.getCustomObjectsApi(api).post({\n body: {\n container: params.container,\n key: params.key,\n value: params.value\n }\n }).execute();\n return created.body;\n } catch (err) {\n throw new ToolExecutionError(\n \"Failed to create custom object\",\n context,\n err\n );\n }\n }\n async update(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n if (!params.id && !params.container && !params.key)\n throw new ToolExecutionError(\n \"Either id or container+key must be provided\",\n context\n );\n try {\n if (params.container && params.key) {\n const updated = await this.getCustomObjectsApi(api).post({\n body: {\n container: params.container,\n key: params.key,\n value: params.value,\n version: params.version\n }\n }).execute();\n return updated.body;\n }\n throw new ToolExecutionError(\n \"Updating by id is not supported; use container+key to update a custom object\",\n context\n );\n } catch (err) {\n throw new ToolExecutionError(\n \"Failed to update custom object\",\n context,\n err\n );\n }\n }\n async delete(context) {\n throw new ToolExecutionError(\n \"Delete operation not implemented for custom objects\",\n context\n );\n }\n};\nasync function readCustomObjects(context, apiClientFactory) {\n const handler = new CustomObjectsHandler(apiClientFactory);\n return handler.read(context);\n}\nasync function createCustomObjects(context, apiClientFactory) {\n const handler = new CustomObjectsHandler(apiClientFactory);\n return handler.create(context);\n}\nasync function updateCustomObjects(context, apiClientFactory) {\n const handler = new CustomObjectsHandler(apiClientFactory);\n return handler.update(context);\n}\nasync function deleteCustomObjects(context, apiClientFactory) {\n const handler = new CustomObjectsHandler(apiClientFactory);\n return handler.delete(context);\n}\n\n// src/resources/customers/customers.schema.ts\nvar import_zod7 = require(\"zod\");\nvar readCustomerParameters = import_zod7.z.object({\n id: import_zod7.z.string().optional().describe(\"Customer ID\"),\n key: import_zod7.z.string().optional().describe(\"Customer key\"),\n storeKey: import_zod7.z.string().optional().describe(\"Store key\"),\n where: import_zod7.z.array(import_zod7.z.string()).optional().describe(\n 'Query predicates specified as strings. Example: [\"email = \\\\\"customer@example.com\\\\\"\"]'\n ),\n sort: import_zod7.z.array(import_zod7.z.string()).optional().describe(\n 'Sort criteria for the results. Example: [\"firstName asc\", \"createdAt desc\"]'\n ),\n limit: import_zod7.z.number().int().min(1).max(500).optional().describe(\n \"A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 10.\"\n ),\n offset: import_zod7.z.number().int().min(0).optional().describe(\n \"The number of items to skip before starting to collect the result set.\"\n ),\n expand: import_zod7.z.array(import_zod7.z.string()).optional().describe('Fields to expand. Example: [\"customerGroup\"]')\n});\nvar createCustomerParameters = import_zod7.z.object({\n email: import_zod7.z.string().email().describe(\"Customer email address\"),\n storeKey: import_zod7.z.string().optional().describe(\"Store key\"),\n password: import_zod7.z.string().describe(\"Customer password\"),\n firstName: import_zod7.z.string().optional().describe(\"Customer first name\"),\n lastName: import_zod7.z.string().optional().describe(\"Customer last name\"),\n middleName: import_zod7.z.string().optional().describe(\"Customer middle name\"),\n title: import_zod7.z.string().optional().describe(\"Customer title (e.g., Mr., Mrs., Dr.)\"),\n dateOfBirth: import_zod7.z.string().optional().describe(\"Customer date of birth in ISO 8601 format (YYYY-MM-DD)\"),\n companyName: import_zod7.z.string().optional().describe(\"Customer company name\"),\n vatId: import_zod7.z.string().optional().describe(\"Customer VAT identification number\"),\n addresses: import_zod7.z.array(\n import_zod7.z.object({\n streetName: import_zod7.z.string().describe(\"Street name\"),\n streetNumber: import_zod7.z.string().optional().describe(\"Street number\"),\n additionalStreetInfo: import_zod7.z.string().optional().describe(\"Additional street information\"),\n postalCode: import_zod7.z.string().describe(\"Postal code\"),\n city: import_zod7.z.string().describe(\"City\"),\n region: import_zod7.z.string().optional().describe(\"Region\"),\n state: import_zod7.z.string().optional().describe(\"State\"),\n country: import_zod7.z.string().describe(\"Country code (ISO 3166-1 alpha-2)\"),\n company: import_zod7.z.string().optional().describe(\"Company name\"),\n department: import_zod7.z.string().optional().describe(\"Department\"),\n building: import_zod7.z.string().optional().describe(\"Building\"),\n apartment: import_zod7.z.string().optional().describe(\"Apartment\"),\n pOBox: import_zod7.z.string().optional().describe(\"P.O. Box\"),\n phone: import_zod7.z.string().optional().describe(\"Phone\"),\n mobile: import_zod7.z.string().optional().describe(\"Mobile phone\"),\n email: import_zod7.z.string().email().optional().describe(\"Email\"),\n fax: import_zod7.z.string().optional().describe(\"Fax\"),\n additionalAddressInfo: import_zod7.z.string().optional().describe(\"Additional address information\")\n })\n ).optional().describe(\"Customer addresses\"),\n defaultShippingAddress: import_zod7.z.number().int().optional().describe(\"Index of default shipping address in the addresses array\"),\n defaultBillingAddress: import_zod7.z.number().int().optional().describe(\"Index of default billing address in the addresses array\"),\n shippingAddresses: import_zod7.z.array(import_zod7.z.number().int()).optional().describe(\"Indices of shipping addresses in the addresses array\"),\n billingAddresses: import_zod7.z.array(import_zod7.z.number().int()).optional().describe(\"Indices of billing addresses in the addresses array\"),\n isEmailVerified: import_zod7.z.boolean().optional().describe(\"Whether the customer email is verified\"),\n externalId: import_zod7.z.string().optional().describe(\"Customer external ID\"),\n customerGroup: import_zod7.z.object({\n id: import_zod7.z.string(),\n typeId: import_zod7.z.literal(\"customer-group\")\n }).optional().describe(\"Customer group reference\"),\n custom: import_zod7.z.object({\n type: import_zod7.z.object({\n id: import_zod7.z.string(),\n typeId: import_zod7.z.literal(\"type\")\n }),\n fields: import_zod7.z.record(import_zod7.z.string(), import_zod7.z.any())\n }).optional().describe(\"Custom fields\"),\n locale: import_zod7.z.string().optional().describe(\"Customer locale\"),\n salutation: import_zod7.z.string().optional().describe(\"Customer salutation\"),\n key: import_zod7.z.string().optional().describe(\"Customer key\")\n});\nvar updateCustomerParameters = import_zod7.z.object({\n id: import_zod7.z.string().describe(\"The ID of the customer to update\"),\n version: import_zod7.z.number().int().describe(\"The current version of the customer\"),\n actions: import_zod7.z.array(\n import_zod7.z.object({\n action: import_zod7.z.string().describe(\"The name of the update action to perform\")\n }).and(import_zod7.z.record(import_zod7.z.string(), import_zod7.z.any()).optional()).describe(\n 'Array of update actions to perform on the customer. Each action should have an \"action\" field and other fields specific to that action type.'\n )\n ).describe(\"Update actions\")\n});\nvar deleteCustomerParameters = import_zod7.z.object({\n id: import_zod7.z.string().describe(\"Customer ID\"),\n version: import_zod7.z.number().int().describe(\"Current version (for optimistic locking)\"),\n dataErasure: import_zod7.z.boolean().optional().describe(\"Delete personal data\")\n});\n\n// src/resources/customers/customers.prompt.ts\nvar readCustomerPrompt = `\nThis tool will fetch a Customer by ID (ID or key if provided) from commercetools or a specific store in commercetools or query all available customers in a commercetools project if no arquments or parameters are provided.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the customer to fetch.\n- storeKey (string, optional): The key of the store to fetch the customer from.\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"email = \\\\\"customer@example.com\\\\\"\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"firstName asc\", \"createdAt desc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 10.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- expand (array of strings, optional): Fields to expand. Example: [\"customerGroup\"]\n`;\nvar createCustomerPrompt = `\nThis tool will create a new Customer in commercetools or a specific store in commercetools.\n\nIt takes these required arguments:\n- email (string): Customer email address.\n- password (string): Customer password.\n\nIt takes these optional arguments:\n- storeKey (string, optional): The key of the store to create the customer in.\n- firstName (string, optional): Customer first name.\n- lastName (string, optional): Customer last name.\n- middleName (string, optional): Customer middle name.\n- title (string, optional): Customer title (e.g., Mr., Mrs., Dr.).\n- dateOfBirth (string, optional): Customer date of birth in ISO 8601 format (YYYY-MM-DD).\n- companyName (string, optional): Customer company name.\n- vatId (string, optional): Customer VAT identification number.\n- addresses (array, optional): An array of customer addresses.\n- defaultShippingAddress (integer, optional): Index of default shipping address in the addresses array.\n- defaultBillingAddress (integer, optional): Index of default billing address in the addresses array.\n- shippingAddresses (array of integers, optional): Indices of shipping addresses in the addresses array.\n- billingAddresses (array of integers, optional): Indices of billing addresses in the addresses array.\n- isEmailVerified (boolean, optional): Whether the customer email is verified.\n- externalId (string, optional): Customer external ID.\n- customerGroup (object, optional): Customer group reference.\n- custom (object, optional): Custom fields.\n- locale (string, optional): Customer locale.\n- salutation (string, optional): Customer salutation.\n- key (string, optional): Customer key.\n`;\nvar updateCustomerPrompt = `\nThis tool will update a Customer in commercetools using update actions from the commercetools API.\n\nIt takes these required arguments:\n- id (string): The ID of the customer to update.\n- version (integer): The current version of the customer.\n- actions (array): An array of update actions to perform on the customer. Each action should have an \"action\" field indicating the action type.\n\nExample actions from commercetools API include:\n- addAddress\n- addBillingAddressId\n- addShippingAddressId\n- changeAddress\n- changeEmail\n- removeAddress\n- removeBillingAddressId\n- removeShippingAddressId\n- setCompanyName\n- setCustomField\n- setCustomType\n- setDateOfBirth\n- setDefaultBillingAddress\n- setDefaultShippingAddress\n- setFirstName\n- setLastName\n- setLocale\n- setMiddleName\n- setSalutation\n- setTitle\n- setVatId\n\nEach action type requires specific fields according to the commercetools API.\n`;\nvar deleteCustomerPrompt = `\nThis tool will delete a Customer from commercetools.\n\nIt takes these required arguments:\n- id (string): The ID of the customer to delete.\n- version (integer): The current version of the customer (for optimistic locking).\n\nIt takes these optional arguments:\n- dataErasure (boolean, optional): Delete personal data.\n`;\n\n// src/resources/customers/customers.handler.ts\nvar CustomersHandler = class extends CommercetoolsResourceHandler {\n constructor(apiClientFactory) {\n super(apiClientFactory);\n __publicField(this, \"metadata\", {\n namespace: \"customers\",\n description: \"Manage customers in commercetools\",\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readCustomerParameters,\n create: createCustomerParameters,\n update: updateCustomerParameters,\n delete: deleteCustomerParameters\n }\n });\n }\n getToolDefinition(operation) {\n const prompts = {\n read: readCustomerPrompt,\n create: createCustomerPrompt,\n update: updateCustomerPrompt,\n delete: deleteCustomerPrompt\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation]\n };\n }\n getCustomersApi(api, storeKey) {\n return storeKey ? api.inStoreKeyWithStoreKeyValue({ storeKey }).customers() : api.customers();\n }\n async read(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n if (params?.id) {\n const customer = await this.getCustomersApi(api, params.storeKey).withId({ ID: params.id }).get({\n queryArgs: {\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return customer.body;\n } else if (params?.key) {\n const customer = await this.getCustomersApi(api, params.storeKey).withKey({ key: params.key }).get().execute();\n return customer.body;\n } else {\n const customers = await this.getCustomersApi(api, params.storeKey).get({\n queryArgs: {\n limit: params.limit || 10,\n ...params.offset && { offset: params.offset },\n ...params.sort && { sort: params.sort },\n ...params.where && { where: params.where },\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return customers.body;\n }\n } catch (err) {\n throw new ToolExecutionError(\n err.message || \"Failed to read customers\",\n context,\n err\n );\n }\n }\n async create(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n const customer = await this.getCustomersApi(api, params.storeKey).post({\n body: params\n }).execute();\n return customer.body;\n } catch (error) {\n throw new ToolExecutionError(\n \"Failed to create customers\",\n context,\n error\n );\n }\n }\n async update(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n const customer = await api.customers().withId({ ID: params.id }).get().execute();\n const currentVersion = customer.body.version;\n const updatedCustomer = await api.customers().withId({ ID: params.id }).post({\n body: {\n version: currentVersion,\n actions: params.actions\n }\n }).execute();\n return updatedCustomer.body;\n } catch (error) {\n throw new ToolExecutionError(\n \"Failed to update customers\",\n context,\n error\n );\n }\n }\n async delete(context) {\n throw new ToolExecutionError(\"Delete operation not implemented\", context);\n }\n};\nasync function readCustomers(context, apiClientFactory) {\n const handler = new CustomersHandler(apiClientFactory);\n return handler.read(context);\n}\nasync function createCustomers(context, apiClientFactory) {\n const handler = new CustomersHandler(apiClientFactory);\n return handler.create(context);\n}\nasync function updateCustomers(context, apiClientFactory) {\n const handler = new CustomersHandler(apiClientFactory);\n return handler.update(context);\n}\nasync function deleteCustomers(context, apiClientFactory) {\n const handler = new CustomersHandler(apiClientFactory);\n return handler.delete(context);\n}\n\n// src/resources/customer-groups/customer-groups.schema.ts\nvar import_zod8 = require(\"zod\");\nvar readCustomerGroupsParameters = import_zod8.z.object({\n id: import_zod8.z.string().optional().describe(\"Customer group ID\"),\n key: import_zod8.z.string().optional().describe(\"Customer group key\"),\n where: import_zod8.z.array(import_zod8.z.string()).optional().describe(\n 'Query predicates specified as strings. Example: [\"key = \\\\\"vip\\\\\"\"] or [\"name = \\\\\"VIP Customers\\\\\"\"]'\n ),\n sort: import_zod8.z.array(import_zod8.z.string()).optional().describe(\n 'Sort criteria for the results. Example: [\"name asc\", \"createdAt desc\", \"key asc\"]'\n ),\n limit: import_zod8.z.number().int().min(1).max(500).optional().describe(\n \"A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\"\n ),\n offset: import_zod8.z.number().int().min(0).optional().describe(\n \"The number of items to skip before starting to collect the result set.\"\n ),\n expand: import_zod8.z.array(import_zod8.z.string()).optional().describe(\n \"Fields to expand. Customer groups have no reference expansions by default.\"\n )\n});\nvar createCustomerGroupsParameters = import_zod8.z.object({\n groupName: import_zod8.z.string().min(1).describe(\n \"Unique name of the customer group. Must be different from any existing group name in the project.\"\n ),\n key: import_zod8.z.string().min(2).max(256).optional().describe(\n \"User-defined unique identifier for the customer group (2-256 characters, alphanumeric with underscores/hyphens).\"\n ),\n custom: import_zod8.z.object({\n type: import_zod8.z.object({\n id: import_zod8.z.string().describe(\"ID of the custom type\"),\n typeId: import_zod8.z.literal(\"type\")\n }),\n fields: import_zod8.z.record(import_zod8.z.string(), import_zod8.z.any()).optional().describe(\"Custom field values\")\n }).optional().describe(\n 'Custom fields for the customer group. Requires a Type with resourceTypeIds including \"customer-group\".'\n )\n});\nvar updateCustomerGroupsParameters = import_zod8.z.object({\n id: import_zod8.z.string().optional().describe(\"The ID of the customer group to update\"),\n key: import_zod8.z.string().optional().describe(\"The key of the customer group to update\"),\n version: import_zod8.z.number().int().describe(\n \"The current version of the customer group (for optimistic locking)\"\n ),\n actions: import_zod8.z.array(\n import_zod8.z.object({\n action: import_zod8.z.string().describe(\"The name of the update action to perform\")\n }).and(import_zod8.z.record(import_zod8.z.string(), import_zod8.z.any()).optional()).describe(\n 'Array of update actions. Each action must have an \"action\" field and other fields specific to that action type (e.g. changeName requires \"name\", setKey requires \"key\").'\n )\n ).describe(\"Update actions\")\n});\nvar deleteCustomerGroupsParameters = import_zod8.z.object({\n id: import_zod8.z.string().optional().describe(\"Customer group ID (required if key is not provided)\"),\n key: import_zod8.z.string().optional().describe(\"Customer group key (required if id is not provided)\"),\n version: import_zod8.z.number().int().describe(\n \"Current version of the customer group (for optimistic locking).\"\n )\n});\n\n// src/resources/customer-groups/customer-groups.prompt.ts\nvar readCustomerGroupsPrompt = `\nThis tool will fetch a Customer Group by ID or key (if provided) from commercetools or query all available customer groups in a commercetools project if no arguments or parameters are provided.\n\nCustomer groups are used to segment customers (e.g. for B2B pricing, promotions, or analytics). Each customer can be assigned to at most one customer group.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the customer group to fetch.\n- key (string, optional): The key of the customer group to fetch.\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"key = \\\\\"vip\\\\\"\"] or [\"name = \\\\\"VIP Customers\\\\\"\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"name asc\", \"createdAt desc\", \"key asc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- expand (array of strings, optional): Fields to expand. Customer groups typically have no reference fields to expand.\n`;\nvar createCustomerGroupsPrompt = `\nThis tool will create a new Customer Group in commercetools.\n\nCustomer groups segment customers for pricing, promotions, or reporting. Common examples include \"VIP\", \"Wholesale\", or \"B2B\".\n\nIt takes these required arguments:\n- groupName (string): Unique name of the customer group. Must be different from any existing group name in the project.\n\nIt takes these optional arguments:\n- key (string, optional): User-defined unique identifier for the customer group (2-256 characters, alphanumeric with underscores/hyphens). If omitted, a key may be derived or left unset.\n- custom (object, optional): Custom fields for the customer group. Must include a \"type\" object with \"id\" and \"typeId\" set to \"type\", and optionally a \"fields\" object with custom field values. The Type must have resourceTypeIds including \"customer-group\".\n`;\nvar updateCustomerGroupsPrompt = `\nThis tool will update a Customer Group in commercetools using update actions from the commercetools API.\n\nIt takes these required arguments:\n- version (integer): The current version of the customer group (for optimistic locking).\n- actions (array): An array of update actions to perform. Each action must have an \"action\" field indicating the action type and any required fields for that action.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the customer group to update (required if key is not provided).\n- key (string, optional): The key of the customer group to update (required if id is not provided).\n\nExample actions from the commercetools API include:\n- changeName: Change the name of the customer group. Requires \"name\" (string).\n- setKey: Set or change the key. Requires \"key\" (string, optional; omit or set to null to remove).\n- setCustomType: Set custom type and fields. Requires \"type\" (object with \"id\", \"typeId\") and optionally \"fields\" (object).\n- setCustomField: Set a custom field value. Requires \"name\" (string) and \"value\" (any; use null to remove).\n\nEach action type requires specific fields according to the commercetools API documentation.\n`;\nvar deleteCustomerGroupsPrompt = `\nThis tool will delete a Customer Group from commercetools.\n\nDeleting a customer group does not delete the customers that were assigned to it; their customerGroup reference will be cleared or may need to be updated separately depending on API behavior.\n\nIt takes these required arguments:\n- version (integer): The current version of the customer group (for optimistic locking).\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the customer group to delete (required if key is not provided).\n- key (string, optional): The key of the customer group to delete (required if id is not provided).\n`;\n\n// src/resources/customer-groups/customer-groups.handler.ts\nvar CustomerGroupsHandler = class extends CommercetoolsResourceHandler {\n constructor(apiClientFactory) {\n super(apiClientFactory);\n __publicField(this, \"metadata\", {\n namespace: \"customer-groups\",\n description: \"Manage customer groups in commercetools\",\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readCustomerGroupsParameters,\n create: createCustomerGroupsParameters,\n update: updateCustomerGroupsParameters,\n delete: deleteCustomerGroupsParameters\n }\n });\n }\n getToolDefinition(operation) {\n const prompts = {\n read: readCustomerGroupsPrompt,\n create: createCustomerGroupsPrompt,\n update: updateCustomerGroupsPrompt,\n delete: deleteCustomerGroupsPrompt\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation]\n };\n }\n getCustomerGroupsApi(api) {\n return api.customerGroups();\n }\n async read(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n const apiResource = this.getCustomerGroupsApi(api);\n if (params?.id) {\n const res2 = await apiResource.withId({ ID: params.id }).get({\n queryArgs: { ...params.expand && { expand: params.expand } }\n }).execute();\n return res2.body;\n }\n if (params?.key) {\n const res2 = await apiResource.withKey({ key: params.key }).get({\n queryArgs: { ...params.expand && { expand: params.expand } }\n }).execute();\n return res2.body;\n }\n const res = await apiResource.get({\n queryArgs: {\n limit: params.limit ?? 20,\n ...params.offset != null && { offset: params.offset },\n ...params.sort && { sort: params.sort },\n ...params.where && { where: params.where },\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return res.body;\n } catch (err) {\n throw new ToolExecutionError(\n \"Failed to read customer groups\",\n context,\n err\n );\n }\n }\n async create(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n const body = {\n groupName: params.groupName,\n ...params.key != null && { key: params.key },\n ...params.custom != null && { custom: params.custom }\n };\n const created = await this.getCustomerGroupsApi(api).post({\n body\n }).execute();\n return created.body;\n } catch (err) {\n throw new ToolExecutionError(\n \"Failed to create customer group\",\n context,\n err\n );\n }\n }\n async update(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n const apiResource = this.getCustomerGroupsApi(api);\n let groupId;\n let version = params.version;\n if (params.id) {\n groupId = params.id;\n } else if (params.key) {\n const res = await apiResource.withKey({ key: params.key }).get().execute();\n groupId = res.body.id;\n version = res.body.version;\n } else {\n throw new ToolExecutionError(\n \"Either id or key must be provided\",\n context\n );\n }\n const updated = await apiResource.withId({ ID: groupId }).post({\n body: {\n version,\n actions: params.actions ?? []\n }\n }).execute();\n return updated.body;\n } catch (err) {\n throw new ToolExecutionError(\n \"Failed to update customer group\",\n context,\n err\n );\n }\n }\n async delete(context) {\n throw new ToolExecutionError(\n \"Delete operation not implemented for customer groups\",\n context\n );\n }\n};\nasync function readCustomerGroups(context, apiClientFactory) {\n const handler = new CustomerGroupsHandler(apiClientFactory);\n return handler.read(context);\n}\nasync function createCustomerGroups(context, apiClientFactory) {\n const handler = new CustomerGroupsHandler(apiClientFactory);\n return handler.create(context);\n}\nasync function updateCustomerGroups(context, apiClientFactory) {\n const handler = new CustomerGroupsHandler(apiClientFactory);\n return handler.update(context);\n}\nasync function deleteCustomerGroups(context, apiClientFactory) {\n const handler = new CustomerGroupsHandler(apiClientFactory);\n return handler.delete(context);\n}\n\n// src/resources/customer-search/customer-search.schema.ts\nvar import_zod9 = require(\"zod\");\nvar readCustomerSearchParameters = import_zod9.z.object({\n query: import_zod9.z.record(import_zod9.z.any()).optional().describe(\n \"Search query (SearchQuery). Use fullText (field, value), exact (field, value), range (field, gte, lt), or compound (and, or, not). Text fields: all, firstName, lastName, email, companyName, fullName, addresses.*. Keyword: id, key, customerNumber, externalId, vatId, customerGroup.id, stores.key. Number/date: dateOfBirth, createdAt, lastModifiedAt, version.\"\n ),\n sort: import_zod9.z.array(import_zod9.z.record(import_zod9.z.any())).optional().describe(\n 'Sort criteria (SearchSorting). If not provided, results are sorted by relevance descending. Example: [{\"field\": \"createdAt\", \"order\": \"desc\"}]'\n ),\n limit: import_zod9.z.number().int().min(1).max(100).optional().describe(\n \"Maximum number of search results. Default: 20. Minimum: 1, Maximum: 100.\"\n ),\n offset: import_zod9.z.number().int().min(0).max(9900).optional().describe(\n \"Number of search results to skip for pagination. Default: 0. Minimum: 0, Maximum: 9900.\"\n )\n});\nvar createCustomerSearchParameters = import_zod9.z.object({}).describe(\"Customer Search does not support create operations\");\nvar updateCustomerSearchParameters = import_zod9.z.object({}).describe(\"Customer Search does not support update operations\");\nvar deleteCustomerSearchParameters = import_zod9.z.object({}).describe(\"Customer Search does not support delete operations\");\n\n// src/resources/customer-search/customer-search.prompt.ts\nvar readCustomerSearchPrompt = `\nThis tool searches across Customers in a commercetools Project using the [Customer Search API](https://docs.commercetools.com/api/projects/customer-search). It is designed for back-office use cases (e.g. Merchant Center, admin tools), not storefront search.\n\nThe API is **ID-first**: it returns only Customer IDs (and relevance scores). To get full Customer data, use the Get Customer by ID endpoint (customers.read with id) after searching.\n\nCustomer Search is deactivated for a Project by default. Activate it via the Project API (Change Customer Search status) or by indexing in Merchant Center (Customers > Customer list). If no search calls are made for 30 days, the feature is automatically deactivated.\n\nIt takes these optional arguments:\n- query (object, optional): Search query in the [Search Query Language](https://docs.commercetools.com/api/search-query-language). Examples:\n - Full-text on a field: { \"fullText\": { \"field\": \"firstName\", \"value\": \"john\" } }\n - Search in all text fields: { \"fullText\": { \"field\": \"all\", \"value\": \"example\" } }\n - Exact match (keyword): { \"exact\": { \"field\": \"email\", \"value\": \"user@example.com\" } } or { \"exact\": { \"field\": \"id\", \"value\": \"customer-id\" } }\n - Range (date/number): { \"range\": { \"field\": \"createdAt\", \"gte\": \"2023-12-01T00:00:00.000Z\", \"lt\": \"2024-01-01T00:00:00.000Z\" } }\n - Compound: { \"and\": [ { \"fullText\": { \"field\": \"firstName\", \"value\": \"john\" } }, { \"exact\": { \"field\": \"customerGroup.id\", \"value\": \"group-id\" } } ] } or { \"or\": [ ... ] }\n Text fields: all, firstName, lastName, email, companyName, fullName, addresses.all, addresses.city, addresses.country, etc. Keyword: id, key, customerNumber, externalId, vatId, customerGroup.id, stores.key. Number/date: dateOfBirth, createdAt, lastModifiedAt, version.\n- sort (array of objects, optional): Sort criteria (SearchSorting). If not provided, results are sorted by relevance descending. Example: [{\"field\": \"createdAt\", \"order\": \"desc\"}].\n- limit (integer, optional): Maximum number of results. Default: 20. Min: 1, Max: 100.\n- offset (integer, optional): Number of results to skip for pagination. Default: 0. Min: 0, Max: 9900.\n\nIf the index is not ready or the feature is inactive, a SearchNotReady error is returned.\n`;\nvar createCustomerSearchPrompt = `\nCustomer Search does not support create operations. This is a read-only search API. Use the Customers API (customers.create) to create customers.\n`;\nvar updateCustomerSearchPrompt = `\nCustomer Search does not support update operations. This is a read-only search API. Use the Customers API (customers.update) to update customers.\n`;\nvar deleteCustomerSearchPrompt = `\nCustomer Search does not support delete operations. This is a read-only search API. Use the Customers API (customers.delete) to delete customers.\n`;\n\n// src/resources/customer-search/customer-search.handler.ts\nvar CustomerSearchHandler = class extends CommercetoolsResourceHandler {\n constructor(apiClientFactory) {\n super(apiClientFactory);\n __publicField(this, \"metadata\", {\n namespace: \"customer-search\",\n description: \"Search customers in commercetools (back-office, ID-first)\",\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readCustomerSearchParameters,\n create: createCustomerSearchParameters,\n update: updateCustomerSearchParameters,\n delete: deleteCustomerSearchParameters\n }\n });\n }\n getToolDefinition(operation) {\n const prompts = {\n read: readCustomerSearchPrompt,\n create: createCustomerSearchPrompt,\n update: updateCustomerSearchPrompt,\n delete: deleteCustomerSearchPrompt\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation]\n };\n }\n getCustomerSearchApi(api) {\n return api.customers().search();\n }\n async read(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n const body = {\n ...params.query != null && {\n query: params.query\n },\n ...params.sort != null && {\n sort: params.sort\n },\n ...params.limit != null && { limit: params.limit },\n ...params.offset != null && { offset: params.offset }\n };\n const searchResponse = await this.getCustomerSearchApi(api).post({ body }).execute();\n return searchResponse.body;\n } catch (err) {\n throw new ToolExecutionError(\n err.message || \"Failed to search customers\",\n context,\n err\n );\n }\n }\n async create(context) {\n throw new ToolExecutionError(\n \"Create operation not supported for customer-search\",\n context\n );\n }\n async update(context) {\n throw new ToolExecutionError(\n \"Update operation not supported for customer-search\",\n context\n );\n }\n async delete(context) {\n throw new ToolExecutionError(\n \"Delete operation not supported for customer-search\",\n context\n );\n }\n};\nasync function readCustomerSearch(context, apiClientFactory) {\n const handler = new CustomerSearchHandler(apiClientFactory);\n return handler.read(context);\n}\nasync function createCustomerSearch(context, apiClientFactory) {\n const handler = new CustomerSearchHandler(apiClientFactory);\n return handler.create(context);\n}\nasync function updateCustomerSearch(context, apiClientFactory) {\n const handler = new CustomerSearchHandler(apiClientFactory);\n return handler.update(context);\n}\nasync function deleteCustomerSearch(context, apiClientFactory) {\n const handler = new CustomerSearchHandler(apiClientFactory);\n return handler.delete(context);\n}\n\n// src/resources/discount-codes/discount-codes.schema.ts\nvar import_zod10 = require(\"zod\");\nvar readDiscountCodesParameters = import_zod10.z.object({\n id: import_zod10.z.string().optional().describe(\"Discount Code ID\"),\n key: import_zod10.z.string().optional().describe(\"Discount Code key\"),\n where: import_zod10.z.array(import_zod10.z.string()).optional().describe(\n 'Query predicates specified as strings. Example: [\"code = \\\\\"SUMMER2024\\\\\"\"]'\n ),\n sort: import_zod10.z.array(import_zod10.z.string()).optional().describe(\n 'Sort criteria for the results. Example: [\"code asc\", \"createdAt desc\"]'\n ),\n limit: import_zod10.z.number().int().min(1).max(500).optional().describe(\n \"A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\"\n ),\n offset: import_zod10.z.number().int().min(0).optional().describe(\n \"The number of items to skip before starting to collect the result set.\"\n ),\n expand: import_zod10.z.array(import_zod10.z.string()).optional().describe('Fields to expand. Example: [\"cartDiscounts[*]\"]')\n});\nvar createDiscountCodesParameters = import_zod10.z.object({\n key: import_zod10.z.string().min(2).max(256).optional().describe(\"User-defined unique identifier for the discount code\"),\n name: import_zod10.z.record(import_zod10.z.string()).optional().describe(\"Localized name of the Discount Code\"),\n description: import_zod10.z.record(import_zod10.z.string()).optional().describe(\"Localized description\"),\n code: import_zod10.z.string().describe(\n \"User-defined unique identifier added to a Cart to apply related Cart Discounts\"\n ),\n cartDiscounts: import_zod10.z.array(\n import_zod10.z.object({\n id: import_zod10.z.string().optional(),\n key: import_zod10.z.string().optional(),\n typeId: import_zod10.z.literal(\"cart-discount\")\n })\n ).describe(\n \"Array of references to up to 10 CartDiscounts that apply when the code is used\"\n ),\n cartPredicate: import_zod10.z.string().optional().describe(\"Optional predicate defining which Carts the code can apply to\"),\n isActive: import_zod10.z.boolean().optional().describe(\"Whether the code can be applied (defaults to false)\"),\n maxApplications: import_zod10.z.number().int().min(0).optional().describe(\"Total number of times the code can be applied\"),\n maxApplicationsPerCustomer: import_zod10.z.number().int().min(0).optional().describe(\"Times the code can be applied per customer\"),\n groups: import_zod10.z.array(import_zod10.z.string()).optional().describe(\"Tags for grouping and organizing Discount Codes\"),\n validFrom: import_zod10.z.string().optional().describe(\"Date/time when the code becomes valid (ISO 8601 format)\"),\n validUntil: import_zod10.z.string().optional().describe(\"Date/time when the code expires (ISO 8601 format)\"),\n custom: import_zod10.z.object({\n type: import_zod10.z.object({\n id: import_zod10.z.string(),\n typeId: import_zod10.z.literal(\"type\")\n }).optional(),\n fields: import_zod10.z.record(import_zod10.z.string(), import_zod10.z.any()).optional()\n }).optional().describe(\"Custom fields for the discount code\")\n});\nvar updateDiscountCodesParameters = import_zod10.z.object({\n id: import_zod10.z.string().optional().describe(\"The ID of the discount code to update\"),\n key: import_zod10.z.string().optional().describe(\"The key of the discount code to update\"),\n version: import_zod10.z.number().int().describe(\"The current version of the discount code\"),\n actions: import_zod10.z.array(\n import_zod10.z.object({\n action: import_zod10.z.string().describe(\"The name of the update action to perform\")\n }).and(import_zod10.z.record(import_zod10.z.string(), import_zod10.z.any()).optional()).describe(\n 'Array of update actions to perform on the discount code. Each action should have an \"action\" field and other fields specific to that action type.'\n )\n ).describe(\"Update actions\")\n});\nvar deleteDiscountCodesParameters = import_zod10.z.object({\n id: import_zod10.z.string().optional().describe(\"Discount Code ID\"),\n key: import_zod10.z.string().optional().describe(\"Discount Code key\"),\n version: import_zod10.z.number().int().describe(\"Current version (for optimistic locking)\"),\n dataErasure: import_zod10.z.boolean().optional().describe(\"Delete personal data\")\n});\n\n// src/resources/discount-codes/discount-codes.prompt.ts\nvar readDiscountCodesPrompt = `\nThis tool will fetch a Discount Code by ID or key (if provided) from commercetools or query all available discount codes in a commercetools project if no arguments or parameters are provided.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the discount code to fetch.\n- key (string, optional): The key of the discount code to fetch.\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"code = \\\\\"SUMMER2024\\\\\"\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"code asc\", \"createdAt desc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- expand (array of strings, optional): Fields to expand. Example: [\"cartDiscounts[*]\"]\n`;\nvar createDiscountCodesPrompt = `\nThis tool will create a new Discount Code in commercetools.\n\nIt takes these required arguments:\n- code (string): User-defined unique identifier added to a Cart to apply related Cart Discounts.\n- cartDiscounts (array): Array of references to up to 10 CartDiscounts that apply when the code is used. Each must have typeId \"cart-discount\" and either id or key.\n\nIt takes these optional arguments:\n- key (string, optional): User-defined unique identifier for the discount code (2-256 characters, alphanumeric with underscores/hyphens).\n- name (object, optional): Localized name of the Discount Code (object with language codes as keys).\n- description (object, optional): Localized description (object with language codes as keys).\n- cartPredicate (string, optional): Optional predicate defining which Carts the code can apply to.\n- isActive (boolean, optional): Whether the code can be applied (defaults to false).\n- maxApplications (integer, optional): Total number of times the code can be applied (must be >= 0).\n- maxApplicationsPerCustomer (integer, optional): Times the code can be applied per customer (must be >= 0).\n- groups (array of strings, optional): Tags for grouping and organizing Discount Codes.\n- validFrom (string, optional): Date/time when the code becomes valid (ISO 8601 format).\n- validUntil (string, optional): Date/time when the code expires (ISO 8601 format).\n- custom (object, optional): Custom fields for the discount code.\n`;\nvar updateDiscountCodesPrompt = `\nThis tool will update a Discount Code in commercetools using update actions from the commercetools API.\n\nIt takes these required arguments:\n- version (integer): The current version of the discount code.\n- actions (array): An array of update actions to perform on the discount code. Each action should have an \"action\" field indicating the action type.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the discount code to update (required if key is not provided).\n- key (string, optional): The key of the discount code to update (required if id is not provided).\n\nExample actions from commercetools API include:\n- changeCartDiscounts\n- changeGroups\n- changeIsActive\n- setCartPredicate\n- setCustomField\n- setCustomType\n- setDescription\n- setKey\n- setMaxApplications\n- setMaxApplicationsPerCustomer\n- setName\n- setValidFrom\n- setValidUntil\n\nEach action type requires specific fields according to the commercetools API.\n`;\nvar deleteDiscountCodesPrompt = `\nThis tool will delete a Discount Code from commercetools.\n\nIt takes these required arguments:\n- version (integer): The current version of the discount code (for optimistic locking).\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the discount code to delete (required if key is not provided).\n- key (string, optional): The key of the discount code to delete (required if id is not provided).\n- dataErasure (boolean, optional): Delete personal data.\n`;\n\n// src/resources/discount-codes/discount-codes.handler.ts\nvar DiscountCodesHandler = class extends CommercetoolsResourceHandler {\n constructor(apiClientFactory) {\n super(apiClientFactory);\n __publicField(this, \"metadata\", {\n namespace: \"discount-codes\",\n description: \"Manage discount codes in commercetools\",\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readDiscountCodesParameters,\n create: createDiscountCodesParameters,\n update: updateDiscountCodesParameters,\n delete: deleteDiscountCodesParameters\n }\n });\n }\n getToolDefinition(operation) {\n const prompts = {\n read: readDiscountCodesPrompt,\n create: createDiscountCodesPrompt,\n update: updateDiscountCodesPrompt,\n delete: deleteDiscountCodesPrompt\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation]\n };\n }\n getDiscountCodesApi(api) {\n return api.discountCodes();\n }\n async read(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n if (params?.id) {\n const discountCode = await this.getDiscountCodesApi(api).withId({ ID: params.id }).get({\n queryArgs: {\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return discountCode.body;\n } else if (params?.key) {\n const discountCode = await this.getDiscountCodesApi(api).withKey({ key: params.key }).get({\n queryArgs: {\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return discountCode.body;\n } else {\n const discountCodes = await this.getDiscountCodesApi(api).get({\n queryArgs: {\n limit: params.limit || 20,\n ...params.offset && { offset: params.offset },\n ...params.sort && { sort: params.sort },\n ...params.where && { where: params.where },\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return discountCodes.body;\n }\n } catch (err) {\n throw new ToolExecutionError(\n err.message || \"Failed to read discount codes\",\n context,\n err\n );\n }\n }\n async create(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n const discountCode = await this.getDiscountCodesApi(api).post({\n body: params\n }).execute();\n return discountCode.body;\n } catch (error) {\n throw new ToolExecutionError(\n \"Failed to create discount code\",\n context,\n error\n );\n }\n }\n async update(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n let currentVersion;\n let discountCodeId;\n if (params.id) {\n const discountCode = await this.getDiscountCodesApi(api).withId({ ID: params.id }).get().execute();\n currentVersion = discountCode.body.version;\n discountCodeId = params.id;\n } else if (params.key) {\n const discountCode = await this.getDiscountCodesApi(api).withKey({ key: params.key }).get().execute();\n currentVersion = discountCode.body.version;\n discountCodeId = discountCode.body.id;\n } else {\n throw new ToolExecutionError(\n \"Either id or key must be provided\",\n context\n );\n }\n const updatedDiscountCode = await this.getDiscountCodesApi(api).withId({ ID: discountCodeId }).post({\n body: {\n version: currentVersion,\n actions: params.actions\n }\n }).execute();\n return updatedDiscountCode.body;\n } catch (error) {\n throw new ToolExecutionError(\n \"Failed to update discount code\",\n context,\n error\n );\n }\n }\n async delete(context) {\n throw new ToolExecutionError(\n \"Delete operation not implemented for discount codes\",\n context\n );\n }\n};\nasync function readDiscountCodes(context, apiClientFactory) {\n const handler = new DiscountCodesHandler(apiClientFactory);\n return handler.read(context);\n}\nasync function createDiscountCodes(context, apiClientFactory) {\n const handler = new DiscountCodesHandler(apiClientFactory);\n return handler.create(context);\n}\nasync function updateDiscountCodes(context, apiClientFactory) {\n const handler = new DiscountCodesHandler(apiClientFactory);\n return handler.update(context);\n}\nasync function deleteDiscountCodes(context, apiClientFactory) {\n const handler = new DiscountCodesHandler(apiClientFactory);\n return handler.delete(context);\n}\n\n// src/resources/extensions/extensions.schema.ts\nvar import_zod11 = require(\"zod\");\nvar readExtensionsParameters = import_zod11.z.object({\n id: import_zod11.z.string().optional().describe(\"Extension ID\"),\n key: import_zod11.z.string().optional().describe(\"Extension key\"),\n where: import_zod11.z.array(import_zod11.z.string()).optional().describe(\n 'Query predicates specified as strings. Example: [\"key = \\\\\"my-extension\\\\\"\"]'\n ),\n sort: import_zod11.z.array(import_zod11.z.string()).optional().describe(\n 'Sort criteria for the results. Example: [\"key asc\", \"createdAt desc\"]'\n ),\n limit: import_zod11.z.number().int().min(1).max(500).optional().describe(\n \"A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\"\n ),\n offset: import_zod11.z.number().int().min(0).optional().describe(\n \"The number of items to skip before starting to collect the result set.\"\n ),\n expand: import_zod11.z.array(import_zod11.z.string()).optional().describe('Fields to expand. Example: [\"destination\", \"triggers\"]')\n});\nvar createExtensionsParameters = import_zod11.z.object({\n key: import_zod11.z.string().min(2).max(256).optional().describe(\"User-defined unique identifier for the extension\"),\n destination: import_zod11.z.object({\n type: import_zod11.z.enum([\"HTTP\", \"AWSLambda\", \"GoogleCloudFunction\"]),\n url: import_zod11.z.string().optional().describe(\"URL of the HTTP endpoint or Google Cloud Function\"),\n arn: import_zod11.z.string().optional().describe(\"ARN of the AWS Lambda function\"),\n accessKey: import_zod11.z.string().optional().describe(\"AWS access key or Azure Event Grid access key\"),\n accessSecret: import_zod11.z.string().optional().describe(\"AWS access secret\"),\n region: import_zod11.z.string().optional().describe(\"AWS region or Google Cloud region\"),\n authentication: import_zod11.z.object({\n type: import_zod11.z.enum([\"AuthorizationHeader\", \"AzureFunctions\"]),\n headerValue: import_zod11.z.string().optional().describe(\"Header value for authorization\"),\n key: import_zod11.z.string().optional().describe(\"Function key for authentication\")\n }).optional().describe(\"Authentication configuration\"),\n connectionString: import_zod11.z.string().optional().describe(\"Azure Service Bus connection string\"),\n uri: import_zod11.z.string().optional().describe(\"RabbitMQ URI or Azure Event Grid URI\")\n }).describe(\"Destination configuration for the extension\"),\n triggers: import_zod11.z.array(\n import_zod11.z.object({\n resourceTypeId: import_zod11.z.enum([\n \"cart\",\n \"order\",\n \"payment\",\n \"payment-method\",\n \"customer\",\n \"customer-group\",\n \"quote-request\",\n \"staged-quote\",\n \"quote\",\n \"business-unit\",\n \"shopping-list\"\n ]).describe(\"Resource type that triggers the extension\"),\n actions: import_zod11.z.array(import_zod11.z.enum([\"Create\", \"Update\"])).describe(\"Actions that trigger the extension\"),\n condition: import_zod11.z.string().optional().describe(\"Conditional predicate for triggering\")\n })\n ).describe(\"Describes what triggers the extension\"),\n timeoutInMs: import_zod11.z.number().int().min(1).max(1e4).optional().describe(\n \"Maximum time in milliseconds for the extension to respond (default: 2000, max: 10000)\"\n )\n});\nvar updateExtensionsParameters = import_zod11.z.object({\n id: import_zod11.z.string().optional().describe(\"The ID of the extension to update\"),\n key: import_zod11.z.string().optional().describe(\"The key of the extension to update\"),\n version: import_zod11.z.number().int().describe(\"The current version of the extension\"),\n actions: import_zod11.z.array(\n import_zod11.z.object({\n action: import_zod11.z.string().describe(\"The name of the update action to perform\")\n }).and(import_zod11.z.record(import_zod11.z.string(), import_zod11.z.any()).optional()).describe(\n 'Array of update actions to perform on the extension. Each action should have an \"action\" field and other fields specific to that action type.'\n )\n ).describe(\"Update actions\")\n});\nvar deleteExtensionsParameters = import_zod11.z.object({\n id: import_zod11.z.string().optional().describe(\"Extension ID\"),\n key: import_zod11.z.string().optional().describe(\"Extension key\"),\n version: import_zod11.z.number().int().describe(\"Current version (for optimistic locking)\")\n});\n\n// src/resources/extensions/extensions.prompt.ts\nvar readExtensionsPrompt = `\nThis tool will fetch an Extension by ID or key (if provided) from commercetools or query all available extensions in a commercetools project if no arguments or parameters are provided.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the extension to fetch.\n- key (string, optional): The key of the extension to fetch.\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"key = \\\\\"my-extension\\\\\"\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"key asc\", \"createdAt desc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- expand (array of strings, optional): Fields to expand. Example: [\"destination\", \"triggers\"]\n`;\nvar createExtensionsPrompt = `\nThis tool will create a new Extension in commercetools.\n\nIt takes these required arguments:\n- destination (object): Destination configuration for the extension. Must have:\n - type (string): Type of destination (\"HTTP\", \"AWSLambda\", or \"GoogleCloudFunction\")\n - For HTTP: url (string, required), authentication (object, optional)\n - For AWSLambda: arn (string, required), accessKey (string, required), accessSecret (string, required), region (string, required)\n - For GoogleCloudFunction: url (string, required), region (string, required)\n- triggers (array): Describes what triggers the extension. Each trigger should have:\n - resourceTypeId (string): Resource type that triggers the extension (cart, order, payment, customer, etc.)\n - actions (array): Actions that trigger the extension ([\"Create\", \"Update\"])\n - condition (string, optional): Conditional predicate for triggering\n\nIt takes these optional arguments:\n- key (string, optional): User-defined unique identifier for the extension (2-256 characters, alphanumeric with underscores/hyphens).\n- timeoutInMs (integer, optional): Maximum time in milliseconds for the extension to respond (1-10000, default: 2000).\n`;\nvar updateExtensionsPrompt = `\nThis tool will update an Extension in commercetools using update actions from the commercetools API.\n\nIt takes these required arguments:\n- version (integer): The current version of the extension.\n- actions (array): An array of update actions to perform on the extension. Each action should have an \"action\" field indicating the action type.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the extension to update (required if key is not provided).\n- key (string, optional): The key of the extension to update (required if id is not provided).\n\nExample actions from commercetools API include:\n- changeDestination\n- addTrigger\n- removeTrigger\n- changeTriggers\n- setKey\n- setTimeoutInMs\n\nEach action type requires specific fields according to the commercetools API.\n`;\nvar deleteExtensionsPrompt = `\nThis tool will delete an Extension from commercetools.\n\nIt takes these required arguments:\n- version (integer): The current version of the extension (for optimistic locking).\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the extension to delete (required if key is not provided).\n- key (string, optional): The key of the extension to delete (required if id is not provided).\n`;\n\n// src/resources/extensions/extensions.handler.ts\nvar ExtensionsHandler = class extends CommercetoolsResourceHandler {\n constructor(apiClientFactory) {\n super(apiClientFactory);\n __publicField(this, \"metadata\", {\n namespace: \"extensions\",\n description: \"Manage extensions in commercetools\",\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readExtensionsParameters,\n create: createExtensionsParameters,\n update: updateExtensionsParameters,\n delete: deleteExtensionsParameters\n }\n });\n }\n getToolDefinition(operation) {\n const prompts = {\n read: readExtensionsPrompt,\n create: createExtensionsPrompt,\n update: updateExtensionsPrompt,\n delete: deleteExtensionsPrompt\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation]\n };\n }\n getExtensionsApi(api) {\n return api.extensions();\n }\n async read(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n if (params?.id) {\n const extension = await this.getExtensionsApi(api).withId({ ID: params.id }).get().execute();\n return extension.body;\n } else if (params?.key) {\n const extension = await this.getExtensionsApi(api).withKey({ key: params.key }).get().execute();\n return extension.body;\n } else {\n const extensions = await this.getExtensionsApi(api).get({\n queryArgs: {\n limit: params.limit || 20,\n ...params.offset && { offset: params.offset },\n ...params.sort && { sort: params.sort },\n ...params.where && { where: params.where },\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return extensions.body;\n }\n } catch (err) {\n throw new ToolExecutionError(\n err.message || \"Failed to read extensions\",\n context,\n err\n );\n }\n }\n async create(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n const extension = await this.getExtensionsApi(api).post({\n body: params\n }).execute();\n return extension.body;\n } catch (error) {\n throw new ToolExecutionError(\n \"Failed to create extension\",\n context,\n error\n );\n }\n }\n async update(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n let currentVersion;\n let extensionId;\n if (params.id) {\n const extension = await this.getExtensionsApi(api).withId({ ID: params.id }).get().execute();\n currentVersion = extension.body.version;\n extensionId = params.id;\n } else if (params.key) {\n const extension = await this.getExtensionsApi(api).withKey({ key: params.key }).get().execute();\n currentVersion = extension.body.version;\n extensionId = extension.body.id;\n } else {\n throw new ToolExecutionError(\n \"Either id or key must be provided\",\n context\n );\n }\n const updatedExtension = await this.getExtensionsApi(api).withId({ ID: extensionId }).post({\n body: {\n version: currentVersion,\n actions: params.actions\n }\n }).execute();\n return updatedExtension.body;\n } catch (error) {\n throw new ToolExecutionError(\n \"Failed to update extension\",\n context,\n error\n );\n }\n }\n async delete(context) {\n throw new ToolExecutionError(\"Not implemented\", context);\n }\n};\nasync function readExtensions(context, apiClientFactory) {\n const handler = new ExtensionsHandler(apiClientFactory);\n return handler.read(context);\n}\nasync function createExtensions(context, apiClientFactory) {\n const handler = new ExtensionsHandler(apiClientFactory);\n return handler.create(context);\n}\nasync function updateExtensions(context, apiClientFactory) {\n const handler = new ExtensionsHandler(apiClientFactory);\n return handler.update(context);\n}\nasync function deleteExtensions(context, apiClientFactory) {\n const handler = new ExtensionsHandler(apiClientFactory);\n return handler.delete(context);\n}\n\n// src/resources/inventory/inventory.schema.ts\nvar import_zod12 = require(\"zod\");\nvar readInventoryParameters = import_zod12.z.object({\n id: import_zod12.z.string().optional().describe(\"Inventory Entry ID\"),\n key: import_zod12.z.string().optional().describe(\"Inventory Entry key\"),\n sku: import_zod12.z.string().optional().describe(\"SKU of the product variant\"),\n where: import_zod12.z.array(import_zod12.z.string()).optional().describe(\n 'Query predicates specified as strings. Example: [\"sku = \\\\\"SKU-123\\\\\"\"]'\n ),\n sort: import_zod12.z.array(import_zod12.z.string()).optional().describe(\n 'Sort criteria for the results. Example: [\"quantityOnStock desc\", \"createdAt asc\"]'\n ),\n limit: import_zod12.z.number().int().min(1).max(500).optional().describe(\n \"A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 10.\"\n ),\n offset: import_zod12.z.number().int().min(0).optional().describe(\n \"The number of items to skip before starting to collect the result set.\"\n ),\n expand: import_zod12.z.array(import_zod12.z.string()).optional().describe('Fields to expand. Example: [\"supplyChannel\"]')\n});\nvar createInventoryParameters = import_zod12.z.object({\n sku: import_zod12.z.string().describe(\"SKU of the product variant\"),\n quantityOnStock: import_zod12.z.number().int().min(0).describe(\"Quantity available in stock\"),\n key: import_zod12.z.string().optional().describe(\"User-defined unique identifier\"),\n supplyChannel: import_zod12.z.object({\n id: import_zod12.z.string().optional(),\n key: import_zod12.z.string().optional(),\n typeId: import_zod12.z.literal(\"channel\")\n }).optional().describe(\"Supply channel reference\"),\n expectedDelivery: import_zod12.z.string().optional().describe(\n \"Expected delivery date in ISO 8601 format (YYYY-MM-DDTHH:mm:ss.sssZ)\"\n ),\n restockableInDays: import_zod12.z.number().int().min(0).optional().describe(\"Number of days until the item is restockable\"),\n custom: import_zod12.z.object({\n type: import_zod12.z.object({\n id: import_zod12.z.string(),\n typeId: import_zod12.z.literal(\"type\")\n }).optional(),\n fields: import_zod12.z.record(import_zod12.z.string(), import_zod12.z.any()).optional()\n }).optional().describe(\"Custom fields\")\n});\nvar updateInventoryParameters = import_zod12.z.object({\n id: import_zod12.z.string().optional().describe(\"The ID of the inventory entry to update\"),\n key: import_zod12.z.string().optional().describe(\"The key of the inventory entry to update\"),\n version: import_zod12.z.number().int().describe(\"The current version of the inventory entry\"),\n actions: import_zod12.z.array(\n import_zod12.z.object({\n action: import_zod12.z.string().describe(\"The name of the update action\")\n }).and(import_zod12.z.record(import_zod12.z.string(), import_zod12.z.unknown()))\n ).describe(\"Update actions\")\n});\nvar deleteInventoryParameters = import_zod12.z.object({\n id: import_zod12.z.string().optional().describe(\"Inventory Entry ID\"),\n key: import_zod12.z.string().optional().describe(\"Inventory Entry key\"),\n version: import_zod12.z.number().int().describe(\"Current version\")\n});\n\n// src/resources/inventory/inventory.prompt.ts\nvar readInventoryPrompt = `\nThis tool will fetch an Inventory Entry by ID, key, or SKU from commercetools or query all available inventory entries in a commercetools project if no arguments or parameters are provided.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the inventory entry to fetch.\n- key (string, optional): The key of the inventory entry to fetch.\n- sku (string, optional): The SKU of the product variant to fetch inventory for.\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"sku = \\\\\"SKU-123\\\\\"\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"quantityOnStock desc\", \"createdAt asc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 10.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- expand (array of strings, optional): Fields to expand. Example: [\"supplyChannel\"]\n`;\nvar createInventoryPrompt = `\nThis tool will create a new Inventory Entry in commercetools.\n\nIt takes these required arguments:\n- sku (string): SKU of the product variant.\n- quantityOnStock (integer): Quantity available in stock (must be >= 0).\n\nIt takes these optional arguments:\n- key (string, optional): User-defined unique identifier for the inventory entry.\n- supplyChannel (object, optional): Supply channel reference. Must have typeId \"channel\" and either id or key.\n- expectedDelivery (string, optional): Expected delivery date in ISO 8601 format (YYYY-MM-DDTHH:mm:ss.sssZ).\n- restockableInDays (integer, optional): Number of days until the item is restockable (must be >= 0).\n- custom (object, optional): Custom fields. Must include type with id and typeId \"type\", and optional fields object.\n`;\nvar updateInventoryPrompt = `\nThis tool will update an Inventory Entry in commercetools using update actions from the commercetools API.\n\nIt takes these required arguments:\n- id (string): The ID of the inventory entry to update.\n- version (integer): The current version of the inventory entry.\n- actions (array): An array of update actions to perform on the inventory entry. Each action should have an \"action\" field indicating the action type.\n\nExample actions from commercetools API include:\n- addQuantity\n- changeQuantity\n- removeQuantity\n- setExpectedDelivery\n- setRestockableInDays\n- setSupplyChannel\n- setCustomField\n- setCustomType\n\nEach action type requires specific fields according to the commercetools API.\n`;\nvar deleteInventoryPrompt = `\nThis tool will delete an Inventory Entry from commercetools.\n\nIt takes these required arguments:\n- id (string): The ID of the inventory entry to delete.\n- version (integer): The current version of the inventory entry (for optimistic locking).\n`;\n\n// src/resources/inventory/inventory.handler.ts\nvar InventoryHandler = class extends CommercetoolsResourceHandler {\n constructor(apiClientFactory) {\n super(apiClientFactory);\n __publicField(this, \"metadata\", {\n namespace: \"inventory\",\n description: \"Manage inventory entries in commercetools\",\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readInventoryParameters,\n create: createInventoryParameters,\n update: updateInventoryParameters,\n delete: deleteInventoryParameters\n }\n });\n }\n getToolDefinition(operation) {\n const prompts = {\n read: readInventoryPrompt,\n create: createInventoryPrompt,\n update: updateInventoryPrompt,\n delete: deleteInventoryPrompt\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation]\n };\n }\n getInventoryApi(api) {\n return api.inventory();\n }\n async read(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n if (params?.id) {\n const inventoryEntry = await this.getInventoryApi(api).withId({ ID: params.id }).get({\n queryArgs: {\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return inventoryEntry.body;\n } else if (params?.key) {\n const inventoryEntry = await this.getInventoryApi(api).withKey({ key: params.key }).get({\n queryArgs: {\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return inventoryEntry.body;\n } else if (params?.sku) {\n const inventoryEntries = await this.getInventoryApi(api).get({\n queryArgs: {\n where: [`sku=\"${params.sku}\"`],\n limit: params.limit || 10,\n ...params.offset && { offset: params.offset },\n ...params.sort && { sort: params.sort },\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return inventoryEntries.body;\n } else {\n const inventoryEntries = await this.getInventoryApi(api).get({\n queryArgs: {\n limit: params.limit || 10,\n ...params.offset && { offset: params.offset },\n ...params.sort && { sort: params.sort },\n ...params.where && { where: params.where },\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return inventoryEntries.body;\n }\n } catch (err) {\n throw new ToolExecutionError(\n err.message || \"Failed to read inventory entry\",\n context,\n err\n );\n }\n }\n async create(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n const inventoryEntry = await this.getInventoryApi(api).post({\n body: params\n }).execute();\n return inventoryEntry.body;\n } catch (error) {\n throw new ToolExecutionError(\n \"Failed to create inventory entry\",\n context,\n error\n );\n }\n }\n async update(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n let currentVersion;\n let inventoryEntryId;\n if (params.id) {\n const inventoryEntry = await this.getInventoryApi(api).withId({ ID: params.id }).get().execute();\n currentVersion = inventoryEntry.body.version;\n inventoryEntryId = params.id;\n } else if (params.key) {\n const inventoryEntry = await this.getInventoryApi(api).withKey({ key: params.key }).get().execute();\n currentVersion = inventoryEntry.body.version;\n inventoryEntryId = inventoryEntry.body.id;\n } else {\n throw new ToolExecutionError(\n \"Either id or key must be provided\",\n context\n );\n }\n const updateActions = params.actions.filter(\n (action) => action.action !== \"removeQuantity\"\n );\n const updatedInventoryEntry = await this.getInventoryApi(api).withId({ ID: inventoryEntryId }).post({\n body: {\n version: currentVersion,\n actions: updateActions\n }\n }).execute();\n return updatedInventoryEntry.body;\n } catch (error) {\n throw new ToolExecutionError(\n \"Failed to update inventory entry\",\n context,\n error\n );\n }\n }\n async delete(context) {\n throw new ToolExecutionError(\"Not implemented\", context);\n }\n};\nasync function readInventory(context, apiClientFactory) {\n const handler = new InventoryHandler(apiClientFactory);\n return handler.read(context);\n}\nasync function createInventory(context, apiClientFactory) {\n const handler = new InventoryHandler(apiClientFactory);\n return handler.create(context);\n}\nasync function updateInventory(context, apiClientFactory) {\n const handler = new InventoryHandler(apiClientFactory);\n return handler.update(context);\n}\nasync function deleteInventory(context, apiClientFactory) {\n const handler = new InventoryHandler(apiClientFactory);\n return handler.delete(context);\n}\n\n// src/resources/messages/messages.schema.ts\nvar import_zod13 = require(\"zod\");\nvar readMessagesParameters = import_zod13.z.object({\n id: import_zod13.z.string().optional(),\n where: import_zod13.z.array(import_zod13.z.string()).optional(),\n sort: import_zod13.z.array(import_zod13.z.string()).optional(),\n limit: import_zod13.z.number().int().min(1).max(500).optional(),\n offset: import_zod13.z.number().int().optional(),\n expand: import_zod13.z.array(import_zod13.z.string()).optional()\n});\nvar createMessagesParameters = import_zod13.z.object({});\nvar updateMessagesParameters = import_zod13.z.object({});\nvar deleteMessagesParameters = import_zod13.z.object({});\n\n// src/resources/messages/messages.prompt.ts\nvar readMessagesPrompt = `\nRead Messages (change or event messages) generated by commercetools.\n\nOptional arguments:\n- id (string): fetch a single Message by ID\n- where (array[string]): query predicates\n- sort (array[string])\n- limit (int)\n- offset (int)\n- expand (array[string])\n\nNotes:\n- Messages are produced by the platform; they cannot be created/updated/deleted via the HTTP API.\n`;\nvar createMessagesPrompt = `\nMessages are generated by commercetools and cannot be created via API.\n`;\nvar updateMessagesPrompt = `\nMessages are read-only and cannot be updated via the API.\n`;\nvar deleteMessagesPrompt = `\nMessages are read-only and cannot be deleted via the API.\n`;\n\n// src/resources/messages/messages.handler.ts\nvar MessagesHandler = class extends CommercetoolsResourceHandler {\n constructor(apiClientFactory) {\n super(apiClientFactory);\n __publicField(this, \"metadata\", {\n namespace: \"messages\",\n description: \"Read messages generated by commercetools (change/messages)\",\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readMessagesParameters,\n create: createMessagesParameters,\n update: updateMessagesParameters,\n delete: deleteMessagesParameters\n }\n });\n }\n getToolDefinition(operation) {\n const prompts = {\n read: readMessagesPrompt,\n create: createMessagesPrompt,\n update: updateMessagesPrompt,\n delete: deleteMessagesPrompt\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation]\n };\n }\n getMessagesApi(api) {\n return api.messages();\n }\n async read(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n if (params?.id) {\n const res = await this.getMessagesApi(api).withId({ ID: params.id }).get().execute();\n return res.body;\n } else {\n const res = await this.getMessagesApi(api).get({\n queryArgs: {\n ...params.limit && { limit: params.limit },\n ...params.offset && { offset: params.offset },\n ...params.sort && { sort: params.sort },\n ...params.where && { where: params.where }\n }\n }).execute();\n return res.body;\n }\n } catch (err) {\n throw new ToolExecutionError(\"Failed to read messages\", context, err);\n }\n }\n async create(_context) {\n throw new ToolExecutionError(\"Create not supported for messages\", _context);\n }\n async update(_context) {\n throw new ToolExecutionError(\"Update not supported for messages\", _context);\n }\n async delete(_context) {\n throw new ToolExecutionError(\"Delete not supported for messages\", _context);\n }\n};\nasync function readMessages(context, apiClientFactory) {\n const handler = new MessagesHandler(apiClientFactory);\n return handler.read(context);\n}\nasync function createMessages(_context, apiClientFactory) {\n const handler = new MessagesHandler(apiClientFactory);\n return handler.create(_context);\n}\nasync function updateMessages(_context, apiClientFactory) {\n const handler = new MessagesHandler(apiClientFactory);\n return handler.update(_context);\n}\nasync function deleteMessages(_context, apiClientFactory) {\n const handler = new MessagesHandler(apiClientFactory);\n return handler.delete(_context);\n}\n\n// src/resources/product-discounts/product-discounts.schema.ts\nvar import_zod14 = require(\"zod\");\nvar readProductDiscountsParameters = import_zod14.z.object({\n id: import_zod14.z.string().optional().describe(\"Product Discount ID\"),\n key: import_zod14.z.string().optional().describe(\"Product Discount key\"),\n where: import_zod14.z.array(import_zod14.z.string()).optional().describe(\n 'Query predicates specified as strings. Example: [\"key = \\\\\"summer-sale\\\\\"\"]'\n ),\n sort: import_zod14.z.array(import_zod14.z.string()).optional().describe(\n 'Sort criteria for the results. Example: [\"key asc\", \"createdAt desc\"]'\n ),\n limit: import_zod14.z.number().int().min(1).max(500).optional().describe(\n \"A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\"\n ),\n offset: import_zod14.z.number().int().min(0).optional().describe(\n \"The number of items to skip before starting to collect the result set.\"\n ),\n expand: import_zod14.z.array(import_zod14.z.string()).optional().describe(\"Fields to expand. Example: []\")\n});\nvar createProductDiscountsParameters = import_zod14.z.object({\n key: import_zod14.z.string().min(2).max(256).optional().describe(\"User-defined unique identifier for the product discount\"),\n name: import_zod14.z.record(import_zod14.z.string()).describe(\"Product Discount name (localized string)\"),\n description: import_zod14.z.record(import_zod14.z.string()).optional().describe(\"Product Discount description (localized string)\"),\n value: import_zod14.z.any().describe(\"Value of the product discount\"),\n predicate: import_zod14.z.string().describe(\"Valid ProductDiscount predicate\"),\n sortOrder: import_zod14.z.string().describe(\"String value used to order ProductDiscounts\"),\n isActive: import_zod14.z.boolean().optional().describe(\"Whether the product discount is active (defaults to true)\"),\n validFrom: import_zod14.z.string().optional().describe(\"Date/time when the discount becomes valid (ISO 8601 format)\"),\n validUntil: import_zod14.z.string().optional().describe(\"Date/time when the discount expires (ISO 8601 format)\"),\n references: import_zod14.z.array(import_zod14.z.any()).optional().describe(\"References to other resources\")\n});\nvar updateProductDiscountsParameters = import_zod14.z.object({\n id: import_zod14.z.string().optional().describe(\"The ID of the product discount to update\"),\n key: import_zod14.z.string().optional().describe(\"The key of the product discount to update\"),\n version: import_zod14.z.number().int().describe(\"The current version of the product discount\"),\n actions: import_zod14.z.array(\n import_zod14.z.object({\n action: import_zod14.z.string().describe(\"The name of the update action to perform\")\n }).and(import_zod14.z.record(import_zod14.z.string(), import_zod14.z.any()).optional()).describe(\n 'Array of update actions to perform on the product discount. Each action should have an \"action\" field and other fields specific to that action type.'\n )\n ).describe(\"Update actions\")\n});\nvar deleteProductDiscountsParameters = import_zod14.z.object({\n id: import_zod14.z.string().optional().describe(\"Product Discount ID\"),\n key: import_zod14.z.string().optional().describe(\"Product Discount key\"),\n version: import_zod14.z.number().int().describe(\"Current version (for optimistic locking)\")\n});\n\n// src/resources/product-discounts/product-discounts.prompt.ts\nvar readProductDiscountsPrompt = `\nThis tool will fetch a Product Discount by ID or key (if provided) from commercetools or query all available product discounts in a commercetools project if no arguments or parameters are provided.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the product discount to fetch.\n- key (string, optional): The key of the product discount to fetch.\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"key = \\\\\"summer-sale\\\\\"\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"key asc\", \"createdAt desc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- expand (array of strings, optional): Fields to expand.\n`;\nvar createProductDiscountsPrompt = `\nThis tool will create a new Product Discount in commercetools.\n\nIt takes these required arguments:\n- name (object): Product Discount name (localized string, object with language codes as keys). Example: {\"en\": \"Summer Sale\", \"de\": \"Sommerverkauf\"}\n- value (object): Value of the product discount (can be absolute, relative, or external).\n- predicate (string): Valid ProductDiscount predicate. Example: \"1=1\" or \"variants.attributes.color = \\\\\"red\\\\\"\"\n- sortOrder (string): String value used to order ProductDiscounts.\n\nIt takes these optional arguments:\n- key (string, optional): User-defined unique identifier for the product discount (2-256 characters, alphanumeric with underscores/hyphens).\n- description (object, optional): Product Discount description (localized string, object with language codes as keys).\n- isActive (boolean, optional): Whether the product discount is active (defaults to true).\n- validFrom (string, optional): Date/time when the discount becomes valid (ISO 8601 format).\n- validUntil (string, optional): Date/time when the discount expires (ISO 8601 format).\n- references (array, optional): References to other resources.\n`;\nvar updateProductDiscountsPrompt = `\nThis tool will update a Product Discount in commercetools using update actions from the commercetools API.\n\nIt takes these required arguments:\n- version (integer): The current version of the product discount.\n- actions (array): An array of update actions to perform on the product discount. Each action should have an \"action\" field indicating the action type.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the product discount to update (required if key is not provided).\n- key (string, optional): The key of the product discount to update (required if id is not provided).\n\nExample actions from commercetools API include:\n- changeIsActive\n- changeName\n- changePredicate\n- changeSortOrder\n- changeValue\n- setDescription\n- setKey\n- setValidFrom\n- setValidUntil\n\nEach action type requires specific fields according to the commercetools API.\n`;\nvar deleteProductDiscountsPrompt = `\nThis tool will delete a Product Discount from commercetools.\n\nIt takes these required arguments:\n- version (integer): The current version of the product discount (for optimistic locking).\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the product discount to delete (required if key is not provided).\n- key (string, optional): The key of the product discount to delete (required if id is not provided).\n`;\n\n// src/resources/product-discounts/product-discounts.handler.ts\nvar ProductDiscountsHandler = class extends CommercetoolsResourceHandler {\n constructor(apiClientFactory) {\n super(apiClientFactory);\n __publicField(this, \"metadata\", {\n namespace: \"product-discounts\",\n description: \"Manage product discounts in commercetools\",\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readProductDiscountsParameters,\n create: createProductDiscountsParameters,\n update: updateProductDiscountsParameters,\n delete: deleteProductDiscountsParameters\n }\n });\n }\n getToolDefinition(operation) {\n const prompts = {\n read: readProductDiscountsPrompt,\n create: createProductDiscountsPrompt,\n update: updateProductDiscountsPrompt,\n delete: deleteProductDiscountsPrompt\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation]\n };\n }\n getProductDiscountsApi(api) {\n return api.productDiscounts();\n }\n async read(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n if (params?.id) {\n const productDiscount = await this.getProductDiscountsApi(api).withId({ ID: params.id }).get({\n queryArgs: {\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return productDiscount.body;\n } else if (params?.key) {\n const productDiscount = await this.getProductDiscountsApi(api).withKey({ key: params.key }).get({\n queryArgs: {\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return productDiscount.body;\n } else {\n const productDiscounts = await this.getProductDiscountsApi(api).get({\n queryArgs: {\n limit: params.limit || 20,\n ...params.offset && { offset: params.offset },\n ...params.sort && { sort: params.sort },\n ...params.where && { where: params.where },\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return productDiscounts.body;\n }\n } catch (err) {\n throw new ToolExecutionError(\n err.message || \"Failed to read product discounts\",\n context,\n err\n );\n }\n }\n async create(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n const productDiscount = await this.getProductDiscountsApi(api).post({\n body: params\n }).execute();\n return productDiscount.body;\n } catch (error) {\n throw new ToolExecutionError(\n \"Failed to create product discount\",\n context,\n error\n );\n }\n }\n async update(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n let currentVersion;\n let productDiscountId;\n if (params.id) {\n const productDiscount = await this.getProductDiscountsApi(api).withId({ ID: params.id }).get().execute();\n currentVersion = productDiscount.body.version;\n productDiscountId = params.id;\n } else if (params.key) {\n const productDiscount = await this.getProductDiscountsApi(api).withKey({ key: params.key }).get().execute();\n currentVersion = productDiscount.body.version;\n productDiscountId = productDiscount.body.id;\n } else {\n throw new ToolExecutionError(\n \"Either id or key must be provided\",\n context\n );\n }\n const updatedProductDiscount = await this.getProductDiscountsApi(api).withId({ ID: productDiscountId }).post({\n body: {\n version: currentVersion,\n actions: params.actions\n }\n }).execute();\n return updatedProductDiscount.body;\n } catch (error) {\n throw new ToolExecutionError(\n \"Failed to update product discount\",\n context,\n error\n );\n }\n }\n async delete(context) {\n throw new ToolExecutionError(\"Not implemented\", context);\n }\n};\nasync function readProductDiscounts(context, apiClientFactory) {\n const handler = new ProductDiscountsHandler(apiClientFactory);\n return handler.read(context);\n}\nasync function createProductDiscounts(context, apiClientFactory) {\n const handler = new ProductDiscountsHandler(apiClientFactory);\n return handler.create(context);\n}\nasync function updateProductDiscounts(context, apiClientFactory) {\n const handler = new ProductDiscountsHandler(apiClientFactory);\n return handler.update(context);\n}\nasync function deleteProductDiscounts(context, apiClientFactory) {\n const handler = new ProductDiscountsHandler(apiClientFactory);\n return handler.delete(context);\n}\n\n// src/resources/product-projections/product-projections.schema.ts\nvar import_zod15 = require(\"zod\");\nvar readProductProjectionsParameters = import_zod15.z.object({\n id: import_zod15.z.string().optional(),\n key: import_zod15.z.string().optional(),\n where: import_zod15.z.array(import_zod15.z.string()).optional(),\n sort: import_zod15.z.array(import_zod15.z.string()).optional(),\n limit: import_zod15.z.number().int().min(1).max(500).optional(),\n offset: import_zod15.z.number().int().optional(),\n expand: import_zod15.z.array(import_zod15.z.string()).optional(),\n fuzzy: import_zod15.z.boolean().optional()\n});\nvar createProductProjectionsParameters = import_zod15.z.object({});\nvar updateProductProjectionsParameters = import_zod15.z.object({});\nvar deleteProductProjectionsParameters = import_zod15.z.object({});\n\n// src/resources/product-projections/product-projections.prompt.ts\nvar readProductProjectionsPrompt = `\nThis tool reads Product Projections (published product data / search results) from commercetools.\n\nUsage patterns:\n- Read a single product projection by \\`id\\` or \\`key\\`.\n- Search product projections using search parameters (full-text, filters), or perform a paged query.\n\nIt accepts these optional arguments:\n- id (string, optional): Fetch a single Product Projection by its ID.\n- key (string, optional): Fetch a single Product Projection by its key.\n- text (string, optional): Full-text search query (search across searchable attributes).\n- fuzzy (boolean, optional): If true, allow fuzzy matching for text searches.\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"categories(id=\\\\\"123\\\\\")\", \"masterVariant(sku=\\\\\"SKU-1\\\\\")\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"name.en asc\", \"createdAt desc\"]\n- limit (integer, optional): Number of results to return (1-500). Default depends on API.\n- offset (integer, optional): Number of items to skip before collecting results.\n- expand (array of strings, optional): Fields to expand (e.g., [\"categories\", \"masterVariant\"]).\n\nNotes:\n- If \\`id\\` or \\`key\\` is provided the tool will return a single Product Projection object.\n- If no identifier is provided the tool will perform a search/query and return a paged search response.\n`;\nvar createProductProjectionsPrompt = `\nProduct Projections are read-only representations derived from Products; creating a Product Projection directly is not supported.\n\nIf you need to create product data, use the Product creation APIs (products.create) which will result in product projections becoming available once published.\n`;\nvar updateProductProjectionsPrompt = `\nProduct Projections are derived (read-only) and cannot be updated directly.\n\nTo change product projection data, update the underlying Product resource using the products.update tool (apply update actions to the Product), then publish as needed so projections reflect the changes.\n`;\nvar deleteProductProjectionsPrompt = `\nProduct Projections cannot be deleted directly because they are projections of Product resources.\n\nTo remove a projection, delete the underlying Product resource (products.delete) or unpublish it according to your commercetools workflow.\n`;\n\n// src/resources/product-projections/product-projections.handler.ts\nvar ProductProjectionsHandler = class extends CommercetoolsResourceHandler {\n constructor(apiClientFactory) {\n super(apiClientFactory);\n __publicField(this, \"metadata\", {\n namespace: \"product-projections\",\n description: \"Read product projections (search/projections)\",\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readProductProjectionsParameters,\n create: createProductProjectionsParameters,\n update: updateProductProjectionsParameters,\n delete: deleteProductProjectionsParameters\n }\n });\n }\n getToolDefinition(operation) {\n const prompts = {\n read: readProductProjectionsPrompt,\n create: createProductProjectionsPrompt,\n update: updateProductProjectionsPrompt,\n delete: deleteProductProjectionsPrompt\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation]\n };\n }\n getProductProjectionsApi(api) {\n return api.productProjections();\n }\n async read(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n if (params?.id) {\n const res = await this.getProductProjectionsApi(api).withId({ ID: params.id }).get().execute();\n return res.body;\n } else if (params?.key) {\n const res = await this.getProductProjectionsApi(api).withKey({ key: params.key }).get().execute();\n return res.body;\n } else {\n const search = await this.getProductProjectionsApi(api).search().post({ body: params }).execute();\n return search.body;\n }\n } catch (err) {\n throw new ToolExecutionError(\n \"Failed to read product projections\",\n context,\n err\n );\n }\n }\n async create(_context) {\n throw new ToolExecutionError(\n \"Create not supported for product-projections\",\n _context\n );\n }\n async update(_context) {\n throw new ToolExecutionError(\n \"Update not supported for product-projections\",\n _context\n );\n }\n async delete(_context) {\n throw new ToolExecutionError(\n \"Delete not supported for product-projections\",\n _context\n );\n }\n};\nasync function readProductProjections(context, apiClientFactory) {\n const handler = new ProductProjectionsHandler(apiClientFactory);\n return handler.read(context);\n}\nasync function createProductProjections(_context, apiClientFactory) {\n const handler = new ProductProjectionsHandler(apiClientFactory);\n return handler.create(_context);\n}\nasync function updateProductProjections(_context, apiClientFactory) {\n const handler = new ProductProjectionsHandler(apiClientFactory);\n return handler.update(_context);\n}\nasync function deleteProductProjections(_context, apiClientFactory) {\n const handler = new ProductProjectionsHandler(apiClientFactory);\n return handler.delete(_context);\n}\n\n// src/resources/product-search/product-search.schema.ts\nvar import_zod16 = require(\"zod\");\nvar readProductSearchParameters = import_zod16.z.object({\n query: import_zod16.z.string().optional().describe(\"Search query in the search query language\"),\n filter: import_zod16.z.array(import_zod16.z.string()).optional().describe(\"Filter expressions\"),\n facet: import_zod16.z.array(import_zod16.z.string()).optional().describe(\"Facet expressions\"),\n sort: import_zod16.z.array(import_zod16.z.string()).optional().describe(\"Sort criteria for the results\"),\n limit: import_zod16.z.number().int().min(1).max(500).optional().describe(\n \"A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\"\n ),\n offset: import_zod16.z.number().int().min(0).optional().describe(\n \"The number of items to skip before starting to collect the result set.\"\n ),\n markMatchingVariants: import_zod16.z.boolean().optional().describe(\"Whether to mark matching variants\"),\n priceCurrency: import_zod16.z.string().optional().describe(\"Currency code for price selection\"),\n priceCountry: import_zod16.z.string().optional().describe(\"Country code for price selection\"),\n priceCustomerGroup: import_zod16.z.string().optional().describe(\"Customer group ID for price selection\"),\n priceChannel: import_zod16.z.string().optional().describe(\"Channel ID for price selection\"),\n localeProjection: import_zod16.z.string().optional().describe(\"Locale for projection\"),\n storeProjection: import_zod16.z.string().optional().describe(\"Store key for projection\"),\n expand: import_zod16.z.array(import_zod16.z.string()).optional().describe(\"Fields to expand\")\n});\nvar createProductSearchParameters = import_zod16.z.object({}).describe(\"Product Search does not support create operations\");\nvar updateProductSearchParameters = import_zod16.z.object({}).describe(\"Product Search does not support update operations\");\nvar deleteProductSearchParameters = import_zod16.z.object({}).describe(\"Product Search does not support delete operations\");\n\n// src/resources/product-search/product-search.prompt.ts\nvar readProductSearchPrompt = `\nThis tool will search for products in commercetools using the Product Search API.\n\nIt takes these optional arguments:\n- query (string, optional): Search query in the search query language. Example: \"red shoes\" or \"name.en:shoes AND variants.attributes.color:red\"\n- filter (array of strings, optional): Filter expressions. Example: [\"variants.price.centAmount:range(1000 to 5000)\"]\n- facet (array of strings, optional): Facet expressions for faceted search.\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"name.en asc\", \"variants.price.centAmount desc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- markMatchingVariants (boolean, optional): Whether to mark matching variants in the response.\n- priceCurrency (string, optional): Currency code for price selection.\n- priceCountry (string, optional): Country code for price selection.\n- priceCustomerGroup (string, optional): Customer group ID for price selection.\n- priceChannel (string, optional): Channel ID for price selection.\n- localeProjection (string, optional): Locale for projection.\n- storeProjection (string, optional): Store key for projection.\n- expand (array of strings, optional): Fields to expand.\n`;\nvar createProductSearchPrompt = `\nProduct Search does not support create operations. This is a read-only search API.\n`;\nvar updateProductSearchPrompt = `\nProduct Search does not support update operations. This is a read-only search API.\n`;\nvar deleteProductSearchPrompt = `\nProduct Search does not support delete operations. This is a read-only search API.\n`;\n\n// src/resources/product-search/product-search.handler.ts\nvar ProductSearchHandler = class extends CommercetoolsResourceHandler {\n constructor(apiClientFactory) {\n super(apiClientFactory);\n __publicField(this, \"metadata\", {\n namespace: \"product-search\",\n description: \"Search products in commercetools\",\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readProductSearchParameters,\n create: createProductSearchParameters,\n update: updateProductSearchParameters,\n delete: deleteProductSearchParameters\n }\n });\n }\n getToolDefinition(operation) {\n const prompts = {\n read: readProductSearchPrompt,\n create: createProductSearchPrompt,\n update: updateProductSearchPrompt,\n delete: deleteProductSearchPrompt\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation]\n };\n }\n getProductSearchApi(api) {\n return api.products().search();\n }\n async read(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n const searchResponse = await this.getProductSearchApi(api).post({\n body: params\n }).execute();\n return searchResponse.body;\n } catch (err) {\n throw new ToolExecutionError(\n err.message || \"Failed to search products\",\n context,\n err\n );\n }\n }\n async create(context) {\n throw new ToolExecutionError(\n \"Create operation not supported for product-search\",\n context\n );\n }\n async update(context) {\n throw new ToolExecutionError(\n \"Update operation not supported for product-search\",\n context\n );\n }\n async delete(context) {\n throw new ToolExecutionError(\n \"Delete operation not supported for product-search\",\n context\n );\n }\n};\nasync function readProductSearch(context, apiClientFactory) {\n const handler = new ProductSearchHandler(apiClientFactory);\n return handler.read(context);\n}\nasync function createProductSearch(context, apiClientFactory) {\n const handler = new ProductSearchHandler(apiClientFactory);\n return handler.create(context);\n}\nasync function updateProductSearch(context, apiClientFactory) {\n const handler = new ProductSearchHandler(apiClientFactory);\n return handler.update(context);\n}\nasync function deleteProductSearch(context, apiClientFactory) {\n const handler = new ProductSearchHandler(apiClientFactory);\n return handler.delete(context);\n}\n\n// src/resources/product-selections/product-selections.schema.ts\nvar import_zod17 = require(\"zod\");\nvar readProductSelectionsParameters = import_zod17.z.object({\n id: import_zod17.z.string().optional().describe(\"Product Selection ID\"),\n key: import_zod17.z.string().optional().describe(\"Product Selection key\"),\n where: import_zod17.z.array(import_zod17.z.string()).optional().describe(\n 'Query predicates specified as strings. Example: [\"key = \\\\\"my-selection\\\\\"\"]'\n ),\n sort: import_zod17.z.array(import_zod17.z.string()).optional().describe(\n 'Sort criteria for the results. Example: [\"key asc\", \"createdAt desc\"]'\n ),\n limit: import_zod17.z.number().int().min(1).max(500).optional().describe(\n \"A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\"\n ),\n offset: import_zod17.z.number().int().min(0).optional().describe(\n \"The number of items to skip before starting to collect the result set.\"\n ),\n expand: import_zod17.z.array(import_zod17.z.string()).optional().describe(\"Fields to expand. Example: []\")\n});\nvar createProductSelectionsParameters = import_zod17.z.object({\n key: import_zod17.z.string().min(2).max(256).optional().describe(\"User-defined unique identifier for the product selection\"),\n name: import_zod17.z.record(import_zod17.z.string()).describe(\"Product Selection name (localized string)\"),\n mode: import_zod17.z.enum([\"Individual\", \"IndividualExclusion\"]).optional().describe(\n \"Selection mode: Individual (explicitly includes) or IndividualExclusion (explicitly excludes)\"\n ),\n custom: import_zod17.z.object({\n type: import_zod17.z.object({\n id: import_zod17.z.string(),\n typeId: import_zod17.z.literal(\"type\")\n }).optional(),\n fields: import_zod17.z.record(import_zod17.z.string(), import_zod17.z.any()).optional()\n }).optional().describe(\"Custom fields for the product selection\")\n});\nvar updateProductSelectionsParameters = import_zod17.z.object({\n id: import_zod17.z.string().optional().describe(\"The ID of the product selection to update\"),\n key: import_zod17.z.string().optional().describe(\"The key of the product selection to update\"),\n version: import_zod17.z.number().int().describe(\"The current version of the product selection\"),\n actions: import_zod17.z.array(\n import_zod17.z.object({\n action: import_zod17.z.string().describe(\"The name of the update action to perform\")\n }).and(import_zod17.z.record(import_zod17.z.string(), import_zod17.z.any()).optional()).describe(\n 'Array of update actions to perform on the product selection. Each action should have an \"action\" field and other fields specific to that action type.'\n )\n ).describe(\"Update actions\")\n});\nvar deleteProductSelectionsParameters = import_zod17.z.object({\n id: import_zod17.z.string().optional().describe(\"Product Selection ID\"),\n key: import_zod17.z.string().optional().describe(\"Product Selection key\"),\n version: import_zod17.z.number().int().describe(\"Current version (for optimistic locking)\")\n});\n\n// src/resources/product-selections/product-selections.prompt.ts\nvar readProductSelectionsPrompt = `\nThis tool will fetch a Product Selection by ID or key (if provided) from commercetools or query all available product selections in a commercetools project if no arguments or parameters are provided.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the product selection to fetch.\n- key (string, optional): The key of the product selection to fetch.\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"key = \\\\\"my-selection\\\\\"\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"key asc\", \"createdAt desc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- expand (array of strings, optional): Fields to expand.\n`;\nvar createProductSelectionsPrompt = `\nThis tool will create a new Product Selection in commercetools.\n\nIt takes these required arguments:\n- name (object): Product Selection name (localized string, object with language codes as keys). Example: {\"en\": \"Summer Collection\", \"de\": \"Sommerkollektion\"}\n\nIt takes these optional arguments:\n- key (string, optional): User-defined unique identifier for the product selection (2-256 characters, alphanumeric with underscores/hyphens).\n- mode (string, optional): Selection mode. Must be \"Individual\" (explicitly includes selected products) or \"IndividualExclusion\" (explicitly excludes selected products). Defaults to \"Individual\".\n- custom (object, optional): Custom fields for the product selection.\n`;\nvar updateProductSelectionsPrompt = `\nThis tool will update a Product Selection in commercetools using update actions from the commercetools API.\n\nIt takes these required arguments:\n- version (integer): The current version of the product selection.\n- actions (array): An array of update actions to perform on the product selection. Each action should have an \"action\" field indicating the action type.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the product selection to update (required if key is not provided).\n- key (string, optional): The key of the product selection to update (required if id is not provided).\n\nExample actions from commercetools API include:\n- addProduct\n- changeName\n- removeProduct\n- setCustomField\n- setCustomType\n- setKey\n\nEach action type requires specific fields according to the commercetools API.\n`;\nvar deleteProductSelectionsPrompt = `\nThis tool will delete a Product Selection from commercetools.\n\nIt takes these required arguments:\n- version (integer): The current version of the product selection (for optimistic locking).\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the product selection to delete (required if key is not provided).\n- key (string, optional): The key of the product selection to delete (required if id is not provided).\n`;\n\n// src/resources/product-selections/product-selections.handler.ts\nvar ProductSelectionsHandler = class extends CommercetoolsResourceHandler {\n constructor(apiClientFactory) {\n super(apiClientFactory);\n __publicField(this, \"metadata\", {\n namespace: \"product-selections\",\n description: \"Manage product selections in commercetools\",\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readProductSelectionsParameters,\n create: createProductSelectionsParameters,\n update: updateProductSelectionsParameters,\n delete: deleteProductSelectionsParameters\n }\n });\n }\n getToolDefinition(operation) {\n const prompts = {\n read: readProductSelectionsPrompt,\n create: createProductSelectionsPrompt,\n update: updateProductSelectionsPrompt,\n delete: deleteProductSelectionsPrompt\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation]\n };\n }\n getProductSelectionsApi(api) {\n return api.productSelections();\n }\n async read(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n if (params?.id) {\n const productSelection = await this.getProductSelectionsApi(api).withId({ ID: params.id }).get({\n queryArgs: {\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return productSelection.body;\n } else if (params?.key) {\n const productSelection = await this.getProductSelectionsApi(api).withKey({ key: params.key }).get({\n queryArgs: {\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return productSelection.body;\n } else {\n const productSelections = await this.getProductSelectionsApi(api).get({\n queryArgs: {\n limit: params.limit || 20,\n ...params.offset && { offset: params.offset },\n ...params.sort && { sort: params.sort },\n ...params.where && { where: params.where },\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return productSelections.body;\n }\n } catch (err) {\n throw new ToolExecutionError(\n err.message || \"Failed to read product selections\",\n context,\n err\n );\n }\n }\n async create(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n const productSelection = await this.getProductSelectionsApi(api).post({\n body: params\n }).execute();\n return productSelection.body;\n } catch (error) {\n throw new ToolExecutionError(\n \"Failed to create product selection\",\n context,\n error\n );\n }\n }\n async update(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n let currentVersion;\n let productSelectionId;\n if (params.id) {\n const productSelection = await this.getProductSelectionsApi(api).withId({ ID: params.id }).get().execute();\n currentVersion = productSelection.body.version;\n productSelectionId = params.id;\n } else if (params.key) {\n const productSelection = await this.getProductSelectionsApi(api).withKey({ key: params.key }).get().execute();\n currentVersion = productSelection.body.version;\n productSelectionId = productSelection.body.id;\n } else {\n throw new ToolExecutionError(\n \"Either id or key must be provided\",\n context\n );\n }\n const updatedProductSelection = await this.getProductSelectionsApi(api).withId({ ID: productSelectionId }).post({\n body: {\n version: currentVersion,\n actions: params.actions\n }\n }).execute();\n return updatedProductSelection.body;\n } catch (error) {\n throw new ToolExecutionError(\n \"Failed to update product selection\",\n context,\n error\n );\n }\n }\n async delete(context) {\n throw new ToolExecutionError(\"Not implemented\", context);\n }\n};\nasync function readProductSelections(context, apiClientFactory) {\n const handler = new ProductSelectionsHandler(apiClientFactory);\n return handler.read(context);\n}\nasync function createProductSelections(context, apiClientFactory) {\n const handler = new ProductSelectionsHandler(apiClientFactory);\n return handler.create(context);\n}\nasync function updateProductSelections(context, apiClientFactory) {\n const handler = new ProductSelectionsHandler(apiClientFactory);\n return handler.update(context);\n}\nasync function deleteProductSelections(context, apiClientFactory) {\n const handler = new ProductSelectionsHandler(apiClientFactory);\n return handler.delete(context);\n}\n\n// src/resources/product-tailoring/product-tailoring.schema.ts\nvar import_zod18 = require(\"zod\");\nvar readProductTailoringParameters = import_zod18.z.object({\n id: import_zod18.z.string().optional().describe(\"Product Tailoring ID\"),\n key: import_zod18.z.string().optional().describe(\"Product Tailoring key\"),\n productId: import_zod18.z.string().optional().describe(\"Product ID\"),\n productKey: import_zod18.z.string().optional().describe(\"Product key\"),\n storeKey: import_zod18.z.string().optional().describe(\"Store key\"),\n where: import_zod18.z.array(import_zod18.z.string()).optional().describe(\n 'Query predicates specified as strings. Example: [\"productKey = \\\\\"product-123\\\\\"\"]'\n ),\n sort: import_zod18.z.array(import_zod18.z.string()).optional().describe(\n 'Sort criteria for the results. Example: [\"productKey asc\", \"createdAt desc\"]'\n ),\n limit: import_zod18.z.number().int().min(1).max(500).optional().describe(\n \"A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\"\n ),\n offset: import_zod18.z.number().int().min(0).optional().describe(\n \"The number of items to skip before starting to collect the result set.\"\n ),\n expand: import_zod18.z.array(import_zod18.z.string()).optional().describe(\"Fields to expand. Example: []\")\n});\nvar createProductTailoringParameters = import_zod18.z.object({\n productKey: import_zod18.z.string().describe(\"Product key\"),\n storeKey: import_zod18.z.string().describe(\"Store key\"),\n name: import_zod18.z.record(import_zod18.z.string()).optional().describe(\"Tailored product name (localized string)\"),\n description: import_zod18.z.record(import_zod18.z.string()).optional().describe(\"Tailored product description (localized string)\"),\n slug: import_zod18.z.record(import_zod18.z.string()).optional().describe(\"Tailored product slug (localized string)\"),\n metaTitle: import_zod18.z.record(import_zod18.z.string()).optional().describe(\"Tailored meta title (localized string)\"),\n metaDescription: import_zod18.z.record(import_zod18.z.string()).optional().describe(\"Tailored meta description (localized string)\"),\n metaKeywords: import_zod18.z.record(import_zod18.z.string()).optional().describe(\"Tailored meta keywords (localized string)\"),\n variantTailoring: import_zod18.z.array(\n import_zod18.z.object({\n id: import_zod18.z.number().int().describe(\"Variant ID\"),\n images: import_zod18.z.array(import_zod18.z.any()).optional().describe(\"Tailored images for the variant\"),\n assets: import_zod18.z.array(import_zod18.z.any()).optional().describe(\"Tailored assets for the variant\"),\n attributes: import_zod18.z.record(import_zod18.z.any()).optional().describe(\"Tailored attributes for the variant\")\n })\n ).optional().describe(\"Variant tailoring data\")\n});\nvar updateProductTailoringParameters = import_zod18.z.object({\n id: import_zod18.z.string().optional().describe(\"Product Tailoring ID\"),\n key: import_zod18.z.string().optional().describe(\"Product Tailoring key\"),\n productId: import_zod18.z.string().optional().describe(\"Product ID\"),\n productKey: import_zod18.z.string().optional().describe(\"Product key\"),\n storeKey: import_zod18.z.string().optional().describe(\"Store key\"),\n version: import_zod18.z.number().int().describe(\"The current version of the product tailoring\"),\n actions: import_zod18.z.array(\n import_zod18.z.object({\n action: import_zod18.z.string().describe(\"The name of the update action to perform\")\n }).and(import_zod18.z.record(import_zod18.z.string(), import_zod18.z.any()).optional()).describe(\n 'Array of update actions to perform on the product tailoring. Each action should have an \"action\" field and other fields specific to that action type.'\n )\n ).describe(\"Update actions\")\n});\nvar deleteProductTailoringParameters = import_zod18.z.object({\n id: import_zod18.z.string().optional().describe(\"Product Tailoring ID\"),\n key: import_zod18.z.string().optional().describe(\"Product Tailoring key\"),\n productId: import_zod18.z.string().optional().describe(\"Product ID\"),\n productKey: import_zod18.z.string().optional().describe(\"Product key\"),\n storeKey: import_zod18.z.string().optional().describe(\"Store key\"),\n version: import_zod18.z.number().int().describe(\"Current version (for optimistic locking)\")\n});\n\n// src/resources/product-tailoring/product-tailoring.prompt.ts\nvar readProductTailoringPrompt = `\nThis tool will fetch Product Tailoring from commercetools. You can fetch by ID, key, product ID with store key, or product key with store key. If no specific identifier is provided, it will query all available product tailoring records.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the product tailoring to fetch.\n- key (string, optional): The key of the product tailoring to fetch.\n- productId (string, optional): The product ID to fetch tailoring for (requires storeKey).\n- productKey (string, optional): The product key to fetch tailoring for (requires storeKey).\n- storeKey (string, optional): The store key (required when using productId or productKey).\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"productKey = \\\\\"product-123\\\\\"\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"productKey asc\", \"createdAt desc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- expand (array of strings, optional): Fields to expand.\n`;\nvar createProductTailoringPrompt = `\nThis tool will create a new Product Tailoring in commercetools.\n\nIt takes these required arguments:\n- productKey (string): Product key.\n- storeKey (string): Store key.\n\nIt takes these optional arguments:\n- name (object, optional): Tailored product name (localized string, object with language codes as keys).\n- description (object, optional): Tailored product description (localized string).\n- slug (object, optional): Tailored product slug (localized string).\n- metaTitle (object, optional): Tailored meta title (localized string).\n- metaDescription (object, optional): Tailored meta description (localized string).\n- metaKeywords (object, optional): Tailored meta keywords (localized string).\n- variantTailoring (array, optional): Variant tailoring data. Each variant tailoring should have:\n - id (integer): Variant ID.\n - images (array, optional): Tailored images for the variant.\n - assets (array, optional): Tailored assets for the variant.\n - attributes (object, optional): Tailored attributes for the variant.\n`;\nvar updateProductTailoringPrompt = `\nThis tool will update a Product Tailoring in commercetools using update actions from the commercetools API.\n\nIt takes these required arguments:\n- version (integer): The current version of the product tailoring.\n- actions (array): An array of update actions to perform on the product tailoring. Each action should have an \"action\" field indicating the action type.\n\nIt takes these optional arguments (one of the following must be provided):\n- id (string, optional): The ID of the product tailoring to update.\n- key (string, optional): The key of the product tailoring to update.\n- productId (string, optional): The product ID (requires storeKey).\n- productKey (string, optional): The product key (requires storeKey).\n- storeKey (string, optional): The store key (required when using productId or productKey).\n\nExample actions from commercetools API include:\n- changeName\n- changeDescription\n- changeSlug\n- setMetaTitle\n- setMetaDescription\n- setMetaKeywords\n- setVariantImages\n- setVariantAssets\n- setVariantAttribute\n\nEach action type requires specific fields according to the commercetools API.\n`;\nvar deleteProductTailoringPrompt = `\nThis tool will delete a Product Tailoring from commercetools.\n\nIt takes these required arguments:\n- version (integer): The current version of the product tailoring (for optimistic locking).\n\nIt takes these optional arguments (one of the following must be provided):\n- id (string, optional): The ID of the product tailoring to delete.\n- key (string, optional): The key of the product tailoring to delete.\n- productId (string, optional): The product ID (requires storeKey).\n- productKey (string, optional): The product key (requires storeKey).\n- storeKey (string, optional): The store key (required when using productId or productKey).\n`;\n\n// src/resources/product-tailoring/product-tailoring.handler.ts\nvar ProductTailoringHandler = class extends CommercetoolsResourceHandler {\n constructor(apiClientFactory) {\n super(apiClientFactory);\n __publicField(this, \"metadata\", {\n namespace: \"product-tailoring\",\n description: \"Manage product tailoring in commercetools\",\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readProductTailoringParameters,\n create: createProductTailoringParameters,\n update: updateProductTailoringParameters,\n delete: deleteProductTailoringParameters\n }\n });\n }\n getToolDefinition(operation) {\n const prompts = {\n read: readProductTailoringPrompt,\n create: createProductTailoringPrompt,\n update: updateProductTailoringPrompt,\n delete: deleteProductTailoringPrompt\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation]\n };\n }\n getProductTailoringApi(api, storeKey) {\n return storeKey ? api.inStoreKeyWithStoreKeyValue({ storeKey }).productTailoring() : api.productTailoring();\n }\n async read(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n if (params?.id) {\n const productTailoring = await api.productTailoring().withId({ ID: params.id }).get({\n queryArgs: {\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return productTailoring.body;\n }\n if (params?.key) {\n const productTailoring = await api.productTailoring().withKey({ key: params.key }).get({\n queryArgs: {\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return productTailoring.body;\n }\n if (params?.productId && params?.storeKey) {\n const productTailoring = await api.inStoreKeyWithStoreKeyValue({ storeKey: params.storeKey }).products().withProductId({ productID: params.productId }).productTailoring().get({\n queryArgs: {\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return productTailoring.body;\n }\n if (params?.productKey && params?.storeKey) {\n const productTailoring = await api.inStoreKeyWithStoreKeyValue({ storeKey: params.storeKey }).products().withProductKey({ productKey: params.productKey }).productTailoring().get({\n queryArgs: {\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return productTailoring.body;\n }\n const productTailorings = await this.getProductTailoringApi(\n api,\n params.storeKey\n ).get({\n queryArgs: {\n limit: params.limit || 20,\n ...params.offset && { offset: params.offset },\n ...params.sort && { sort: params.sort },\n ...params.where && { where: params.where },\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return productTailorings.body;\n } catch (err) {\n throw new ToolExecutionError(\n err.message || \"Failed to read product tailoring\",\n context,\n err\n );\n }\n }\n async create(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n const productTailoring = await this.getProductTailoringApi(\n api,\n params.storeKey\n ).post({\n body: params\n }).execute();\n return productTailoring.body;\n } catch (error) {\n throw new ToolExecutionError(\n \"Failed to create product tailoring\",\n context,\n error\n );\n }\n }\n async update(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n let productTailoring;\n let currentVersion;\n if (params.id) {\n const response = await api.productTailoring().withId({ ID: params.id }).get().execute();\n productTailoring = response.body;\n currentVersion = productTailoring.version;\n const updated = await api.productTailoring().withId({ ID: params.id }).post({\n body: {\n version: currentVersion,\n actions: params.actions\n }\n }).execute();\n return updated.body;\n }\n if (params.key) {\n const response = await api.productTailoring().withKey({ key: params.key }).get().execute();\n productTailoring = response.body;\n currentVersion = productTailoring.version;\n const updated = await api.productTailoring().withKey({ key: params.key }).post({\n body: {\n version: currentVersion,\n actions: params.actions\n }\n }).execute();\n return updated.body;\n }\n if (params.productId && params.storeKey) {\n const response = await api.inStoreKeyWithStoreKeyValue({ storeKey: params.storeKey }).products().withProductId({ productID: params.productId }).productTailoring().get().execute();\n productTailoring = response.body;\n currentVersion = productTailoring.version;\n const updated = await api.inStoreKeyWithStoreKeyValue({ storeKey: params.storeKey }).products().withProductId({ productID: params.productId }).productTailoring().post({\n body: {\n version: currentVersion,\n actions: params.actions\n }\n }).execute();\n return updated.body;\n }\n if (params.productKey && params.storeKey) {\n const response = await api.inStoreKeyWithStoreKeyValue({ storeKey: params.storeKey }).products().withProductKey({ productKey: params.productKey }).productTailoring().get().execute();\n productTailoring = response.body;\n currentVersion = productTailoring.version;\n const updated = await api.inStoreKeyWithStoreKeyValue({ storeKey: params.storeKey }).products().withProductKey({ productKey: params.productKey }).productTailoring().post({\n body: {\n version: currentVersion,\n actions: params.actions\n }\n }).execute();\n return updated.body;\n }\n throw new ToolExecutionError(\n \"Either id, key, or (productId/productKey with storeKey) must be provided\",\n context\n );\n } catch (error) {\n throw new ToolExecutionError(\n \"Failed to update product tailoring\",\n context,\n error\n );\n }\n }\n async delete(context) {\n throw new ToolExecutionError(\"Not implemented\", context);\n }\n};\nasync function readProductTailoring(context, apiClientFactory) {\n const handler = new ProductTailoringHandler(apiClientFactory);\n return handler.read(context);\n}\nasync function createProductTailoring(context, apiClientFactory) {\n const handler = new ProductTailoringHandler(apiClientFactory);\n return handler.create(context);\n}\nasync function updateProductTailoring(context, apiClientFactory) {\n const handler = new ProductTailoringHandler(apiClientFactory);\n return handler.update(context);\n}\nasync function deleteProductTailoring(context, apiClientFactory) {\n const handler = new ProductTailoringHandler(apiClientFactory);\n return handler.delete(context);\n}\n\n// src/resources/product-types/product-types.schema.ts\nvar import_zod19 = require(\"zod\");\nvar readProductTypesParameters = import_zod19.z.object({\n id: import_zod19.z.string().optional().describe(\"Product Type ID\"),\n key: import_zod19.z.string().optional().describe(\"Product Type key\"),\n where: import_zod19.z.array(import_zod19.z.string()).optional().describe(\n 'Query predicates specified as strings. Example: [\"key = \\\\\"my-product-type\\\\\"\"]'\n ),\n sort: import_zod19.z.array(import_zod19.z.string()).optional().describe(\n 'Sort criteria for the results. Example: [\"key asc\", \"createdAt desc\"]'\n ),\n limit: import_zod19.z.number().int().min(1).max(500).optional().describe(\n \"A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\"\n ),\n offset: import_zod19.z.number().int().min(0).optional().describe(\n \"The number of items to skip before starting to collect the result set.\"\n ),\n expand: import_zod19.z.array(import_zod19.z.string()).optional().describe(\"Fields to expand. Example: []\")\n});\nvar createProductTypesParameters = import_zod19.z.object({\n key: import_zod19.z.string().min(2).max(256).describe(\"User-defined unique identifier for the product type\"),\n name: import_zod19.z.string().describe(\"Product Type name\"),\n description: import_zod19.z.string().optional().describe(\"Product Type description\"),\n attributes: import_zod19.z.array(\n import_zod19.z.object({\n name: import_zod19.z.string().describe(\"Attribute name\"),\n label: import_zod19.z.record(import_zod19.z.string()).optional().describe(\"Localized label for the attribute\"),\n isRequired: import_zod19.z.boolean().optional().describe(\"Whether the attribute is required\"),\n isSearchable: import_zod19.z.boolean().optional().describe(\"Whether the attribute is searchable\"),\n type: import_zod19.z.any().describe(\"Attribute type definition\"),\n attributeConstraint: import_zod19.z.enum([\"None\", \"Unique\", \"CombinationUnique\", \"SameForAll\"]).optional().describe(\"Attribute constraint\"),\n inputHint: import_zod19.z.enum([\"SingleLine\", \"MultiLine\"]).optional().describe(\"Input hint for String attributes\"),\n inputTip: import_zod19.z.record(import_zod19.z.string()).optional().describe(\"Input tip for the attribute (localized)\")\n })\n ).optional().describe(\"Array of attribute definitions\")\n});\nvar updateProductTypesParameters = import_zod19.z.object({\n id: import_zod19.z.string().optional().describe(\"The ID of the product type to update\"),\n key: import_zod19.z.string().optional().describe(\"The key of the product type to update\"),\n version: import_zod19.z.number().int().describe(\"The current version of the product type\"),\n actions: import_zod19.z.array(\n import_zod19.z.object({\n action: import_zod19.z.string().describe(\"The name of the update action to perform\")\n }).and(import_zod19.z.record(import_zod19.z.string(), import_zod19.z.any()).optional()).describe(\n 'Array of update actions to perform on the product type. Each action should have an \"action\" field and other fields specific to that action type.'\n )\n ).describe(\"Update actions\")\n});\nvar deleteProductTypesParameters = import_zod19.z.object({\n id: import_zod19.z.string().optional().describe(\"Product Type ID\"),\n key: import_zod19.z.string().optional().describe(\"Product Type key\"),\n version: import_zod19.z.number().int().describe(\"Current version (for optimistic locking)\")\n});\n\n// src/resources/product-types/product-types.prompt.ts\nvar readProductTypesPrompt = `\nThis tool will fetch a Product Type by ID or key (if provided) from commercetools or query all available product types in a commercetools project if no arguments or parameters are provided.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the product type to fetch.\n- key (string, optional): The key of the product type to fetch.\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"key = \\\\\"my-product-type\\\\\"\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"key asc\", \"createdAt desc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- expand (array of strings, optional): Fields to expand.\n`;\nvar createProductTypesPrompt = `\nThis tool will create a new Product Type in commercetools.\n\nIt takes these required arguments:\n- key (string): User-defined unique identifier for the product type (2-256 characters, alphanumeric with underscores/hyphens).\n- name (string): Product Type name.\n\nIt takes these optional arguments:\n- description (string, optional): Product Type description.\n- attributes (array, optional): Array of attribute definitions. Each attribute definition should have:\n - name (string): Attribute name.\n - label (object, optional): Localized label for the attribute (object with language codes as keys).\n - isRequired (boolean, optional): Whether the attribute is required.\n - isSearchable (boolean, optional): Whether the attribute is searchable.\n - type (object): Attribute type definition (Boolean, Text, LocalizedText, Enum, LocalizedEnum, Number, Money, Date, Time, DateTime, Reference, Set, Nested).\n - attributeConstraint (string, optional): Attribute constraint (\"None\", \"Unique\", \"CombinationUnique\", \"SameForAll\").\n - inputHint (string, optional): Input hint for String attributes (\"SingleLine\" or \"MultiLine\").\n - inputTip (object, optional): Input tip for the attribute (localized string).\n`;\nvar updateProductTypesPrompt = `\nThis tool will update a Product Type in commercetools using update actions from the commercetools API.\n\nIt takes these required arguments:\n- id (string): The ID of the product type to update.\n- version (integer): The current version of the product type.\n- actions (array): An array of update actions to perform on the product type. Each action should have an \"action\" field indicating the action type.\n\nExample actions from commercetools API include:\n- addAttributeDefinition\n- addEnumValue\n- addLocalizedEnumValue\n- addPlainEnumValue\n- changeAttributeConstraint\n- changeAttributeName\n- changeAttributeOrder\n- changeDescription\n- changeEnumKey\n- changeEnumValueLabel\n- changeEnumValueOrder\n- changeInputHint\n- changeIsSearchable\n- changeLabel\n- changeLocalizedEnumValueLabel\n- changeLocalizedEnumValueOrder\n- changeName\n- removeAttributeDefinition\n- removeEnumValues\n- setInputTip\n\nEach action type requires specific fields according to the commercetools API.\n`;\nvar deleteProductTypesPrompt = `\nThis tool will delete a Product Type from commercetools.\n\nIt takes these required arguments:\n- id (string): The ID of the product type to delete.\n- version (integer): The current version of the product type (for optimistic locking).\n`;\n\n// src/resources/product-types/product-types.handler.ts\nvar ProductTypesHandler = class extends CommercetoolsResourceHandler {\n constructor(apiClientFactory) {\n super(apiClientFactory);\n __publicField(this, \"metadata\", {\n namespace: \"product-types\",\n description: \"Manage product types in commercetools\",\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readProductTypesParameters,\n create: createProductTypesParameters,\n update: updateProductTypesParameters,\n delete: deleteProductTypesParameters\n }\n });\n }\n getToolDefinition(operation) {\n const prompts = {\n read: readProductTypesPrompt,\n create: createProductTypesPrompt,\n update: updateProductTypesPrompt,\n delete: deleteProductTypesPrompt\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation]\n };\n }\n getProductTypesApi(api) {\n return api.productTypes();\n }\n async read(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n if (params?.id) {\n const productType = await this.getProductTypesApi(api).withId({ ID: params.id }).get({\n queryArgs: {\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return productType.body;\n } else if (params?.key) {\n const productType = await this.getProductTypesApi(api).withKey({ key: params.key }).get().execute();\n return productType.body;\n } else {\n const productTypes = await this.getProductTypesApi(api).get({\n queryArgs: {\n limit: params.limit || 20,\n ...params.offset && { offset: params.offset },\n ...params.sort && { sort: params.sort },\n ...params.where && { where: params.where },\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return productTypes.body;\n }\n } catch (err) {\n throw new ToolExecutionError(\n err.message || \"Failed to read product types\",\n context,\n err\n );\n }\n }\n async create(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n const productType = await this.getProductTypesApi(api).post({\n body: params\n }).execute();\n return productType.body;\n } catch (error) {\n throw new ToolExecutionError(\n \"Failed to create product type\",\n context,\n error\n );\n }\n }\n async update(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n let currentVersion;\n let productTypeId;\n if (params.id) {\n const productType = await this.getProductTypesApi(api).withId({ ID: params.id }).get().execute();\n currentVersion = productType.body.version;\n productTypeId = params.id;\n } else if (params.key) {\n const productType = await this.getProductTypesApi(api).withKey({ key: params.key }).get().execute();\n currentVersion = productType.body.version;\n productTypeId = productType.body.id;\n } else {\n throw new ToolExecutionError(\n \"Either id or key must be provided\",\n context\n );\n }\n const updatedProductType = await this.getProductTypesApi(api).withId({ ID: productTypeId }).post({\n body: {\n version: currentVersion,\n actions: params.actions\n }\n }).execute();\n return updatedProductType.body;\n } catch (error) {\n throw new ToolExecutionError(\n \"Failed to update product type\",\n context,\n error\n );\n }\n }\n async delete(context) {\n throw new ToolExecutionError(\"Not implemented\", context);\n }\n};\nasync function readProductTypes(context, apiClientFactory) {\n const handler = new ProductTypesHandler(apiClientFactory);\n return handler.read(context);\n}\nasync function createProductTypes(context, apiClientFactory) {\n const handler = new ProductTypesHandler(apiClientFactory);\n return handler.create(context);\n}\nasync function updateProductTypes(context, apiClientFactory) {\n const handler = new ProductTypesHandler(apiClientFactory);\n return handler.update(context);\n}\nasync function deleteProductTypes(context, apiClientFactory) {\n const handler = new ProductTypesHandler(apiClientFactory);\n return handler.delete(context);\n}\n\n// src/resources/products/products.schema.ts\nvar import_zod20 = require(\"zod\");\nvar readProductsParameters = import_zod20.z.object({\n id: import_zod20.z.string().optional().describe(\"Product ID\"),\n key: import_zod20.z.string().optional().describe(\"Product key\"),\n where: import_zod20.z.array(import_zod20.z.string()).optional().describe(\n 'Query predicates specified as strings. Example: [\"key = \\\\\"product-key\\\\\"\"]'\n ),\n sort: import_zod20.z.array(import_zod20.z.string()).optional().describe(\n 'Sort criteria for the results. Example: [\"name asc\", \"createdAt desc\"]'\n ),\n limit: import_zod20.z.number().int().min(1).max(500).optional().describe(\n \"A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\"\n ),\n offset: import_zod20.z.number().int().min(0).optional().describe(\n \"The number of items to skip before starting to collect the result set.\"\n ),\n expand: import_zod20.z.array(import_zod20.z.string()).optional().describe('Fields to expand. Example: [\"productType\", \"categories[*]\"]'),\n priceCurrency: import_zod20.z.string().optional().describe(\"Currency code for price selection\"),\n priceCountry: import_zod20.z.string().optional().describe(\"Country code for price selection\"),\n priceCustomerGroup: import_zod20.z.string().optional().describe(\"Customer group ID for price selection\"),\n priceChannel: import_zod20.z.string().optional().describe(\"Channel ID for price selection\"),\n localeProjection: import_zod20.z.string().optional().describe(\"Locale for projection\"),\n storeProjection: import_zod20.z.string().optional().describe(\"Store key for projection\")\n});\nvar createProductsParameters = import_zod20.z.object({\n key: import_zod20.z.string().min(2).max(256).optional().describe(\"User-defined unique identifier for the product\"),\n productType: import_zod20.z.object({\n id: import_zod20.z.string().optional(),\n key: import_zod20.z.string().optional(),\n typeId: import_zod20.z.literal(\"product-type\")\n }).describe(\"Product Type reference\"),\n name: import_zod20.z.record(import_zod20.z.string()).describe(\"Product name (localized string)\"),\n description: import_zod20.z.record(import_zod20.z.string()).optional().describe(\"Product description (localized string)\"),\n slug: import_zod20.z.record(import_zod20.z.string()).describe(\"Product slug (localized string)\"),\n categories: import_zod20.z.array(\n import_zod20.z.object({\n id: import_zod20.z.string().optional(),\n key: import_zod20.z.string().optional(),\n typeId: import_zod20.z.literal(\"category\")\n })\n ).optional().describe(\"Array of category references\"),\n categoryOrderHints: import_zod20.z.record(import_zod20.z.string()).optional().describe(\"Category order hints\"),\n metaTitle: import_zod20.z.record(import_zod20.z.string()).optional().describe(\"Meta title (localized string)\"),\n metaDescription: import_zod20.z.record(import_zod20.z.string()).optional().describe(\"Meta description (localized string)\"),\n metaKeywords: import_zod20.z.record(import_zod20.z.string()).optional().describe(\"Meta keywords (localized string)\"),\n masterVariant: import_zod20.z.any().optional().describe(\"Master variant\"),\n variants: import_zod20.z.array(import_zod20.z.any()).optional().describe(\"Product variants\"),\n taxCategory: import_zod20.z.object({\n id: import_zod20.z.string().optional(),\n key: import_zod20.z.string().optional(),\n typeId: import_zod20.z.literal(\"tax-category\")\n }).optional().describe(\"Tax category reference\"),\n state: import_zod20.z.object({\n id: import_zod20.z.string().optional(),\n key: import_zod20.z.string().optional(),\n typeId: import_zod20.z.literal(\"state\")\n }).optional().describe(\"State reference\"),\n reviewRatingStatistics: import_zod20.z.any().optional().describe(\"Review rating statistics\"),\n publish: import_zod20.z.boolean().optional().describe(\"Whether to publish the product\"),\n priceMode: import_zod20.z.enum([\"Embedded\", \"Standalone\"]).optional().describe(\"Price mode\")\n});\nvar updateProductsParameters = import_zod20.z.object({\n id: import_zod20.z.string().optional().describe(\"The ID of the product to update\"),\n key: import_zod20.z.string().optional().describe(\"The key of the product to update\"),\n version: import_zod20.z.number().int().describe(\"The current version of the product\"),\n actions: import_zod20.z.array(\n import_zod20.z.object({\n action: import_zod20.z.string().describe(\"The name of the update action to perform\")\n }).and(import_zod20.z.record(import_zod20.z.string(), import_zod20.z.any()).optional()).describe(\n 'Array of update actions to perform on the product. Each action should have an \"action\" field and other fields specific to that action type.'\n )\n ).describe(\"Update actions\")\n});\nvar deleteProductsParameters = import_zod20.z.object({\n id: import_zod20.z.string().optional().describe(\"Product ID\"),\n key: import_zod20.z.string().optional().describe(\"Product key\"),\n version: import_zod20.z.number().int().describe(\"Current version (for optimistic locking)\"),\n priceMode: import_zod20.z.enum([\"Embedded\", \"Standalone\"]).optional().describe(\"Price mode\")\n});\n\n// src/resources/products/products.prompt.ts\nvar readProductsPrompt = `\nThis tool will fetch a Product by ID or key (if provided) from commercetools or query all available products in a commercetools project if no arguments or parameters are provided.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the product to fetch.\n- key (string, optional): The key of the product to fetch.\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"key = \\\\\"product-key\\\\\"\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"name asc\", \"createdAt desc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- expand (array of strings, optional): Fields to expand. Example: [\"productType\", \"categories[*]\"]\n- priceCurrency (string, optional): Currency code for price selection.\n- priceCountry (string, optional): Country code for price selection.\n- priceCustomerGroup (string, optional): Customer group ID for price selection.\n- priceChannel (string, optional): Channel ID for price selection.\n- localeProjection (string, optional): Locale for projection.\n- storeProjection (string, optional): Store key for projection.\n`;\nvar createProductsPrompt = `\nThis tool will create a new Product in commercetools.\n\nIt takes these required arguments:\n- productType (object): Product Type reference. Must have typeId \"product-type\" and either id or key.\n- name (object): Product name (localized string, object with language codes as keys).\n- slug (object): Product slug (localized string, object with language codes as keys).\n\nIt takes these optional arguments:\n- key (string, optional): User-defined unique identifier for the product (2-256 characters, alphanumeric with underscores/hyphens).\n- description (object, optional): Product description (localized string).\n- categories (array, optional): Array of category references. Each must have typeId \"category\" and either id or key.\n- categoryOrderHints (object, optional): Category order hints.\n- metaTitle (object, optional): Meta title (localized string).\n- metaDescription (object, optional): Meta description (localized string).\n- metaKeywords (object, optional): Meta keywords (localized string).\n- masterVariant (object, optional): Master variant definition.\n- variants (array, optional): Array of product variants.\n- taxCategory (object, optional): Tax category reference. Must have typeId \"tax-category\" and either id or key.\n- state (object, optional): State reference. Must have typeId \"state\" and either id or key.\n- reviewRatingStatistics (object, optional): Review rating statistics.\n- publish (boolean, optional): Whether to publish the product.\n- priceMode (string, optional): Price mode (\"Embedded\" or \"Standalone\").\n`;\nvar updateProductsPrompt = `\nThis tool will update a Product in commercetools using update actions from the commercetools API.\n\nIt takes these required arguments:\n- version (integer): The current version of the product.\n- actions (array): An array of update actions to perform on the product. Each action should have an \"action\" field indicating the action type.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the product to update (required if key is not provided).\n- key (string, optional): The key of the product to update (required if id is not provided).\n\nExample actions from commercetools API include:\n- addAsset\n- addExternalImage\n- addPrice\n- addToCategory\n- changeAssetName\n- changeAssetOrder\n- changeImageLabel\n- changeMasterVariant\n- changeName\n- changePrice\n- changeSlug\n- moveImageToPosition\n- publish\n- removeAsset\n- removeFromCategory\n- removeImage\n- removePrice\n- removeVariant\n- revertStagedChanges\n- setAssetCustomField\n- setAssetCustomType\n- setAssetDescription\n- setAssetKey\n- setAssetSources\n- setAssetTags\n- setAttribute\n- setAttributeInAllVariants\n- setCategoryOrderHint\n- setDescription\n- setDiscountedPrice\n- setImageLabel\n- setKey\n- setMetaDescription\n- setMetaKeywords\n- setMetaTitle\n- setPriceMode\n- setPrices\n- setProductPriceCustomField\n- setProductPriceCustomType\n- setProductVariantKey\n- setSearchKeywords\n- setSku\n- setTaxCategory\n- transitionState\n- unpublish\n\nEach action type requires specific fields according to the commercetools API.\n`;\nvar deleteProductsPrompt = `\nThis tool will delete a Product from commercetools.\n\nIt takes these required arguments:\n- version (integer): The current version of the product (for optimistic locking).\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the product to delete (required if key is not provided).\n- key (string, optional): The key of the product to delete (required if id is not provided).\n- priceMode (string, optional): Price mode (\"Embedded\" or \"Standalone\").\n`;\n\n// src/resources/products/products.handler.ts\nvar ProductsHandler = class extends CommercetoolsResourceHandler {\n constructor(apiClientFactory) {\n super(apiClientFactory);\n __publicField(this, \"metadata\", {\n namespace: \"products\",\n description: \"Manage products in commercetools\",\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readProductsParameters,\n create: createProductsParameters,\n update: updateProductsParameters,\n delete: deleteProductsParameters\n }\n });\n }\n getToolDefinition(operation) {\n const prompts = {\n read: readProductsPrompt,\n create: createProductsPrompt,\n update: updateProductsPrompt,\n delete: deleteProductsPrompt\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation]\n };\n }\n getProductsApi(api) {\n return api.products();\n }\n async read(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n if (params?.id) {\n const product = await this.getProductsApi(api).withId({ ID: params.id }).get({\n queryArgs: {\n ...params.expand && { expand: params.expand },\n ...params.priceCurrency && {\n priceCurrency: params.priceCurrency\n },\n ...params.priceCountry && { priceCountry: params.priceCountry },\n ...params.priceCustomerGroup && {\n priceCustomerGroup: params.priceCustomerGroup\n },\n ...params.priceChannel && { priceChannel: params.priceChannel },\n ...params.localeProjection && {\n localeProjection: params.localeProjection\n },\n ...params.storeProjection && {\n storeProjection: params.storeProjection\n }\n }\n }).execute();\n return product.body;\n } else if (params?.key) {\n const product = await this.getProductsApi(api).withKey({ key: params.key }).get({\n queryArgs: {\n ...params.expand && { expand: params.expand },\n ...params.priceCurrency && {\n priceCurrency: params.priceCurrency\n },\n ...params.priceCountry && { priceCountry: params.priceCountry },\n ...params.priceCustomerGroup && {\n priceCustomerGroup: params.priceCustomerGroup\n },\n ...params.priceChannel && { priceChannel: params.priceChannel },\n ...params.localeProjection && {\n localeProjection: params.localeProjection\n },\n ...params.storeProjection && {\n storeProjection: params.storeProjection\n }\n }\n }).execute();\n return product.body;\n } else {\n const products = await this.getProductsApi(api).get({\n queryArgs: {\n limit: params.limit || 20,\n ...params.offset && { offset: params.offset },\n ...params.sort && { sort: params.sort },\n ...params.where && { where: params.where },\n ...params.expand && { expand: params.expand },\n ...params.priceCurrency && {\n priceCurrency: params.priceCurrency\n },\n ...params.priceCountry && { priceCountry: params.priceCountry },\n ...params.priceCustomerGroup && {\n priceCustomerGroup: params.priceCustomerGroup\n },\n ...params.priceChannel && { priceChannel: params.priceChannel },\n ...params.localeProjection && {\n localeProjection: params.localeProjection\n },\n ...params.storeProjection && {\n storeProjection: params.storeProjection\n }\n }\n }).execute();\n return products.body;\n }\n } catch (err) {\n throw new ToolExecutionError(\n err.message || \"Failed to read products\",\n context,\n err\n );\n }\n }\n async create(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n const product = await this.getProductsApi(api).post({\n body: params\n }).execute();\n return product.body;\n } catch (error) {\n throw new ToolExecutionError(\"Failed to create product\", context, error);\n }\n }\n async update(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n let currentVersion;\n let productId;\n if (params.id) {\n const product = await this.getProductsApi(api).withId({ ID: params.id }).get().execute();\n currentVersion = product.body.version;\n productId = params.id;\n } else if (params.key) {\n const product = await this.getProductsApi(api).withKey({ key: params.key }).get().execute();\n currentVersion = product.body.version;\n productId = product.body.id;\n } else {\n throw new ToolExecutionError(\n \"Either id or key must be provided\",\n context\n );\n }\n const updatedProduct = await this.getProductsApi(api).withId({ ID: productId }).post({\n body: {\n version: currentVersion,\n actions: params.actions\n }\n }).execute();\n return updatedProduct.body;\n } catch (error) {\n throw new ToolExecutionError(\"Failed to update product\", context, error);\n }\n }\n async delete(context) {\n throw new ToolExecutionError(\"Not implemented\", context);\n }\n};\nasync function readProducts(context, apiClientFactory) {\n const handler = new ProductsHandler(apiClientFactory);\n return handler.read(context);\n}\nasync function createProducts(context, apiClientFactory) {\n const handler = new ProductsHandler(apiClientFactory);\n return handler.create(context);\n}\nasync function updateProducts(context, apiClientFactory) {\n const handler = new ProductsHandler(apiClientFactory);\n return handler.update(context);\n}\nasync function deleteProducts(context, apiClientFactory) {\n const handler = new ProductsHandler(apiClientFactory);\n return handler.delete(context);\n}\n\n// src/resources/project/project.handler.ts\nvar import_zod22 = require(\"zod\");\n\n// src/resources/project/project.schema.ts\nvar import_zod21 = require(\"zod\");\nvar readProjectParameters = import_zod21.z.object({\n projectKey: import_zod21.z.string().optional().describe(\n \"The key of the project to read. If not provided, the current project will be used.\"\n )\n});\nvar messagesConfigurationDraftSchema = import_zod21.z.object({\n enabled: import_zod21.z.boolean().describe(\"When true, the Messages Query feature is active.\"),\n deleteDaysAfterCreation: import_zod21.z.number().min(1).max(90).optional().describe(\n \"Specifies the number of days each Message should be available via the Messages Query API.\"\n )\n});\nvar cartsConfigurationSchema = import_zod21.z.object({\n deleteDaysAfterLastModification: import_zod21.z.number().min(1).optional().describe(\n \"Default value for the deleteDaysAfterLastModification parameter of CartDraft and MyCartDraft.\"\n ),\n countryTaxRateFallbackEnabled: import_zod21.z.boolean().optional().describe(\n \"Indicates if country - no state Tax Rate fallback should be used.\"\n )\n});\nvar shoppingListsConfigurationSchema = import_zod21.z.object({\n deleteDaysAfterLastModification: import_zod21.z.number().min(1).optional().describe(\n \"Default value for the deleteDaysAfterLastModification parameter of ShoppingListDraft.\"\n )\n});\nvar customFieldLocalizedEnumValueSchema = import_zod21.z.object({\n key: import_zod21.z.string().describe(\"The key of the enum value.\"),\n label: import_zod21.z.record(import_zod21.z.string(), import_zod21.z.string()).describe(\"The localized labels for the enum value.\")\n});\nvar shippingRateInputTypeSchema = import_zod21.z.discriminatedUnion(\"type\", [\n import_zod21.z.object({\n type: import_zod21.z.literal(\"CartValue\")\n }),\n import_zod21.z.object({\n type: import_zod21.z.literal(\"CartClassification\"),\n values: import_zod21.z.array(customFieldLocalizedEnumValueSchema).describe(\"The classification items for ShippingRatePriceTier.\")\n }),\n import_zod21.z.object({\n type: import_zod21.z.literal(\"CartScore\"),\n score: import_zod21.z.number().describe(\"The score mapping for available shipping rate tiers.\")\n })\n]);\nvar externalOAuthSchema = import_zod21.z.object({\n url: import_zod21.z.string().url().describe(\"The URL of the token introspection endpoint.\"),\n authorizationHeader: import_zod21.z.string().describe(\n \"The authorization header to authenticate against the introspection endpoint.\"\n )\n});\nvar customerSearchStatusSchema = import_zod21.z.enum([\"Activated\", \"Deactivated\"]);\nvar businessUnitSearchStatusSchema = import_zod21.z.enum([\"Activated\", \"Deactivated\"]);\nvar orderSearchStatusSchema = import_zod21.z.enum([\"Activated\", \"Deactivated\"]);\nvar productSearchIndexingModeSchema = import_zod21.z.enum([\n \"ProductProjectionsSearch\",\n \"ProductsSearch\"\n]);\nvar businessUnitConfigurationStatusSchema = import_zod21.z.enum([\n \"Active\",\n \"Inactive\",\n \"Verification\"\n]);\nvar associateRoleResourceIdentifierSchema = import_zod21.z.object({\n typeId: import_zod21.z.literal(\"associate-role\"),\n id: import_zod21.z.string().optional().describe(\"The ID of the associate role.\"),\n key: import_zod21.z.string().optional().describe(\"The key of the associate role.\")\n});\nvar changeNameSchema = import_zod21.z.object({\n action: import_zod21.z.literal(\"changeName\"),\n name: import_zod21.z.string().describe(\"New value to set.\")\n});\nvar changeCountriesSchema = import_zod21.z.object({\n action: import_zod21.z.literal(\"changeCountries\"),\n countries: import_zod21.z.array(import_zod21.z.string()).describe(\"New value to set. Must not be empty.\")\n});\nvar changeCurrenciesSchema = import_zod21.z.object({\n action: import_zod21.z.literal(\"changeCurrencies\"),\n currencies: import_zod21.z.array(import_zod21.z.string()).describe(\"New value to set. Must not be empty.\")\n});\nvar changeLanguagesSchema = import_zod21.z.object({\n action: import_zod21.z.literal(\"changeLanguages\"),\n languages: import_zod21.z.array(import_zod21.z.string()).describe(\"New value to set. Must not be empty.\")\n});\nvar changeMessagesConfigurationSchema = import_zod21.z.object({\n action: import_zod21.z.literal(\"changeMessagesConfiguration\"),\n messagesConfiguration: messagesConfigurationDraftSchema.describe(\n \"Configuration for the Messages Query feature.\"\n )\n});\nvar changeCartsConfigurationSchema = import_zod21.z.object({\n action: import_zod21.z.literal(\"changeCartsConfiguration\"),\n cartsConfiguration: cartsConfigurationSchema.describe(\n \"Configuration for the Carts feature.\"\n )\n});\nvar changeCountryTaxRateFallbackEnabledSchema = import_zod21.z.object({\n action: import_zod21.z.literal(\"changeCountryTaxRateFallbackEnabled\"),\n countryTaxRateFallbackEnabled: import_zod21.z.boolean().describe(\"When true, country - no state Tax Rate is used as fallback.\")\n});\nvar changeShoppingListsConfigurationSchema = import_zod21.z.object({\n action: import_zod21.z.literal(\"changeShoppingListsConfiguration\"),\n shoppingListsConfiguration: shoppingListsConfigurationSchema.describe(\n \"Configuration for the Shopping Lists feature.\"\n )\n});\nvar changeMyBusinessUnitStatusOnCreationSchema = import_zod21.z.object({\n action: import_zod21.z.literal(\"changeMyBusinessUnitStatusOnCreation\"),\n status: businessUnitConfigurationStatusSchema.describe(\n \"Status for Business Units created using the My Business Unit endpoint.\"\n )\n});\nvar setMyBusinessUnitAssociateRoleOnCreationSchema = import_zod21.z.object({\n action: import_zod21.z.literal(\"setMyBusinessUnitAssociateRoleOnCreation\"),\n associateRole: associateRoleResourceIdentifierSchema.describe(\n \"Default Associate Role assigned to the Associate creating a Business Unit.\"\n )\n});\nvar setShippingRateInputTypeSchema = import_zod21.z.object({\n action: import_zod21.z.literal(\"setShippingRateInputType\"),\n shippingRateInputType: shippingRateInputTypeSchema.optional().describe(\"Value to set. If empty, any existing value will be removed.\")\n});\nvar setExternalOAuthSchema = import_zod21.z.object({\n action: import_zod21.z.literal(\"setExternalOAuth\"),\n externalOAuth: externalOAuthSchema.optional().describe(\"Value to set. If empty, any existing value will be removed.\")\n});\nvar changeProductSearchIndexingEnabledSchema = import_zod21.z.object({\n action: import_zod21.z.literal(\"changeProductSearchIndexingEnabled\"),\n enabled: import_zod21.z.boolean().describe(\"If false, the indexing of Product information will stop.\"),\n mode: productSearchIndexingModeSchema.optional().describe(\n \"Controls whether the action should apply to Product Projection Search or to Product Search.\"\n )\n});\nvar changeOrderSearchStatusSchema = import_zod21.z.object({\n action: import_zod21.z.literal(\"changeOrderSearchStatus\"),\n status: orderSearchStatusSchema.describe(\n \"Activates or deactivates the Order Search feature.\"\n )\n});\nvar changeCustomerSearchStatusSchema = import_zod21.z.object({\n action: import_zod21.z.literal(\"changeCustomerSearchStatus\"),\n status: customerSearchStatusSchema.describe(\n \"Activates or deactivates the Customer Search feature.\"\n )\n});\nvar changeBusinessUnitSearchStatusSchema = import_zod21.z.object({\n action: import_zod21.z.literal(\"changeBusinessUnitSearchStatus\"),\n status: businessUnitSearchStatusSchema.describe(\n \"Activates or deactivates the Search Business Units feature.\"\n )\n});\nvar updateActionSchema = import_zod21.z.discriminatedUnion(\"action\", [\n changeNameSchema,\n changeCountriesSchema,\n changeCurrenciesSchema,\n changeLanguagesSchema,\n changeMessagesConfigurationSchema,\n changeCartsConfigurationSchema,\n changeCountryTaxRateFallbackEnabledSchema,\n changeShoppingListsConfigurationSchema,\n changeMyBusinessUnitStatusOnCreationSchema,\n setMyBusinessUnitAssociateRoleOnCreationSchema,\n setShippingRateInputTypeSchema,\n setExternalOAuthSchema,\n changeProductSearchIndexingEnabledSchema,\n changeOrderSearchStatusSchema,\n changeCustomerSearchStatusSchema,\n changeBusinessUnitSearchStatusSchema\n]);\nvar updateProjectParameters = import_zod21.z.object({\n version: import_zod21.z.number().describe(\n \"The current version of the project. If not provided, the current version will be fetched automatically.\"\n ),\n actions: import_zod21.z.array(updateActionSchema).describe(\"The list of update actions to apply to the project.\"),\n projectKey: import_zod21.z.string().optional().describe(\n \"The key of the project to update. If not provided, the current project will be used.\"\n )\n});\n\n// src/resources/project/project.prompt.ts\nvar readProjectPrompt = `\nThis tool will fetch information about a commercetools project.\n\nIt takes these optional arguments:\n- projectKey (string, optional): The key of the project to read. If not provided, the current projectKey from the configuration will be used.\n\nThe response will contain detailed information about the project including countries, currencies, languages, and more.\n`;\nvar updateProjectPrompt = `\nThis tool will update settings for a commercetools project. This is an admin-only operation.\n\nIt takes these arguments:\n- version (number, optional): The current version of the project. If not provided, the current version will be fetched automatically.\n- actions (array, required): The list of update actions to apply to the project.\n- projectKey (string, optional): The key of the project to update. If not provided, the current project will be used.\n\nAvailable update actions include:\n- changeName: Update the project name\n- changeCountries: Update the list of countries\n- changeCurrencies: Update the list of currencies\n- changeLanguages: Update the list of languages\n- changeMessagesConfiguration: Update the Messages Query feature configuration\n- changeCartsConfiguration: Update the Carts feature configuration\n- changeCountryTaxRateFallbackEnabled: Change the country tax rate fallback setting\n- changeShoppingListsConfiguration: Update the Shopping Lists feature configuration\n- setShippingRateInputType: Set the shipping rate input type\n- setExternalOAuth: Configure an external OAuth provider\n- changeProductSearchIndexingEnabled: Enable/disable product search indexing\n- changeOrderSearchStatus: Change the Order Search status\n- changeCustomerSearchStatus: Change the Customer Search status\n- changeBusinessUnitSearchStatus: Change the Business Unit Search status\n- and more\n\nThe response will contain the updated project information.\n`;\n\n// src/resources/project/project.handler.ts\nvar ProjectHandler = class extends CommercetoolsResourceHandler {\n constructor(apiClientFactory) {\n super(apiClientFactory);\n __publicField(this, \"metadata\", {\n namespace: \"project\",\n description: \"Manage project in commercetools\",\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readProjectParameters,\n update: updateProjectParameters,\n create: import_zod22.z.object({}),\n // Empty schema for unsupported operation\n delete: import_zod22.z.object({})\n // Empty schema for unsupported operation\n }\n });\n }\n getToolDefinition(operation) {\n const prompts = {\n read: readProjectPrompt,\n update: updateProjectPrompt\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation]\n };\n }\n async read(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n try {\n const project = await api.get().execute();\n return project.body;\n } catch (error) {\n throw new ToolExecutionError(\"Failed to read project\", context, error);\n }\n }\n async update(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n const project = await api.post({\n body: {\n version: params.version,\n actions: params.actions\n }\n }).execute();\n return project.body;\n } catch (error) {\n throw new ToolExecutionError(\"Failed to update project\", context, error);\n }\n }\n async create(_context) {\n throw new ToolExecutionError(\"Create operation not implemented\", _context);\n }\n async delete(_context) {\n throw new ToolExecutionError(\"Delete operation not implemented\", _context);\n }\n};\nasync function readProject(context, apiClientFactory) {\n const handler = new ProjectHandler(apiClientFactory);\n return handler.read(context);\n}\nasync function updateProject(context, apiClientFactory) {\n const handler = new ProjectHandler(apiClientFactory);\n return handler.update(context);\n}\n\n// src/resources/reviews/reviews.schema.ts\nvar import_zod23 = require(\"zod\");\nvar readReviewsParameters = import_zod23.z.object({\n id: import_zod23.z.string().optional().describe(\"Review ID\"),\n key: import_zod23.z.string().optional().describe(\"Review key\"),\n where: import_zod23.z.array(import_zod23.z.string()).optional().describe(\n 'Query predicates specified as strings. Example: [\"rating > 50\"]'\n ),\n sort: import_zod23.z.array(import_zod23.z.string()).optional().describe(\n 'Sort criteria for the results. Example: [\"rating desc\", \"createdAt asc\"]'\n ),\n limit: import_zod23.z.number().int().min(1).max(500).optional().describe(\n \"A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\"\n ),\n offset: import_zod23.z.number().int().min(0).optional().describe(\n \"The number of items to skip before starting to collect the result set.\"\n ),\n expand: import_zod23.z.array(import_zod23.z.string()).optional().describe('Fields to expand. Example: [\"customer\", \"target\"]')\n});\nvar createReviewsParameters = import_zod23.z.object({\n key: import_zod23.z.string().min(2).max(256).optional().describe(\"User-defined unique identifier for the review\"),\n uniquenessValue: import_zod23.z.string().optional().describe(\"Must be unique among reviews\"),\n locale: import_zod23.z.string().optional().describe(\"Language in which the content is written\"),\n authorName: import_zod23.z.string().optional().describe(\"Name of the author\"),\n title: import_zod23.z.string().optional().describe(\"Title of the review\"),\n text: import_zod23.z.string().optional().describe(\"Text content of the review\"),\n target: import_zod23.z.object({\n id: import_zod23.z.string().optional(),\n key: import_zod23.z.string().optional(),\n typeId: import_zod23.z.enum([\"product\", \"channel\"])\n }).optional().describe(\"Identifies the target of the review (Product or Channel)\"),\n state: import_zod23.z.object({\n id: import_zod23.z.string().optional(),\n key: import_zod23.z.string().optional(),\n typeId: import_zod23.z.literal(\"state\")\n }).optional().describe(\"State of the review used for approval processes\"),\n rating: import_zod23.z.number().int().min(-100).max(100).optional().describe(\"Rating of the Product or Channel, range -100 to 100\"),\n customer: import_zod23.z.object({\n id: import_zod23.z.string().optional(),\n key: import_zod23.z.string().optional(),\n typeId: import_zod23.z.literal(\"customer\")\n }).optional().describe(\"Customer who created the review\"),\n custom: import_zod23.z.object({\n type: import_zod23.z.object({\n id: import_zod23.z.string(),\n typeId: import_zod23.z.literal(\"type\")\n }).optional(),\n fields: import_zod23.z.record(import_zod23.z.string(), import_zod23.z.any()).optional()\n }).optional().describe(\"Custom fields for the review\")\n});\nvar updateReviewsParameters = import_zod23.z.object({\n id: import_zod23.z.string().optional().describe(\"The ID of the review to update\"),\n key: import_zod23.z.string().optional().describe(\"The key of the review to update\"),\n version: import_zod23.z.number().int().describe(\"The current version of the review\"),\n actions: import_zod23.z.array(\n import_zod23.z.object({\n action: import_zod23.z.string().describe(\"The name of the update action to perform\")\n }).and(import_zod23.z.record(import_zod23.z.string(), import_zod23.z.any()).optional()).describe(\n 'Array of update actions to perform on the review. Each action should have an \"action\" field and other fields specific to that action type.'\n )\n ).describe(\"Update actions\")\n});\nvar deleteReviewsParameters = import_zod23.z.object({\n id: import_zod23.z.string().optional().describe(\"Review ID\"),\n key: import_zod23.z.string().optional().describe(\"Review key\"),\n version: import_zod23.z.number().int().describe(\"Current version (for optimistic locking)\"),\n dataErasure: import_zod23.z.boolean().optional().describe(\"Delete personal data\")\n});\n\n// src/resources/reviews/reviews.prompt.ts\nvar readReviewsPrompt = `\nThis tool will fetch a Review by ID or key (if provided) from commercetools or query all available reviews in a commercetools project if no arguments or parameters are provided.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the review to fetch.\n- key (string, optional): The key of the review to fetch.\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"rating > 50\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"rating desc\", \"createdAt asc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- expand (array of strings, optional): Fields to expand. Example: [\"customer\", \"target\"]\n`;\nvar createReviewsPrompt = `\nThis tool will create a new Review in commercetools.\n\nIt takes these optional arguments:\n- key (string, optional): User-defined unique identifier for the review (2-256 characters, alphanumeric with underscores/hyphens).\n- uniquenessValue (string, optional): Must be unique among reviews.\n- locale (string, optional): Language in which the content is written.\n- authorName (string, optional): Name of the author.\n- title (string, optional): Title of the review.\n- text (string, optional): Text content of the review.\n- target (object, optional): Identifies the target of the review. Must have typeId \"product\" or \"channel\" and either id or key.\n- state (object, optional): State of the review used for approval processes. Must have typeId \"state\" and either id or key.\n- rating (integer, optional): Rating of the Product or Channel, range -100 to 100.\n- customer (object, optional): Customer who created the review. Must have typeId \"customer\" and either id or key.\n- custom (object, optional): Custom fields for the review.\n`;\nvar updateReviewsPrompt = `\nThis tool will update a Review in commercetools using update actions from the commercetools API.\n\nIt takes these required arguments:\n- version (integer): The current version of the review.\n- actions (array): An array of update actions to perform on the review. Each action should have an \"action\" field indicating the action type.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the review to update (required if key is not provided).\n- key (string, optional): The key of the review to update (required if id is not provided).\n\nExample actions from commercetools API include:\n- setKey\n- setAuthorName\n- setTitle\n- setText\n- setTarget\n- setRating\n- setCustomer\n- setState\n- transitionState\n- setCustomType\n- setCustomField\n\nEach action type requires specific fields according to the commercetools API.\n`;\nvar deleteReviewsPrompt = `\nThis tool will delete a Review from commercetools.\n\nIt takes these required arguments:\n- version (integer): The current version of the review (for optimistic locking).\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the review to delete (required if key is not provided).\n- key (string, optional): The key of the review to delete (required if id is not provided).\n- dataErasure (boolean, optional): Delete personal data.\n`;\n\n// src/resources/reviews/reviews.handler.ts\nvar ReviewsHandler = class extends CommercetoolsResourceHandler {\n constructor(apiClientFactory) {\n super(apiClientFactory);\n __publicField(this, \"metadata\", {\n namespace: \"reviews\",\n description: \"Manage reviews in commercetools\",\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readReviewsParameters,\n create: createReviewsParameters,\n update: updateReviewsParameters,\n delete: deleteReviewsParameters\n }\n });\n }\n getToolDefinition(operation) {\n const prompts = {\n read: readReviewsPrompt,\n create: createReviewsPrompt,\n update: updateReviewsPrompt,\n delete: deleteReviewsPrompt\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation]\n };\n }\n getReviewsApi(api) {\n return api.reviews();\n }\n async read(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n if (params?.id) {\n const review = await this.getReviewsApi(api).withId({ ID: params.id }).get({\n queryArgs: {\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return review.body;\n } else if (params?.key) {\n const review = await this.getReviewsApi(api).withKey({ key: params.key }).get({\n queryArgs: {\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return review.body;\n } else {\n const reviews = await this.getReviewsApi(api).get({\n queryArgs: {\n limit: params.limit || 20,\n ...params.offset && { offset: params.offset },\n ...params.sort && { sort: params.sort },\n ...params.where && { where: params.where },\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return reviews.body;\n }\n } catch (err) {\n throw new ToolExecutionError(\n err.message || \"Failed to read reviews\",\n context,\n err\n );\n }\n }\n async create(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n const review = await this.getReviewsApi(api).post({\n body: params\n }).execute();\n return review.body;\n } catch (error) {\n throw new ToolExecutionError(\"Failed to create review\", context, error);\n }\n }\n async update(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n let currentVersion;\n let reviewId;\n if (params.id) {\n const review = await this.getReviewsApi(api).withId({ ID: params.id }).get().execute();\n currentVersion = review.body.version;\n reviewId = params.id;\n } else if (params.key) {\n const review = await this.getReviewsApi(api).withKey({ key: params.key }).get().execute();\n currentVersion = review.body.version;\n reviewId = review.body.id;\n } else {\n throw new ToolExecutionError(\n \"Either id or key must be provided\",\n context\n );\n }\n const updatedReview = await this.getReviewsApi(api).withId({ ID: reviewId }).post({\n body: {\n version: currentVersion,\n actions: params.actions\n }\n }).execute();\n return updatedReview.body;\n } catch (error) {\n throw new ToolExecutionError(\"Failed to update review\", context, error);\n }\n }\n async delete(context) {\n throw new ToolExecutionError(\"Not implemented\", context);\n }\n};\nasync function readReviews(context, apiClientFactory) {\n const handler = new ReviewsHandler(apiClientFactory);\n return handler.read(context);\n}\nasync function createReviews(context, apiClientFactory) {\n const handler = new ReviewsHandler(apiClientFactory);\n return handler.create(context);\n}\nasync function updateReviews(context, apiClientFactory) {\n const handler = new ReviewsHandler(apiClientFactory);\n return handler.update(context);\n}\nasync function deleteReviews(context, apiClientFactory) {\n const handler = new ReviewsHandler(apiClientFactory);\n return handler.delete(context);\n}\n\n// src/resources/standalone-prices/standalone-prices.schema.ts\nvar import_zod24 = require(\"zod\");\nvar readStandalonePricesParameters = import_zod24.z.object({\n id: import_zod24.z.string().optional(),\n key: import_zod24.z.string().optional(),\n sku: import_zod24.z.string().optional(),\n where: import_zod24.z.array(import_zod24.z.string()).optional(),\n sort: import_zod24.z.array(import_zod24.z.string()).optional(),\n limit: import_zod24.z.number().int().min(1).max(500).optional(),\n offset: import_zod24.z.number().int().optional(),\n expand: import_zod24.z.array(import_zod24.z.string()).optional()\n});\nvar createStandalonePricesParameters = import_zod24.z.object({\n body: import_zod24.z.record(import_zod24.z.any())\n});\nvar updateStandalonePricesParameters = import_zod24.z.object({\n id: import_zod24.z.string().optional(),\n key: import_zod24.z.string().optional(),\n version: import_zod24.z.number().optional(),\n actions: import_zod24.z.array(import_zod24.z.record(import_zod24.z.any())).optional()\n});\nvar deleteStandalonePricesParameters = import_zod24.z.object({\n id: import_zod24.z.string().optional(),\n key: import_zod24.z.string().optional(),\n version: import_zod24.z.number().optional()\n});\n\n// src/resources/standalone-prices/standalone-prices.prompt.ts\nvar readStandalonePricesPrompt = \"Read standalone prices parameters\";\nvar createStandalonePricesPrompt = \"Create standalone price parameters\";\nvar updateStandalonePricesPrompt = \"Update standalone price parameters\";\nvar deleteStandalonePricesPrompt = \"Delete standalone price parameters\";\n\n// src/resources/standalone-prices/standalone-prices.handler.ts\nvar StandalonePricesHandler = class extends CommercetoolsResourceHandler {\n constructor(apiClientFactory) {\n super(apiClientFactory);\n __publicField(this, \"metadata\", {\n namespace: \"standalone-prices\",\n description: \"Manage standalone prices in commercetools\",\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readStandalonePricesParameters,\n create: createStandalonePricesParameters,\n update: updateStandalonePricesParameters,\n delete: deleteStandalonePricesParameters\n }\n });\n }\n getToolDefinition(operation) {\n const prompts = {\n read: readStandalonePricesPrompt,\n create: createStandalonePricesPrompt,\n update: updateStandalonePricesPrompt,\n delete: deleteStandalonePricesPrompt\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation]\n };\n }\n getStandalonePricesApi(api) {\n return api.standalonePrices();\n }\n async read(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n if (params?.id) {\n const res = await this.getStandalonePricesApi(api).withId({ ID: params.id }).get().execute();\n return res.body;\n } else if (params?.key) {\n const res = await this.getStandalonePricesApi(api).withKey({ key: params.key }).get().execute();\n return res.body;\n } else {\n const res = await this.getStandalonePricesApi(api).get({\n queryArgs: {\n ...params.limit && { limit: params.limit },\n ...params.offset && { offset: params.offset },\n ...params.where && { where: params.where }\n }\n }).execute();\n return res.body;\n }\n } catch (err) {\n throw new ToolExecutionError(\n \"Failed to read standalone prices\",\n context,\n err\n );\n }\n }\n async create(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n const created = await this.getStandalonePricesApi(api).post({ body: params }).execute();\n return created.body;\n } catch (err) {\n throw new ToolExecutionError(\n \"Failed to create standalone price\",\n context,\n err\n );\n }\n }\n async update(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n let currentVersion = params.version;\n let id = params.id;\n if (!id && params.key) {\n const s = await this.getStandalonePricesApi(api).withKey({ key: params.key }).get().execute();\n id = s.body.id;\n currentVersion = s.body.version;\n }\n if (!id)\n throw new ToolExecutionError(\n \"Either id or key must be provided\",\n context\n );\n const updated = await this.getStandalonePricesApi(api).withId({ ID: id }).post({\n body: {\n version: currentVersion,\n actions: params.actions\n }\n }).execute();\n return updated.body;\n } catch (err) {\n throw new ToolExecutionError(\n \"Failed to update standalone price\",\n context,\n err\n );\n }\n }\n async delete(context) {\n throw new ToolExecutionError(\n \"Delete not supported for standalone prices\",\n context\n );\n }\n};\nasync function readStandalonePrices(context, apiClientFactory) {\n const handler = new StandalonePricesHandler(apiClientFactory);\n return handler.read(context);\n}\nasync function createStandalonePrices(context, apiClientFactory) {\n const handler = new StandalonePricesHandler(apiClientFactory);\n return handler.create(context);\n}\nasync function updateStandalonePrices(context, apiClientFactory) {\n const handler = new StandalonePricesHandler(apiClientFactory);\n return handler.update(context);\n}\nasync function deleteStandalonePrices(context, apiClientFactory) {\n const handler = new StandalonePricesHandler(apiClientFactory);\n return handler.delete(context);\n}\n\n// src/resources/states/states.schema.ts\nvar import_zod25 = require(\"zod\");\nvar readStatesParameters = import_zod25.z.object({\n id: import_zod25.z.string().optional(),\n key: import_zod25.z.string().optional(),\n where: import_zod25.z.array(import_zod25.z.string()).optional(),\n sort: import_zod25.z.array(import_zod25.z.string()).optional(),\n limit: import_zod25.z.number().int().min(1).max(500).optional(),\n offset: import_zod25.z.number().int().optional(),\n expand: import_zod25.z.array(import_zod25.z.string()).optional(),\n withTotal: import_zod25.z.boolean().optional()\n});\nvar createStatesParameters = import_zod25.z.object({\n body: import_zod25.z.record(import_zod25.z.any())\n});\nvar updateStatesParameters = import_zod25.z.object({\n id: import_zod25.z.string().optional(),\n key: import_zod25.z.string().optional(),\n version: import_zod25.z.number().optional(),\n actions: import_zod25.z.array(import_zod25.z.record(import_zod25.z.any())).optional()\n});\nvar deleteStatesParameters = import_zod25.z.object({\n id: import_zod25.z.string().optional(),\n key: import_zod25.z.string().optional(),\n version: import_zod25.z.number().optional()\n});\n\n// src/resources/states/states.prompt.ts\nvar readStatesPrompt = `\nRead States by ID, key, or query predicates. States model finite-state machines used for Orders, Products, Reviews, etc.\n\nOptional arguments:\n- id (string): fetch a single State by ID\n- key (string): fetch a single State by key\n- where (array[string]): query predicates, e.g. ['type=\"ProductState\"']\n- sort (array[string]): sort criteria\n- limit (int): 1-500\n- offset (int)\n- expand (array[string])\n- withTotal (boolean): include total count\n`;\nvar createStatesPrompt = `\nCreate a new State in the project.\n\nRequired (in body):\n- key (string): unique key for the State\n- type (string): StateTypeEnum (e.g., ProductState, ReviewState)\n- name (object): Localized name, e.g. { \"en\": \"New State\" }\n\nOptional:\n- description (object)\n- initial (boolean)\n- roles (array[string])\n- transitions (array of state references)\n`;\nvar updateStatesPrompt = `\nUpdate State by id or key using update actions.\n\nRequired:\n- version (int)\n- actions (array): update actions, each must include 'action' discriminator\n\nOptional:\n- id (string) or key (string) to resolve the State to update\n`;\nvar deleteStatesPrompt = `\nDelete a State by id or key.\n\nRequired:\n- version (int)\n\nOptional:\n- id (string) or key (string)\n`;\n\n// src/resources/states/states.handler.ts\nvar StatesHandler = class extends CommercetoolsResourceHandler {\n constructor(apiClientFactory) {\n super(apiClientFactory);\n __publicField(this, \"metadata\", {\n namespace: \"states\",\n description: \"Manage states in commercetools\",\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readStatesParameters,\n create: createStatesParameters,\n update: updateStatesParameters,\n delete: deleteStatesParameters\n }\n });\n }\n getToolDefinition(operation) {\n const prompts = {\n read: readStatesPrompt,\n create: createStatesPrompt,\n update: updateStatesPrompt,\n delete: deleteStatesPrompt\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation]\n };\n }\n getStatesApi(api) {\n return api.states();\n }\n async read(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n if (params?.id) {\n const res = await this.getStatesApi(api).withId({ ID: params.id }).get().execute();\n return res.body;\n } else if (params?.key) {\n const res = await this.getStatesApi(api).withKey({ key: params.key }).get().execute();\n return res.body;\n } else {\n const res = await this.getStatesApi(api).get({\n queryArgs: {\n ...params.limit && { limit: params.limit },\n ...params.offset && { offset: params.offset },\n ...params.sort && { sort: params.sort },\n ...params.where && { where: params.where },\n ...params.withTotal !== void 0 && {\n withTotal: params.withTotal\n }\n }\n }).execute();\n return res.body;\n }\n } catch (err) {\n throw new ToolExecutionError(\"Failed to read states\", context, err);\n }\n }\n async create(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n const created = await this.getStatesApi(api).post({ body: params }).execute();\n return created.body;\n } catch (err) {\n throw new ToolExecutionError(\"Failed to create state\", context, err);\n }\n }\n async update(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n let currentVersion = params.version;\n let stateId = params.id;\n if (!stateId && params.key) {\n const s = await this.getStatesApi(api).withKey({ key: params.key }).get().execute();\n stateId = s.body.id;\n currentVersion = s.body.version;\n }\n if (!stateId)\n throw new ToolExecutionError(\n \"Either id or key must be provided\",\n context\n );\n const updated = await this.getStatesApi(api).withId({ ID: stateId }).post({\n body: {\n version: currentVersion,\n actions: params.actions\n }\n }).execute();\n return updated.body;\n } catch (err) {\n throw new ToolExecutionError(\"Failed to update state\", context, err);\n }\n }\n async delete(context) {\n throw new ToolExecutionError(\"Delete not supported for states\", context);\n }\n};\nasync function readStates(context, apiClientFactory) {\n const handler = new StatesHandler(apiClientFactory);\n return handler.read(context);\n}\nasync function createStates(context, apiClientFactory) {\n const handler = new StatesHandler(apiClientFactory);\n return handler.create(context);\n}\nasync function updateStates(context, apiClientFactory) {\n const handler = new StatesHandler(apiClientFactory);\n return handler.update(context);\n}\nasync function deleteStates(context, apiClientFactory) {\n const handler = new StatesHandler(apiClientFactory);\n return handler.delete(context);\n}\n\n// src/resources/stores/stores.schema.ts\nvar import_zod26 = require(\"zod\");\nvar readStoresParameters = import_zod26.z.object({\n id: import_zod26.z.string().optional(),\n key: import_zod26.z.string().optional(),\n where: import_zod26.z.array(import_zod26.z.string()).optional(),\n sort: import_zod26.z.array(import_zod26.z.string()).optional(),\n limit: import_zod26.z.number().int().min(1).max(500).optional(),\n offset: import_zod26.z.number().int().optional(),\n expand: import_zod26.z.array(import_zod26.z.string()).optional()\n});\nvar createStoresParameters = import_zod26.z.object({\n body: import_zod26.z.record(import_zod26.z.any())\n});\nvar updateStoresParameters = import_zod26.z.object({\n id: import_zod26.z.string().optional(),\n key: import_zod26.z.string().optional(),\n version: import_zod26.z.number().optional(),\n actions: import_zod26.z.array(import_zod26.z.record(import_zod26.z.any())).optional()\n});\nvar deleteStoresParameters = import_zod26.z.object({\n id: import_zod26.z.string().optional(),\n key: import_zod26.z.string().optional(),\n version: import_zod26.z.number().optional()\n});\n\n// src/resources/stores/stores.prompt.ts\nvar readStoresPrompt = \"Read stores parameters\";\nvar createStoresPrompt = \"Create store parameters\";\nvar updateStoresPrompt = \"Update store parameters\";\nvar deleteStoresPrompt = \"Delete store parameters\";\n\n// src/resources/stores/stores.handler.ts\nvar StoresHandler = class extends CommercetoolsResourceHandler {\n constructor(apiClientFactory) {\n super(apiClientFactory);\n __publicField(this, \"metadata\", {\n namespace: \"stores\",\n description: \"Manage stores in commercetools\",\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readStoresParameters,\n create: createStoresParameters,\n update: updateStoresParameters,\n delete: deleteStoresParameters\n }\n });\n }\n getToolDefinition(operation) {\n const prompts = {\n read: readStoresPrompt,\n create: createStoresPrompt,\n update: updateStoresPrompt,\n delete: deleteStoresPrompt\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation]\n };\n }\n getStoresApi(api) {\n return api.stores();\n }\n async read(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n if (params?.id) {\n const res = await this.getStoresApi(api).withId({ ID: params.id }).get().execute();\n return res.body;\n } else if (params?.key) {\n const res = await this.getStoresApi(api).withKey({ key: params.key }).get().execute();\n return res.body;\n } else {\n const res = await this.getStoresApi(api).get({\n queryArgs: {\n ...params.limit && { limit: params.limit },\n ...params.offset && { offset: params.offset },\n ...params.sort && { sort: params.sort },\n ...params.where && { where: params.where }\n }\n }).execute();\n return res.body;\n }\n } catch (err) {\n throw new ToolExecutionError(\"Failed to read stores\", context, err);\n }\n }\n async create(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n const created = await this.getStoresApi(api).post({ body: params }).execute();\n return created.body;\n } catch (err) {\n throw new ToolExecutionError(\"Failed to create store\", context, err);\n }\n }\n async update(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n let currentVersion = params.version;\n let storeId = params.id;\n if (!storeId && params.key) {\n const s = await this.getStoresApi(api).withKey({ key: params.key }).get().execute();\n storeId = s.body.id;\n currentVersion = s.body.version;\n }\n if (!storeId)\n throw new ToolExecutionError(\n \"Either id or key must be provided\",\n context\n );\n const updated = await this.getStoresApi(api).withId({ ID: storeId }).post({\n body: {\n version: currentVersion,\n actions: params.actions\n }\n }).execute();\n return updated.body;\n } catch (err) {\n throw new ToolExecutionError(\"Failed to update store\", context, err);\n }\n }\n async delete(context) {\n throw new ToolExecutionError(\"Delete not supported for stores\", context);\n }\n};\nasync function readStores(context, apiClientFactory) {\n const handler = new StoresHandler(apiClientFactory);\n return handler.read(context);\n}\nasync function createStores(context, apiClientFactory) {\n const handler = new StoresHandler(apiClientFactory);\n return handler.create(context);\n}\nasync function updateStores(context, apiClientFactory) {\n const handler = new StoresHandler(apiClientFactory);\n return handler.update(context);\n}\nasync function deleteStores(context, apiClientFactory) {\n const handler = new StoresHandler(apiClientFactory);\n return handler.delete(context);\n}\n\n// src/resources/subscriptions/subscriptions.schema.ts\nvar import_zod27 = require(\"zod\");\nvar readSubscriptionsParameters = import_zod27.z.object({\n id: import_zod27.z.string().optional(),\n key: import_zod27.z.string().optional(),\n where: import_zod27.z.array(import_zod27.z.string()).optional(),\n sort: import_zod27.z.array(import_zod27.z.string()).optional(),\n limit: import_zod27.z.number().int().min(1).max(500).optional(),\n offset: import_zod27.z.number().int().optional(),\n expand: import_zod27.z.array(import_zod27.z.string()).optional()\n});\nvar createSubscriptionsParameters = import_zod27.z.object({\n body: import_zod27.z.record(import_zod27.z.any())\n});\nvar updateSubscriptionsParameters = import_zod27.z.object({\n id: import_zod27.z.string().optional(),\n key: import_zod27.z.string().optional(),\n version: import_zod27.z.number().optional(),\n actions: import_zod27.z.array(import_zod27.z.record(import_zod27.z.any())).optional()\n});\nvar deleteSubscriptionsParameters = import_zod27.z.object({\n id: import_zod27.z.string().optional(),\n key: import_zod27.z.string().optional(),\n version: import_zod27.z.number().optional()\n});\n\n// src/resources/subscriptions/subscriptions.prompt.ts\nvar readSubscriptionsPrompt = `\nRead Subscriptions by id, key or query. Subscriptions send notifications to external destinations (SQS/SNS/EventBridge/GooglePubSub/etc).\n\nOptional arguments:\n- id (string): fetch a single Subscription by ID\n- key (string): fetch a single Subscription by key\n- where (array[string]): query predicates\n- sort (array[string])\n- limit (int)\n- offset (int)\n- expand (array[string])\n\nNotes:\n- Subscriptions have complex destination configuration. Use create/update only if you supply a valid SubscriptionDraft.\n`;\nvar createSubscriptionsPrompt = `\nCreate a Subscription in the project.\n\nRequired (in body):\n- destination (object): Destination configuration (SQS, SNS, GoogleCloudPubSub, AzureEventGrid, AzureServiceBus, ConfluentCloud, EventBridge) with provider-specific fields.\n\nOptional (in body):\n- key (string): user-defined identifier\n- messages (array): message subscriptions\n- changes (array): change subscriptions\n- events (array): event subscriptions (BETA)\n`;\nvar updateSubscriptionsPrompt = `\nUpdate a Subscription by id or key using update actions.\n\nRequired:\n- version (int)\n- actions (array): update actions (e.g., setKey, changeDestination, setMessages, setChanges)\n\nOptional:\n- id (string) or key (string)\n`;\nvar deleteSubscriptionsPrompt = `\nDelete a Subscription by id or key.\n\nRequired:\n- version (int)\n\nOptional:\n- id (string) or key (string)\n`;\n\n// src/resources/subscriptions/subscriptions.handler.ts\nvar SubscriptionsHandler = class extends CommercetoolsResourceHandler {\n constructor(apiClientFactory) {\n super(apiClientFactory);\n __publicField(this, \"metadata\", {\n namespace: \"subscriptions\",\n description: \"Manage subscriptions in commercetools\",\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readSubscriptionsParameters,\n create: createSubscriptionsParameters,\n update: updateSubscriptionsParameters,\n delete: deleteSubscriptionsParameters\n }\n });\n }\n getToolDefinition(operation) {\n const prompts = {\n read: readSubscriptionsPrompt,\n create: createSubscriptionsPrompt,\n update: updateSubscriptionsPrompt,\n delete: deleteSubscriptionsPrompt\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation]\n };\n }\n getSubscriptionsApi(api) {\n return api.subscriptions();\n }\n async read(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n if (params?.id) {\n const res = await this.getSubscriptionsApi(api).withId({ ID: params.id }).get().execute();\n return res.body;\n } else if (params?.key) {\n const res = await this.getSubscriptionsApi(api).withKey({ key: params.key }).get().execute();\n return res.body;\n } else {\n const res = await this.getSubscriptionsApi(api).get({\n queryArgs: {\n ...params.limit && { limit: params.limit },\n ...params.offset && { offset: params.offset },\n ...params.sort && { sort: params.sort },\n ...params.where && { where: params.where }\n }\n }).execute();\n return res.body;\n }\n } catch (err) {\n throw new ToolExecutionError(\n \"Failed to read subscriptions\",\n context,\n err\n );\n }\n }\n async create(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n const created = await this.getSubscriptionsApi(api).post({ body: params }).execute();\n return created.body;\n } catch (err) {\n throw new ToolExecutionError(\n \"Failed to create subscription\",\n context,\n err\n );\n }\n }\n async update(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n let currentVersion = params.version;\n let id = params.id;\n if (!id && params.key) {\n const s = await this.getSubscriptionsApi(api).withKey({ key: params.key }).get().execute();\n id = s.body.id;\n currentVersion = s.body.version;\n }\n if (!id)\n throw new ToolExecutionError(\n \"Either id or key must be provided\",\n context\n );\n const updated = await this.getSubscriptionsApi(api).withId({ ID: id }).post({\n body: {\n version: currentVersion,\n actions: params.actions\n }\n }).execute();\n return updated.body;\n } catch (err) {\n throw new ToolExecutionError(\n \"Failed to update subscription\",\n context,\n err\n );\n }\n }\n async delete(context) {\n throw new ToolExecutionError(\n \"Delete not supported for subscriptions\",\n context\n );\n }\n};\nasync function readSubscriptions(context, apiClientFactory) {\n const handler = new SubscriptionsHandler(apiClientFactory);\n return handler.read(context);\n}\nasync function createSubscriptions(context, apiClientFactory) {\n const handler = new SubscriptionsHandler(apiClientFactory);\n return handler.create(context);\n}\nasync function updateSubscriptions(context, apiClientFactory) {\n const handler = new SubscriptionsHandler(apiClientFactory);\n return handler.update(context);\n}\nasync function deleteSubscriptions(context, apiClientFactory) {\n const handler = new SubscriptionsHandler(apiClientFactory);\n return handler.delete(context);\n}\n\n// src/resources/tax-categories/tax-categories.schema.ts\nvar import_zod28 = require(\"zod\");\nvar readTaxCategoriesParameters = import_zod28.z.object({\n id: import_zod28.z.string().optional().describe(\"Tax Category ID\"),\n key: import_zod28.z.string().optional().describe(\"Tax Category key\"),\n where: import_zod28.z.array(import_zod28.z.string()).optional().describe(\n 'Query predicates specified as strings. Example: [\"name = \\\\\"Standard\\\\\"\"]'\n ),\n sort: import_zod28.z.array(import_zod28.z.string()).optional().describe(\n 'Sort criteria for the results. Example: [\"name asc\", \"createdAt desc\"]'\n ),\n limit: import_zod28.z.number().int().min(1).max(500).optional().describe(\n \"A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\"\n ),\n offset: import_zod28.z.number().int().min(0).optional().describe(\n \"The number of items to skip before starting to collect the result set.\"\n ),\n expand: import_zod28.z.array(import_zod28.z.string()).optional().describe(\"Fields to expand. Example: []\")\n});\nvar createTaxCategoriesParameters = import_zod28.z.object({\n key: import_zod28.z.string().min(2).max(256).optional().describe(\"User-defined unique identifier for the tax category\"),\n name: import_zod28.z.string().describe(\"Tax Category name\"),\n description: import_zod28.z.string().optional().describe(\"Tax Category description\"),\n rates: import_zod28.z.array(\n import_zod28.z.object({\n name: import_zod28.z.string().describe(\"Tax rate name\"),\n amount: import_zod28.z.number().min(0).max(1).optional().describe(\"Tax rate amount (0-1)\"),\n includedInPrice: import_zod28.z.boolean().optional().describe(\"Whether the tax is included in the price\"),\n country: import_zod28.z.string().describe(\"Country code (ISO 3166-1 alpha-2)\"),\n state: import_zod28.z.string().optional().describe(\"State within the country\"),\n subRates: import_zod28.z.array(\n import_zod28.z.object({\n name: import_zod28.z.string(),\n amount: import_zod28.z.number().min(0).max(1).optional()\n })\n ).optional().describe(\"Sub-rates for the tax rate\")\n })\n ).optional().describe(\"Array of tax rates\")\n});\nvar updateTaxCategoriesParameters = import_zod28.z.object({\n id: import_zod28.z.string().optional().describe(\"The ID of the tax category to update\"),\n key: import_zod28.z.string().optional().describe(\"The key of the tax category to update\"),\n version: import_zod28.z.number().int().describe(\"The current version of the tax category\"),\n actions: import_zod28.z.array(\n import_zod28.z.object({\n action: import_zod28.z.string().describe(\"The name of the update action to perform\")\n }).and(import_zod28.z.record(import_zod28.z.string(), import_zod28.z.any()).optional()).describe(\n 'Array of update actions to perform on the tax category. Each action should have an \"action\" field and other fields specific to that action type.'\n )\n ).describe(\"Update actions\")\n});\nvar deleteTaxCategoriesParameters = import_zod28.z.object({\n id: import_zod28.z.string().optional().describe(\"Tax Category ID\"),\n key: import_zod28.z.string().optional().describe(\"Tax Category key\"),\n version: import_zod28.z.number().int().describe(\"Current version (for optimistic locking)\")\n});\n\n// src/resources/tax-categories/tax-categories.prompt.ts\nvar readTaxCategoriesPrompt = `\nThis tool will fetch a Tax Category by ID or key (if provided) from commercetools or query all available tax categories in a commercetools project if no arguments or parameters are provided.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the tax category to fetch.\n- key (string, optional): The key of the tax category to fetch.\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"name = \\\\\"Standard\\\\\"\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"name asc\", \"createdAt desc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- expand (array of strings, optional): Fields to expand.\n`;\nvar createTaxCategoriesPrompt = `\nThis tool will create a new Tax Category in commercetools.\n\nIt takes these required arguments:\n- name (string): Tax Category name.\n\nIt takes these optional arguments:\n- key (string, optional): User-defined unique identifier for the tax category (2-256 characters, alphanumeric with underscores/hyphens).\n- description (string, optional): Tax Category description.\n- rates (array, optional): Array of tax rate objects. Each tax rate should have:\n - name (string): Tax rate name.\n - amount (number, optional): Tax rate amount (0-1).\n - includedInPrice (boolean, optional): Whether the tax is included in the price.\n - country (string): Country code (ISO 3166-1 alpha-2).\n - state (string, optional): State within the country.\n - subRates (array, optional): Array of sub-rate objects.\n`;\nvar updateTaxCategoriesPrompt = `\nThis tool will update a Tax Category in commercetools using update actions from the commercetools API.\n\nIt takes these required arguments:\n- id (string): The ID of the tax category to update.\n- version (integer): The current version of the tax category.\n- actions (array): An array of update actions to perform on the tax category. Each action should have an \"action\" field indicating the action type.\n\nExample actions from commercetools API include:\n- addTaxRate\n- changeName\n- removeTaxRate\n- replaceTaxRate\n- setDescription\n- setKey\n\nEach action type requires specific fields according to the commercetools API.\n`;\nvar deleteTaxCategoriesPrompt = `\nThis tool will delete a Tax Category from commercetools.\n\nIt takes these required arguments:\n- id (string): The ID of the tax category to delete.\n- version (integer): The current version of the tax category (for optimistic locking).\n`;\n\n// src/resources/tax-categories/tax-categories.handler.ts\nvar TaxCategoriesHandler = class extends CommercetoolsResourceHandler {\n constructor(apiClientFactory) {\n super(apiClientFactory);\n __publicField(this, \"metadata\", {\n namespace: \"tax-categories\",\n description: \"Manage tax categories in commercetools\",\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readTaxCategoriesParameters,\n create: createTaxCategoriesParameters,\n update: updateTaxCategoriesParameters,\n delete: deleteTaxCategoriesParameters\n }\n });\n }\n getToolDefinition(operation) {\n const prompts = {\n read: readTaxCategoriesPrompt,\n create: createTaxCategoriesPrompt,\n update: updateTaxCategoriesPrompt,\n delete: deleteTaxCategoriesPrompt\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation]\n };\n }\n getTaxCategoriesApi(api) {\n return api.taxCategories();\n }\n async read(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n if (params?.id) {\n const taxCategory = await this.getTaxCategoriesApi(api).withId({ ID: params.id }).get({\n queryArgs: {\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return taxCategory.body;\n } else if (params?.key) {\n const taxCategory = await this.getTaxCategoriesApi(api).withKey({ key: params.key }).get().execute();\n return taxCategory.body;\n } else {\n const taxCategories = await this.getTaxCategoriesApi(api).get({\n queryArgs: {\n limit: params.limit || 20,\n ...params.offset && { offset: params.offset },\n ...params.sort && { sort: params.sort },\n ...params.where && { where: params.where },\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return taxCategories.body;\n }\n } catch (err) {\n throw new ToolExecutionError(\n err.message || \"Failed to read tax categories\",\n context,\n err\n );\n }\n }\n async create(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n const taxCategory = await this.getTaxCategoriesApi(api).post({\n body: params\n }).execute();\n return taxCategory.body;\n } catch (error) {\n throw new ToolExecutionError(\n \"Failed to create tax category\",\n context,\n error\n );\n }\n }\n async update(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n let currentVersion;\n let taxCategoryId;\n if (params.id) {\n const taxCategory = await this.getTaxCategoriesApi(api).withId({ ID: params.id }).get().execute();\n currentVersion = taxCategory.body.version;\n taxCategoryId = params.id;\n } else if (params.key) {\n const taxCategory = await this.getTaxCategoriesApi(api).withKey({ key: params.key }).get().execute();\n currentVersion = taxCategory.body.version;\n taxCategoryId = taxCategory.body.id;\n } else {\n throw new ToolExecutionError(\n \"Either id or key must be provided\",\n context\n );\n }\n const updatedTaxCategory = await this.getTaxCategoriesApi(api).withId({ ID: taxCategoryId }).post({\n body: {\n version: currentVersion,\n actions: params.actions\n }\n }).execute();\n return updatedTaxCategory.body;\n } catch (error) {\n throw new ToolExecutionError(\n \"Failed to update tax category\",\n context,\n error\n );\n }\n }\n async delete(context) {\n throw new ToolExecutionError(\"Not implemented\", context);\n }\n};\nasync function readTaxCategories(context, apiClientFactory) {\n const handler = new TaxCategoriesHandler(apiClientFactory);\n return handler.read(context);\n}\nasync function createTaxCategories(context, apiClientFactory) {\n const handler = new TaxCategoriesHandler(apiClientFactory);\n return handler.create(context);\n}\nasync function updateTaxCategories(context, apiClientFactory) {\n const handler = new TaxCategoriesHandler(apiClientFactory);\n return handler.update(context);\n}\nasync function deleteTaxCategories(context, apiClientFactory) {\n const handler = new TaxCategoriesHandler(apiClientFactory);\n return handler.delete(context);\n}\n\n// src/resources/types/types.schema.ts\nvar import_zod29 = require(\"zod\");\nvar readTypesParameters = import_zod29.z.object({\n id: import_zod29.z.string().optional().describe(\"Type ID\"),\n key: import_zod29.z.string().optional().describe(\"Type key\"),\n where: import_zod29.z.array(import_zod29.z.string()).optional().describe(\n 'Query predicates specified as strings. Example: [\"key = \\\\\"my-type\\\\\"\"]'\n ),\n sort: import_zod29.z.array(import_zod29.z.string()).optional().describe(\n 'Sort criteria for the results. Example: [\"key asc\", \"createdAt desc\"]'\n ),\n limit: import_zod29.z.number().int().min(1).max(500).optional().describe(\n \"A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\"\n ),\n offset: import_zod29.z.number().int().min(0).optional().describe(\n \"The number of items to skip before starting to collect the result set.\"\n ),\n expand: import_zod29.z.array(import_zod29.z.string()).optional().describe(\"Fields to expand. Example: []\")\n});\nvar createTypesParameters = import_zod29.z.object({\n key: import_zod29.z.string().min(2).max(256).describe(\"User-defined unique identifier for the type\"),\n name: import_zod29.z.record(import_zod29.z.string()).describe(\n \"Type name (localized string, object with language codes as keys)\"\n ),\n description: import_zod29.z.record(import_zod29.z.string()).optional().describe(\"Type description (localized string)\"),\n resourceTypeIds: import_zod29.z.array(import_zod29.z.string()).describe(\n 'Resource types that can be customized with this type. Example: [\"category\", \"product\"]'\n ),\n fieldDefinitions: import_zod29.z.array(\n import_zod29.z.object({\n name: import_zod29.z.string().describe(\"Field name\"),\n label: import_zod29.z.record(import_zod29.z.string()).describe(\"Localized label for the field\"),\n required: import_zod29.z.boolean().optional().describe(\"Whether the field is required\"),\n inputHint: import_zod29.z.enum([\"SingleLine\", \"MultiLine\"]).optional().describe(\"Input hint for String fields\"),\n type: import_zod29.z.any().describe(\"Field type definition\")\n })\n ).optional().describe(\"Array of field definitions\")\n});\nvar updateTypesParameters = import_zod29.z.object({\n id: import_zod29.z.string().optional().describe(\"The ID of the type to update\"),\n key: import_zod29.z.string().optional().describe(\"The key of the type to update\"),\n version: import_zod29.z.number().int().describe(\"The current version of the type\"),\n actions: import_zod29.z.array(\n import_zod29.z.object({\n action: import_zod29.z.string().describe(\"The name of the update action to perform\")\n }).and(import_zod29.z.record(import_zod29.z.string(), import_zod29.z.any()).optional()).describe(\n 'Array of update actions to perform on the type. Each action should have an \"action\" field and other fields specific to that action type.'\n )\n ).describe(\"Update actions\")\n});\nvar deleteTypesParameters = import_zod29.z.object({\n id: import_zod29.z.string().optional().describe(\"Type ID\"),\n key: import_zod29.z.string().optional().describe(\"Type key\"),\n version: import_zod29.z.number().int().describe(\"Current version (for optimistic locking)\")\n});\n\n// src/resources/types/types.prompt.ts\nvar readTypesPrompt = `\nThis tool will fetch a Type by ID or key (if provided) from commercetools or query all available types in a commercetools project if no arguments or parameters are provided.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the type to fetch.\n- key (string, optional): The key of the type to fetch.\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"key = \\\\\"my-type\\\\\"\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"key asc\", \"createdAt desc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- expand (array of strings, optional): Fields to expand.\n`;\nvar createTypesPrompt = `\nThis tool will create a new Type in commercetools.\n\nIt takes these required arguments:\n- key (string): User-defined unique identifier for the type (2-256 characters, alphanumeric with underscores/hyphens).\n- name (object): Type name (localized string, object with language codes as keys). Example: {\"en\": \"My Type\", \"de\": \"Mein Typ\"}\n- resourceTypeIds (array of strings): Resource types that can be customized with this type. Example: [\"category\", \"product\"]\n\nIt takes these optional arguments:\n- description (object, optional): Type description (localized string, object with language codes as keys).\n- fieldDefinitions (array, optional): Array of field definitions. Each field definition should have:\n - name (string): Field name.\n - label (object): Localized label for the field (object with language codes as keys).\n - required (boolean, optional): Whether the field is required.\n - inputHint (string, optional): Input hint for String fields (\"SingleLine\" or \"MultiLine\").\n - type (object): Field type definition (Boolean, String, LocalizedString, Enum, LocalizedEnum, Number, Money, Date, Time, DateTime, Reference, Set).\n`;\nvar updateTypesPrompt = `\nThis tool will update a Type in commercetools using update actions from the commercetools API.\n\nIt takes these required arguments:\n- id (string): The ID of the type to update.\n- version (integer): The current version of the type.\n- actions (array): An array of update actions to perform on the type. Each action should have an \"action\" field indicating the action type.\n\nExample actions from commercetools API include:\n- addFieldDefinition\n- changeFieldDefinitionOrder\n- changeKey\n- changeLabel\n- changeName\n- removeFieldDefinition\n- setDescription\n- setInputHint\n\nEach action type requires specific fields according to the commercetools API.\n`;\nvar deleteTypesPrompt = `\nThis tool will delete a Type from commercetools.\n\nIt takes these required arguments:\n- id (string): The ID of the type to delete.\n- version (integer): The current version of the type (for optimistic locking).\n`;\n\n// src/resources/types/types.handler.ts\nvar TypesHandler = class extends CommercetoolsResourceHandler {\n constructor(apiClientFactory) {\n super(apiClientFactory);\n __publicField(this, \"metadata\", {\n namespace: \"types\",\n description: \"Manage types in commercetools\",\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readTypesParameters,\n create: createTypesParameters,\n update: updateTypesParameters,\n delete: deleteTypesParameters\n }\n });\n }\n getToolDefinition(operation) {\n const prompts = {\n read: readTypesPrompt,\n create: createTypesPrompt,\n update: updateTypesPrompt,\n delete: deleteTypesPrompt\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation]\n };\n }\n getTypesApi(api) {\n return api.types();\n }\n async read(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n if (params?.id) {\n const type = await this.getTypesApi(api).withId({ ID: params.id }).get({\n queryArgs: {\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return type.body;\n } else if (params?.key) {\n const type = await this.getTypesApi(api).withKey({ key: params.key }).get().execute();\n return type.body;\n } else {\n const types = await this.getTypesApi(api).get({\n queryArgs: {\n limit: params.limit || 20,\n ...params.offset && { offset: params.offset },\n ...params.sort && { sort: params.sort },\n ...params.where && { where: params.where },\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return types.body;\n }\n } catch (err) {\n throw new ToolExecutionError(\n err.message || \"Failed to read types\",\n context,\n err\n );\n }\n }\n async create(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n const type = await this.getTypesApi(api).post({\n body: params\n }).execute();\n return type.body;\n } catch (error) {\n throw new ToolExecutionError(\"Failed to create type\", context, error);\n }\n }\n async update(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n let currentVersion;\n let typeId;\n if (params.id) {\n const type = await this.getTypesApi(api).withId({ ID: params.id }).get().execute();\n currentVersion = type.body.version;\n typeId = params.id;\n } else if (params.key) {\n const type = await this.getTypesApi(api).withKey({ key: params.key }).get().execute();\n currentVersion = type.body.version;\n typeId = type.body.id;\n } else {\n throw new ToolExecutionError(\n \"Either id or key must be provided\",\n context\n );\n }\n const updatedType = await this.getTypesApi(api).withId({ ID: typeId }).post({\n body: {\n version: currentVersion,\n actions: params.actions\n }\n }).execute();\n return updatedType.body;\n } catch (error) {\n throw new ToolExecutionError(\"Failed to update type\", context, error);\n }\n }\n async delete(context) {\n throw new ToolExecutionError(\"Not implemented\", context);\n }\n};\nasync function readTypes(context, apiClientFactory) {\n const handler = new TypesHandler(apiClientFactory);\n return handler.read(context);\n}\nasync function createTypes(context, apiClientFactory) {\n const handler = new TypesHandler(apiClientFactory);\n return handler.create(context);\n}\nasync function updateTypes(context, apiClientFactory) {\n const handler = new TypesHandler(apiClientFactory);\n return handler.update(context);\n}\nasync function deleteTypes(context, apiClientFactory) {\n const handler = new TypesHandler(apiClientFactory);\n return handler.delete(context);\n}\n\n// src/resources/zones/zones.schema.ts\nvar import_zod30 = require(\"zod\");\nvar readZonesParameters = import_zod30.z.object({\n id: import_zod30.z.string().optional().describe(\"Zone ID\"),\n key: import_zod30.z.string().optional().describe(\"Zone key\"),\n where: import_zod30.z.array(import_zod30.z.string()).optional().describe(\n 'Query predicates specified as strings. Example: [\"name = \\\\\"Europe\\\\\"\"]'\n ),\n sort: import_zod30.z.array(import_zod30.z.string()).optional().describe(\n 'Sort criteria for the results. Example: [\"name asc\", \"createdAt desc\"]'\n ),\n limit: import_zod30.z.number().int().min(1).max(500).optional().describe(\n \"A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\"\n ),\n offset: import_zod30.z.number().int().min(0).optional().describe(\n \"The number of items to skip before starting to collect the result set.\"\n ),\n expand: import_zod30.z.array(import_zod30.z.string()).optional().describe(\"Fields to expand. Example: []\")\n});\nvar createZonesParameters = import_zod30.z.object({\n key: import_zod30.z.string().min(2).max(256).optional().describe(\"User-defined unique identifier for the zone\"),\n name: import_zod30.z.string().describe(\"Zone name\"),\n description: import_zod30.z.string().optional().describe(\"Zone description\"),\n locations: import_zod30.z.array(\n import_zod30.z.object({\n country: import_zod30.z.string().describe(\"Country code (ISO 3166-1 alpha-2)\"),\n state: import_zod30.z.string().optional().describe(\"State within the country\")\n })\n ).optional().describe(\"Array of locations (countries and optionally states)\")\n});\nvar updateZonesParameters = import_zod30.z.object({\n id: import_zod30.z.string().optional().describe(\"The ID of the zone to update\"),\n key: import_zod30.z.string().optional().describe(\"The key of the zone to update\"),\n version: import_zod30.z.number().int().describe(\"The current version of the zone\"),\n actions: import_zod30.z.array(\n import_zod30.z.object({\n action: import_zod30.z.string().describe(\"The name of the update action to perform\")\n }).and(import_zod30.z.record(import_zod30.z.string(), import_zod30.z.any()).optional()).describe(\n 'Array of update actions to perform on the zone. Each action should have an \"action\" field and other fields specific to that action type.'\n )\n ).describe(\"Update actions\")\n});\nvar deleteZonesParameters = import_zod30.z.object({\n id: import_zod30.z.string().optional().describe(\"Zone ID\"),\n key: import_zod30.z.string().optional().describe(\"Zone key\"),\n version: import_zod30.z.number().int().describe(\"Current version (for optimistic locking)\")\n});\n\n// src/resources/zones/zones.prompt.ts\nvar readZonesPrompt = `\nThis tool will fetch a Zone by ID or key (if provided) from commercetools or query all available zones in a commercetools project if no arguments or parameters are provided.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the zone to fetch.\n- key (string, optional): The key of the zone to fetch.\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"name = \\\\\"Europe\\\\\"\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"name asc\", \"createdAt desc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- expand (array of strings, optional): Fields to expand.\n`;\nvar createZonesPrompt = `\nThis tool will create a new Zone in commercetools.\n\nIt takes these required arguments:\n- name (string): Zone name.\n\nIt takes these optional arguments:\n- key (string, optional): User-defined unique identifier for the zone (2-256 characters, alphanumeric with underscores/hyphens).\n- description (string, optional): Zone description.\n- locations (array, optional): Array of location objects. Each location should have:\n - country (string): Country code (ISO 3166-1 alpha-2).\n - state (string, optional): State within the country.\n`;\nvar updateZonesPrompt = `\nThis tool will update a Zone in commercetools using update actions from the commercetools API.\n\nIt takes these required arguments:\n- id (string): The ID of the zone to update.\n- version (integer): The current version of the zone.\n- actions (array): An array of update actions to perform on the zone. Each action should have an \"action\" field indicating the action type.\n\nExample actions from commercetools API include:\n- addLocation\n- changeName\n- setDescription\n- setKey\n- removeLocation\n\nEach action type requires specific fields according to the commercetools API.\n`;\nvar deleteZonesPrompt = `\nThis tool will delete a Zone from commercetools.\n\nIt takes these required arguments:\n- id (string): The ID of the zone to delete.\n- version (integer): The current version of the zone (for optimistic locking).\n`;\n\n// src/resources/zones/zones.handler.ts\nvar ZonesHandler = class extends CommercetoolsResourceHandler {\n constructor(apiClientFactory) {\n super(apiClientFactory);\n __publicField(this, \"metadata\", {\n namespace: \"zones\",\n description: \"Manage zones in commercetools\",\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readZonesParameters,\n create: createZonesParameters,\n update: updateZonesParameters,\n delete: deleteZonesParameters\n }\n });\n }\n getToolDefinition(operation) {\n const prompts = {\n read: readZonesPrompt,\n create: createZonesPrompt,\n update: updateZonesPrompt,\n delete: deleteZonesPrompt\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation]\n };\n }\n getZonesApi(api) {\n return api.zones();\n }\n async read(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n if (params?.id) {\n const zone = await this.getZonesApi(api).withId({ ID: params.id }).get({\n queryArgs: {\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return zone.body;\n } else if (params?.key) {\n const zone = await this.getZonesApi(api).withKey({ key: params.key }).get().execute();\n return zone.body;\n } else {\n const zones = await this.getZonesApi(api).get({\n queryArgs: {\n limit: params.limit || 20,\n ...params.offset && { offset: params.offset },\n ...params.sort && { sort: params.sort },\n ...params.where && { where: params.where },\n ...params.expand && { expand: params.expand }\n }\n }).execute();\n return zones.body;\n }\n } catch (err) {\n throw new ToolExecutionError(\n err.message || \"Failed to read zones\",\n context,\n err\n );\n }\n }\n async create(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n const zone = await this.getZonesApi(api).post({\n body: params\n }).execute();\n return zone.body;\n } catch (error) {\n throw new ToolExecutionError(\"Failed to create zone\", context, error);\n }\n }\n async update(context) {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey\n });\n const params = context.parameters;\n try {\n let currentVersion;\n let zoneId;\n if (params.id) {\n const zone = await this.getZonesApi(api).withId({ ID: params.id }).get().execute();\n currentVersion = zone.body.version;\n zoneId = params.id;\n } else if (params.key) {\n const zone = await this.getZonesApi(api).withKey({ key: params.key }).get().execute();\n currentVersion = zone.body.version;\n zoneId = zone.body.id;\n } else {\n throw new ToolExecutionError(\n \"Either id or key must be provided\",\n context\n );\n }\n const updatedZone = await this.getZonesApi(api).withId({ ID: zoneId }).post({\n body: {\n version: currentVersion,\n actions: params.actions\n }\n }).execute();\n return updatedZone.body;\n } catch (error) {\n throw new ToolExecutionError(\"Failed to update zone\", context, error);\n }\n }\n async delete(context) {\n throw new ToolExecutionError(\"Not implemented\", context);\n }\n};\nasync function readZones(context, apiClientFactory) {\n const handler = new ZonesHandler(apiClientFactory);\n return handler.read(context);\n}\nasync function createZones(context, apiClientFactory) {\n const handler = new ZonesHandler(apiClientFactory);\n return handler.create(context);\n}\nasync function updateZones(context, apiClientFactory) {\n const handler = new ZonesHandler(apiClientFactory);\n return handler.update(context);\n}\nasync function deleteZones(context, apiClientFactory) {\n const handler = new ZonesHandler(apiClientFactory);\n return handler.delete(context);\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n ApiClientFactory,\n AttributeGroupsHandler,\n BaseResourceHandler,\n CartsHandler,\n CategoriesHandler,\n ChannelsHandler,\n CommercetoolsAPIClient,\n CustomObjectsHandler,\n CustomerGroupsHandler,\n CustomerSearchHandler,\n CustomersHandler,\n DEFAULT_API_URL,\n DiscountCodesHandler,\n ExtensionsHandler,\n InventoryHandler,\n MessagesHandler,\n OPERATIONS,\n ProductDiscountsHandler,\n ProductProjectionsHandler,\n ProductSearchHandler,\n ProductSelectionsHandler,\n ProductTailoringHandler,\n ProductTypesHandler,\n ProductsHandler,\n ProjectHandler,\n ReviewsHandler,\n StandalonePricesHandler,\n StatesHandler,\n StoresHandler,\n SubscriptionsHandler,\n TOOL_NAME_PREFIX,\n TaxCategoriesHandler,\n ToolExecutionError,\n ToolHandler,\n TypesHandler,\n ZonesHandler,\n createAttributeGroups,\n createCarts,\n createCategories,\n createChannels,\n createCustomObjects,\n createCustomerGroups,\n createCustomerSearch,\n createCustomers,\n createDiscountCodes,\n createExtensions,\n createInventory,\n createMessages,\n createProductDiscounts,\n createProductProjections,\n createProductSearch,\n createProductSelections,\n createProductTailoring,\n createProductTypes,\n createProducts,\n createReviews,\n createStandalonePrices,\n createStates,\n createStores,\n createSubscriptions,\n createTaxCategories,\n createTypes,\n createZones,\n deleteAttributeGroups,\n deleteCarts,\n deleteCategories,\n deleteChannels,\n deleteCustomObjects,\n deleteCustomerGroups,\n deleteCustomerSearch,\n deleteCustomers,\n deleteDiscountCodes,\n deleteExtensions,\n deleteInventory,\n deleteMessages,\n deleteProductDiscounts,\n deleteProductProjections,\n deleteProductSearch,\n deleteProductSelections,\n deleteProductTailoring,\n deleteProductTypes,\n deleteProducts,\n deleteReviews,\n deleteStandalonePrices,\n deleteStates,\n deleteStores,\n deleteSubscriptions,\n deleteTaxCategories,\n deleteTypes,\n deleteZones,\n getDecoratorRegisteredHandlers,\n readAttributeGroups,\n readCarts,\n readCategories,\n readChannels,\n readCustomObjects,\n readCustomerGroups,\n readCustomerSearch,\n readCustomers,\n readDiscountCodes,\n readExtensions,\n readInventory,\n readMessages,\n readProductDiscounts,\n readProductProjections,\n readProductSearch,\n readProductSelections,\n readProductTailoring,\n readProductTypes,\n readProducts,\n readProject,\n readReviews,\n readStandalonePrices,\n readStates,\n readStores,\n readSubscriptions,\n readTaxCategories,\n readTypes,\n readZones,\n updateAttributeGroups,\n updateCarts,\n updateCategories,\n updateChannels,\n updateCustomObjects,\n updateCustomerGroups,\n updateCustomerSearch,\n updateCustomers,\n updateDiscountCodes,\n updateExtensions,\n updateInventory,\n updateMessages,\n updateProductDiscounts,\n updateProductProjections,\n updateProductSearch,\n updateProductSelections,\n updateProductTailoring,\n updateProductTypes,\n updateProducts,\n updateProject,\n updateReviews,\n updateStandalonePrices,\n updateStates,\n updateStores,\n updateSubscriptions,\n updateTaxCategories,\n updateTypes,\n updateZones\n});\n","export { BaseResourceHandler } from './handlers/base.handler';\nexport {\n ToolHandler,\n getDecoratorRegisteredHandlers,\n} from './decorators/tool.decorator';\n\n// tools handlers (alphabetical)\nexport {\n AttributeGroupsHandler,\n readAttributeGroups,\n createAttributeGroups,\n updateAttributeGroups,\n deleteAttributeGroups,\n} from './resources/attribute-groups/attribute-groups.handler';\nexport {\n CategoriesHandler,\n readCategories,\n createCategories,\n updateCategories,\n deleteCategories,\n} from './resources/categories/categories.handler';\nexport {\n CartsHandler,\n readCarts,\n createCarts,\n updateCarts,\n deleteCarts,\n} from './resources/carts/carts.handler';\nexport {\n ChannelsHandler,\n readChannels,\n createChannels,\n updateChannels,\n deleteChannels,\n} from './resources/channels/channels.handler';\nexport {\n CustomObjectsHandler,\n readCustomObjects,\n createCustomObjects,\n updateCustomObjects,\n deleteCustomObjects,\n} from './resources/custom-objects/custom-objects.handler';\nexport {\n CustomersHandler,\n readCustomers,\n createCustomers,\n updateCustomers,\n deleteCustomers,\n} from './resources/customers/customers.handler';\nexport {\n CustomerGroupsHandler,\n readCustomerGroups,\n createCustomerGroups,\n updateCustomerGroups,\n deleteCustomerGroups,\n} from './resources/customer-groups/customer-groups.handler';\nexport {\n CustomerSearchHandler,\n readCustomerSearch,\n createCustomerSearch,\n updateCustomerSearch,\n deleteCustomerSearch,\n} from './resources/customer-search/customer-search.handler';\nexport {\n DiscountCodesHandler,\n readDiscountCodes,\n createDiscountCodes,\n updateDiscountCodes,\n deleteDiscountCodes,\n} from './resources/discount-codes/discount-codes.handler';\nexport {\n ExtensionsHandler,\n readExtensions,\n createExtensions,\n updateExtensions,\n deleteExtensions,\n} from './resources/extensions/extensions.handler';\nexport {\n InventoryHandler,\n readInventory,\n createInventory,\n updateInventory,\n deleteInventory,\n} from './resources/inventory/inventory.handler';\nexport {\n MessagesHandler,\n readMessages,\n createMessages,\n updateMessages,\n deleteMessages,\n} from './resources/messages/messages.handler';\nexport {\n ProductDiscountsHandler,\n readProductDiscounts,\n createProductDiscounts,\n updateProductDiscounts,\n deleteProductDiscounts,\n} from './resources/product-discounts/product-discounts.handler';\nexport {\n ProductProjectionsHandler,\n readProductProjections,\n createProductProjections,\n updateProductProjections,\n deleteProductProjections,\n} from './resources/product-projections/product-projections.handler';\nexport {\n ProductSearchHandler,\n readProductSearch,\n createProductSearch,\n updateProductSearch,\n deleteProductSearch,\n} from './resources/product-search/product-search.handler';\nexport {\n ProductSelectionsHandler,\n readProductSelections,\n createProductSelections,\n updateProductSelections,\n deleteProductSelections,\n} from './resources/product-selections/product-selections.handler';\nexport {\n ProductTailoringHandler,\n readProductTailoring,\n createProductTailoring,\n updateProductTailoring,\n deleteProductTailoring,\n} from './resources/product-tailoring/product-tailoring.handler';\nexport {\n ProductTypesHandler,\n readProductTypes,\n createProductTypes,\n updateProductTypes,\n deleteProductTypes,\n} from './resources/product-types/product-types.handler';\nexport {\n ProductsHandler,\n readProducts,\n createProducts,\n updateProducts,\n deleteProducts,\n} from './resources/products/products.handler';\nexport {\n ProjectHandler,\n readProject,\n updateProject,\n} from './resources/project/project.handler';\nexport {\n ReviewsHandler,\n readReviews,\n createReviews,\n updateReviews,\n deleteReviews,\n} from './resources/reviews/reviews.handler';\nexport {\n StandalonePricesHandler,\n readStandalonePrices,\n createStandalonePrices,\n updateStandalonePrices,\n deleteStandalonePrices,\n} from './resources/standalone-prices/standalone-prices.handler';\nexport {\n StatesHandler,\n readStates,\n createStates,\n updateStates,\n deleteStates,\n} from './resources/states/states.handler';\nexport {\n StoresHandler,\n readStores,\n createStores,\n updateStores,\n deleteStores,\n} from './resources/stores/stores.handler';\nexport {\n SubscriptionsHandler,\n readSubscriptions,\n createSubscriptions,\n updateSubscriptions,\n deleteSubscriptions,\n} from './resources/subscriptions/subscriptions.handler';\nexport {\n TaxCategoriesHandler,\n readTaxCategories,\n createTaxCategories,\n updateTaxCategories,\n deleteTaxCategories,\n} from './resources/tax-categories/tax-categories.handler';\nexport {\n TypesHandler,\n readTypes,\n createTypes,\n updateTypes,\n deleteTypes,\n} from './resources/types/types.handler';\nexport {\n ZonesHandler,\n readZones,\n createZones,\n updateZones,\n deleteZones,\n} from './resources/zones/zones.handler';\n\nexport * from './utils/constants';\nexport * from './shared';\n","export const TOOL_NAME_PREFIX = '';\nexport const OPERATIONS = ['read', 'create', 'update', 'delete'];\nexport const DEFAULT_API_URL = 'https://api.europe-west1.gcp.commercetools.com';\n","import {\n ToolExecutionContext,\n ResourceMetadata,\n ToolHandler,\n ToolOperation,\n} from '../shared';\nimport { OPERATIONS } from '../utils/constants';\n\n/**\n * Generic base handler - NO API client logic\n * Only handles tool routing, validation, and naming\n */\nexport abstract class BaseResourceHandler<\n TConfig = unknown,\n> implements ToolHandler<TConfig> {\n protected abstract readonly metadata: ResourceMetadata;\n\n // Abstract CRUD methods - implementers decide how to call APIs\n abstract read(context: ToolExecutionContext<TConfig>): Promise<unknown>;\n abstract create(context: ToolExecutionContext<TConfig>): Promise<unknown>;\n abstract update(context: ToolExecutionContext<TConfig>): Promise<unknown>;\n abstract delete(context: ToolExecutionContext<TConfig>): Promise<unknown>;\n\n // Generic tool name generation\n // Pattern: {namespace}.{operation}\n // Examples: \"products.read\", \"product-discount.create\"\n protected getToolName(operation: ToolOperation): string {\n const prefix = this.metadata.toolNamePrefix || '';\n return `${prefix}${this.metadata.namespace}.${operation}`;\n }\n\n // Generic operation extraction\n // Pattern: {prefix}{namespace}.{operation}\n // Examples: \"products.read\", \"product-discount.create\", \"mcp_products.read\"\n protected getOperation(toolName: string): ToolOperation | null {\n const prefix = this.metadata.toolNamePrefix || '';\n\n const escapedPrefix = prefix.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n const regEx = new RegExp(\n `^${escapedPrefix}(.+)\\\\.(read|create|update|delete)$`\n );\n const match = toolName.match(regEx);\n if (match && match[1] === this.metadata.namespace) {\n return match[2] as ToolOperation;\n }\n\n return null;\n }\n\n // Generic execution routing (no API client assumptions)\n async execute(context: ToolExecutionContext<TConfig>): Promise<unknown> {\n const { toolName } = context;\n const operation = this.getOperation(toolName);\n\n if (!operation) {\n throw new Error(`Unknown ${this.metadata.namespace} tool: ${toolName}`);\n }\n\n // Validate parameters\n const schema = this.metadata.schemas[operation];\n const validatedParams = schema.parse(context.parameters) as Record<\n string,\n unknown\n >;\n\n const validatedContext = {\n ...context,\n parameters: validatedParams,\n };\n\n // Route to appropriate method\n switch (operation) {\n case 'read':\n return this.read(validatedContext);\n case 'create':\n return this.create(validatedContext);\n case 'update':\n return this.update(validatedContext);\n case 'delete':\n return this.delete(validatedContext);\n default:\n throw new Error(`Unsupported operation: ${operation}`);\n }\n }\n\n getAllToolNames(): string[] {\n return (OPERATIONS as ToolOperation[]).map((op) => this.getToolName(op));\n }\n\n getToolDefinition(operation: ToolOperation) {\n return {\n name: this.getToolName(operation),\n description: `${operation} ${this.metadata.namespace}`,\n inputSchema: this.metadata.schemas[operation],\n };\n }\n\n getAllToolDefinitions() {\n return (OPERATIONS as ToolOperation[]).map((op) =>\n this.getToolDefinition(op)\n );\n }\n}\n","import { type IConstructor, type Configuration } from '../shared';\nimport { type BaseResourceHandler } from '../handlers/base.handler';\n\n/**\n * Global registry for decorator-based discovery\n * Handlers are registered when their class is decorated\n */\nconst decoratorRegistry: BaseResourceHandler<Configuration>[] = [];\n\n/**\n * Decorator to automatically register a tool handler\n *\n * Usage:\n * ```typescript\n * @ToolHandler()\n * export class CustomerHandler extends BaseResourceHandler {\n * // ...\n * }\n * ```\n *\n * The handler will be automatically discovered and registered\n * when the module is loaded.\n */\nexport function ToolHandler() {\n return function <T extends IConstructor<BaseResourceHandler<Configuration>>>(\n constructor: T\n ) {\n // Create instance and register when class is defined\n // Note: This requires the class to have a default constructor\n // or constructor that accepts IApiClientFactory as optional parameter\n const handler = new constructor() as BaseResourceHandler<Configuration>;\n decoratorRegistry.push(handler);\n\n // Return the original constructor\n return constructor;\n };\n}\n\n/**\n * Get all handlers registered via decorator\n * This is called by ToolDiscovery to register all decorated handlers\n */\nexport function getDecoratorRegisteredHandlers(): BaseResourceHandler<Configuration>[] {\n return [...decoratorRegistry];\n}\n\n/**\n * Clear the decorator registry (mainly for testing)\n */\nexport function clearDecoratorRegistry(): void {\n decoratorRegistry.length = 0;\n}\n","import { z } from 'zod';\n\nexport const readAttributeGroupsParameters = z.object({\n id: z.string().optional(),\n key: z.string().optional(),\n where: z.array(z.string()).optional(),\n sort: z.array(z.string()).optional(),\n limit: z.number().int().min(1).max(500).optional(),\n offset: z.number().int().optional(),\n expand: z.array(z.string()).optional(),\n});\n\nexport const createAttributeGroupsParameters = z.object({\n body: z.record(z.any()),\n});\n\nexport const updateAttributeGroupsParameters = z.object({\n id: z.string().optional(),\n key: z.string().optional(),\n version: z.number().optional(),\n actions: z.array(z.record(z.any())).optional(),\n});\n\nexport const deleteAttributeGroupsParameters = z.object({\n id: z.string().optional(),\n key: z.string().optional(),\n version: z.number().optional(),\n});\n","export const readAttributeGroupsPrompt = 'Read attribute groups parameters';\nexport const createAttributeGroupsPrompt = 'Create attribute group parameters';\nexport const updateAttributeGroupsPrompt = 'Update attribute group parameters';\nexport const deleteAttributeGroupsPrompt = 'Delete attribute group parameters';\n","import { type ToolOperation } from '../types/types';\nimport {\n type Configuration,\n type ToolExecutionContext,\n type IErrorConstructor,\n} from '../types/interface';\n\n/**\n * Structured error for tool execution failures\n * Provides context and debugging information\n * Generic over configuration type to support custom configs\n */\nexport class ToolExecutionError<TConfig extends Configuration> extends Error {\n public readonly toolName: string;\n public readonly operation: string;\n public readonly projectKey: string;\n public readonly sessionId?: string;\n public readonly parameters: Record<string, unknown>;\n public readonly originalError: unknown;\n public readonly timestamp: Date;\n\n constructor(\n message: string,\n context: ToolExecutionContext<TConfig>,\n originalError?: unknown\n ) {\n super(message);\n this.name = 'ToolExecutionError';\n this.toolName = context.toolName;\n this.operation = this.extractOperation(context.toolName);\n this.projectKey = context.configuration.projectKey;\n this.sessionId = context.sessionId;\n this.parameters = context.parameters;\n this.originalError = originalError;\n this.timestamp = new Date();\n\n // Maintain proper stack trace\n if ((Error as IErrorConstructor).captureStackTrace) {\n (Error as IErrorConstructor).captureStackTrace(this, ToolExecutionError);\n }\n }\n\n /**\n * Extract operation from tool name\n */\n private extractOperation(toolName: string): ToolOperation | 'unknown' {\n const match = toolName.match(\n /^mcp_commercetools_(read|create|update|delete)_(.+)$/\n );\n return match && match[1] ? (match[1] as ToolOperation) : 'unknown';\n }\n\n /**\n * Get error details for logging/debugging\n */\n toJSON() {\n return {\n name: this.name,\n message: this.message,\n toolName: this.toolName,\n operation: this.operation,\n projectKey: this.projectKey,\n sessionId: this.sessionId,\n parameters: this.parameters,\n timestamp: this.timestamp.toISOString(),\n originalError:\n this.originalError instanceof Error\n ? {\n name: this.originalError.name,\n message: this.originalError.message,\n stack: this.originalError.stack,\n }\n : this.originalError,\n stack: this.stack,\n };\n }\n}\n","import {\n ClientBuilder,\n type Client,\n type HttpMiddlewareOptions,\n} from '@commercetools/ts-client';\nimport {\n createApiBuilderFromCtpClient,\n type ApiRoot,\n} from '@commercetools/platform-sdk';\n\nimport { type Configuration } from '../types/interface';\nimport { type ApiRootFn } from '../types/types';\nimport { DEFAULT_API_URL } from '../../utils/constants';\n\n/**\n * Commercetools API Client\n * Creates and manages commercetools SDK client instances\n *\n * Note: This class uses the full Configuration type internally for backward compatibility,\n * but can accept any config that extends CommercetoolsConfig\n */\nexport class CommercetoolsAPIClient {\n private client: Client | undefined;\n private apiRoot: ApiRoot;\n private configuration: Configuration;\n private authToken?: string;\n\n constructor(configuration: Configuration, authToken?: string) {\n this.authToken = authToken;\n this.client = this.createClient();\n this.configuration = configuration;\n\n if (!this.client) {\n throw new Error('Failed to create commercetools client');\n }\n\n this.apiRoot = createApiBuilderFromCtpClient(this.client);\n }\n\n /**\n * Get the API root instance\n */\n public getApiRoot(fn?: ApiRootFn, baseUri?: string): ApiRoot {\n if (fn && typeof fn === 'function') {\n return fn(this.client!, baseUri);\n }\n\n // return default root\n return this.apiRoot;\n }\n\n /**\n * Get the client instance\n */\n public getClient(): Client {\n return this.client!;\n }\n\n /**\n * Construct an apiRoot\n */\n public contructApiRoot(\n client: Client,\n fn: (client: Client, baseUri?: string) => ApiRoot,\n baseUri?: string\n ): ApiRoot {\n return fn(client, baseUri);\n }\n\n /**\n * Create commercetools client\n */\n private createClient(): Client | never {\n // Extract API configuration from metadata or use defaults\n const httpMiddlewareOptions: HttpMiddlewareOptions = {\n host: DEFAULT_API_URL,\n };\n\n const client = new ClientBuilder()\n .withHttpMiddleware(httpMiddlewareOptions)\n .withConcurrentModificationMiddleware()\n .withCorrelationIdMiddleware({\n generate: () => this.configuration.correlationId,\n })\n .withUserAgentMiddleware({\n libraryName: 'multitenant-mcp-service',\n libraryVersion: '1.0.0',\n });\n\n if (!this.authToken) {\n throw new Error('Authentication token is required');\n }\n\n return client\n .withExistingTokenFlow(`Bearer ${this.authToken}`, { force: true })\n .build();\n }\n}\n","import { type Configuration, type IApiClientFactory } from '../types/interface';\nimport { CommercetoolsAPIClient } from './sdk.commercetools';\n\n/**\n * Default implementation of API client factory\n * Generic over configuration type to support custom configs\n */\nexport class ApiClientFactory<\n TConfig extends Configuration = Configuration,\n> implements IApiClientFactory<TConfig> {\n public createApiClient(configuration: TConfig, authToken: string) {\n // Cast to Configuration for CommercetoolsAPIClient which expects the full Configuration type\n // In practice, CommercetoolsAPIClient only uses projectKey and metadata, so this is safe\n const apiClient = new CommercetoolsAPIClient(\n configuration as TConfig,\n authToken\n );\n return apiClient.getApiRoot();\n }\n\n public getApiRoot(configuration: TConfig, authToken: string) {\n return new CommercetoolsAPIClient(\n configuration as unknown as Configuration,\n authToken\n );\n }\n}\n","import { ApiRoot } from '@commercetools/platform-sdk';\nimport {\n type Configuration,\n type IApiClientFactory,\n type ToolExecutionContext,\n ApiClientFactory,\n} from '../shared';\nimport { BaseResourceHandler } from './base.handler';\n\n/**\n * Commercetools-specific resource handler\n * Extends BaseResourceHandler with commercetools API client functionality\n * This is an abstract class - subclasses must implement the CRUD methods\n *\n * @template TConfig - Configuration type that must extend Configuration (requires projectKey)\n *\n * Example usage:\n * ```typescript\n * // Using default Configuration\n * export class CustomersHandler extends CommercetoolsResourceHandler { ... }\n *\n * // Using custom config type\n * interface MyCustomConfig extends Configuration {\n * projectKey: string;\n * customField: string;\n * }\n * export class CustomersHandler extends CommercetoolsResourceHandler<MyCustomConfig> { ... }\n * ```\n */\nexport abstract class CommercetoolsResourceHandler<\n TConfig extends Configuration = Configuration,\n> extends BaseResourceHandler<TConfig> {\n protected apiClientFactory: IApiClientFactory<TConfig>;\n\n constructor(apiClientFactory?: IApiClientFactory<TConfig>) {\n super();\n this.apiClientFactory =\n apiClientFactory ||\n (new ApiClientFactory() as IApiClientFactory<TConfig>);\n }\n\n /**\n * Get the API root instance for commercetools\n */\n protected getApiRoot(context: ToolExecutionContext<TConfig>): ApiRoot {\n return this.apiClientFactory.createApiClient(\n context.configuration,\n context.authToken\n );\n }\n}\n","import { z } from 'zod';\nimport {\n AttributeGroupDraft,\n AttributeGroupUpdateAction,\n type AttributeGroup,\n type AttributeGroupPagedQueryResponse,\n type ByProjectKeyRequestBuilder,\n} from '@commercetools/platform-sdk';\nimport {\n readAttributeGroupsParameters,\n createAttributeGroupsParameters,\n updateAttributeGroupsParameters,\n deleteAttributeGroupsParameters,\n} from './attribute-groups.schema';\nimport {\n readAttributeGroupsPrompt,\n createAttributeGroupsPrompt,\n updateAttributeGroupsPrompt,\n deleteAttributeGroupsPrompt,\n} from './attribute-groups.prompt';\nimport {\n IApiClientFactory,\n type ResourceMetadata,\n type ToolExecutionContext,\n ToolExecutionError,\n type Configuration,\n} from '../../shared';\nimport { CommercetoolsResourceHandler } from '../../handlers/commercetools.handler';\nimport { TOOL_NAME_PREFIX } from '../../utils/constants';\n\nexport class AttributeGroupsHandler<\n TConfig extends Configuration = Configuration,\n> extends CommercetoolsResourceHandler<TConfig> {\n protected readonly metadata: ResourceMetadata = {\n namespace: 'attribute-groups',\n description: 'Manage attribute groups in commercetools',\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readAttributeGroupsParameters,\n create: createAttributeGroupsParameters,\n update: updateAttributeGroupsParameters,\n delete: deleteAttributeGroupsParameters,\n },\n };\n\n constructor(apiClientFactory?: IApiClientFactory<TConfig>) {\n super(apiClientFactory);\n }\n\n override getToolDefinition(\n operation: 'read' | 'create' | 'update' | 'delete'\n ) {\n const prompts = {\n read: readAttributeGroupsPrompt,\n create: createAttributeGroupsPrompt,\n update: updateAttributeGroupsPrompt,\n delete: deleteAttributeGroupsPrompt,\n };\n\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation],\n };\n }\n\n protected getAttributeGroupsApi(api: ByProjectKeyRequestBuilder) {\n return api.attributeGroups();\n }\n\n async read(\n context: ToolExecutionContext<TConfig>\n ): Promise<AttributeGroup | AttributeGroupPagedQueryResponse> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<\n typeof readAttributeGroupsParameters\n >;\n try {\n if (params?.id) {\n const res = await this.getAttributeGroupsApi(api)\n .withId({ ID: params.id })\n .get()\n .execute();\n return res.body;\n } else if (params?.key) {\n const res = await this.getAttributeGroupsApi(api)\n .withKey({ key: params.key })\n .get()\n .execute();\n return res.body;\n } else {\n const res = await this.getAttributeGroupsApi(api)\n .get({\n queryArgs: {\n ...(params.limit && { limit: params.limit }),\n ...(params.offset && { offset: params.offset }),\n },\n })\n .execute();\n return res.body;\n }\n } catch (err: unknown) {\n throw new ToolExecutionError(\n 'Failed to read attribute groups',\n context,\n err\n );\n }\n }\n\n async create(\n context: ToolExecutionContext<TConfig>\n ): Promise<AttributeGroup> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<\n typeof createAttributeGroupsParameters\n >;\n try {\n const created = await this.getAttributeGroupsApi(api)\n .post({ body: params as AttributeGroupDraft })\n .execute();\n return created.body;\n } catch (err: unknown) {\n throw new ToolExecutionError(\n 'Failed to create attribute group',\n context,\n err\n );\n }\n }\n\n async update(\n context: ToolExecutionContext<TConfig>\n ): Promise<AttributeGroup> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<\n typeof updateAttributeGroupsParameters\n >;\n try {\n let currentVersion = params.version;\n let id = params.id;\n if (!id && params.key) {\n const s = await this.getAttributeGroupsApi(api)\n .withKey({ key: params.key })\n .get()\n .execute();\n id = s.body.id;\n currentVersion = s.body.version;\n }\n if (!id)\n throw new ToolExecutionError(\n 'Either id or key must be provided',\n context\n );\n const updated = await this.getAttributeGroupsApi(api)\n .withId({ ID: id })\n .post({\n body: {\n version: currentVersion,\n actions: params.actions as AttributeGroupUpdateAction[],\n },\n })\n .execute();\n return updated.body;\n } catch (err: unknown) {\n throw new ToolExecutionError(\n 'Failed to update attribute group',\n context,\n err\n );\n }\n }\n\n async delete(\n context: ToolExecutionContext<TConfig>\n ): Promise<AttributeGroup> {\n // const api = this.getApiRoot(context).withProjectKey({ projectKey: context.configuration.projectKey });\n // const params = context.parameters as z.infer<typeof deleteAttributeGroupsParameters>;\n // try {\n // let id = params.id;\n // if (!id && params.key) {\n // const s = await this.getAttributeGroupsApi(api).withKey({ key: params.key }).get().execute();\n // id = s.body.id;\n // }\n // if (!id) throw new ToolExecutionError('Either id or key must be provided', context);\n // const deleted = await this.getAttributeGroupsApi(api).withId({ ID: id }).delete({\n // queryArgs: { version: params.version },\n // }).execute();\n // return deleted.body;\n // } catch (err: unknown) {\n // throw new ToolExecutionError('Failed to delete attribute group', context, err);\n // }\n\n throw new ToolExecutionError(\n 'Delete not supported for attribute groups',\n context\n );\n }\n}\n\nexport async function readAttributeGroups<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<AttributeGroup | AttributeGroupPagedQueryResponse> {\n const handler = new AttributeGroupsHandler<TConfig>(apiClientFactory);\n return handler.read(context);\n}\n\nexport async function createAttributeGroups<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<AttributeGroup> {\n const handler = new AttributeGroupsHandler<TConfig>(apiClientFactory);\n return handler.create(context);\n}\n\nexport async function updateAttributeGroups<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<AttributeGroup> {\n const handler = new AttributeGroupsHandler<TConfig>(apiClientFactory);\n return handler.update(context);\n}\n\nexport async function deleteAttributeGroups<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<AttributeGroup> {\n const handler = new AttributeGroupsHandler<TConfig>(apiClientFactory);\n return handler.delete(context);\n}\n","import { z } from 'zod';\n\nexport const readCategoriesParameters = z.object({\n id: z.string().optional().describe('Category ID'),\n key: z.string().optional().describe('Category key'),\n where: z\n .array(z.string())\n .optional()\n .describe(\n 'Query predicates specified as strings. Example: [\"key = \\\\\"my-category\\\\\"\"]'\n ),\n sort: z\n .array(z.string())\n .optional()\n .describe(\n 'Sort criteria for the results. Example: [\"key asc\", \"createdAt desc\"]'\n ),\n limit: z\n .number()\n .int()\n .min(1)\n .max(500)\n .optional()\n .describe(\n 'A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.'\n ),\n offset: z\n .number()\n .int()\n .min(0)\n .optional()\n .describe(\n 'The number of items to skip before starting to collect the result set.'\n ),\n expand: z\n .array(z.string())\n .optional()\n .describe('Fields to expand. Example: [\"parent\", \"ancestors[*]\"]'),\n});\n\nexport const createCategoriesParameters = z.object({\n key: z\n .string()\n .min(2)\n .max(256)\n .optional()\n .describe('User-defined unique identifier for the category'),\n name: z.record(z.string()).describe('Category name (localized string)'),\n slug: z.record(z.string()).describe('Category slug (localized string)'),\n description: z\n .record(z.string())\n .optional()\n .describe('Category description (localized string)'),\n parent: z\n .object({\n id: z.string().optional(),\n key: z.string().optional(),\n typeId: z.literal('category'),\n })\n .optional()\n .describe('Parent category reference'),\n orderHint: z\n .string()\n .optional()\n .describe('String value used to order categories'),\n externalId: z\n .string()\n .optional()\n .describe('External ID for integration with external systems'),\n metaTitle: z\n .record(z.string())\n .optional()\n .describe('Meta title (localized string)'),\n metaDescription: z\n .record(z.string())\n .optional()\n .describe('Meta description (localized string)'),\n metaKeywords: z\n .record(z.string())\n .optional()\n .describe('Meta keywords (localized string)'),\n assets: z.array(z.any()).optional().describe('Assets for the category'),\n custom: z\n .object({\n type: z\n .object({\n id: z.string(),\n typeId: z.literal('type'),\n })\n .optional(),\n fields: z.record(z.string(), z.any()).optional(),\n })\n .optional()\n .describe('Custom fields for the category'),\n});\n\nexport const updateCategoriesParameters = z.object({\n id: z.string().optional().describe('The ID of the category to update'),\n key: z.string().optional().describe('The key of the category to update'),\n version: z.number().int().describe('The current version of the category'),\n actions: z\n .array(\n z\n .object({\n action: z\n .string()\n .describe('The name of the update action to perform'),\n })\n .and(z.record(z.string(), z.any()).optional())\n .describe(\n 'Array of update actions to perform on the category. Each action should have an \"action\" field and other fields specific to that action type.'\n )\n )\n .describe('Update actions'),\n});\n\nexport const deleteCategoriesParameters = z.object({\n id: z.string().optional().describe('Category ID'),\n key: z.string().optional().describe('Category key'),\n version: z\n .number()\n .int()\n .describe('Current version (for optimistic locking)'),\n});\n","export const readCategoriesPrompt = `\nThis tool will fetch a Category by ID or key (if provided) from commercetools or query all available categories in a commercetools project if no arguments or parameters are provided.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the category to fetch.\n- key (string, optional): The key of the category to fetch.\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"key = \\\\\"my-category\\\\\"\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"key asc\", \"createdAt desc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- expand (array of strings, optional): Fields to expand. Example: [\"parent\", \"ancestors[*]\"]\n`;\n\nexport const createCategoriesPrompt = `\nThis tool will create a new Category in commercetools.\n\nIt takes these required arguments:\n- name (object): Category name (localized string, object with language codes as keys). Example: {\"en\": \"Electronics\", \"de\": \"Elektronik\"}\n- slug (object): Category slug (localized string, object with language codes as keys). Example: {\"en\": \"electronics\", \"de\": \"elektronik\"}\n\nIt takes these optional arguments:\n- key (string, optional): User-defined unique identifier for the category (2-256 characters, alphanumeric with underscores/hyphens).\n- description (object, optional): Category description (localized string, object with language codes as keys).\n- parent (object, optional): Parent category reference. Must have typeId \"category\" and either id or key.\n- orderHint (string, optional): String value used to order categories.\n- externalId (string, optional): External ID for integration with external systems.\n- metaTitle (object, optional): Meta title (localized string).\n- metaDescription (object, optional): Meta description (localized string).\n- metaKeywords (object, optional): Meta keywords (localized string).\n- assets (array, optional): Assets for the category.\n- custom (object, optional): Custom fields for the category.\n`;\n\nexport const updateCategoriesPrompt = `\nThis tool will update a Category in commercetools using update actions from the commercetools API.\n\nIt takes these required arguments:\n- version (integer): The current version of the category.\n- actions (array): An array of update actions to perform on the category. Each action should have an \"action\" field indicating the action type.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the category to update (required if key is not provided).\n- key (string, optional): The key of the category to update (required if id is not provided).\n\nExample actions from commercetools API include:\n- addAsset\n- changeAssetName\n- changeAssetOrder\n- changeName\n- changeOrderHint\n- changeParent\n- changeSlug\n- removeAsset\n- setAssetCustomField\n- setAssetCustomType\n- setAssetDescription\n- setAssetKey\n- setAssetSources\n- setAssetTags\n- setCustomField\n- setCustomType\n- setDescription\n- setExternalId\n- setKey\n- setMetaDescription\n- setMetaKeywords\n- setMetaTitle\n\nEach action type requires specific fields according to the commercetools API.\n`;\n\nexport const deleteCategoriesPrompt = `\nThis tool will delete a Category from commercetools.\n\nIt takes these required arguments:\n- version (integer): The current version of the category (for optimistic locking).\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the category to delete (required if key is not provided).\n- key (string, optional): The key of the category to delete (required if id is not provided).\n`;\n","import { z } from 'zod';\nimport {\n type Category,\n type CategoryPagedQueryResponse,\n type CategoryDraft,\n type CategoryUpdateAction,\n type ByProjectKeyRequestBuilder,\n} from '@commercetools/platform-sdk';\nimport {\n readCategoriesParameters,\n createCategoriesParameters,\n updateCategoriesParameters,\n deleteCategoriesParameters,\n} from './categories.schema';\nimport {\n readCategoriesPrompt,\n createCategoriesPrompt,\n updateCategoriesPrompt,\n deleteCategoriesPrompt,\n} from './categories.prompt';\nimport {\n IApiClientFactory,\n type ResourceMetadata,\n type ToolExecutionContext,\n ToolExecutionError,\n type Configuration,\n} from '../../shared';\nimport { CommercetoolsResourceHandler } from '../../handlers/commercetools.handler';\nimport { TOOL_NAME_PREFIX } from '../../utils/constants';\n\n/**\n * Categories Resource Handler\n * Generic over configuration type - defaults to CommercetoolsConfig\n */\nexport class CategoriesHandler<\n TConfig extends Configuration = Configuration,\n> extends CommercetoolsResourceHandler<TConfig> {\n protected readonly metadata: ResourceMetadata = {\n namespace: 'categories',\n description: 'Manage categories in commercetools',\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readCategoriesParameters,\n create: createCategoriesParameters,\n update: updateCategoriesParameters,\n delete: deleteCategoriesParameters,\n },\n };\n\n constructor(apiClientFactory?: IApiClientFactory<TConfig>) {\n super(apiClientFactory);\n }\n\n override getToolDefinition(\n operation: 'read' | 'create' | 'update' | 'delete'\n ) {\n const prompts = {\n read: readCategoriesPrompt,\n create: createCategoriesPrompt,\n update: updateCategoriesPrompt,\n delete: deleteCategoriesPrompt,\n };\n\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation],\n };\n }\n\n protected getCategoriesApi(api: ByProjectKeyRequestBuilder) {\n return api.categories();\n }\n\n async read(\n context: ToolExecutionContext<TConfig>\n ): Promise<Category | CategoryPagedQueryResponse> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n\n const params = context.parameters as z.infer<\n typeof readCategoriesParameters\n >;\n\n try {\n if (params?.id) {\n const category = await this.getCategoriesApi(api)\n .withId({ ID: params.id })\n .get({\n queryArgs: {\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n\n return category.body;\n } else if (params?.key) {\n const category = await this.getCategoriesApi(api)\n .withKey({ key: params.key })\n .get({\n queryArgs: {\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n return category.body;\n } else {\n const categories = await this.getCategoriesApi(api)\n .get({\n queryArgs: {\n limit: params.limit || 20,\n ...(params.offset && { offset: params.offset }),\n ...(params.sort && { sort: params.sort }),\n ...(params.where && { where: params.where }),\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n\n return categories.body;\n }\n } catch (err: unknown) {\n throw new ToolExecutionError(\n (err as { message: string }).message || 'Failed to read categories',\n context,\n err\n );\n }\n }\n\n async create(context: ToolExecutionContext<TConfig>): Promise<Category> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<\n typeof createCategoriesParameters\n >;\n\n try {\n const category = await this.getCategoriesApi(api)\n .post({\n body: params as CategoryDraft,\n })\n .execute();\n\n return category.body;\n } catch (error: unknown) {\n throw new ToolExecutionError('Failed to create category', context, error);\n }\n }\n\n async update(context: ToolExecutionContext<TConfig>): Promise<Category> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n\n const params = context.parameters as z.infer<\n typeof updateCategoriesParameters\n >;\n\n try {\n let currentVersion: number;\n let categoryId: string;\n\n if (params.id) {\n const category = await this.getCategoriesApi(api)\n .withId({ ID: params.id })\n .get()\n .execute();\n currentVersion = category.body.version;\n categoryId = params.id;\n } else if (params.key) {\n const category = await this.getCategoriesApi(api)\n .withKey({ key: params.key })\n .get()\n .execute();\n currentVersion = category.body.version;\n categoryId = category.body.id;\n } else {\n throw new ToolExecutionError(\n 'Either id or key must be provided',\n context\n );\n }\n\n const updatedCategory = await this.getCategoriesApi(api)\n .withId({ ID: categoryId })\n .post({\n body: {\n version: currentVersion,\n actions: params.actions as CategoryUpdateAction[],\n },\n })\n .execute();\n\n return updatedCategory.body;\n } catch (error: unknown) {\n throw new ToolExecutionError('Failed to update category', context, error);\n }\n }\n\n async delete(context: ToolExecutionContext<TConfig>): Promise<Category> {\n // const api = this.getApiRoot(context).withProjectKey({\n // projectKey: context.configuration.projectKey,\n // });\n\n // const params = context.parameters as z.infer<\n // typeof deleteCategoriesParameters\n // >;\n\n // try {\n // let categoryId: string;\n\n // if (params.id) {\n // categoryId = params.id;\n // } else if (params.key) {\n // const category = await this.getCategoriesApi(api)\n // .withKey({ key: params.key })\n // .get()\n // .execute();\n // categoryId = category.body.id;\n // } else {\n // throw new ToolExecutionError(\n // 'Either id or key must be provided',\n // context\n // );\n // }\n\n // const deletedCategory = await this.getCategoriesApi(api)\n // .withId({ ID: categoryId })\n // .delete({\n // queryArgs: {\n // version: params.version,\n // },\n // })\n // .execute();\n\n // return deletedCategory.body;\n // } catch (error: unknown) {\n // throw new ToolExecutionError(\n // 'Failed to delete category',\n // context,\n // error\n // );\n // }\n\n throw new ToolExecutionError('Not implemented', context);\n }\n}\n\n// Export individual functions for backward compatibility or direct usage\n// These functions wrap the handler methods and can be called directly\n\nexport async function readCategories<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Category | CategoryPagedQueryResponse> {\n const handler = new CategoriesHandler<TConfig>(apiClientFactory);\n return handler.read(context);\n}\n\nexport async function createCategories<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Category> {\n const handler = new CategoriesHandler<TConfig>(apiClientFactory);\n return handler.create(context);\n}\n\nexport async function updateCategories<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Category> {\n const handler = new CategoriesHandler<TConfig>(apiClientFactory);\n return handler.update(context);\n}\n\nexport async function deleteCategories<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Category> {\n const handler = new CategoriesHandler<TConfig>(apiClientFactory);\n return handler.delete(context);\n}\n","import { z } from 'zod';\n\nexport const readCartParameters = z.object({\n id: z.string().optional().describe('Cart ID'),\n key: z\n .string()\n .optional()\n .describe('Cart key (user-defined unique identifier)'),\n storeKey: z\n .string()\n .optional()\n .describe(\n 'Store key. When provided, the request is executed in the context of that store (store-specific carts). Omit for project-level carts.'\n ),\n where: z\n .array(z.string())\n .optional()\n .describe(\n 'Query predicates specified as strings. Example: [\"customerId = \\\\\"customer-123\\\\\"\"] or [\"key = \\\\\"cart-key-1\\\\\"\"]'\n ),\n sort: z\n .array(z.string())\n .optional()\n .describe(\n 'Sort criteria for the results. Example: [\"createdAt desc\", \"lastModifiedAt desc\"]'\n ),\n limit: z\n .number()\n .int()\n .min(1)\n .max(500)\n .optional()\n .describe(\n 'A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.'\n ),\n offset: z\n .number()\n .int()\n .min(0)\n .optional()\n .describe(\n 'The number of items to skip before starting to collect the result set.'\n ),\n expand: z\n .array(z.string())\n .optional()\n .describe(\n 'Fields to expand. Example: [\"lineItems[*].variant\", \"shippingInfo.shippingMethod\", \"discountCodes[*]\"]'\n ),\n});\n\nexport const createCartParameters = z.object({\n storeKey: z\n .string()\n .optional()\n .describe(\n 'Store key. When provided, the cart is created in the context of that store. Omit for project-level carts.'\n ),\n body: z\n .record(z.any())\n .describe(\n 'Cart draft (CartDraft). Required fields typically include: currency (string, ISO 4217), and optionally: country (string, ISO 3166-1 alpha-2), key, customerId, customerEmail, inventoryMode (Single|None), lineItems (array), customLineItems (array), shippingAddress (Address), billingAddress (Address), shippingMethod (ResourceIdentifier), store (ResourceIdentifier), locale, taxMode (Platform|External), taxRoundingMode, taxCalculationMode, externalTaxRateForShippingMethod, discountCodes (array of strings), custom (type + fields), deleteDaysAfterLastModification, itemShippingAddresses (array of Address), etc. See commercetools API docs for CartDraft for full structure.'\n ),\n});\n\nexport const updateCartParameters = z.object({\n id: z.string().optional().describe('The ID of the cart to update'),\n key: z.string().optional().describe('The key of the cart to update'),\n storeKey: z\n .string()\n .optional()\n .describe('Store key when the cart is store-specific'),\n version: z\n .number()\n .int()\n .describe('The current version of the cart (for optimistic locking)'),\n actions: z\n .array(z.record(z.any()))\n .optional()\n .describe(\n 'Update actions. Each action must have an \"action\" field (e.g. addLineItem, setShippingAddress, addDiscountCode, recalculate, etc.) and fields specific to that action. See commercetools Cart update actions documentation.'\n ),\n});\n\nexport const deleteCartParameters = z.object({\n id: z\n .string()\n .optional()\n .describe('Cart ID (required if key is not provided)'),\n key: z\n .string()\n .optional()\n .describe('Cart key (required if id is not provided)'),\n storeKey: z\n .string()\n .optional()\n .describe('Store key when the cart is store-specific'),\n version: z\n .number()\n .int()\n .describe('Current version of the cart (for optimistic locking)'),\n dataErasure: z\n .boolean()\n .optional()\n .describe(\n 'When true, personal data (e.g. email, addresses) associated with the cart is deleted. Default is false.'\n ),\n});\n","export const readCartPrompt = `\nThis tool will fetch a Cart by ID or key (if provided) from commercetools, optionally in a store context, or query carts in the project (or in a store when storeKey is provided).\n\nCarts hold line items, custom line items, shipping and billing addresses, and can be converted to orders. They can be project-level or store-specific.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the cart to fetch.\n- key (string, optional): The key of the cart to fetch (user-defined unique identifier).\n- storeKey (string, optional): The key of the store. When provided, the request is executed in the context of that store (for store-specific carts). Omit for project-level carts.\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"customerId = \\\\\"customer-123\\\\\"\"] or [\"key = \\\\\"cart-key-1\\\\\"\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"createdAt desc\", \"lastModifiedAt desc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- expand (array of strings, optional): Fields to expand. Example: [\"lineItems[*].variant\", \"shippingInfo.shippingMethod\", \"discountCodes[*]\"]\n`;\n\nexport const createCartPrompt = `\nThis tool will create a new Cart in commercetools (optionally in a store when storeKey is provided).\n\nA cart requires at least a currency (and often a country for shipping/tax). You can add line items, shipping address, discount codes, and more at creation or in a follow-up update.\n\nIt takes these required arguments:\n- body (object): Cart draft (CartDraft). Must include at least:\n - currency (string): ISO 4217 currency code (e.g. \"USD\", \"EUR\").\n\nIt takes these optional arguments:\n- storeKey (string, optional): The key of the store. When provided, the cart is created in the context of that store. Omit for project-level carts.\n- body fields (all optional except currency): country (string, ISO 3166-1 alpha-2), key (string), customerId (string), customerEmail (string), inventoryMode (\"Single\" or \"None\"), lineItems (array of LineItemDraft: productId, variantId, quantity, supplyChannel, distributionChannel, custom, etc.), customLineItems (array of CustomLineItemDraft), shippingAddress (Address), billingAddress (Address), shippingMethod (ResourceIdentifier to ShippingMethod), store (ResourceIdentifier to Store), locale (string), taxMode (\"Platform\" or \"External\"), taxRoundingMode, taxCalculationMode, externalTaxRateForShippingMethod (ExternalTaxRateDraft), discountCodes (array of discount code strings), custom (type + fields), deleteDaysAfterLastModification (number), itemShippingAddresses (array of Address), origin (Customer or Merchant), etc. See the commercetools API documentation for CartDraft for the complete structure and nested types.\n`;\n\nexport const updateCartPrompt = `\nThis tool will update a Cart in commercetools using update actions.\n\nIt takes these required arguments:\n- version (integer): The current version of the cart (for optimistic locking).\n- Either id or key must be provided to identify the cart.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the cart to update (required if key is not provided).\n- key (string, optional): The key of the cart to update (required if id is not provided).\n- storeKey (string, optional): The key of the store when the cart is store-specific.\n- actions (array, optional): An array of update actions. Each action must have an \"action\" field indicating the action type and any required fields for that action.\n\nExample actions from the commercetools Cart API include:\n- addLineItem: Add a line item. Fields: productId, variantId?, sku?, quantity?, supplyChannel?, distributionChannel?, custom?, addedAt?, shippingDetails?\n- removeLineItem: Remove a line item. Fields: lineItemId, quantity?\n- changeLineItemQuantity: Change line item quantity. Fields: lineItemId, quantity\n- setLineItemShippingDetails: Set shipping details for a line item. Fields: lineItemId, shippingDetails?\n- addCustomLineItem: Add a custom line item. Fields: name (LocalizedString), quantity, money, slug, taxCategory?, externalTaxRate?, custom?\n- removeCustomLineItem: Remove a custom line item. Fields: customLineItemId\n- setShippingAddress: Set shipping address. Fields: address?\n- setBillingAddress: Set billing address. Fields: address?\n- setShippingMethod: Set shipping method. Fields: shippingMethod?, externalTaxRate?\n- addDiscountCode: Add a discount code. Fields: code\n- removeDiscountCode: Remove a discount code. Fields: discountCode (Reference)\n- recalculate: Recalculate cart (prices, taxes, totals). Fields: updateProductData?\n- setKey: Set cart key. Fields: key?\n- setCustomerId: Set customer ID. Fields: customerId?\n- setCustomerEmail: Set customer email. Fields: email?\n- setCustomType: Set custom type. Fields: type?, fields?\n- setCustomField: Set custom field. Fields: name, value?\n- setLocale: Set locale. Fields: locale?\n- setDeleteDaysAfterLastModification: Set delete days. Fields: deleteDaysAfterLastModification?\n- setItemShippingAddress: Set item shipping address. Fields: addressKey, address?\n- addItemShippingAddress: Add item shipping address. Fields: address\n- removeItemShippingAddress: Remove item shipping address. Fields: addressKey\n\nEach action type requires specific fields according to the commercetools API documentation.\n`;\n\nexport const deleteCartPrompt = `\nThis tool will delete a Cart from commercetools.\n\nIt takes these required arguments:\n- version (integer): The current version of the cart (for optimistic locking).\n- Either id or key must be provided to identify the cart.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the cart to delete (required if key is not provided).\n- key (string, optional): The key of the cart to delete (required if id is not provided).\n- storeKey (string, optional): The key of the store when the cart is store-specific.\n- dataErasure (boolean, optional): When true, personal data (e.g. email, addresses) associated with the cart is deleted. Default is false.\n`;\n","import { z } from 'zod';\nimport {\n type Cart,\n type CartPagedQueryResponse,\n type ByProjectKeyRequestBuilder,\n type CartUpdateAction,\n} from '@commercetools/platform-sdk';\nimport {\n readCartParameters,\n createCartParameters,\n updateCartParameters,\n deleteCartParameters,\n} from './carts.schema';\nimport {\n readCartPrompt,\n createCartPrompt,\n updateCartPrompt,\n deleteCartPrompt,\n} from './carts.prompt';\nimport {\n IApiClientFactory,\n type ResourceMetadata,\n type ToolExecutionContext,\n ToolExecutionError,\n type Configuration,\n} from '../../shared';\nimport { CommercetoolsResourceHandler } from '../../handlers/commercetools.handler';\nimport { TOOL_NAME_PREFIX } from '../../utils/constants';\n\n/**\n * Carts Resource Handler\n * Store-aware: supports storeKey for store-specific carts.\n */\nexport class CartsHandler<\n TConfig extends Configuration = Configuration,\n> extends CommercetoolsResourceHandler<TConfig> {\n protected readonly metadata: ResourceMetadata = {\n namespace: 'carts',\n description: 'Manage carts in commercetools',\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readCartParameters,\n create: createCartParameters,\n update: updateCartParameters,\n delete: deleteCartParameters,\n },\n };\n\n constructor(apiClientFactory?: IApiClientFactory<TConfig>) {\n super(apiClientFactory);\n }\n\n override getToolDefinition(\n operation: 'read' | 'create' | 'update' | 'delete'\n ) {\n const prompts = {\n read: readCartPrompt,\n create: createCartPrompt,\n update: updateCartPrompt,\n delete: deleteCartPrompt,\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation],\n };\n }\n\n protected getCartsApi(api: ByProjectKeyRequestBuilder, storeKey?: string) {\n return storeKey\n ? api.inStoreKeyWithStoreKeyValue({ storeKey }).carts()\n : api.carts();\n }\n\n async read(\n context: ToolExecutionContext<TConfig>\n ): Promise<Cart | CartPagedQueryResponse> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<typeof readCartParameters>;\n try {\n const cartsApi = this.getCartsApi(api, params.storeKey);\n if (params?.id) {\n const res = await cartsApi\n .withId({ ID: params.id })\n .get({\n queryArgs: { ...(params.expand && { expand: params.expand }) },\n })\n .execute();\n return res.body;\n }\n if (params?.key) {\n const res = await cartsApi\n .withKey({ key: params.key })\n .get({\n queryArgs: { ...(params.expand && { expand: params.expand }) },\n })\n .execute();\n return res.body;\n }\n const res = await cartsApi\n .get({\n queryArgs: {\n limit: params.limit ?? 20,\n ...(params.offset != null && { offset: params.offset }),\n ...(params.sort && { sort: params.sort }),\n ...(params.where && { where: params.where }),\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n return res.body;\n } catch (err: unknown) {\n throw new ToolExecutionError('Failed to read cart', context, err);\n }\n }\n\n async create(context: ToolExecutionContext<TConfig>): Promise<Cart> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<typeof createCartParameters>;\n try {\n const cartsApi = this.getCartsApi(api, params.storeKey);\n const created = await cartsApi\n .post({\n body: params.body as unknown as import('@commercetools/platform-sdk').CartDraft,\n })\n .execute();\n return created.body;\n } catch (err: unknown) {\n throw new ToolExecutionError('Failed to create cart', context, err);\n }\n }\n\n async update(context: ToolExecutionContext<TConfig>): Promise<Cart> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<typeof updateCartParameters>;\n try {\n const cartsApi = this.getCartsApi(api, params.storeKey);\n let cartId: string;\n let version: number = params.version;\n if (params.id) {\n cartId = params.id;\n } else if (params.key) {\n const res = await cartsApi.withKey({ key: params.key }).get().execute();\n cartId = res.body.id;\n version = res.body.version;\n } else {\n throw new ToolExecutionError(\n 'Either id or key must be provided',\n context\n );\n }\n const updated = await cartsApi\n .withId({ ID: cartId })\n .post({\n body: {\n version,\n actions: (params.actions ?? []) as CartUpdateAction[],\n },\n })\n .execute();\n return updated.body;\n } catch (err: unknown) {\n throw new ToolExecutionError('Failed to update cart', context, err);\n }\n }\n\n async delete(context: ToolExecutionContext<TConfig>): Promise<Cart> {\n throw new ToolExecutionError(\n 'Delete operation not implemented for carts',\n context\n );\n\n // const api = this.getApiRoot(context).withProjectKey({\n // projectKey: context.configuration.projectKey,\n // });\n // const params = context.parameters as z.infer<typeof deleteCartParameters>;\n // try {\n // const cartsApi = this.getCartsApi(api, params.storeKey);\n // let cartId: string;\n // let version: number = params.version;\n // if (params.id) {\n // cartId = params.id;\n // } else if (params.key) {\n // const res = await cartsApi.withKey({ key: params.key }).get().execute();\n // cartId = res.body.id;\n // version = res.body.version;\n // } else {\n // throw new ToolExecutionError(\n // 'Either id or key must be provided',\n // context\n // );\n // }\n // const deleted = await cartsApi\n // .withId({ ID: cartId })\n // .delete({\n // queryArgs: {\n // version,\n // ...(params.dataErasure != null && {\n // dataErasure: params.dataErasure,\n // }),\n // },\n // })\n // .execute();\n // return deleted.body;\n // } catch (err: unknown) {\n // throw new ToolExecutionError('Failed to delete cart', context, err);\n // }\n }\n}\n\nexport async function readCarts<TConfig extends Configuration = Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Cart | CartPagedQueryResponse> {\n const handler = new CartsHandler<TConfig>(apiClientFactory);\n return handler.read(context);\n}\n\nexport async function createCarts<\n TConfig extends Configuration = Configuration,\n>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Cart> {\n const handler = new CartsHandler<TConfig>(apiClientFactory);\n return handler.create(context);\n}\n\nexport async function updateCarts<\n TConfig extends Configuration = Configuration,\n>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Cart> {\n const handler = new CartsHandler<TConfig>(apiClientFactory);\n return handler.update(context);\n}\n\nexport async function deleteCarts<\n TConfig extends Configuration = Configuration,\n>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Cart> {\n const handler = new CartsHandler<TConfig>(apiClientFactory);\n return handler.delete(context);\n}\n","import { z } from 'zod';\nimport {\n type Channel,\n type ChannelPagedQueryResponse,\n type ByProjectKeyRequestBuilder,\n ChannelUpdateAction,\n ChannelDraft,\n} from '@commercetools/platform-sdk';\nimport {\n readChannelsParameters,\n createChannelsParameters,\n updateChannelsParameters,\n // deleteChannelsParameters,\n} from './channels.schema';\nimport {\n readChannelsPrompt,\n createChannelsPrompt,\n updateChannelsPrompt,\n // deleteChannelsPrompt,\n} from './channels.prompt';\nimport {\n IApiClientFactory,\n type ResourceMetadata,\n type ToolExecutionContext,\n ToolExecutionError,\n type Configuration,\n} from '../../shared';\nimport { CommercetoolsResourceHandler } from '../../handlers/commercetools.handler';\nimport { TOOL_NAME_PREFIX } from '../../utils/constants';\n\nexport class ChannelsHandler<\n TConfig extends Configuration = Configuration,\n> extends CommercetoolsResourceHandler<TConfig> {\n protected readonly metadata: ResourceMetadata = {\n namespace: 'channels',\n description: 'Manage channels in commercetools',\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readChannelsParameters,\n create: createChannelsParameters,\n update: updateChannelsParameters,\n delete: z.object({}),\n },\n };\n\n constructor(apiClientFactory?: IApiClientFactory<TConfig>) {\n super(apiClientFactory);\n }\n\n override getToolDefinition(\n operation: 'read' | 'create' | 'update' | 'delete'\n ) {\n const prompts = {\n read: readChannelsPrompt,\n create: createChannelsPrompt,\n update: updateChannelsPrompt,\n // delete: deleteChannelsPrompt,\n };\n\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation],\n };\n }\n\n protected getChannelsApi(api: ByProjectKeyRequestBuilder) {\n return api.channels();\n }\n\n async read(\n context: ToolExecutionContext<TConfig>\n ): Promise<Channel | ChannelPagedQueryResponse> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<typeof readChannelsParameters>;\n try {\n if (params?.id) {\n const res = await this.getChannelsApi(api)\n .withId({ ID: params.id })\n .get()\n .execute();\n return res.body;\n } else if (params?.key) {\n const res = await this.getChannelsApi(api)\n .withKey({ key: params.key })\n .get()\n .execute();\n return res.body;\n } else {\n const res = await this.getChannelsApi(api)\n .get({\n queryArgs: {\n ...(params.limit && { limit: params.limit }),\n ...(params.offset && { offset: params.offset }),\n },\n })\n .execute();\n return res.body;\n }\n } catch (err: unknown) {\n throw new ToolExecutionError('Failed to read channels', context, err);\n }\n }\n\n async create(context: ToolExecutionContext<TConfig>): Promise<Channel> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<\n typeof createChannelsParameters\n >;\n try {\n const created = await this.getChannelsApi(api)\n .post({ body: params as ChannelDraft })\n .execute();\n return created.body;\n } catch (err: unknown) {\n throw new ToolExecutionError('Failed to create channel', context, err);\n }\n }\n\n async update(context: ToolExecutionContext<TConfig>): Promise<Channel> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<\n typeof updateChannelsParameters\n >;\n try {\n let currentVersion = params.version;\n let channelId = params.id;\n if (!channelId && params.key) {\n const s = await this.getChannelsApi(api)\n .withKey({ key: params.key })\n .get()\n .execute();\n channelId = s.body.id;\n currentVersion = s.body.version;\n }\n if (!channelId)\n throw new ToolExecutionError(\n 'Either id or key must be provided',\n context\n );\n const updated = await this.getChannelsApi(api)\n .withId({ ID: channelId })\n .post({\n body: {\n version: currentVersion,\n actions: params.actions as ChannelUpdateAction[],\n },\n })\n .execute();\n return updated.body;\n } catch (err: unknown) {\n throw new ToolExecutionError('Failed to update channel', context, err);\n }\n }\n\n async delete(context: ToolExecutionContext<TConfig>): Promise<Channel> {\n // const api = this.getApiRoot(context).withProjectKey({ projectKey: context.configuration.projectKey });\n // const params = context.parameters as z.infer<typeof deleteChannelsParameters>;\n // try {\n // let channelId = params.id;\n // if (!channelId && params.key) {\n // const s = await this.getChannelsApi(api).withKey({ key: params.key }).get().execute();\n // channelId = s.body.id;\n // }\n // if (!channelId) throw new ToolExecutionError('Either id or key must be provided', context);\n // const deleted = await this.getChannelsApi(api).withId({ ID: channelId }).delete({\n // queryArgs: { version: params.version },\n // }).execute();\n // return deleted.body;\n // } catch (err: unknown) {\n // throw new ToolExecutionError('Failed to delete channel', context, err);\n // }\n\n throw new ToolExecutionError('Delete not supported for channels', context);\n }\n}\n\nexport async function readChannels<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Channel | ChannelPagedQueryResponse> {\n const handler = new ChannelsHandler<TConfig>(apiClientFactory);\n return handler.read(context);\n}\n\nexport async function createChannels<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Channel> {\n const handler = new ChannelsHandler<TConfig>(apiClientFactory);\n return handler.create(context);\n}\n\nexport async function updateChannels<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Channel> {\n const handler = new ChannelsHandler<TConfig>(apiClientFactory);\n return handler.update(context);\n}\n\nexport async function deleteChannels<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Channel> {\n const handler = new ChannelsHandler<TConfig>(apiClientFactory);\n return handler.delete(context);\n}\n","import { z } from 'zod';\n\nexport const readChannelsParameters = z.object({\n id: z.string().optional(),\n key: z.string().optional(),\n where: z.array(z.string()).optional(),\n sort: z.array(z.string()).optional(),\n limit: z.number().int().min(1).max(500).optional(),\n offset: z.number().int().optional(),\n expand: z.array(z.string()).optional(),\n});\n\nexport const createChannelsParameters = z.object({\n body: z.record(z.any()),\n});\n\nexport const updateChannelsParameters = z.object({\n id: z.string().optional(),\n key: z.string().optional(),\n version: z.number().optional(),\n actions: z.array(z.record(z.any())).optional(),\n});\n\nexport const deleteChannelsParameters = z.object({\n id: z.string().optional(),\n key: z.string().optional(),\n version: z.number().optional(),\n});\n","export const readChannelsPrompt = `\nThis tool will fetch information about commercetools channels.\n\nIt can be used in three ways:\n1. To fetch a single channel by its ID\n2. To fetch a single channel by its key\n3. To query multiple channels based on criteria\n\nIt takes these parameters:\n- id (string, optional): The ID of the channel to fetch\n- key (string, optional): The key of the channel to fetch\n- where (string array, optional): Query predicates for filtering channels. Example: [\"roles contains any \\\\\"InventorySupply\\\\\",\\\\\"ProductDistribution\\\\\"\"]\n- limit (int, optional): The number of channels to return (default: 20, range: 1-500)\n- offset (int, optional): The number of items to skip before starting to collect the result set\n- sort (string array, optional): Sort criteria for the results. Example: [\"name.en asc\", \"createdAt desc\"]\n- expand (string array, optional): An array of field paths to expand. Example: [\"custom.type\"]\n\nIf both id and key are not provided, it will fetch a list of channels using query parameters.\n`;\n\nexport const createChannelsPrompt = `\nThis tool will create a new Channel in commercetools.\n\nIt takes these required arguments:\n- key (string): User-defined unique identifier for the Channel\n- roles (array): Roles of the Channel. Each channel must have at least one role.\n Available roles: \"InventorySupply\", \"ProductDistribution\", \"OrderExport\", \"OrderImport\", \"Primary\"\n\nIt takes these optional arguments:\n- name (object, optional): Localized name of the Channel (record mapping locale to string)\n- description (object, optional): Localized description of the Channel (record mapping locale to string)\n- address (object, optional): Address where the Channel is located\n- geoLocation (object, optional): GeoJSON Point encoding the geo location of the Channel\n- custom (object, optional): Custom fields for the Channel\n\nExample name and description format:\n{\n \"en\": \"Main Warehouse\",\n \"de\": \"Hauptlager\"\n}\n\nExample geoLocation format:\n{\n \"type\": \"Point\",\n \"coordinates\": [13.377704, 52.516275]\n}\n`;\n\nexport const updateChannelsPrompt = `\nThis tool will update a Channel in commercetools using update actions from the commercetools API.\n\nIt takes these required arguments:\n- version (integer): The current version of the channel\n- actions (array): An array of update actions to perform on the channel. Each action should have an \"action\" field indicating the action type\n\nIt also requires ONE of these identifiers:\n- id (string, optional): The ID of the channel to update\n- key (string, optional): The key of the channel to update\n\nExample actions from commercetools API include:\n- changeKey: Change the key of the channel\n- changeName: Change the localized name of the channel\n- changeDescription: Change the localized description of the channel\n- setRoles: Set the roles of the channel\n- addRoles: Add roles to the channel\n- removeRoles: Remove roles from the channel\n- setAddress: Set the address of the channel\n- setGeoLocation: Set the geo location of the channel\n- setCustomType: Set the custom type for the channel\n- setCustomField: Set a custom field for the channel\n\nEach action type requires specific fields according to the commercetools API.\n`;\n","import { z } from 'zod';\n\nexport const readCustomObjectsParameters = z.object({\n container: z.string().optional(),\n key: z.string().optional(),\n id: z.string().optional(),\n where: z.array(z.string()).optional(),\n sort: z.array(z.string()).optional(),\n limit: z.number().int().min(1).max(500).optional(),\n offset: z.number().int().optional(),\n expand: z.array(z.string()).optional(),\n});\n\nexport const createCustomObjectsParameters = z.object({\n container: z.string().describe('Container name (namespace)'),\n key: z.string().describe('User-defined key'),\n value: z.any().describe('JSON-serializable value'),\n});\n\nexport const updateCustomObjectsParameters = z.object({\n container: z.string().optional(),\n key: z.string().optional(),\n id: z.string().optional(),\n version: z.number().optional(),\n value: z.any().optional(),\n});\n\nexport const deleteCustomObjectsParameters = z.object({\n container: z.string().optional(),\n key: z.string().optional(),\n id: z.string().optional(),\n version: z.number().optional(),\n});\n","export const readCustomObjectsPrompt = `\nRead custom objects from the commercetools platform. You can:\n- Get a single custom object by providing its container and key\n- List multiple custom objects in a container with optional filtering, sorting, and pagination\n\nParameters:\n- container: Container of the custom object to retrieve (required)\n- key: Key of the custom object to retrieve (optional)\n- limit: Number of results requested when listing (default: 20, max: 500)\n- offset: Number of elements to skip when listing (default: 0, max: 10000)\n- sort: Sort criteria for listing results (e.g., [\"createdAt desc\", \"key asc\"])\n- where: Query predicates for filtering when listing (e.g., [\"container=\\\\\"myContainer\\\\\"\"])\n- expand: Reference paths to expand (e.g., [\"value.order\"])\n\nExamples:\n// Get by container and key\ncustomObjects.read({\n container: \"myContainer\",\n key: \"myKey\"\n})\n\n// List all custom objects in a container\ncustomObjects.read({\n container: \"myContainer\",\n limit: 10\n})\n\n// List with filtering\ncustomObjects.read({\n container: \"myContainer\",\n where: [\"key=\\\\\"specific-key\\\\\"\"]\n})\n`;\n\nexport const createCustomObjectsPrompt = `\nCreate a new custom object in the commercetools platform.\n\nParameters:\n- container: Namespace to group custom objects (required)\n- key: User-defined unique identifier within the container (required)\n- value: Can be any JSON standard type, such as number, string, boolean, array, object, or a common API data type (required)\n\nExample:\ncustomObjects.create({\n container: \"myContainer\",\n key: \"myKey\",\n value: {\n \"text\": {\n \"de\": \"Das ist ein Text\",\n \"en\": \"This is a text\"\n },\n \"order\": {\n \"typeId\": \"order\",\n \"id\": \"<order-id>\"\n }\n }\n})\n`;\n\nexport const updateCustomObjectsPrompt = `\nUpdate a custom object in the commercetools platform. You must identify the object using container and key.\n\nParameters:\n- container: Container of the custom object to update (required)\n- key: Key of the custom object to update (required)\n- version: Expected version of the custom object (required)\n- actions: Array of update actions (required)\n\nAvailable update actions:\n- setValue: Set a new value for the custom object\n\nExamples:\n// Update by container and key\ncustomObjects.update({\n container: \"myContainer\",\n key: \"myKey\",\n version: 1,\n actions: [\n {\n action: \"setValue\",\n value: {\n \"updatedText\": \"New value\",\n \"timestamp\": \"2024-01-01T00:00:00Z\"\n }\n }\n ]\n})\n`;\n\nexport const deleteCustomObjectsPrompt = `\nDelete a custom object in the commercetools platform. You must identify the object using container and key.\n\nParameters:\n- container: Container of the custom object to delete (required)\n- key: Key of the custom object to delete (required)\n- version: Expected version of the custom object (required)\n\nExamples:\n// Delete by container and key\ncustomObjects.delete({\n container: \"myContainer\",\n key: \"myKey\",\n version: 1,\n})\n`;\n","import { z } from 'zod';\nimport {\n type CustomObject,\n type CustomObjectPagedQueryResponse,\n type ByProjectKeyRequestBuilder,\n} from '@commercetools/platform-sdk';\nimport {\n readCustomObjectsParameters,\n createCustomObjectsParameters,\n updateCustomObjectsParameters,\n deleteCustomObjectsParameters,\n} from './custom-objects.schema';\nimport {\n readCustomObjectsPrompt,\n createCustomObjectsPrompt,\n updateCustomObjectsPrompt,\n deleteCustomObjectsPrompt,\n} from './custom-objects.prompt';\nimport {\n IApiClientFactory,\n type ResourceMetadata,\n type ToolExecutionContext,\n ToolExecutionError,\n type Configuration,\n} from '../../shared';\nimport { CommercetoolsResourceHandler } from '../../handlers/commercetools.handler';\nimport { TOOL_NAME_PREFIX } from '../../utils/constants';\n\nexport class CustomObjectsHandler<\n TConfig extends Configuration = Configuration,\n> extends CommercetoolsResourceHandler<TConfig> {\n protected readonly metadata: ResourceMetadata = {\n namespace: 'custom-objects',\n description: 'Manage custom objects in commercetools',\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readCustomObjectsParameters,\n create: createCustomObjectsParameters,\n update: updateCustomObjectsParameters,\n delete: deleteCustomObjectsParameters,\n },\n };\n\n constructor(apiClientFactory?: IApiClientFactory<TConfig>) {\n super(apiClientFactory);\n }\n\n override getToolDefinition(\n operation: 'read' | 'create' | 'update' | 'delete'\n ) {\n const prompts = {\n read: readCustomObjectsPrompt,\n create: createCustomObjectsPrompt,\n update: updateCustomObjectsPrompt,\n delete: deleteCustomObjectsPrompt,\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation],\n };\n }\n\n protected getCustomObjectsApi(api: ByProjectKeyRequestBuilder) {\n // SDK exposes customObjects endpoints; use as any for flexibility\n return (api as ByProjectKeyRequestBuilder).customObjects();\n }\n\n async read(\n context: ToolExecutionContext<TConfig>\n ): Promise<CustomObject | CustomObjectPagedQueryResponse> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<\n typeof readCustomObjectsParameters\n >;\n try {\n if (params?.container && params?.key) {\n const res = await this.getCustomObjectsApi(api)\n .withContainerAndKey({ container: params.container, key: params.key })\n .get()\n .execute();\n return res.body;\n } else if (params?.container) {\n const res = await this.getCustomObjectsApi(api)\n .withContainer({ container: params.container })\n .get({\n queryArgs: {\n ...(params.limit && { limit: params.limit }),\n ...(params.offset && { offset: params.offset }),\n ...(params.sort && { sort: params.sort }),\n ...(params.where && { where: params.where }),\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n return res.body;\n } else {\n // Fallback to the generic (deprecated) endpoint if no container provided\n const res = await this.getCustomObjectsApi(api)\n .get({\n queryArgs: {\n ...(params.limit && { limit: params.limit }),\n ...(params.offset && { offset: params.offset }),\n ...(params.sort && { sort: params.sort }),\n ...(params.where && { where: params.where }),\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n return res.body;\n }\n } catch (err: unknown) {\n throw new ToolExecutionError(\n 'Failed to read custom objects',\n context,\n err\n );\n }\n }\n\n async create(context: ToolExecutionContext<TConfig>): Promise<CustomObject> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<\n typeof createCustomObjectsParameters\n >;\n try {\n const created = await this.getCustomObjectsApi(api)\n .post({\n body: {\n container: params.container,\n key: params.key,\n value: params.value,\n },\n })\n .execute();\n return created.body;\n } catch (err: unknown) {\n throw new ToolExecutionError(\n 'Failed to create custom object',\n context,\n err\n );\n }\n }\n\n async update(context: ToolExecutionContext<TConfig>): Promise<CustomObject> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<\n typeof updateCustomObjectsParameters\n >;\n if (!params.id && !params.container && !params.key)\n throw new ToolExecutionError(\n 'Either id or container+key must be provided',\n context\n );\n\n try {\n if (params.container && params.key) {\n // Use post with container/key/value per base.functions pattern to update by container+key\n const updated = await this.getCustomObjectsApi(api)\n .post({\n body: {\n container: params.container,\n key: params.key,\n value: params.value,\n version: params.version,\n },\n })\n .execute();\n return updated.body;\n }\n\n // Update by id is not supported directly by the customObjects request builder; attempt delete/recreate pattern is not ideal.\n // Prefer updating by container+key. Here we throw to guide caller to use container+key.\n throw new ToolExecutionError(\n 'Updating by id is not supported; use container+key to update a custom object',\n context\n );\n } catch (err: unknown) {\n throw new ToolExecutionError(\n 'Failed to update custom object',\n context,\n err\n );\n }\n }\n\n async delete(context: ToolExecutionContext<TConfig>): Promise<CustomObject> {\n // const api = this.getApiRoot(context).withProjectKey({ projectKey: context.configuration.projectKey });\n // const params = context.parameters as z.infer<typeof deleteCustomObjectsParameters>;\n // try {\n // if (params.container && params.key) {\n // const deleted = await this.getCustomObjectsApi(api).withContainerAndKey({ container: params.container, key: params.key }).delete({\n // queryArgs: {\n // version: params.version,\n // },\n // }).execute();\n // return deleted.body;\n // }\n\n // // SDK does not support delete by id on customObjects request builder; require container+key\n // throw new ToolExecutionError('Delete by id is not supported; provide container and key to delete a custom object', context);\n // } catch (err: unknown) {\n // throw new ToolExecutionError('Failed to delete custom object', context, err);\n // }\n\n throw new ToolExecutionError(\n 'Delete operation not implemented for custom objects',\n context\n );\n }\n}\n\nexport async function readCustomObjects<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<CustomObject | CustomObjectPagedQueryResponse> {\n const handler = new CustomObjectsHandler<TConfig>(apiClientFactory);\n return handler.read(context);\n}\n\nexport async function createCustomObjects<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<CustomObject> {\n const handler = new CustomObjectsHandler<TConfig>(apiClientFactory);\n return handler.create(context);\n}\n\nexport async function updateCustomObjects<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<CustomObject> {\n const handler = new CustomObjectsHandler<TConfig>(apiClientFactory);\n return handler.update(context);\n}\n\nexport async function deleteCustomObjects<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<CustomObject> {\n const handler = new CustomObjectsHandler<TConfig>(apiClientFactory);\n return handler.delete(context);\n}\n","import { z } from 'zod';\n\nexport const readCustomerParameters = z.object({\n id: z.string().optional().describe('Customer ID'),\n key: z.string().optional().describe('Customer key'),\n storeKey: z.string().optional().describe('Store key'),\n where: z\n .array(z.string())\n .optional()\n .describe(\n 'Query predicates specified as strings. Example: [\"email = \\\\\"customer@example.com\\\\\"\"]'\n ),\n sort: z\n .array(z.string())\n .optional()\n .describe(\n 'Sort criteria for the results. Example: [\"firstName asc\", \"createdAt desc\"]'\n ),\n limit: z\n .number()\n .int()\n .min(1)\n .max(500)\n .optional()\n .describe(\n 'A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 10.'\n ),\n offset: z\n .number()\n .int()\n .min(0)\n .optional()\n .describe(\n 'The number of items to skip before starting to collect the result set.'\n ),\n expand: z\n .array(z.string())\n .optional()\n .describe('Fields to expand. Example: [\"customerGroup\"]'),\n});\n\nexport const createCustomerParameters = z.object({\n email: z.string().email().describe('Customer email address'),\n storeKey: z.string().optional().describe('Store key'),\n password: z.string().describe('Customer password'),\n firstName: z.string().optional().describe('Customer first name'),\n lastName: z.string().optional().describe('Customer last name'),\n middleName: z.string().optional().describe('Customer middle name'),\n title: z\n .string()\n .optional()\n .describe('Customer title (e.g., Mr., Mrs., Dr.)'),\n dateOfBirth: z\n .string()\n .optional()\n .describe('Customer date of birth in ISO 8601 format (YYYY-MM-DD)'),\n companyName: z.string().optional().describe('Customer company name'),\n vatId: z.string().optional().describe('Customer VAT identification number'),\n addresses: z\n .array(\n z.object({\n streetName: z.string().describe('Street name'),\n streetNumber: z.string().optional().describe('Street number'),\n additionalStreetInfo: z\n .string()\n .optional()\n .describe('Additional street information'),\n postalCode: z.string().describe('Postal code'),\n city: z.string().describe('City'),\n region: z.string().optional().describe('Region'),\n state: z.string().optional().describe('State'),\n country: z.string().describe('Country code (ISO 3166-1 alpha-2)'),\n company: z.string().optional().describe('Company name'),\n department: z.string().optional().describe('Department'),\n building: z.string().optional().describe('Building'),\n apartment: z.string().optional().describe('Apartment'),\n pOBox: z.string().optional().describe('P.O. Box'),\n phone: z.string().optional().describe('Phone'),\n mobile: z.string().optional().describe('Mobile phone'),\n email: z.string().email().optional().describe('Email'),\n fax: z.string().optional().describe('Fax'),\n additionalAddressInfo: z\n .string()\n .optional()\n .describe('Additional address information'),\n })\n )\n .optional()\n .describe('Customer addresses'),\n defaultShippingAddress: z\n .number()\n .int()\n .optional()\n .describe('Index of default shipping address in the addresses array'),\n defaultBillingAddress: z\n .number()\n .int()\n .optional()\n .describe('Index of default billing address in the addresses array'),\n shippingAddresses: z\n .array(z.number().int())\n .optional()\n .describe('Indices of shipping addresses in the addresses array'),\n billingAddresses: z\n .array(z.number().int())\n .optional()\n .describe('Indices of billing addresses in the addresses array'),\n isEmailVerified: z\n .boolean()\n .optional()\n .describe('Whether the customer email is verified'),\n externalId: z.string().optional().describe('Customer external ID'),\n customerGroup: z\n .object({\n id: z.string(),\n typeId: z.literal('customer-group'),\n })\n .optional()\n .describe('Customer group reference'),\n custom: z\n .object({\n type: z.object({\n id: z.string(),\n typeId: z.literal('type'),\n }),\n fields: z.record(z.string(), z.any()),\n })\n .optional()\n .describe('Custom fields'),\n locale: z.string().optional().describe('Customer locale'),\n salutation: z.string().optional().describe('Customer salutation'),\n key: z.string().optional().describe('Customer key'),\n});\n\nexport const updateCustomerParameters = z.object({\n id: z.string().describe('The ID of the customer to update'),\n version: z.number().int().describe('The current version of the customer'),\n actions: z\n .array(\n z\n .object({\n action: z\n .string()\n .describe('The name of the update action to perform'),\n })\n .and(z.record(z.string(), z.any()).optional())\n .describe(\n 'Array of update actions to perform on the customer. Each action should have an \"action\" field and other fields specific to that action type.'\n )\n )\n .describe('Update actions'),\n});\n\nexport const deleteCustomerParameters = z.object({\n id: z.string().describe('Customer ID'),\n version: z\n .number()\n .int()\n .describe('Current version (for optimistic locking)'),\n dataErasure: z.boolean().optional().describe('Delete personal data'),\n});\n","export const readCustomerPrompt = `\nThis tool will fetch a Customer by ID (ID or key if provided) from commercetools or a specific store in commercetools or query all available customers in a commercetools project if no arquments or parameters are provided.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the customer to fetch.\n- storeKey (string, optional): The key of the store to fetch the customer from.\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"email = \\\\\"customer@example.com\\\\\"\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"firstName asc\", \"createdAt desc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 10.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- expand (array of strings, optional): Fields to expand. Example: [\"customerGroup\"]\n`;\n\nexport const createCustomerPrompt = `\nThis tool will create a new Customer in commercetools or a specific store in commercetools.\n\nIt takes these required arguments:\n- email (string): Customer email address.\n- password (string): Customer password.\n\nIt takes these optional arguments:\n- storeKey (string, optional): The key of the store to create the customer in.\n- firstName (string, optional): Customer first name.\n- lastName (string, optional): Customer last name.\n- middleName (string, optional): Customer middle name.\n- title (string, optional): Customer title (e.g., Mr., Mrs., Dr.).\n- dateOfBirth (string, optional): Customer date of birth in ISO 8601 format (YYYY-MM-DD).\n- companyName (string, optional): Customer company name.\n- vatId (string, optional): Customer VAT identification number.\n- addresses (array, optional): An array of customer addresses.\n- defaultShippingAddress (integer, optional): Index of default shipping address in the addresses array.\n- defaultBillingAddress (integer, optional): Index of default billing address in the addresses array.\n- shippingAddresses (array of integers, optional): Indices of shipping addresses in the addresses array.\n- billingAddresses (array of integers, optional): Indices of billing addresses in the addresses array.\n- isEmailVerified (boolean, optional): Whether the customer email is verified.\n- externalId (string, optional): Customer external ID.\n- customerGroup (object, optional): Customer group reference.\n- custom (object, optional): Custom fields.\n- locale (string, optional): Customer locale.\n- salutation (string, optional): Customer salutation.\n- key (string, optional): Customer key.\n`;\n\nexport const updateCustomerPrompt = `\nThis tool will update a Customer in commercetools using update actions from the commercetools API.\n\nIt takes these required arguments:\n- id (string): The ID of the customer to update.\n- version (integer): The current version of the customer.\n- actions (array): An array of update actions to perform on the customer. Each action should have an \"action\" field indicating the action type.\n\nExample actions from commercetools API include:\n- addAddress\n- addBillingAddressId\n- addShippingAddressId\n- changeAddress\n- changeEmail\n- removeAddress\n- removeBillingAddressId\n- removeShippingAddressId\n- setCompanyName\n- setCustomField\n- setCustomType\n- setDateOfBirth\n- setDefaultBillingAddress\n- setDefaultShippingAddress\n- setFirstName\n- setLastName\n- setLocale\n- setMiddleName\n- setSalutation\n- setTitle\n- setVatId\n\nEach action type requires specific fields according to the commercetools API.\n`;\n\nexport const deleteCustomerPrompt = `\nThis tool will delete a Customer from commercetools.\n\nIt takes these required arguments:\n- id (string): The ID of the customer to delete.\n- version (integer): The current version of the customer (for optimistic locking).\n\nIt takes these optional arguments:\n- dataErasure (boolean, optional): Delete personal data.\n`;\n","import { z } from 'zod';\nimport {\n type Customer,\n type CustomerPagedQueryResponse,\n type CustomerDraft,\n type CustomerUpdateAction,\n type ByProjectKeyRequestBuilder,\n CustomerSignInResult,\n} from '@commercetools/platform-sdk';\nimport {\n readCustomerParameters,\n createCustomerParameters,\n updateCustomerParameters,\n deleteCustomerParameters,\n} from './customers.schema';\nimport {\n readCustomerPrompt,\n createCustomerPrompt,\n updateCustomerPrompt,\n deleteCustomerPrompt,\n} from './customers.prompt';\nimport {\n IApiClientFactory,\n type ResourceMetadata,\n type ToolExecutionContext,\n ToolExecutionError,\n type Configuration,\n} from '../../shared';\nimport { CommercetoolsResourceHandler } from '../../handlers/commercetools.handler';\nimport { TOOL_NAME_PREFIX } from '../../utils/constants';\n\n/**\n * Customers Resource Handler\n * Generic over configuration type - defaults to CommercetoolsConfig\n *\n * Usage with default config:\n * ```typescript\n * const handler = new CustomersHandler();\n * ```\n *\n * Usage with custom config:\n * ```typescript\n * interface MyConfig extends CommercetoolsConfig {\n * projectKey: string;\n * customField: string;\n * }\n * const handler = new CustomersHandler<MyConfig>();\n * ```\n */\nexport class CustomersHandler<\n TConfig extends Configuration = Configuration,\n> extends CommercetoolsResourceHandler<TConfig> {\n protected readonly metadata: ResourceMetadata = {\n namespace: 'customers',\n description: 'Manage customers in commercetools',\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readCustomerParameters,\n create: createCustomerParameters,\n update: updateCustomerParameters,\n delete: deleteCustomerParameters,\n },\n };\n\n constructor(apiClientFactory?: IApiClientFactory<TConfig>) {\n super(apiClientFactory);\n }\n\n override getToolDefinition(\n operation: 'read' | 'create' | 'update' | 'delete'\n ) {\n const prompts = {\n read: readCustomerPrompt,\n create: createCustomerPrompt,\n update: updateCustomerPrompt,\n delete: deleteCustomerPrompt,\n };\n\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation],\n };\n }\n\n protected getCustomersApi(\n api: ByProjectKeyRequestBuilder,\n storeKey?: string\n ) {\n return storeKey\n ? api.inStoreKeyWithStoreKeyValue({ storeKey }).customers()\n : api.customers();\n }\n\n async read(\n context: ToolExecutionContext<TConfig>\n ): Promise<Customer | CustomerPagedQueryResponse> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n\n const params = context.parameters as z.infer<typeof readCustomerParameters>;\n\n try {\n if (params?.id) {\n const customer = await this.getCustomersApi(api, params.storeKey)\n .withId({ ID: params.id })\n .get({\n queryArgs: {\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n\n return customer.body;\n } else if (params?.key) {\n const customer = await this.getCustomersApi(api, params.storeKey)\n .withKey({ key: params.key })\n .get()\n .execute();\n return customer.body;\n } else {\n const customers = await this.getCustomersApi(api, params.storeKey)\n .get({\n queryArgs: {\n limit: params.limit || 10,\n ...(params.offset && { offset: params.offset }),\n ...(params.sort && { sort: params.sort }),\n ...(params.where && { where: params.where }),\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n\n return customers.body;\n }\n } catch (err: unknown) {\n throw new ToolExecutionError(\n (err as { message: string }).message || 'Failed to read customers',\n context,\n err\n );\n }\n }\n\n async create(\n context: ToolExecutionContext<TConfig>\n ): Promise<CustomerSignInResult> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<\n typeof createCustomerParameters\n >;\n\n try {\n const customer = await this.getCustomersApi(api, params.storeKey)\n .post({\n body: params as CustomerDraft,\n })\n .execute();\n\n return customer.body;\n } catch (error: unknown) {\n throw new ToolExecutionError(\n 'Failed to create customers',\n context,\n error\n );\n }\n }\n\n async update(context: ToolExecutionContext<TConfig>): Promise<Customer> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n\n const params = context.parameters as z.infer<\n typeof updateCustomerParameters\n >;\n\n try {\n const customer = await api\n .customers()\n .withId({ ID: params.id })\n .get()\n .execute();\n const currentVersion = customer.body.version;\n\n const updatedCustomer = await api\n .customers()\n .withId({ ID: params.id })\n .post({\n body: {\n version: currentVersion,\n actions: params.actions as CustomerUpdateAction[],\n },\n })\n .execute();\n\n return updatedCustomer.body;\n } catch (error: unknown) {\n throw new ToolExecutionError(\n 'Failed to update customers',\n context,\n error\n );\n }\n }\n\n async delete(context: ToolExecutionContext<TConfig>): Promise<Customer> {\n throw new ToolExecutionError('Delete operation not implemented', context);\n }\n}\n\n// Export individual functions for backward compatibility or direct usage\n// These functions wrap the handler methods and can be called directly\n\nexport async function readCustomers<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Customer | CustomerPagedQueryResponse> {\n const handler = new CustomersHandler<TConfig>(apiClientFactory);\n return handler.read(context);\n}\n\nexport async function createCustomers<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<CustomerSignInResult> {\n const handler = new CustomersHandler<TConfig>(apiClientFactory);\n return handler.create(context);\n}\n\nexport async function updateCustomers<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Customer> {\n const handler = new CustomersHandler<TConfig>(apiClientFactory);\n return handler.update(context);\n}\n\nexport async function deleteCustomers<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Customer> {\n const handler = new CustomersHandler<TConfig>(apiClientFactory);\n return handler.delete(context);\n}\n","import { z } from 'zod';\n\nexport const readCustomerGroupsParameters = z.object({\n id: z.string().optional().describe('Customer group ID'),\n key: z.string().optional().describe('Customer group key'),\n where: z\n .array(z.string())\n .optional()\n .describe(\n 'Query predicates specified as strings. Example: [\"key = \\\\\"vip\\\\\"\"] or [\"name = \\\\\"VIP Customers\\\\\"\"]'\n ),\n sort: z\n .array(z.string())\n .optional()\n .describe(\n 'Sort criteria for the results. Example: [\"name asc\", \"createdAt desc\", \"key asc\"]'\n ),\n limit: z\n .number()\n .int()\n .min(1)\n .max(500)\n .optional()\n .describe(\n 'A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.'\n ),\n offset: z\n .number()\n .int()\n .min(0)\n .optional()\n .describe(\n 'The number of items to skip before starting to collect the result set.'\n ),\n expand: z\n .array(z.string())\n .optional()\n .describe(\n 'Fields to expand. Customer groups have no reference expansions by default.'\n ),\n});\n\nexport const createCustomerGroupsParameters = z.object({\n groupName: z\n .string()\n .min(1)\n .describe(\n 'Unique name of the customer group. Must be different from any existing group name in the project.'\n ),\n key: z\n .string()\n .min(2)\n .max(256)\n .optional()\n .describe(\n 'User-defined unique identifier for the customer group (2-256 characters, alphanumeric with underscores/hyphens).'\n ),\n custom: z\n .object({\n type: z.object({\n id: z.string().describe('ID of the custom type'),\n typeId: z.literal('type'),\n }),\n fields: z\n .record(z.string(), z.any())\n .optional()\n .describe('Custom field values'),\n })\n .optional()\n .describe(\n 'Custom fields for the customer group. Requires a Type with resourceTypeIds including \"customer-group\".'\n ),\n});\n\nexport const updateCustomerGroupsParameters = z.object({\n id: z.string().optional().describe('The ID of the customer group to update'),\n key: z\n .string()\n .optional()\n .describe('The key of the customer group to update'),\n version: z\n .number()\n .int()\n .describe(\n 'The current version of the customer group (for optimistic locking)'\n ),\n actions: z\n .array(\n z\n .object({\n action: z\n .string()\n .describe('The name of the update action to perform'),\n })\n .and(z.record(z.string(), z.any()).optional())\n .describe(\n 'Array of update actions. Each action must have an \"action\" field and other fields specific to that action type (e.g. changeName requires \"name\", setKey requires \"key\").'\n )\n )\n .describe('Update actions'),\n});\n\nexport const deleteCustomerGroupsParameters = z.object({\n id: z\n .string()\n .optional()\n .describe('Customer group ID (required if key is not provided)'),\n key: z\n .string()\n .optional()\n .describe('Customer group key (required if id is not provided)'),\n version: z\n .number()\n .int()\n .describe(\n 'Current version of the customer group (for optimistic locking).'\n ),\n});\n","export const readCustomerGroupsPrompt = `\nThis tool will fetch a Customer Group by ID or key (if provided) from commercetools or query all available customer groups in a commercetools project if no arguments or parameters are provided.\n\nCustomer groups are used to segment customers (e.g. for B2B pricing, promotions, or analytics). Each customer can be assigned to at most one customer group.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the customer group to fetch.\n- key (string, optional): The key of the customer group to fetch.\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"key = \\\\\"vip\\\\\"\"] or [\"name = \\\\\"VIP Customers\\\\\"\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"name asc\", \"createdAt desc\", \"key asc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- expand (array of strings, optional): Fields to expand. Customer groups typically have no reference fields to expand.\n`;\n\nexport const createCustomerGroupsPrompt = `\nThis tool will create a new Customer Group in commercetools.\n\nCustomer groups segment customers for pricing, promotions, or reporting. Common examples include \"VIP\", \"Wholesale\", or \"B2B\".\n\nIt takes these required arguments:\n- groupName (string): Unique name of the customer group. Must be different from any existing group name in the project.\n\nIt takes these optional arguments:\n- key (string, optional): User-defined unique identifier for the customer group (2-256 characters, alphanumeric with underscores/hyphens). If omitted, a key may be derived or left unset.\n- custom (object, optional): Custom fields for the customer group. Must include a \"type\" object with \"id\" and \"typeId\" set to \"type\", and optionally a \"fields\" object with custom field values. The Type must have resourceTypeIds including \"customer-group\".\n`;\n\nexport const updateCustomerGroupsPrompt = `\nThis tool will update a Customer Group in commercetools using update actions from the commercetools API.\n\nIt takes these required arguments:\n- version (integer): The current version of the customer group (for optimistic locking).\n- actions (array): An array of update actions to perform. Each action must have an \"action\" field indicating the action type and any required fields for that action.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the customer group to update (required if key is not provided).\n- key (string, optional): The key of the customer group to update (required if id is not provided).\n\nExample actions from the commercetools API include:\n- changeName: Change the name of the customer group. Requires \"name\" (string).\n- setKey: Set or change the key. Requires \"key\" (string, optional; omit or set to null to remove).\n- setCustomType: Set custom type and fields. Requires \"type\" (object with \"id\", \"typeId\") and optionally \"fields\" (object).\n- setCustomField: Set a custom field value. Requires \"name\" (string) and \"value\" (any; use null to remove).\n\nEach action type requires specific fields according to the commercetools API documentation.\n`;\n\nexport const deleteCustomerGroupsPrompt = `\nThis tool will delete a Customer Group from commercetools.\n\nDeleting a customer group does not delete the customers that were assigned to it; their customerGroup reference will be cleared or may need to be updated separately depending on API behavior.\n\nIt takes these required arguments:\n- version (integer): The current version of the customer group (for optimistic locking).\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the customer group to delete (required if key is not provided).\n- key (string, optional): The key of the customer group to delete (required if id is not provided).\n`;\n","import { z } from 'zod';\nimport {\n type CustomerGroup,\n type CustomerGroupPagedQueryResponse,\n type ByProjectKeyRequestBuilder,\n type CustomerGroupDraft,\n type CustomerGroupUpdateAction,\n} from '@commercetools/platform-sdk';\nimport {\n readCustomerGroupsParameters,\n createCustomerGroupsParameters,\n updateCustomerGroupsParameters,\n deleteCustomerGroupsParameters,\n} from './customer-groups.schema';\nimport {\n readCustomerGroupsPrompt,\n createCustomerGroupsPrompt,\n updateCustomerGroupsPrompt,\n deleteCustomerGroupsPrompt,\n} from './customer-groups.prompt';\nimport {\n IApiClientFactory,\n type ResourceMetadata,\n type ToolExecutionContext,\n ToolExecutionError,\n type Configuration,\n} from '../../shared';\nimport { CommercetoolsResourceHandler } from '../../handlers/commercetools.handler';\nimport { TOOL_NAME_PREFIX } from '../../utils/constants';\n\n/**\n * Customer Groups Resource Handler\n */\nexport class CustomerGroupsHandler<\n TConfig extends Configuration = Configuration,\n> extends CommercetoolsResourceHandler<TConfig> {\n protected readonly metadata: ResourceMetadata = {\n namespace: 'customer-groups',\n description: 'Manage customer groups in commercetools',\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readCustomerGroupsParameters,\n create: createCustomerGroupsParameters,\n update: updateCustomerGroupsParameters,\n delete: deleteCustomerGroupsParameters,\n },\n };\n\n constructor(apiClientFactory?: IApiClientFactory<TConfig>) {\n super(apiClientFactory);\n }\n\n override getToolDefinition(\n operation: 'read' | 'create' | 'update' | 'delete'\n ) {\n const prompts = {\n read: readCustomerGroupsPrompt,\n create: createCustomerGroupsPrompt,\n update: updateCustomerGroupsPrompt,\n delete: deleteCustomerGroupsPrompt,\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation],\n };\n }\n\n protected getCustomerGroupsApi(api: ByProjectKeyRequestBuilder) {\n return api.customerGroups();\n }\n\n async read(\n context: ToolExecutionContext<TConfig>\n ): Promise<CustomerGroup | CustomerGroupPagedQueryResponse> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<\n typeof readCustomerGroupsParameters\n >;\n try {\n const apiResource = this.getCustomerGroupsApi(api);\n if (params?.id) {\n const res = await apiResource\n .withId({ ID: params.id })\n .get({\n queryArgs: { ...(params.expand && { expand: params.expand }) },\n })\n .execute();\n return res.body;\n }\n if (params?.key) {\n const res = await apiResource\n .withKey({ key: params.key })\n .get({\n queryArgs: { ...(params.expand && { expand: params.expand }) },\n })\n .execute();\n return res.body;\n }\n const res = await apiResource\n .get({\n queryArgs: {\n limit: params.limit ?? 20,\n ...(params.offset != null && { offset: params.offset }),\n ...(params.sort && { sort: params.sort }),\n ...(params.where && { where: params.where }),\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n return res.body;\n } catch (err: unknown) {\n throw new ToolExecutionError(\n 'Failed to read customer groups',\n context,\n err\n );\n }\n }\n\n async create(context: ToolExecutionContext<TConfig>): Promise<CustomerGroup> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<\n typeof createCustomerGroupsParameters\n >;\n try {\n const body = {\n groupName: params.groupName,\n ...(params.key != null && { key: params.key }),\n ...(params.custom != null && { custom: params.custom }),\n };\n const created = await this.getCustomerGroupsApi(api)\n .post({\n body: body as CustomerGroupDraft,\n })\n .execute();\n return created.body;\n } catch (err: unknown) {\n throw new ToolExecutionError(\n 'Failed to create customer group',\n context,\n err\n );\n }\n }\n\n async update(context: ToolExecutionContext<TConfig>): Promise<CustomerGroup> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<\n typeof updateCustomerGroupsParameters\n >;\n try {\n const apiResource = this.getCustomerGroupsApi(api);\n let groupId: string;\n let version: number = params.version;\n if (params.id) {\n groupId = params.id;\n } else if (params.key) {\n const res = await apiResource\n .withKey({ key: params.key })\n .get()\n .execute();\n groupId = res.body.id;\n version = res.body.version;\n } else {\n throw new ToolExecutionError(\n 'Either id or key must be provided',\n context\n );\n }\n const updated = await apiResource\n .withId({ ID: groupId })\n .post({\n body: {\n version,\n actions: (params.actions ?? []) as CustomerGroupUpdateAction[],\n },\n })\n .execute();\n return updated.body;\n } catch (err: unknown) {\n throw new ToolExecutionError(\n 'Failed to update customer group',\n context,\n err\n );\n }\n }\n\n async delete(context: ToolExecutionContext<TConfig>): Promise<CustomerGroup> {\n // const api = this.getApiRoot(context).withProjectKey({\n // projectKey: context.configuration.projectKey,\n // });\n // const params = context.parameters as z.infer<\n // typeof deleteCustomerGroupsParameters\n // >;\n // try {\n // const apiResource = this.getCustomerGroupsApi(api);\n // let groupId: string;\n // let version: number = params.version;\n // if (params.id) {\n // groupId = params.id;\n // } else if (params.key) {\n // const res = await apiResource\n // .withKey({ key: params.key })\n // .get()\n // .execute();\n // groupId = res.body.id;\n // version = res.body.version;\n // } else {\n // throw new ToolExecutionError(\n // 'Either id or key must be provided',\n // context\n // );\n // }\n // const deleted = await apiResource\n // .withId({ ID: groupId })\n // .delete({ queryArgs: { version } })\n // .execute();\n // return deleted.body;\n // } catch (err: unknown) {\n // throw new ToolExecutionError(\n // 'Failed to delete customer group',\n // context,\n // err\n // );\n // }\n\n throw new ToolExecutionError(\n 'Delete operation not implemented for customer groups',\n context\n );\n }\n}\n\nexport async function readCustomerGroups<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<CustomerGroup | CustomerGroupPagedQueryResponse> {\n const handler = new CustomerGroupsHandler<TConfig>(apiClientFactory);\n return handler.read(context);\n}\n\nexport async function createCustomerGroups<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<CustomerGroup> {\n const handler = new CustomerGroupsHandler<TConfig>(apiClientFactory);\n return handler.create(context);\n}\n\nexport async function updateCustomerGroups<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<CustomerGroup> {\n const handler = new CustomerGroupsHandler<TConfig>(apiClientFactory);\n return handler.update(context);\n}\n\nexport async function deleteCustomerGroups<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<CustomerGroup> {\n const handler = new CustomerGroupsHandler<TConfig>(apiClientFactory);\n return handler.delete(context);\n}\n","import { z } from 'zod';\n\n/**\n * Customer Search is ID-first: returns only Customer IDs (and relevance).\n * Use Get Customer by ID to fetch full Customer data.\n * See: https://docs.commercetools.com/api/projects/customer-search\n */\nexport const readCustomerSearchParameters = z.object({\n query: z\n .record(z.any())\n .optional()\n .describe(\n 'Search query (SearchQuery). Use fullText (field, value), exact (field, value), range (field, gte, lt), or compound (and, or, not). Text fields: all, firstName, lastName, email, companyName, fullName, addresses.*. Keyword: id, key, customerNumber, externalId, vatId, customerGroup.id, stores.key. Number/date: dateOfBirth, createdAt, lastModifiedAt, version.'\n ),\n sort: z\n .array(z.record(z.any()))\n .optional()\n .describe(\n 'Sort criteria (SearchSorting). If not provided, results are sorted by relevance descending. Example: [{\"field\": \"createdAt\", \"order\": \"desc\"}]'\n ),\n limit: z\n .number()\n .int()\n .min(1)\n .max(100)\n .optional()\n .describe(\n 'Maximum number of search results. Default: 20. Minimum: 1, Maximum: 100.'\n ),\n offset: z\n .number()\n .int()\n .min(0)\n .max(9900)\n .optional()\n .describe(\n 'Number of search results to skip for pagination. Default: 0. Minimum: 0, Maximum: 9900.'\n ),\n});\n\nexport const createCustomerSearchParameters = z\n .object({})\n .describe('Customer Search does not support create operations');\n\nexport const updateCustomerSearchParameters = z\n .object({})\n .describe('Customer Search does not support update operations');\n\nexport const deleteCustomerSearchParameters = z\n .object({})\n .describe('Customer Search does not support delete operations');\n","export const readCustomerSearchPrompt = `\nThis tool searches across Customers in a commercetools Project using the [Customer Search API](https://docs.commercetools.com/api/projects/customer-search). It is designed for back-office use cases (e.g. Merchant Center, admin tools), not storefront search.\n\nThe API is **ID-first**: it returns only Customer IDs (and relevance scores). To get full Customer data, use the Get Customer by ID endpoint (customers.read with id) after searching.\n\nCustomer Search is deactivated for a Project by default. Activate it via the Project API (Change Customer Search status) or by indexing in Merchant Center (Customers > Customer list). If no search calls are made for 30 days, the feature is automatically deactivated.\n\nIt takes these optional arguments:\n- query (object, optional): Search query in the [Search Query Language](https://docs.commercetools.com/api/search-query-language). Examples:\n - Full-text on a field: { \"fullText\": { \"field\": \"firstName\", \"value\": \"john\" } }\n - Search in all text fields: { \"fullText\": { \"field\": \"all\", \"value\": \"example\" } }\n - Exact match (keyword): { \"exact\": { \"field\": \"email\", \"value\": \"user@example.com\" } } or { \"exact\": { \"field\": \"id\", \"value\": \"customer-id\" } }\n - Range (date/number): { \"range\": { \"field\": \"createdAt\", \"gte\": \"2023-12-01T00:00:00.000Z\", \"lt\": \"2024-01-01T00:00:00.000Z\" } }\n - Compound: { \"and\": [ { \"fullText\": { \"field\": \"firstName\", \"value\": \"john\" } }, { \"exact\": { \"field\": \"customerGroup.id\", \"value\": \"group-id\" } } ] } or { \"or\": [ ... ] }\n Text fields: all, firstName, lastName, email, companyName, fullName, addresses.all, addresses.city, addresses.country, etc. Keyword: id, key, customerNumber, externalId, vatId, customerGroup.id, stores.key. Number/date: dateOfBirth, createdAt, lastModifiedAt, version.\n- sort (array of objects, optional): Sort criteria (SearchSorting). If not provided, results are sorted by relevance descending. Example: [{\"field\": \"createdAt\", \"order\": \"desc\"}].\n- limit (integer, optional): Maximum number of results. Default: 20. Min: 1, Max: 100.\n- offset (integer, optional): Number of results to skip for pagination. Default: 0. Min: 0, Max: 9900.\n\nIf the index is not ready or the feature is inactive, a SearchNotReady error is returned.\n`;\n\nexport const createCustomerSearchPrompt = `\nCustomer Search does not support create operations. This is a read-only search API. Use the Customers API (customers.create) to create customers.\n`;\n\nexport const updateCustomerSearchPrompt = `\nCustomer Search does not support update operations. This is a read-only search API. Use the Customers API (customers.update) to update customers.\n`;\n\nexport const deleteCustomerSearchPrompt = `\nCustomer Search does not support delete operations. This is a read-only search API. Use the Customers API (customers.delete) to delete customers.\n`;\n","import { z } from 'zod';\nimport {\n type CustomerPagedSearchResponse,\n type CustomerSearchRequest,\n type ByProjectKeyRequestBuilder,\n} from '@commercetools/platform-sdk';\nimport {\n readCustomerSearchParameters,\n createCustomerSearchParameters,\n updateCustomerSearchParameters,\n deleteCustomerSearchParameters,\n} from './customer-search.schema';\nimport {\n readCustomerSearchPrompt,\n createCustomerSearchPrompt,\n updateCustomerSearchPrompt,\n deleteCustomerSearchPrompt,\n} from './customer-search.prompt';\nimport {\n IApiClientFactory,\n type ResourceMetadata,\n type ToolExecutionContext,\n ToolExecutionError,\n type Configuration,\n} from '../../shared';\nimport { CommercetoolsResourceHandler } from '../../handlers/commercetools.handler';\nimport { TOOL_NAME_PREFIX } from '../../utils/constants';\n\n/**\n * Customer Search Resource Handler\n * Search-only: POST to customers/search. Create/update/delete are not supported.\n * See: https://docs.commercetools.com/api/projects/customer-search\n */\nexport class CustomerSearchHandler<\n TConfig extends Configuration = Configuration,\n> extends CommercetoolsResourceHandler<TConfig> {\n protected readonly metadata: ResourceMetadata = {\n namespace: 'customer-search',\n description: 'Search customers in commercetools (back-office, ID-first)',\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readCustomerSearchParameters,\n create: createCustomerSearchParameters,\n update: updateCustomerSearchParameters,\n delete: deleteCustomerSearchParameters,\n },\n };\n\n constructor(apiClientFactory?: IApiClientFactory<TConfig>) {\n super(apiClientFactory);\n }\n\n override getToolDefinition(\n operation: 'read' | 'create' | 'update' | 'delete'\n ) {\n const prompts = {\n read: readCustomerSearchPrompt,\n create: createCustomerSearchPrompt,\n update: updateCustomerSearchPrompt,\n delete: deleteCustomerSearchPrompt,\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation],\n };\n }\n\n protected getCustomerSearchApi(api: ByProjectKeyRequestBuilder) {\n return api.customers().search();\n }\n\n async read(\n context: ToolExecutionContext<TConfig>\n ): Promise<CustomerPagedSearchResponse> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<\n typeof readCustomerSearchParameters\n >;\n\n try {\n const body: CustomerSearchRequest = {\n ...(params.query != null && {\n query: params.query as CustomerSearchRequest['query'],\n }),\n ...(params.sort != null && {\n sort: params.sort as CustomerSearchRequest['sort'],\n }),\n ...(params.limit != null && { limit: params.limit }),\n ...(params.offset != null && { offset: params.offset }),\n };\n const searchResponse = await this.getCustomerSearchApi(api)\n .post({ body })\n .execute();\n return searchResponse.body;\n } catch (err: unknown) {\n throw new ToolExecutionError(\n (err as { message: string }).message || 'Failed to search customers',\n context,\n err\n );\n }\n }\n\n async create(context: ToolExecutionContext<TConfig>): Promise<never> {\n throw new ToolExecutionError(\n 'Create operation not supported for customer-search',\n context\n );\n }\n\n async update(context: ToolExecutionContext<TConfig>): Promise<never> {\n throw new ToolExecutionError(\n 'Update operation not supported for customer-search',\n context\n );\n }\n\n async delete(context: ToolExecutionContext<TConfig>): Promise<never> {\n throw new ToolExecutionError(\n 'Delete operation not supported for customer-search',\n context\n );\n }\n}\n\nexport async function readCustomerSearch<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<CustomerPagedSearchResponse> {\n const handler = new CustomerSearchHandler<TConfig>(apiClientFactory);\n return handler.read(context);\n}\n\nexport async function createCustomerSearch<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<never> {\n const handler = new CustomerSearchHandler<TConfig>(apiClientFactory);\n return handler.create(context);\n}\n\nexport async function updateCustomerSearch<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<never> {\n const handler = new CustomerSearchHandler<TConfig>(apiClientFactory);\n return handler.update(context);\n}\n\nexport async function deleteCustomerSearch<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<never> {\n const handler = new CustomerSearchHandler<TConfig>(apiClientFactory);\n return handler.delete(context);\n}\n","import { z } from 'zod';\n\nexport const readDiscountCodesParameters = z.object({\n id: z.string().optional().describe('Discount Code ID'),\n key: z.string().optional().describe('Discount Code key'),\n where: z\n .array(z.string())\n .optional()\n .describe(\n 'Query predicates specified as strings. Example: [\"code = \\\\\"SUMMER2024\\\\\"\"]'\n ),\n sort: z\n .array(z.string())\n .optional()\n .describe(\n 'Sort criteria for the results. Example: [\"code asc\", \"createdAt desc\"]'\n ),\n limit: z\n .number()\n .int()\n .min(1)\n .max(500)\n .optional()\n .describe(\n 'A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.'\n ),\n offset: z\n .number()\n .int()\n .min(0)\n .optional()\n .describe(\n 'The number of items to skip before starting to collect the result set.'\n ),\n expand: z\n .array(z.string())\n .optional()\n .describe('Fields to expand. Example: [\"cartDiscounts[*]\"]'),\n});\n\nexport const createDiscountCodesParameters = z.object({\n key: z\n .string()\n .min(2)\n .max(256)\n .optional()\n .describe('User-defined unique identifier for the discount code'),\n name: z\n .record(z.string())\n .optional()\n .describe('Localized name of the Discount Code'),\n description: z\n .record(z.string())\n .optional()\n .describe('Localized description'),\n code: z\n .string()\n .describe(\n 'User-defined unique identifier added to a Cart to apply related Cart Discounts'\n ),\n cartDiscounts: z\n .array(\n z.object({\n id: z.string().optional(),\n key: z.string().optional(),\n typeId: z.literal('cart-discount'),\n })\n )\n .describe(\n 'Array of references to up to 10 CartDiscounts that apply when the code is used'\n ),\n cartPredicate: z\n .string()\n .optional()\n .describe('Optional predicate defining which Carts the code can apply to'),\n isActive: z\n .boolean()\n .optional()\n .describe('Whether the code can be applied (defaults to false)'),\n maxApplications: z\n .number()\n .int()\n .min(0)\n .optional()\n .describe('Total number of times the code can be applied'),\n maxApplicationsPerCustomer: z\n .number()\n .int()\n .min(0)\n .optional()\n .describe('Times the code can be applied per customer'),\n groups: z\n .array(z.string())\n .optional()\n .describe('Tags for grouping and organizing Discount Codes'),\n validFrom: z\n .string()\n .optional()\n .describe('Date/time when the code becomes valid (ISO 8601 format)'),\n validUntil: z\n .string()\n .optional()\n .describe('Date/time when the code expires (ISO 8601 format)'),\n custom: z\n .object({\n type: z\n .object({\n id: z.string(),\n typeId: z.literal('type'),\n })\n .optional(),\n fields: z.record(z.string(), z.any()).optional(),\n })\n .optional()\n .describe('Custom fields for the discount code'),\n});\n\nexport const updateDiscountCodesParameters = z.object({\n id: z.string().optional().describe('The ID of the discount code to update'),\n key: z.string().optional().describe('The key of the discount code to update'),\n version: z\n .number()\n .int()\n .describe('The current version of the discount code'),\n actions: z\n .array(\n z\n .object({\n action: z\n .string()\n .describe('The name of the update action to perform'),\n })\n .and(z.record(z.string(), z.any()).optional())\n .describe(\n 'Array of update actions to perform on the discount code. Each action should have an \"action\" field and other fields specific to that action type.'\n )\n )\n .describe('Update actions'),\n});\n\nexport const deleteDiscountCodesParameters = z.object({\n id: z.string().optional().describe('Discount Code ID'),\n key: z.string().optional().describe('Discount Code key'),\n version: z\n .number()\n .int()\n .describe('Current version (for optimistic locking)'),\n dataErasure: z.boolean().optional().describe('Delete personal data'),\n});\n","export const readDiscountCodesPrompt = `\nThis tool will fetch a Discount Code by ID or key (if provided) from commercetools or query all available discount codes in a commercetools project if no arguments or parameters are provided.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the discount code to fetch.\n- key (string, optional): The key of the discount code to fetch.\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"code = \\\\\"SUMMER2024\\\\\"\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"code asc\", \"createdAt desc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- expand (array of strings, optional): Fields to expand. Example: [\"cartDiscounts[*]\"]\n`;\n\nexport const createDiscountCodesPrompt = `\nThis tool will create a new Discount Code in commercetools.\n\nIt takes these required arguments:\n- code (string): User-defined unique identifier added to a Cart to apply related Cart Discounts.\n- cartDiscounts (array): Array of references to up to 10 CartDiscounts that apply when the code is used. Each must have typeId \"cart-discount\" and either id or key.\n\nIt takes these optional arguments:\n- key (string, optional): User-defined unique identifier for the discount code (2-256 characters, alphanumeric with underscores/hyphens).\n- name (object, optional): Localized name of the Discount Code (object with language codes as keys).\n- description (object, optional): Localized description (object with language codes as keys).\n- cartPredicate (string, optional): Optional predicate defining which Carts the code can apply to.\n- isActive (boolean, optional): Whether the code can be applied (defaults to false).\n- maxApplications (integer, optional): Total number of times the code can be applied (must be >= 0).\n- maxApplicationsPerCustomer (integer, optional): Times the code can be applied per customer (must be >= 0).\n- groups (array of strings, optional): Tags for grouping and organizing Discount Codes.\n- validFrom (string, optional): Date/time when the code becomes valid (ISO 8601 format).\n- validUntil (string, optional): Date/time when the code expires (ISO 8601 format).\n- custom (object, optional): Custom fields for the discount code.\n`;\n\nexport const updateDiscountCodesPrompt = `\nThis tool will update a Discount Code in commercetools using update actions from the commercetools API.\n\nIt takes these required arguments:\n- version (integer): The current version of the discount code.\n- actions (array): An array of update actions to perform on the discount code. Each action should have an \"action\" field indicating the action type.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the discount code to update (required if key is not provided).\n- key (string, optional): The key of the discount code to update (required if id is not provided).\n\nExample actions from commercetools API include:\n- changeCartDiscounts\n- changeGroups\n- changeIsActive\n- setCartPredicate\n- setCustomField\n- setCustomType\n- setDescription\n- setKey\n- setMaxApplications\n- setMaxApplicationsPerCustomer\n- setName\n- setValidFrom\n- setValidUntil\n\nEach action type requires specific fields according to the commercetools API.\n`;\n\nexport const deleteDiscountCodesPrompt = `\nThis tool will delete a Discount Code from commercetools.\n\nIt takes these required arguments:\n- version (integer): The current version of the discount code (for optimistic locking).\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the discount code to delete (required if key is not provided).\n- key (string, optional): The key of the discount code to delete (required if id is not provided).\n- dataErasure (boolean, optional): Delete personal data.\n`;\n","import { z } from 'zod';\nimport {\n type DiscountCode,\n type DiscountCodePagedQueryResponse,\n type DiscountCodeDraft,\n type DiscountCodeUpdateAction,\n type ByProjectKeyRequestBuilder,\n} from '@commercetools/platform-sdk';\nimport {\n readDiscountCodesParameters,\n createDiscountCodesParameters,\n updateDiscountCodesParameters,\n deleteDiscountCodesParameters,\n} from './discount-codes.schema';\nimport {\n readDiscountCodesPrompt,\n createDiscountCodesPrompt,\n updateDiscountCodesPrompt,\n deleteDiscountCodesPrompt,\n} from './discount-codes.prompt';\nimport {\n IApiClientFactory,\n type ResourceMetadata,\n type ToolExecutionContext,\n ToolExecutionError,\n type Configuration,\n} from '../../shared';\nimport { CommercetoolsResourceHandler } from '../../handlers/commercetools.handler';\nimport { TOOL_NAME_PREFIX } from '../../utils/constants';\n\n/**\n * Discount Codes Resource Handler\n * Generic over configuration type - defaults to CommercetoolsConfig\n */\nexport class DiscountCodesHandler<\n TConfig extends Configuration = Configuration,\n> extends CommercetoolsResourceHandler<TConfig> {\n protected readonly metadata: ResourceMetadata = {\n namespace: 'discount-codes',\n description: 'Manage discount codes in commercetools',\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readDiscountCodesParameters,\n create: createDiscountCodesParameters,\n update: updateDiscountCodesParameters,\n delete: deleteDiscountCodesParameters,\n },\n };\n\n constructor(apiClientFactory?: IApiClientFactory<TConfig>) {\n super(apiClientFactory);\n }\n\n override getToolDefinition(\n operation: 'read' | 'create' | 'update' | 'delete'\n ) {\n const prompts = {\n read: readDiscountCodesPrompt,\n create: createDiscountCodesPrompt,\n update: updateDiscountCodesPrompt,\n delete: deleteDiscountCodesPrompt,\n };\n\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation],\n };\n }\n\n protected getDiscountCodesApi(api: ByProjectKeyRequestBuilder) {\n return api.discountCodes();\n }\n\n async read(\n context: ToolExecutionContext<TConfig>\n ): Promise<DiscountCode | DiscountCodePagedQueryResponse> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n\n const params = context.parameters as z.infer<\n typeof readDiscountCodesParameters\n >;\n\n try {\n if (params?.id) {\n const discountCode = await this.getDiscountCodesApi(api)\n .withId({ ID: params.id })\n .get({\n queryArgs: {\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n\n return discountCode.body;\n } else if (params?.key) {\n const discountCode = await this.getDiscountCodesApi(api)\n .withKey({ key: params.key })\n .get({\n queryArgs: {\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n return discountCode.body;\n } else {\n const discountCodes = await this.getDiscountCodesApi(api)\n .get({\n queryArgs: {\n limit: params.limit || 20,\n ...(params.offset && { offset: params.offset }),\n ...(params.sort && { sort: params.sort }),\n ...(params.where && { where: params.where }),\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n\n return discountCodes.body;\n }\n } catch (err: unknown) {\n throw new ToolExecutionError(\n (err as { message: string }).message || 'Failed to read discount codes',\n context,\n err\n );\n }\n }\n\n async create(context: ToolExecutionContext<TConfig>): Promise<DiscountCode> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<\n typeof createDiscountCodesParameters\n >;\n\n try {\n const discountCode = await this.getDiscountCodesApi(api)\n .post({\n body: params as DiscountCodeDraft,\n })\n .execute();\n\n return discountCode.body;\n } catch (error: unknown) {\n throw new ToolExecutionError(\n 'Failed to create discount code',\n context,\n error\n );\n }\n }\n\n async update(context: ToolExecutionContext<TConfig>): Promise<DiscountCode> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n\n const params = context.parameters as z.infer<\n typeof updateDiscountCodesParameters\n >;\n\n try {\n let currentVersion: number;\n let discountCodeId: string;\n\n if (params.id) {\n const discountCode = await this.getDiscountCodesApi(api)\n .withId({ ID: params.id })\n .get()\n .execute();\n currentVersion = discountCode.body.version;\n discountCodeId = params.id;\n } else if (params.key) {\n const discountCode = await this.getDiscountCodesApi(api)\n .withKey({ key: params.key })\n .get()\n .execute();\n currentVersion = discountCode.body.version;\n discountCodeId = discountCode.body.id;\n } else {\n throw new ToolExecutionError(\n 'Either id or key must be provided',\n context\n );\n }\n\n const updatedDiscountCode = await this.getDiscountCodesApi(api)\n .withId({ ID: discountCodeId })\n .post({\n body: {\n version: currentVersion,\n actions: params.actions as DiscountCodeUpdateAction[],\n },\n })\n .execute();\n\n return updatedDiscountCode.body;\n } catch (error: unknown) {\n throw new ToolExecutionError(\n 'Failed to update discount code',\n context,\n error\n );\n }\n }\n\n async delete(context: ToolExecutionContext<TConfig>): Promise<DiscountCode> {\n // const api = this.getApiRoot(context).withProjectKey({\n // projectKey: context.configuration.projectKey,\n // });\n\n // const params = context.parameters as z.infer<\n // typeof deleteDiscountCodesParameters\n // >;\n\n // try {\n // let discountCodeId: string;\n\n // if (params.id) {\n // discountCodeId = params.id;\n // } else if (params.key) {\n // const discountCode = await this.getDiscountCodesApi(api)\n // .withKey({ key: params.key })\n // .get()\n // .execute();\n // discountCodeId = discountCode.body.id;\n // } else {\n // throw new ToolExecutionError(\n // 'Either id or key must be provided',\n // context\n // );\n // }\n\n // const deletedDiscountCode = await this.getDiscountCodesApi(api)\n // .withId({ ID: discountCodeId })\n // .delete({\n // queryArgs: {\n // version: params.version,\n // ...(params.dataErasure && { dataErasure: params.dataErasure }),\n // },\n // })\n // .execute();\n\n // return deletedDiscountCode.body;\n // } catch (error: unknown) {\n // throw new ToolExecutionError(\n // 'Failed to delete discount code',\n // context,\n // error\n // );\n // }\n\n throw new ToolExecutionError(\n 'Delete operation not implemented for discount codes',\n context\n );\n }\n}\n\n// Export individual functions for backward compatibility or direct usage\n// These functions wrap the handler methods and can be called directly\n\nexport async function readDiscountCodes<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<DiscountCode | DiscountCodePagedQueryResponse> {\n const handler = new DiscountCodesHandler<TConfig>(apiClientFactory);\n return handler.read(context);\n}\n\nexport async function createDiscountCodes<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<DiscountCode> {\n const handler = new DiscountCodesHandler<TConfig>(apiClientFactory);\n return handler.create(context);\n}\n\nexport async function updateDiscountCodes<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<DiscountCode> {\n const handler = new DiscountCodesHandler<TConfig>(apiClientFactory);\n return handler.update(context);\n}\n\nexport async function deleteDiscountCodes<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<DiscountCode> {\n const handler = new DiscountCodesHandler<TConfig>(apiClientFactory);\n return handler.delete(context);\n}\n","import { z } from 'zod';\n\nexport const readExtensionsParameters = z.object({\n id: z.string().optional().describe('Extension ID'),\n key: z.string().optional().describe('Extension key'),\n where: z\n .array(z.string())\n .optional()\n .describe(\n 'Query predicates specified as strings. Example: [\"key = \\\\\"my-extension\\\\\"\"]'\n ),\n sort: z\n .array(z.string())\n .optional()\n .describe(\n 'Sort criteria for the results. Example: [\"key asc\", \"createdAt desc\"]'\n ),\n limit: z\n .number()\n .int()\n .min(1)\n .max(500)\n .optional()\n .describe(\n 'A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.'\n ),\n offset: z\n .number()\n .int()\n .min(0)\n .optional()\n .describe(\n 'The number of items to skip before starting to collect the result set.'\n ),\n expand: z\n .array(z.string())\n .optional()\n .describe('Fields to expand. Example: [\"destination\", \"triggers\"]'),\n});\n\nexport const createExtensionsParameters = z.object({\n key: z\n .string()\n .min(2)\n .max(256)\n .optional()\n .describe('User-defined unique identifier for the extension'),\n destination: z\n .object({\n type: z.enum(['HTTP', 'AWSLambda', 'GoogleCloudFunction']),\n url: z\n .string()\n .optional()\n .describe('URL of the HTTP endpoint or Google Cloud Function'),\n arn: z.string().optional().describe('ARN of the AWS Lambda function'),\n accessKey: z\n .string()\n .optional()\n .describe('AWS access key or Azure Event Grid access key'),\n accessSecret: z.string().optional().describe('AWS access secret'),\n region: z\n .string()\n .optional()\n .describe('AWS region or Google Cloud region'),\n authentication: z\n .object({\n type: z.enum(['AuthorizationHeader', 'AzureFunctions']),\n headerValue: z\n .string()\n .optional()\n .describe('Header value for authorization'),\n key: z\n .string()\n .optional()\n .describe('Function key for authentication'),\n })\n .optional()\n .describe('Authentication configuration'),\n connectionString: z\n .string()\n .optional()\n .describe('Azure Service Bus connection string'),\n uri: z\n .string()\n .optional()\n .describe('RabbitMQ URI or Azure Event Grid URI'),\n })\n .describe('Destination configuration for the extension'),\n triggers: z\n .array(\n z.object({\n resourceTypeId: z\n .enum([\n 'cart',\n 'order',\n 'payment',\n 'payment-method',\n 'customer',\n 'customer-group',\n 'quote-request',\n 'staged-quote',\n 'quote',\n 'business-unit',\n 'shopping-list',\n ])\n .describe('Resource type that triggers the extension'),\n actions: z\n .array(z.enum(['Create', 'Update']))\n .describe('Actions that trigger the extension'),\n condition: z\n .string()\n .optional()\n .describe('Conditional predicate for triggering'),\n })\n )\n .describe('Describes what triggers the extension'),\n timeoutInMs: z\n .number()\n .int()\n .min(1)\n .max(10000)\n .optional()\n .describe(\n 'Maximum time in milliseconds for the extension to respond (default: 2000, max: 10000)'\n ),\n});\n\nexport const updateExtensionsParameters = z.object({\n id: z.string().optional().describe('The ID of the extension to update'),\n key: z.string().optional().describe('The key of the extension to update'),\n version: z.number().int().describe('The current version of the extension'),\n actions: z\n .array(\n z\n .object({\n action: z\n .string()\n .describe('The name of the update action to perform'),\n })\n .and(z.record(z.string(), z.any()).optional())\n .describe(\n 'Array of update actions to perform on the extension. Each action should have an \"action\" field and other fields specific to that action type.'\n )\n )\n .describe('Update actions'),\n});\n\nexport const deleteExtensionsParameters = z.object({\n id: z.string().optional().describe('Extension ID'),\n key: z.string().optional().describe('Extension key'),\n version: z\n .number()\n .int()\n .describe('Current version (for optimistic locking)'),\n});\n","export const readExtensionsPrompt = `\nThis tool will fetch an Extension by ID or key (if provided) from commercetools or query all available extensions in a commercetools project if no arguments or parameters are provided.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the extension to fetch.\n- key (string, optional): The key of the extension to fetch.\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"key = \\\\\"my-extension\\\\\"\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"key asc\", \"createdAt desc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- expand (array of strings, optional): Fields to expand. Example: [\"destination\", \"triggers\"]\n`;\n\nexport const createExtensionsPrompt = `\nThis tool will create a new Extension in commercetools.\n\nIt takes these required arguments:\n- destination (object): Destination configuration for the extension. Must have:\n - type (string): Type of destination (\"HTTP\", \"AWSLambda\", or \"GoogleCloudFunction\")\n - For HTTP: url (string, required), authentication (object, optional)\n - For AWSLambda: arn (string, required), accessKey (string, required), accessSecret (string, required), region (string, required)\n - For GoogleCloudFunction: url (string, required), region (string, required)\n- triggers (array): Describes what triggers the extension. Each trigger should have:\n - resourceTypeId (string): Resource type that triggers the extension (cart, order, payment, customer, etc.)\n - actions (array): Actions that trigger the extension ([\"Create\", \"Update\"])\n - condition (string, optional): Conditional predicate for triggering\n\nIt takes these optional arguments:\n- key (string, optional): User-defined unique identifier for the extension (2-256 characters, alphanumeric with underscores/hyphens).\n- timeoutInMs (integer, optional): Maximum time in milliseconds for the extension to respond (1-10000, default: 2000).\n`;\n\nexport const updateExtensionsPrompt = `\nThis tool will update an Extension in commercetools using update actions from the commercetools API.\n\nIt takes these required arguments:\n- version (integer): The current version of the extension.\n- actions (array): An array of update actions to perform on the extension. Each action should have an \"action\" field indicating the action type.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the extension to update (required if key is not provided).\n- key (string, optional): The key of the extension to update (required if id is not provided).\n\nExample actions from commercetools API include:\n- changeDestination\n- addTrigger\n- removeTrigger\n- changeTriggers\n- setKey\n- setTimeoutInMs\n\nEach action type requires specific fields according to the commercetools API.\n`;\n\nexport const deleteExtensionsPrompt = `\nThis tool will delete an Extension from commercetools.\n\nIt takes these required arguments:\n- version (integer): The current version of the extension (for optimistic locking).\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the extension to delete (required if key is not provided).\n- key (string, optional): The key of the extension to delete (required if id is not provided).\n`;\n","import { z } from 'zod';\nimport {\n type Extension,\n type ExtensionPagedQueryResponse,\n type ExtensionDraft,\n type ExtensionUpdateAction,\n type ByProjectKeyRequestBuilder,\n} from '@commercetools/platform-sdk';\nimport {\n readExtensionsParameters,\n createExtensionsParameters,\n updateExtensionsParameters,\n deleteExtensionsParameters,\n} from './extensions.schema';\nimport {\n readExtensionsPrompt,\n createExtensionsPrompt,\n updateExtensionsPrompt,\n deleteExtensionsPrompt,\n} from './extensions.prompt';\nimport {\n IApiClientFactory,\n type ResourceMetadata,\n type ToolExecutionContext,\n ToolExecutionError,\n type Configuration,\n} from '../../shared';\nimport { CommercetoolsResourceHandler } from '../../handlers/commercetools.handler';\nimport { TOOL_NAME_PREFIX } from '../../utils/constants';\n\n/**\n * Extensions Resource Handler\n * Generic over configuration type - defaults to CommercetoolsConfig\n */\nexport class ExtensionsHandler<\n TConfig extends Configuration = Configuration,\n> extends CommercetoolsResourceHandler<TConfig> {\n protected readonly metadata: ResourceMetadata = {\n namespace: 'extensions',\n description: 'Manage extensions in commercetools',\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readExtensionsParameters,\n create: createExtensionsParameters,\n update: updateExtensionsParameters,\n delete: deleteExtensionsParameters,\n },\n };\n\n constructor(apiClientFactory?: IApiClientFactory<TConfig>) {\n super(apiClientFactory);\n }\n\n override getToolDefinition(\n operation: 'read' | 'create' | 'update' | 'delete'\n ) {\n const prompts = {\n read: readExtensionsPrompt,\n create: createExtensionsPrompt,\n update: updateExtensionsPrompt,\n delete: deleteExtensionsPrompt,\n };\n\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation],\n };\n }\n\n protected getExtensionsApi(api: ByProjectKeyRequestBuilder) {\n return api.extensions();\n }\n\n async read(\n context: ToolExecutionContext<TConfig>\n ): Promise<Extension | ExtensionPagedQueryResponse> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n\n const params = context.parameters as z.infer<\n typeof readExtensionsParameters\n >;\n\n try {\n if (params?.id) {\n const extension = await this.getExtensionsApi(api)\n .withId({ ID: params.id })\n .get()\n .execute();\n\n return extension.body;\n } else if (params?.key) {\n const extension = await this.getExtensionsApi(api)\n .withKey({ key: params.key })\n .get()\n .execute();\n return extension.body;\n } else {\n const extensions = await this.getExtensionsApi(api)\n .get({\n queryArgs: {\n limit: params.limit || 20,\n ...(params.offset && { offset: params.offset }),\n ...(params.sort && { sort: params.sort }),\n ...(params.where && { where: params.where }),\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n\n return extensions.body;\n }\n } catch (err: unknown) {\n throw new ToolExecutionError(\n (err as { message: string }).message || 'Failed to read extensions',\n context,\n err\n );\n }\n }\n\n async create(context: ToolExecutionContext<TConfig>): Promise<Extension> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<\n typeof createExtensionsParameters\n >;\n\n try {\n const extension = await this.getExtensionsApi(api)\n .post({\n body: params as ExtensionDraft,\n })\n .execute();\n\n return extension.body;\n } catch (error: unknown) {\n throw new ToolExecutionError(\n 'Failed to create extension',\n context,\n error\n );\n }\n }\n\n async update(context: ToolExecutionContext<TConfig>): Promise<Extension> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n\n const params = context.parameters as z.infer<\n typeof updateExtensionsParameters\n >;\n\n try {\n let currentVersion: number;\n let extensionId: string;\n\n if (params.id) {\n const extension = await this.getExtensionsApi(api)\n .withId({ ID: params.id })\n .get()\n .execute();\n currentVersion = extension.body.version;\n extensionId = params.id;\n } else if (params.key) {\n const extension = await this.getExtensionsApi(api)\n .withKey({ key: params.key })\n .get()\n .execute();\n currentVersion = extension.body.version;\n extensionId = extension.body.id;\n } else {\n throw new ToolExecutionError(\n 'Either id or key must be provided',\n context\n );\n }\n\n const updatedExtension = await this.getExtensionsApi(api)\n .withId({ ID: extensionId })\n .post({\n body: {\n version: currentVersion,\n actions: params.actions as ExtensionUpdateAction[],\n },\n })\n .execute();\n\n return updatedExtension.body;\n } catch (error: unknown) {\n throw new ToolExecutionError(\n 'Failed to update extension',\n context,\n error\n );\n }\n }\n\n async delete(context: ToolExecutionContext<TConfig>): Promise<Extension> {\n // const api = this.getApiRoot(context).withProjectKey({\n // projectKey: context.configuration.projectKey,\n // });\n\n // const params = context.parameters as z.infer<\n // typeof deleteExtensionsParameters\n // >;\n\n // try {\n // let extensionId: string;\n\n // if (params.id) {\n // extensionId = params.id;\n // } else if (params.key) {\n // const extension = await this.getExtensionsApi(api)\n // .withKey({ key: params.key })\n // .get()\n // .execute();\n // extensionId = extension.body.id;\n // } else {\n // throw new ToolExecutionError(\n // 'Either id or key must be provided',\n // context\n // );\n // }\n\n // const deletedExtension = await this.getExtensionsApi(api)\n // .withId({ ID: extensionId })\n // .delete({\n // queryArgs: {\n // version: params.version,\n // },\n // })\n // .execute();\n\n // return deletedExtension.body;\n // } catch (error: unknown) {\n // throw new ToolExecutionError(\n // 'Failed to delete extension',\n // context,\n // error\n // );\n // }\n\n throw new ToolExecutionError('Not implemented', context);\n }\n}\n\n// Export individual functions for backward compatibility or direct usage\n// These functions wrap the handler methods and can be called directly\n\nexport async function readExtensions<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Extension | ExtensionPagedQueryResponse> {\n const handler = new ExtensionsHandler<TConfig>(apiClientFactory);\n return handler.read(context);\n}\n\nexport async function createExtensions<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Extension> {\n const handler = new ExtensionsHandler<TConfig>(apiClientFactory);\n return handler.create(context);\n}\n\nexport async function updateExtensions<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Extension> {\n const handler = new ExtensionsHandler<TConfig>(apiClientFactory);\n return handler.update(context);\n}\n\nexport async function deleteExtensions<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Extension> {\n const handler = new ExtensionsHandler<TConfig>(apiClientFactory);\n return handler.delete(context);\n}\n","import { z } from 'zod';\n\nexport const readInventoryParameters = z.object({\n id: z.string().optional().describe('Inventory Entry ID'),\n key: z.string().optional().describe('Inventory Entry key'),\n sku: z.string().optional().describe('SKU of the product variant'),\n where: z\n .array(z.string())\n .optional()\n .describe(\n 'Query predicates specified as strings. Example: [\"sku = \\\\\"SKU-123\\\\\"\"]'\n ),\n sort: z\n .array(z.string())\n .optional()\n .describe(\n 'Sort criteria for the results. Example: [\"quantityOnStock desc\", \"createdAt asc\"]'\n ),\n limit: z\n .number()\n .int()\n .min(1)\n .max(500)\n .optional()\n .describe(\n 'A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 10.'\n ),\n offset: z\n .number()\n .int()\n .min(0)\n .optional()\n .describe(\n 'The number of items to skip before starting to collect the result set.'\n ),\n expand: z\n .array(z.string())\n .optional()\n .describe('Fields to expand. Example: [\"supplyChannel\"]'),\n});\n\nexport const createInventoryParameters = z.object({\n sku: z.string().describe('SKU of the product variant'),\n quantityOnStock: z\n .number()\n .int()\n .min(0)\n .describe('Quantity available in stock'),\n key: z.string().optional().describe('User-defined unique identifier'),\n supplyChannel: z\n .object({\n id: z.string().optional(),\n key: z.string().optional(),\n typeId: z.literal('channel'),\n })\n .optional()\n .describe('Supply channel reference'),\n expectedDelivery: z\n .string()\n .optional()\n .describe(\n 'Expected delivery date in ISO 8601 format (YYYY-MM-DDTHH:mm:ss.sssZ)'\n ),\n restockableInDays: z\n .number()\n .int()\n .min(0)\n .optional()\n .describe('Number of days until the item is restockable'),\n custom: z\n .object({\n type: z\n .object({\n id: z.string(),\n typeId: z.literal('type'),\n })\n .optional(),\n fields: z.record(z.string(), z.any()).optional(),\n })\n .optional()\n .describe('Custom fields'),\n});\n\nexport const updateInventoryParameters = z.object({\n id: z.string().optional().describe('The ID of the inventory entry to update'),\n key: z\n .string()\n .optional()\n .describe('The key of the inventory entry to update'),\n version: z\n .number()\n .int()\n .describe('The current version of the inventory entry'),\n actions: z\n .array(\n z\n .object({\n action: z.string().describe('The name of the update action'),\n })\n .and(z.record(z.string(), z.unknown()))\n )\n .describe('Update actions'),\n});\n\nexport const deleteInventoryParameters = z.object({\n id: z.string().optional().describe('Inventory Entry ID'),\n key: z.string().optional().describe('Inventory Entry key'),\n version: z.number().int().describe('Current version'),\n});\n","export const readInventoryPrompt = `\nThis tool will fetch an Inventory Entry by ID, key, or SKU from commercetools or query all available inventory entries in a commercetools project if no arguments or parameters are provided.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the inventory entry to fetch.\n- key (string, optional): The key of the inventory entry to fetch.\n- sku (string, optional): The SKU of the product variant to fetch inventory for.\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"sku = \\\\\"SKU-123\\\\\"\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"quantityOnStock desc\", \"createdAt asc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 10.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- expand (array of strings, optional): Fields to expand. Example: [\"supplyChannel\"]\n`;\n\nexport const createInventoryPrompt = `\nThis tool will create a new Inventory Entry in commercetools.\n\nIt takes these required arguments:\n- sku (string): SKU of the product variant.\n- quantityOnStock (integer): Quantity available in stock (must be >= 0).\n\nIt takes these optional arguments:\n- key (string, optional): User-defined unique identifier for the inventory entry.\n- supplyChannel (object, optional): Supply channel reference. Must have typeId \"channel\" and either id or key.\n- expectedDelivery (string, optional): Expected delivery date in ISO 8601 format (YYYY-MM-DDTHH:mm:ss.sssZ).\n- restockableInDays (integer, optional): Number of days until the item is restockable (must be >= 0).\n- custom (object, optional): Custom fields. Must include type with id and typeId \"type\", and optional fields object.\n`;\n\nexport const updateInventoryPrompt = `\nThis tool will update an Inventory Entry in commercetools using update actions from the commercetools API.\n\nIt takes these required arguments:\n- id (string): The ID of the inventory entry to update.\n- version (integer): The current version of the inventory entry.\n- actions (array): An array of update actions to perform on the inventory entry. Each action should have an \"action\" field indicating the action type.\n\nExample actions from commercetools API include:\n- addQuantity\n- changeQuantity\n- removeQuantity\n- setExpectedDelivery\n- setRestockableInDays\n- setSupplyChannel\n- setCustomField\n- setCustomType\n\nEach action type requires specific fields according to the commercetools API.\n`;\n\nexport const deleteInventoryPrompt = `\nThis tool will delete an Inventory Entry from commercetools.\n\nIt takes these required arguments:\n- id (string): The ID of the inventory entry to delete.\n- version (integer): The current version of the inventory entry (for optimistic locking).\n`;\n","import { z } from 'zod';\nimport {\n type InventoryEntry,\n type InventoryPagedQueryResponse,\n type InventoryEntryDraft,\n type InventoryEntryUpdateAction,\n type ByProjectKeyRequestBuilder,\n} from '@commercetools/platform-sdk';\nimport {\n readInventoryParameters,\n createInventoryParameters,\n updateInventoryParameters,\n deleteInventoryParameters,\n} from './inventory.schema';\nimport {\n readInventoryPrompt,\n createInventoryPrompt,\n updateInventoryPrompt,\n deleteInventoryPrompt,\n} from './inventory.prompt';\nimport {\n IApiClientFactory,\n ToolExecutionError,\n type ResourceMetadata,\n type ToolExecutionContext,\n type Configuration,\n} from '../../shared';\nimport { CommercetoolsResourceHandler } from '../../handlers/commercetools.handler';\nimport { TOOL_NAME_PREFIX } from '../../utils/constants';\n\n/**\n * Inventory Resource Handler\n * Generic over configuration type - defaults to CommercetoolsConfig\n */\nexport class InventoryHandler<\n TConfig extends Configuration = Configuration,\n> extends CommercetoolsResourceHandler<TConfig> {\n protected readonly metadata: ResourceMetadata = {\n namespace: 'inventory',\n description: 'Manage inventory entries in commercetools',\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readInventoryParameters,\n create: createInventoryParameters,\n update: updateInventoryParameters,\n delete: deleteInventoryParameters,\n },\n };\n\n constructor(apiClientFactory?: IApiClientFactory<TConfig>) {\n super(apiClientFactory);\n }\n\n override getToolDefinition(\n operation: 'read' | 'create' | 'update' | 'delete'\n ) {\n const prompts = {\n read: readInventoryPrompt,\n create: createInventoryPrompt,\n update: updateInventoryPrompt,\n delete: deleteInventoryPrompt,\n };\n\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation],\n };\n }\n\n protected getInventoryApi(api: ByProjectKeyRequestBuilder) {\n return api.inventory();\n }\n\n async read(\n context: ToolExecutionContext<TConfig>\n ): Promise<InventoryEntry | InventoryPagedQueryResponse> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n\n const params = context.parameters as z.infer<\n typeof readInventoryParameters\n >;\n\n try {\n if (params?.id) {\n const inventoryEntry = await this.getInventoryApi(api)\n .withId({ ID: params.id })\n .get({\n queryArgs: {\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n\n return inventoryEntry.body;\n } else if (params?.key) {\n const inventoryEntry = await this.getInventoryApi(api)\n .withKey({ key: params.key })\n .get({\n queryArgs: {\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n return inventoryEntry.body;\n } else if (params?.sku) {\n const inventoryEntries = await this.getInventoryApi(api)\n .get({\n queryArgs: {\n where: [`sku=\"${params.sku}\"`],\n limit: params.limit || 10,\n ...(params.offset && { offset: params.offset }),\n ...(params.sort && { sort: params.sort }),\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n return inventoryEntries.body;\n } else {\n const inventoryEntries = await this.getInventoryApi(api)\n .get({\n queryArgs: {\n limit: params.limit || 10,\n ...(params.offset && { offset: params.offset }),\n ...(params.sort && { sort: params.sort }),\n ...(params.where && { where: params.where }),\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n\n return inventoryEntries.body;\n }\n } catch (err: unknown) {\n throw new ToolExecutionError(\n (err as { message: string }).message ||\n 'Failed to read inventory entry',\n context,\n err\n );\n }\n }\n\n async create(\n context: ToolExecutionContext<TConfig>\n ): Promise<InventoryEntry> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<\n typeof createInventoryParameters\n >;\n\n try {\n const inventoryEntry = await this.getInventoryApi(api)\n .post({\n body: params as InventoryEntryDraft,\n })\n .execute();\n\n return inventoryEntry.body;\n } catch (error: unknown) {\n throw new ToolExecutionError(\n 'Failed to create inventory entry',\n context,\n error\n );\n }\n }\n\n async update(\n context: ToolExecutionContext<TConfig>\n ): Promise<InventoryEntry> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n\n const params = context.parameters as z.infer<\n typeof updateInventoryParameters\n >;\n\n try {\n let currentVersion: number;\n let inventoryEntryId: string;\n\n if (params.id) {\n const inventoryEntry = await this.getInventoryApi(api)\n .withId({ ID: params.id })\n .get()\n .execute();\n currentVersion = inventoryEntry.body.version;\n inventoryEntryId = params.id;\n } else if (params.key) {\n const inventoryEntry = await this.getInventoryApi(api)\n .withKey({ key: params.key })\n .get()\n .execute();\n currentVersion = inventoryEntry.body.version;\n inventoryEntryId = inventoryEntry.body.id;\n } else {\n throw new ToolExecutionError(\n 'Either id or key must be provided',\n context\n );\n }\n\n // Filter out any 'delete' actions\n const updateActions = (\n params.actions as InventoryEntryUpdateAction[]\n ).filter(\n (action: InventoryEntryUpdateAction) =>\n action.action !== 'removeQuantity'\n );\n\n const updatedInventoryEntry = await this.getInventoryApi(api)\n .withId({ ID: inventoryEntryId })\n .post({\n body: {\n version: currentVersion,\n actions: updateActions,\n },\n })\n .execute();\n\n return updatedInventoryEntry.body;\n } catch (error: unknown) {\n throw new ToolExecutionError(\n 'Failed to update inventory entry',\n context,\n error\n );\n }\n }\n\n async delete(\n context: ToolExecutionContext<TConfig>\n ): Promise<InventoryEntry> {\n // const api = this.getApiRoot(context).withProjectKey({\n // projectKey: context.configuration.projectKey,\n // });\n\n // const params = context.parameters as z.infer<typeof deleteInventoryParameters>;\n\n // try {\n // let inventoryEntryId: string;\n\n // if (params.id) {\n // inventoryEntryId = params.id;\n // } else if (params.key) {\n // const inventoryEntry = await this.getInventoryApi(api)\n // .withKey({ key: params.key })\n // .get()\n // .execute();\n // inventoryEntryId = inventoryEntry.body.id;\n // } else {\n // throw new ToolExecutionError(\n // 'Either id or key must be provided',\n // context\n // );\n // }\n\n // const deletedInventoryEntry = await this.getInventoryApi(api)\n // .withId({ ID: inventoryEntryId })\n // .delete({\n // queryArgs: {\n // version: params.version,\n // },\n // })\n // .execute();\n\n // return deletedInventoryEntry.body;\n // } catch (error: unknown) {\n // throw new ToolExecutionError('Failed to delete inventory entry', context, error);\n // }\n\n throw new ToolExecutionError('Not implemented', context);\n }\n}\n\n// Export individual functions for backward compatibility or direct usage\n// These functions wrap the handler methods and can be called directly\n\nexport async function readInventory<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<InventoryEntry | InventoryPagedQueryResponse> {\n const handler = new InventoryHandler<TConfig>(apiClientFactory);\n return handler.read(context);\n}\n\nexport async function createInventory<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<InventoryEntry> {\n const handler = new InventoryHandler<TConfig>(apiClientFactory);\n return handler.create(context);\n}\n\nexport async function updateInventory<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<InventoryEntry> {\n const handler = new InventoryHandler<TConfig>(apiClientFactory);\n return handler.update(context);\n}\n\nexport async function deleteInventory<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<InventoryEntry> {\n const handler = new InventoryHandler<TConfig>(apiClientFactory);\n return handler.delete(context);\n}\n","import { z } from 'zod';\n\nexport const readMessagesParameters = z.object({\n id: z.string().optional(),\n where: z.array(z.string()).optional(),\n sort: z.array(z.string()).optional(),\n limit: z.number().int().min(1).max(500).optional(),\n offset: z.number().int().optional(),\n expand: z.array(z.string()).optional(),\n});\n\n// Messages are generated by the platform; creating/updating/deleting messages via API is not supported\nexport const createMessagesParameters = z.object({});\nexport const updateMessagesParameters = z.object({});\nexport const deleteMessagesParameters = z.object({});\n","export const readMessagesPrompt = `\nRead Messages (change or event messages) generated by commercetools.\n\nOptional arguments:\n- id (string): fetch a single Message by ID\n- where (array[string]): query predicates\n- sort (array[string])\n- limit (int)\n- offset (int)\n- expand (array[string])\n\nNotes:\n- Messages are produced by the platform; they cannot be created/updated/deleted via the HTTP API.\n`;\n\nexport const createMessagesPrompt = `\nMessages are generated by commercetools and cannot be created via API.\n`;\n\nexport const updateMessagesPrompt = `\nMessages are read-only and cannot be updated via the API.\n`;\n\nexport const deleteMessagesPrompt = `\nMessages are read-only and cannot be deleted via the API.\n`;\n","import { z } from 'zod';\nimport {\n type Message,\n type MessagePagedQueryResponse,\n type ByProjectKeyRequestBuilder,\n} from '@commercetools/platform-sdk';\nimport {\n readMessagesParameters,\n createMessagesParameters,\n updateMessagesParameters,\n deleteMessagesParameters,\n} from './messages.schema';\nimport {\n readMessagesPrompt,\n createMessagesPrompt,\n updateMessagesPrompt,\n deleteMessagesPrompt,\n} from './messages.prompt';\nimport {\n IApiClientFactory,\n type ResourceMetadata,\n type ToolExecutionContext,\n ToolExecutionError,\n type Configuration,\n} from '../../shared';\nimport { CommercetoolsResourceHandler } from '../../handlers/commercetools.handler';\nimport { TOOL_NAME_PREFIX } from '../../utils/constants';\n\nexport class MessagesHandler<\n TConfig extends Configuration = Configuration,\n> extends CommercetoolsResourceHandler<TConfig> {\n protected readonly metadata: ResourceMetadata = {\n namespace: 'messages',\n description: 'Read messages generated by commercetools (change/messages)',\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readMessagesParameters,\n create: createMessagesParameters,\n update: updateMessagesParameters,\n delete: deleteMessagesParameters,\n },\n };\n\n constructor(apiClientFactory?: IApiClientFactory<TConfig>) {\n super(apiClientFactory);\n }\n\n override getToolDefinition(\n operation: 'read' | 'create' | 'update' | 'delete'\n ) {\n const prompts = {\n read: readMessagesPrompt,\n create: createMessagesPrompt,\n update: updateMessagesPrompt,\n delete: deleteMessagesPrompt,\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation],\n };\n }\n\n protected getMessagesApi(api: ByProjectKeyRequestBuilder) {\n return api.messages();\n }\n\n async read(\n context: ToolExecutionContext<TConfig>\n ): Promise<Message | MessagePagedQueryResponse> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<typeof readMessagesParameters>;\n try {\n if (params?.id) {\n const res = await this.getMessagesApi(api)\n .withId({ ID: params.id })\n .get()\n .execute();\n return res.body;\n } else {\n const res = await this.getMessagesApi(api)\n .get({\n queryArgs: {\n ...(params.limit && { limit: params.limit }),\n ...(params.offset && { offset: params.offset }),\n ...(params.sort && { sort: params.sort }),\n ...(params.where && { where: params.where }),\n },\n })\n .execute();\n return res.body;\n }\n } catch (err: unknown) {\n throw new ToolExecutionError('Failed to read messages', context, err);\n }\n }\n\n async create(_context: ToolExecutionContext<TConfig>): Promise<never> {\n throw new ToolExecutionError('Create not supported for messages', _context);\n }\n async update(_context: ToolExecutionContext<TConfig>): Promise<never> {\n throw new ToolExecutionError('Update not supported for messages', _context);\n }\n async delete(_context: ToolExecutionContext<TConfig>): Promise<never> {\n throw new ToolExecutionError('Delete not supported for messages', _context);\n }\n}\n\nexport async function readMessages<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Message | MessagePagedQueryResponse> {\n const handler = new MessagesHandler<TConfig>(apiClientFactory);\n return handler.read(context);\n}\n\nexport async function createMessages<TConfig extends Configuration>(\n _context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<never> {\n const handler = new MessagesHandler<TConfig>(apiClientFactory);\n return handler.create(_context);\n}\n\nexport async function updateMessages<TConfig extends Configuration>(\n _context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<never> {\n const handler = new MessagesHandler<TConfig>(apiClientFactory);\n return handler.update(_context);\n}\n\nexport async function deleteMessages<TConfig extends Configuration>(\n _context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<never> {\n const handler = new MessagesHandler<TConfig>(apiClientFactory);\n return handler.delete(_context);\n}\n","import { z } from 'zod';\n\nexport const readProductDiscountsParameters = z.object({\n id: z.string().optional().describe('Product Discount ID'),\n key: z.string().optional().describe('Product Discount key'),\n where: z\n .array(z.string())\n .optional()\n .describe(\n 'Query predicates specified as strings. Example: [\"key = \\\\\"summer-sale\\\\\"\"]'\n ),\n sort: z\n .array(z.string())\n .optional()\n .describe(\n 'Sort criteria for the results. Example: [\"key asc\", \"createdAt desc\"]'\n ),\n limit: z\n .number()\n .int()\n .min(1)\n .max(500)\n .optional()\n .describe(\n 'A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.'\n ),\n offset: z\n .number()\n .int()\n .min(0)\n .optional()\n .describe(\n 'The number of items to skip before starting to collect the result set.'\n ),\n expand: z\n .array(z.string())\n .optional()\n .describe('Fields to expand. Example: []'),\n});\n\nexport const createProductDiscountsParameters = z.object({\n key: z\n .string()\n .min(2)\n .max(256)\n .optional()\n .describe('User-defined unique identifier for the product discount'),\n name: z\n .record(z.string())\n .describe('Product Discount name (localized string)'),\n description: z\n .record(z.string())\n .optional()\n .describe('Product Discount description (localized string)'),\n value: z.any().describe('Value of the product discount'),\n predicate: z.string().describe('Valid ProductDiscount predicate'),\n sortOrder: z.string().describe('String value used to order ProductDiscounts'),\n isActive: z\n .boolean()\n .optional()\n .describe('Whether the product discount is active (defaults to true)'),\n validFrom: z\n .string()\n .optional()\n .describe('Date/time when the discount becomes valid (ISO 8601 format)'),\n validUntil: z\n .string()\n .optional()\n .describe('Date/time when the discount expires (ISO 8601 format)'),\n references: z\n .array(z.any())\n .optional()\n .describe('References to other resources'),\n});\n\nexport const updateProductDiscountsParameters = z.object({\n id: z\n .string()\n .optional()\n .describe('The ID of the product discount to update'),\n key: z\n .string()\n .optional()\n .describe('The key of the product discount to update'),\n version: z\n .number()\n .int()\n .describe('The current version of the product discount'),\n actions: z\n .array(\n z\n .object({\n action: z\n .string()\n .describe('The name of the update action to perform'),\n })\n .and(z.record(z.string(), z.any()).optional())\n .describe(\n 'Array of update actions to perform on the product discount. Each action should have an \"action\" field and other fields specific to that action type.'\n )\n )\n .describe('Update actions'),\n});\n\nexport const deleteProductDiscountsParameters = z.object({\n id: z.string().optional().describe('Product Discount ID'),\n key: z.string().optional().describe('Product Discount key'),\n version: z\n .number()\n .int()\n .describe('Current version (for optimistic locking)'),\n});\n","export const readProductDiscountsPrompt = `\nThis tool will fetch a Product Discount by ID or key (if provided) from commercetools or query all available product discounts in a commercetools project if no arguments or parameters are provided.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the product discount to fetch.\n- key (string, optional): The key of the product discount to fetch.\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"key = \\\\\"summer-sale\\\\\"\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"key asc\", \"createdAt desc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- expand (array of strings, optional): Fields to expand.\n`;\n\nexport const createProductDiscountsPrompt = `\nThis tool will create a new Product Discount in commercetools.\n\nIt takes these required arguments:\n- name (object): Product Discount name (localized string, object with language codes as keys). Example: {\"en\": \"Summer Sale\", \"de\": \"Sommerverkauf\"}\n- value (object): Value of the product discount (can be absolute, relative, or external).\n- predicate (string): Valid ProductDiscount predicate. Example: \"1=1\" or \"variants.attributes.color = \\\\\"red\\\\\"\"\n- sortOrder (string): String value used to order ProductDiscounts.\n\nIt takes these optional arguments:\n- key (string, optional): User-defined unique identifier for the product discount (2-256 characters, alphanumeric with underscores/hyphens).\n- description (object, optional): Product Discount description (localized string, object with language codes as keys).\n- isActive (boolean, optional): Whether the product discount is active (defaults to true).\n- validFrom (string, optional): Date/time when the discount becomes valid (ISO 8601 format).\n- validUntil (string, optional): Date/time when the discount expires (ISO 8601 format).\n- references (array, optional): References to other resources.\n`;\n\nexport const updateProductDiscountsPrompt = `\nThis tool will update a Product Discount in commercetools using update actions from the commercetools API.\n\nIt takes these required arguments:\n- version (integer): The current version of the product discount.\n- actions (array): An array of update actions to perform on the product discount. Each action should have an \"action\" field indicating the action type.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the product discount to update (required if key is not provided).\n- key (string, optional): The key of the product discount to update (required if id is not provided).\n\nExample actions from commercetools API include:\n- changeIsActive\n- changeName\n- changePredicate\n- changeSortOrder\n- changeValue\n- setDescription\n- setKey\n- setValidFrom\n- setValidUntil\n\nEach action type requires specific fields according to the commercetools API.\n`;\n\nexport const deleteProductDiscountsPrompt = `\nThis tool will delete a Product Discount from commercetools.\n\nIt takes these required arguments:\n- version (integer): The current version of the product discount (for optimistic locking).\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the product discount to delete (required if key is not provided).\n- key (string, optional): The key of the product discount to delete (required if id is not provided).\n`;\n","import { z } from 'zod';\nimport {\n type ProductDiscount,\n type ProductDiscountPagedQueryResponse,\n type ProductDiscountDraft,\n type ProductDiscountUpdateAction,\n type ByProjectKeyRequestBuilder,\n} from '@commercetools/platform-sdk';\nimport {\n readProductDiscountsParameters,\n createProductDiscountsParameters,\n updateProductDiscountsParameters,\n deleteProductDiscountsParameters,\n} from './product-discounts.schema';\nimport {\n readProductDiscountsPrompt,\n createProductDiscountsPrompt,\n updateProductDiscountsPrompt,\n deleteProductDiscountsPrompt,\n} from './product-discounts.prompt';\nimport {\n IApiClientFactory,\n type ResourceMetadata,\n type ToolExecutionContext,\n ToolExecutionError,\n type Configuration,\n} from '../../shared';\nimport { CommercetoolsResourceHandler } from '../../handlers/commercetools.handler';\nimport { TOOL_NAME_PREFIX } from '../../utils/constants';\n\n/**\n * Product Discounts Resource Handler\n * Generic over configuration type - defaults to CommercetoolsConfig\n */\nexport class ProductDiscountsHandler<\n TConfig extends Configuration = Configuration,\n> extends CommercetoolsResourceHandler<TConfig> {\n protected readonly metadata: ResourceMetadata = {\n namespace: 'product-discounts',\n description: 'Manage product discounts in commercetools',\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readProductDiscountsParameters,\n create: createProductDiscountsParameters,\n update: updateProductDiscountsParameters,\n delete: deleteProductDiscountsParameters,\n },\n };\n\n constructor(apiClientFactory?: IApiClientFactory<TConfig>) {\n super(apiClientFactory);\n }\n\n override getToolDefinition(\n operation: 'read' | 'create' | 'update' | 'delete'\n ) {\n const prompts = {\n read: readProductDiscountsPrompt,\n create: createProductDiscountsPrompt,\n update: updateProductDiscountsPrompt,\n delete: deleteProductDiscountsPrompt,\n };\n\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation],\n };\n }\n\n protected getProductDiscountsApi(api: ByProjectKeyRequestBuilder) {\n return api.productDiscounts();\n }\n\n async read(\n context: ToolExecutionContext<TConfig>\n ): Promise<ProductDiscount | ProductDiscountPagedQueryResponse> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n\n const params = context.parameters as z.infer<\n typeof readProductDiscountsParameters\n >;\n\n try {\n if (params?.id) {\n const productDiscount = await this.getProductDiscountsApi(api)\n .withId({ ID: params.id })\n .get({\n queryArgs: {\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n\n return productDiscount.body;\n } else if (params?.key) {\n const productDiscount = await this.getProductDiscountsApi(api)\n .withKey({ key: params.key })\n .get({\n queryArgs: {\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n return productDiscount.body;\n } else {\n const productDiscounts = await this.getProductDiscountsApi(api)\n .get({\n queryArgs: {\n limit: params.limit || 20,\n ...(params.offset && { offset: params.offset }),\n ...(params.sort && { sort: params.sort }),\n ...(params.where && { where: params.where }),\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n\n return productDiscounts.body;\n }\n } catch (err: unknown) {\n throw new ToolExecutionError(\n (err as { message: string }).message ||\n 'Failed to read product discounts',\n context,\n err\n );\n }\n }\n\n async create(\n context: ToolExecutionContext<TConfig>\n ): Promise<ProductDiscount> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<\n typeof createProductDiscountsParameters\n >;\n\n try {\n const productDiscount = await this.getProductDiscountsApi(api)\n .post({\n body: params as ProductDiscountDraft,\n })\n .execute();\n\n return productDiscount.body;\n } catch (error: unknown) {\n throw new ToolExecutionError(\n 'Failed to create product discount',\n context,\n error\n );\n }\n }\n\n async update(\n context: ToolExecutionContext<TConfig>\n ): Promise<ProductDiscount> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n\n const params = context.parameters as z.infer<\n typeof updateProductDiscountsParameters\n >;\n\n try {\n let currentVersion: number;\n let productDiscountId: string;\n\n if (params.id) {\n const productDiscount = await this.getProductDiscountsApi(api)\n .withId({ ID: params.id })\n .get()\n .execute();\n currentVersion = productDiscount.body.version;\n productDiscountId = params.id;\n } else if (params.key) {\n const productDiscount = await this.getProductDiscountsApi(api)\n .withKey({ key: params.key })\n .get()\n .execute();\n currentVersion = productDiscount.body.version;\n productDiscountId = productDiscount.body.id;\n } else {\n throw new ToolExecutionError(\n 'Either id or key must be provided',\n context\n );\n }\n\n const updatedProductDiscount = await this.getProductDiscountsApi(api)\n .withId({ ID: productDiscountId })\n .post({\n body: {\n version: currentVersion,\n actions: params.actions as ProductDiscountUpdateAction[],\n },\n })\n .execute();\n\n return updatedProductDiscount.body;\n } catch (error: unknown) {\n throw new ToolExecutionError(\n 'Failed to update product discount',\n context,\n error\n );\n }\n }\n\n async delete(\n context: ToolExecutionContext<TConfig>\n ): Promise<ProductDiscount> {\n // const api = this.getApiRoot(context).withProjectKey({\n // projectKey: context.configuration.projectKey,\n // });\n\n // const params = context.parameters as z.infer<\n // typeof deleteProductDiscountsParameters\n // >;\n\n // try {\n // let productDiscountId: string;\n\n // if (params.id) {\n // productDiscountId = params.id;\n // } else if (params.key) {\n // const productDiscount = await this.getProductDiscountsApi(api)\n // .withKey({ key: params.key })\n // .get()\n // .execute();\n // productDiscountId = productDiscount.body.id;\n // } else {\n // throw new ToolExecutionError(\n // 'Either id or key must be provided',\n // context\n // );\n // }\n\n // const deletedProductDiscount = await this.getProductDiscountsApi(api)\n // .withId({ ID: productDiscountId })\n // .delete({\n // queryArgs: {\n // version: params.version,\n // },\n // })\n // .execute();\n\n // return deletedProductDiscount.body;\n // } catch (error: unknown) {\n // throw new ToolExecutionError(\n // 'Failed to delete product discount',\n // context,\n // error\n // );\n // }\n\n throw new ToolExecutionError('Not implemented', context);\n }\n}\n\n// Export individual functions for backward compatibility or direct usage\n// These functions wrap the handler methods and can be called directly\n\nexport async function readProductDiscounts<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<ProductDiscount | ProductDiscountPagedQueryResponse> {\n const handler = new ProductDiscountsHandler<TConfig>(apiClientFactory);\n return handler.read(context);\n}\n\nexport async function createProductDiscounts<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<ProductDiscount> {\n const handler = new ProductDiscountsHandler<TConfig>(apiClientFactory);\n return handler.create(context);\n}\n\nexport async function updateProductDiscounts<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<ProductDiscount> {\n const handler = new ProductDiscountsHandler<TConfig>(apiClientFactory);\n return handler.update(context);\n}\n\nexport async function deleteProductDiscounts<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<ProductDiscount> {\n const handler = new ProductDiscountsHandler<TConfig>(apiClientFactory);\n return handler.delete(context);\n}\n","import { z } from 'zod';\n\nexport const readProductProjectionsParameters = z.object({\n id: z.string().optional(),\n key: z.string().optional(),\n where: z.array(z.string()).optional(),\n sort: z.array(z.string()).optional(),\n limit: z.number().int().min(1).max(500).optional(),\n offset: z.number().int().optional(),\n expand: z.array(z.string()).optional(),\n fuzzy: z.boolean().optional(),\n});\n\n// create/update/delete are not supported for product projections in this handler\nexport const createProductProjectionsParameters = z.object({});\nexport const updateProductProjectionsParameters = z.object({});\nexport const deleteProductProjectionsParameters = z.object({});\n","export const readProductProjectionsPrompt = `\nThis tool reads Product Projections (published product data / search results) from commercetools.\n\nUsage patterns:\n- Read a single product projection by \\`id\\` or \\`key\\`.\n- Search product projections using search parameters (full-text, filters), or perform a paged query.\n\nIt accepts these optional arguments:\n- id (string, optional): Fetch a single Product Projection by its ID.\n- key (string, optional): Fetch a single Product Projection by its key.\n- text (string, optional): Full-text search query (search across searchable attributes).\n- fuzzy (boolean, optional): If true, allow fuzzy matching for text searches.\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"categories(id=\\\\\"123\\\\\")\", \"masterVariant(sku=\\\\\"SKU-1\\\\\")\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"name.en asc\", \"createdAt desc\"]\n- limit (integer, optional): Number of results to return (1-500). Default depends on API.\n- offset (integer, optional): Number of items to skip before collecting results.\n- expand (array of strings, optional): Fields to expand (e.g., [\"categories\", \"masterVariant\"]).\n\nNotes:\n- If \\`id\\` or \\`key\\` is provided the tool will return a single Product Projection object.\n- If no identifier is provided the tool will perform a search/query and return a paged search response.\n`;\n\nexport const createProductProjectionsPrompt = `\nProduct Projections are read-only representations derived from Products; creating a Product Projection directly is not supported.\n\nIf you need to create product data, use the Product creation APIs (products.create) which will result in product projections becoming available once published.\n`;\n\nexport const updateProductProjectionsPrompt = `\nProduct Projections are derived (read-only) and cannot be updated directly.\n\nTo change product projection data, update the underlying Product resource using the products.update tool (apply update actions to the Product), then publish as needed so projections reflect the changes.\n`;\n\nexport const deleteProductProjectionsPrompt = `\nProduct Projections cannot be deleted directly because they are projections of Product resources.\n\nTo remove a projection, delete the underlying Product resource (products.delete) or unpublish it according to your commercetools workflow.\n`;\n","import { z } from 'zod';\nimport {\n type ProductProjection,\n type ProductProjectionPagedSearchResponse,\n type ByProjectKeyRequestBuilder,\n ProductSearchRequest,\n} from '@commercetools/platform-sdk';\nimport {\n readProductProjectionsParameters,\n createProductProjectionsParameters,\n updateProductProjectionsParameters,\n deleteProductProjectionsParameters,\n} from './product-projections.schema';\nimport {\n readProductProjectionsPrompt,\n createProductProjectionsPrompt,\n updateProductProjectionsPrompt,\n deleteProductProjectionsPrompt,\n} from './product-projections.prompt';\nimport {\n IApiClientFactory,\n type ResourceMetadata,\n type ToolExecutionContext,\n ToolExecutionError,\n type Configuration,\n} from '../../shared';\nimport { CommercetoolsResourceHandler } from '../../handlers/commercetools.handler';\nimport { TOOL_NAME_PREFIX } from '../../utils/constants';\n\nexport class ProductProjectionsHandler<\n TConfig extends Configuration = Configuration,\n> extends CommercetoolsResourceHandler<TConfig> {\n protected readonly metadata: ResourceMetadata = {\n namespace: 'product-projections',\n description: 'Read product projections (search/projections)',\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readProductProjectionsParameters,\n create: createProductProjectionsParameters,\n update: updateProductProjectionsParameters,\n delete: deleteProductProjectionsParameters,\n },\n };\n\n constructor(apiClientFactory?: IApiClientFactory<TConfig>) {\n super(apiClientFactory);\n }\n\n override getToolDefinition(\n operation: 'read' | 'create' | 'update' | 'delete'\n ) {\n const prompts = {\n read: readProductProjectionsPrompt,\n create: createProductProjectionsPrompt,\n update: updateProductProjectionsPrompt,\n delete: deleteProductProjectionsPrompt,\n };\n\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation],\n };\n }\n\n protected getProductProjectionsApi(api: ByProjectKeyRequestBuilder) {\n // use product projections endpoint for projections\n // productProjections() exists on the SDK request builder\n // return as any to avoid strict SDK shape differences\n return api.productProjections();\n }\n\n async read(\n context: ToolExecutionContext<TConfig>\n ): Promise<ProductProjection | ProductProjectionPagedSearchResponse> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<\n typeof readProductProjectionsParameters\n >;\n try {\n if (params?.id) {\n const res = await this.getProductProjectionsApi(api)\n .withId({ ID: params.id })\n .get()\n .execute();\n return res.body;\n } else if (params?.key) {\n const res = await this.getProductProjectionsApi(api)\n .withKey({ key: params.key })\n .get()\n .execute();\n return res.body;\n } else {\n // Use productProjections().search() endpoint and cast result\n const search = await this.getProductProjectionsApi(api)\n .search()\n .post({ body: params as string })\n .execute();\n return search.body;\n }\n } catch (err: unknown) {\n throw new ToolExecutionError(\n 'Failed to read product projections',\n context,\n err\n );\n }\n }\n\n async create(_context: ToolExecutionContext<TConfig>): Promise<never> {\n throw new ToolExecutionError(\n 'Create not supported for product-projections',\n _context\n );\n }\n\n async update(_context: ToolExecutionContext<TConfig>): Promise<never> {\n throw new ToolExecutionError(\n 'Update not supported for product-projections',\n _context\n );\n }\n\n async delete(_context: ToolExecutionContext<TConfig>): Promise<never> {\n throw new ToolExecutionError(\n 'Delete not supported for product-projections',\n _context\n );\n }\n}\n\nexport async function readProductProjections<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<ProductProjection | ProductProjectionPagedSearchResponse> {\n const handler = new ProductProjectionsHandler<TConfig>(apiClientFactory);\n return handler.read(context);\n}\n\nexport async function createProductProjections<TConfig extends Configuration>(\n _context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<never> {\n const handler = new ProductProjectionsHandler<TConfig>(apiClientFactory);\n return handler.create(_context);\n}\n\nexport async function updateProductProjections<TConfig extends Configuration>(\n _context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<never> {\n const handler = new ProductProjectionsHandler<TConfig>(apiClientFactory);\n return handler.update(_context);\n}\n\nexport async function deleteProductProjections<TConfig extends Configuration>(\n _context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<never> {\n const handler = new ProductProjectionsHandler<TConfig>(apiClientFactory);\n return handler.delete(_context);\n}\n","import { z } from 'zod';\n\nexport const readProductSearchParameters = z.object({\n query: z\n .string()\n .optional()\n .describe('Search query in the search query language'),\n filter: z.array(z.string()).optional().describe('Filter expressions'),\n facet: z.array(z.string()).optional().describe('Facet expressions'),\n sort: z\n .array(z.string())\n .optional()\n .describe('Sort criteria for the results'),\n limit: z\n .number()\n .int()\n .min(1)\n .max(500)\n .optional()\n .describe(\n 'A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.'\n ),\n offset: z\n .number()\n .int()\n .min(0)\n .optional()\n .describe(\n 'The number of items to skip before starting to collect the result set.'\n ),\n markMatchingVariants: z\n .boolean()\n .optional()\n .describe('Whether to mark matching variants'),\n priceCurrency: z\n .string()\n .optional()\n .describe('Currency code for price selection'),\n priceCountry: z\n .string()\n .optional()\n .describe('Country code for price selection'),\n priceCustomerGroup: z\n .string()\n .optional()\n .describe('Customer group ID for price selection'),\n priceChannel: z\n .string()\n .optional()\n .describe('Channel ID for price selection'),\n localeProjection: z.string().optional().describe('Locale for projection'),\n storeProjection: z.string().optional().describe('Store key for projection'),\n expand: z.array(z.string()).optional().describe('Fields to expand'),\n});\n\nexport const createProductSearchParameters = z\n .object({})\n .describe('Product Search does not support create operations');\n\nexport const updateProductSearchParameters = z\n .object({})\n .describe('Product Search does not support update operations');\n\nexport const deleteProductSearchParameters = z\n .object({})\n .describe('Product Search does not support delete operations');\n","export const readProductSearchPrompt = `\nThis tool will search for products in commercetools using the Product Search API.\n\nIt takes these optional arguments:\n- query (string, optional): Search query in the search query language. Example: \"red shoes\" or \"name.en:shoes AND variants.attributes.color:red\"\n- filter (array of strings, optional): Filter expressions. Example: [\"variants.price.centAmount:range(1000 to 5000)\"]\n- facet (array of strings, optional): Facet expressions for faceted search.\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"name.en asc\", \"variants.price.centAmount desc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- markMatchingVariants (boolean, optional): Whether to mark matching variants in the response.\n- priceCurrency (string, optional): Currency code for price selection.\n- priceCountry (string, optional): Country code for price selection.\n- priceCustomerGroup (string, optional): Customer group ID for price selection.\n- priceChannel (string, optional): Channel ID for price selection.\n- localeProjection (string, optional): Locale for projection.\n- storeProjection (string, optional): Store key for projection.\n- expand (array of strings, optional): Fields to expand.\n`;\n\nexport const createProductSearchPrompt = `\nProduct Search does not support create operations. This is a read-only search API.\n`;\n\nexport const updateProductSearchPrompt = `\nProduct Search does not support update operations. This is a read-only search API.\n`;\n\nexport const deleteProductSearchPrompt = `\nProduct Search does not support delete operations. This is a read-only search API.\n`;\n","import { z } from 'zod';\nimport {\n type ProductPagedSearchResponse,\n type ByProjectKeyRequestBuilder,\n type ProductSearchRequest,\n} from '@commercetools/platform-sdk';\nimport {\n readProductSearchParameters,\n createProductSearchParameters,\n updateProductSearchParameters,\n deleteProductSearchParameters,\n} from './product-search.schema';\nimport {\n readProductSearchPrompt,\n createProductSearchPrompt,\n updateProductSearchPrompt,\n deleteProductSearchPrompt,\n} from './product-search.prompt';\nimport {\n IApiClientFactory,\n type ResourceMetadata,\n type ToolExecutionContext,\n ToolExecutionError,\n type Configuration,\n} from '../../shared';\nimport { CommercetoolsResourceHandler } from '../../handlers/commercetools.handler';\nimport { TOOL_NAME_PREFIX } from '../../utils/constants';\n\n/**\n * Product Search Resource Handler\n * Generic over configuration type - defaults to CommercetoolsConfig\n */\nexport class ProductSearchHandler<\n TConfig extends Configuration = Configuration,\n> extends CommercetoolsResourceHandler<TConfig> {\n protected readonly metadata: ResourceMetadata = {\n namespace: 'product-search',\n description: 'Search products in commercetools',\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readProductSearchParameters,\n create: createProductSearchParameters,\n update: updateProductSearchParameters,\n delete: deleteProductSearchParameters,\n },\n };\n\n constructor(apiClientFactory?: IApiClientFactory<TConfig>) {\n super(apiClientFactory);\n }\n\n override getToolDefinition(\n operation: 'read' | 'create' | 'update' | 'delete'\n ) {\n const prompts = {\n read: readProductSearchPrompt,\n create: createProductSearchPrompt,\n update: updateProductSearchPrompt,\n delete: deleteProductSearchPrompt,\n };\n\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation],\n };\n }\n\n protected getProductSearchApi(api: ByProjectKeyRequestBuilder) {\n return api.products().search();\n }\n\n async read(\n context: ToolExecutionContext<TConfig>\n ): Promise<ProductPagedSearchResponse> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n\n const params = context.parameters as z.infer<\n typeof readProductSearchParameters\n >;\n\n try {\n const searchResponse = await this.getProductSearchApi(api)\n .post({\n body: params as unknown as ProductSearchRequest,\n })\n .execute();\n\n return searchResponse.body;\n } catch (err: unknown) {\n throw new ToolExecutionError(\n (err as { message: string }).message || 'Failed to search products',\n context,\n err\n );\n }\n }\n\n async create(context: ToolExecutionContext<TConfig>): Promise<never> {\n throw new ToolExecutionError(\n 'Create operation not supported for product-search',\n context\n );\n }\n\n async update(context: ToolExecutionContext<TConfig>): Promise<never> {\n throw new ToolExecutionError(\n 'Update operation not supported for product-search',\n context\n );\n }\n\n async delete(context: ToolExecutionContext<TConfig>): Promise<never> {\n throw new ToolExecutionError(\n 'Delete operation not supported for product-search',\n context\n );\n }\n}\n\n// Export individual functions for backward compatibility or direct usage\n// These functions wrap the handler methods and can be called directly\n\nexport async function readProductSearch<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<ProductPagedSearchResponse> {\n const handler = new ProductSearchHandler<TConfig>(apiClientFactory);\n return handler.read(context);\n}\n\nexport async function createProductSearch<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<never> {\n const handler = new ProductSearchHandler<TConfig>(apiClientFactory);\n return handler.create(context);\n}\n\nexport async function updateProductSearch<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<never> {\n const handler = new ProductSearchHandler<TConfig>(apiClientFactory);\n return handler.update(context);\n}\n\nexport async function deleteProductSearch<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<never> {\n const handler = new ProductSearchHandler<TConfig>(apiClientFactory);\n return handler.delete(context);\n}\n","import { z } from 'zod';\n\nexport const readProductSelectionsParameters = z.object({\n id: z.string().optional().describe('Product Selection ID'),\n key: z.string().optional().describe('Product Selection key'),\n where: z\n .array(z.string())\n .optional()\n .describe(\n 'Query predicates specified as strings. Example: [\"key = \\\\\"my-selection\\\\\"\"]'\n ),\n sort: z\n .array(z.string())\n .optional()\n .describe(\n 'Sort criteria for the results. Example: [\"key asc\", \"createdAt desc\"]'\n ),\n limit: z\n .number()\n .int()\n .min(1)\n .max(500)\n .optional()\n .describe(\n 'A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.'\n ),\n offset: z\n .number()\n .int()\n .min(0)\n .optional()\n .describe(\n 'The number of items to skip before starting to collect the result set.'\n ),\n expand: z\n .array(z.string())\n .optional()\n .describe('Fields to expand. Example: []'),\n});\n\nexport const createProductSelectionsParameters = z.object({\n key: z\n .string()\n .min(2)\n .max(256)\n .optional()\n .describe('User-defined unique identifier for the product selection'),\n name: z\n .record(z.string())\n .describe('Product Selection name (localized string)'),\n mode: z\n .enum(['Individual', 'IndividualExclusion'])\n .optional()\n .describe(\n 'Selection mode: Individual (explicitly includes) or IndividualExclusion (explicitly excludes)'\n ),\n custom: z\n .object({\n type: z\n .object({\n id: z.string(),\n typeId: z.literal('type'),\n })\n .optional(),\n fields: z.record(z.string(), z.any()).optional(),\n })\n .optional()\n .describe('Custom fields for the product selection'),\n});\n\nexport const updateProductSelectionsParameters = z.object({\n id: z\n .string()\n .optional()\n .describe('The ID of the product selection to update'),\n key: z\n .string()\n .optional()\n .describe('The key of the product selection to update'),\n version: z\n .number()\n .int()\n .describe('The current version of the product selection'),\n actions: z\n .array(\n z\n .object({\n action: z\n .string()\n .describe('The name of the update action to perform'),\n })\n .and(z.record(z.string(), z.any()).optional())\n .describe(\n 'Array of update actions to perform on the product selection. Each action should have an \"action\" field and other fields specific to that action type.'\n )\n )\n .describe('Update actions'),\n});\n\nexport const deleteProductSelectionsParameters = z.object({\n id: z.string().optional().describe('Product Selection ID'),\n key: z.string().optional().describe('Product Selection key'),\n version: z\n .number()\n .int()\n .describe('Current version (for optimistic locking)'),\n});\n","export const readProductSelectionsPrompt = `\nThis tool will fetch a Product Selection by ID or key (if provided) from commercetools or query all available product selections in a commercetools project if no arguments or parameters are provided.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the product selection to fetch.\n- key (string, optional): The key of the product selection to fetch.\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"key = \\\\\"my-selection\\\\\"\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"key asc\", \"createdAt desc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- expand (array of strings, optional): Fields to expand.\n`;\n\nexport const createProductSelectionsPrompt = `\nThis tool will create a new Product Selection in commercetools.\n\nIt takes these required arguments:\n- name (object): Product Selection name (localized string, object with language codes as keys). Example: {\"en\": \"Summer Collection\", \"de\": \"Sommerkollektion\"}\n\nIt takes these optional arguments:\n- key (string, optional): User-defined unique identifier for the product selection (2-256 characters, alphanumeric with underscores/hyphens).\n- mode (string, optional): Selection mode. Must be \"Individual\" (explicitly includes selected products) or \"IndividualExclusion\" (explicitly excludes selected products). Defaults to \"Individual\".\n- custom (object, optional): Custom fields for the product selection.\n`;\n\nexport const updateProductSelectionsPrompt = `\nThis tool will update a Product Selection in commercetools using update actions from the commercetools API.\n\nIt takes these required arguments:\n- version (integer): The current version of the product selection.\n- actions (array): An array of update actions to perform on the product selection. Each action should have an \"action\" field indicating the action type.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the product selection to update (required if key is not provided).\n- key (string, optional): The key of the product selection to update (required if id is not provided).\n\nExample actions from commercetools API include:\n- addProduct\n- changeName\n- removeProduct\n- setCustomField\n- setCustomType\n- setKey\n\nEach action type requires specific fields according to the commercetools API.\n`;\n\nexport const deleteProductSelectionsPrompt = `\nThis tool will delete a Product Selection from commercetools.\n\nIt takes these required arguments:\n- version (integer): The current version of the product selection (for optimistic locking).\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the product selection to delete (required if key is not provided).\n- key (string, optional): The key of the product selection to delete (required if id is not provided).\n`;\n","import { z } from 'zod';\nimport {\n type ProductSelection,\n type ProductSelectionPagedQueryResponse,\n type ProductSelectionDraft,\n type ProductSelectionUpdateAction,\n type ByProjectKeyRequestBuilder,\n} from '@commercetools/platform-sdk';\nimport {\n readProductSelectionsParameters,\n createProductSelectionsParameters,\n updateProductSelectionsParameters,\n deleteProductSelectionsParameters,\n} from './product-selections.schema';\nimport {\n readProductSelectionsPrompt,\n createProductSelectionsPrompt,\n updateProductSelectionsPrompt,\n deleteProductSelectionsPrompt,\n} from './product-selections.prompt';\nimport {\n IApiClientFactory,\n type ResourceMetadata,\n type ToolExecutionContext,\n ToolExecutionError,\n type Configuration,\n} from '../../shared';\nimport { CommercetoolsResourceHandler } from '../../handlers/commercetools.handler';\nimport { TOOL_NAME_PREFIX } from '../../utils/constants';\n\n/**\n * Product Selections Resource Handler\n * Generic over configuration type - defaults to CommercetoolsConfig\n */\nexport class ProductSelectionsHandler<\n TConfig extends Configuration = Configuration,\n> extends CommercetoolsResourceHandler<TConfig> {\n protected readonly metadata: ResourceMetadata = {\n namespace: 'product-selections',\n description: 'Manage product selections in commercetools',\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readProductSelectionsParameters,\n create: createProductSelectionsParameters,\n update: updateProductSelectionsParameters,\n delete: deleteProductSelectionsParameters,\n },\n };\n\n constructor(apiClientFactory?: IApiClientFactory<TConfig>) {\n super(apiClientFactory);\n }\n\n override getToolDefinition(\n operation: 'read' | 'create' | 'update' | 'delete'\n ) {\n const prompts = {\n read: readProductSelectionsPrompt,\n create: createProductSelectionsPrompt,\n update: updateProductSelectionsPrompt,\n delete: deleteProductSelectionsPrompt,\n };\n\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation],\n };\n }\n\n protected getProductSelectionsApi(api: ByProjectKeyRequestBuilder) {\n return api.productSelections();\n }\n\n async read(\n context: ToolExecutionContext<TConfig>\n ): Promise<ProductSelection | ProductSelectionPagedQueryResponse> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n\n const params = context.parameters as z.infer<\n typeof readProductSelectionsParameters\n >;\n\n try {\n if (params?.id) {\n const productSelection = await this.getProductSelectionsApi(api)\n .withId({ ID: params.id })\n .get({\n queryArgs: {\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n\n return productSelection.body;\n } else if (params?.key) {\n const productSelection = await this.getProductSelectionsApi(api)\n .withKey({ key: params.key })\n .get({\n queryArgs: {\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n return productSelection.body;\n } else {\n const productSelections = await this.getProductSelectionsApi(api)\n .get({\n queryArgs: {\n limit: params.limit || 20,\n ...(params.offset && { offset: params.offset }),\n ...(params.sort && { sort: params.sort }),\n ...(params.where && { where: params.where }),\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n\n return productSelections.body;\n }\n } catch (err: unknown) {\n throw new ToolExecutionError(\n (err as { message: string }).message ||\n 'Failed to read product selections',\n context,\n err\n );\n }\n }\n\n async create(\n context: ToolExecutionContext<TConfig>\n ): Promise<ProductSelection> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<\n typeof createProductSelectionsParameters\n >;\n\n try {\n const productSelection = await this.getProductSelectionsApi(api)\n .post({\n body: params as ProductSelectionDraft,\n })\n .execute();\n\n return productSelection.body;\n } catch (error: unknown) {\n throw new ToolExecutionError(\n 'Failed to create product selection',\n context,\n error\n );\n }\n }\n\n async update(\n context: ToolExecutionContext<TConfig>\n ): Promise<ProductSelection> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n\n const params = context.parameters as z.infer<\n typeof updateProductSelectionsParameters\n >;\n\n try {\n let currentVersion: number;\n let productSelectionId: string;\n\n if (params.id) {\n const productSelection = await this.getProductSelectionsApi(api)\n .withId({ ID: params.id })\n .get()\n .execute();\n currentVersion = productSelection.body.version;\n productSelectionId = params.id;\n } else if (params.key) {\n const productSelection = await this.getProductSelectionsApi(api)\n .withKey({ key: params.key })\n .get()\n .execute();\n currentVersion = productSelection.body.version;\n productSelectionId = productSelection.body.id;\n } else {\n throw new ToolExecutionError(\n 'Either id or key must be provided',\n context\n );\n }\n\n const updatedProductSelection = await this.getProductSelectionsApi(api)\n .withId({ ID: productSelectionId })\n .post({\n body: {\n version: currentVersion,\n actions: params.actions as ProductSelectionUpdateAction[],\n },\n })\n .execute();\n\n return updatedProductSelection.body;\n } catch (error: unknown) {\n throw new ToolExecutionError(\n 'Failed to update product selection',\n context,\n error\n );\n }\n }\n\n async delete(\n context: ToolExecutionContext<TConfig>\n ): Promise<ProductSelection> {\n // const api = this.getApiRoot(context).withProjectKey({\n // projectKey: context.configuration.projectKey,\n // });\n\n // const params = context.parameters as z.infer<\n // typeof deleteProductSelectionsParameters\n // >;\n\n // try {\n // let productSelectionId: string;\n\n // if (params.id) {\n // productSelectionId = params.id;\n // } else if (params.key) {\n // const productSelection = await this.getProductSelectionsApi(api)\n // .withKey({ key: params.key })\n // .get()\n // .execute();\n // productSelectionId = productSelection.body.id;\n // } else {\n // throw new ToolExecutionError(\n // 'Either id or key must be provided',\n // context\n // );\n // }\n\n // const deletedProductSelection = await this.getProductSelectionsApi(api)\n // .withId({ ID: productSelectionId })\n // .delete({\n // queryArgs: {\n // version: params.version,\n // },\n // })\n // .execute();\n\n // return deletedProductSelection.body;\n // } catch (error: unknown) {\n // throw new ToolExecutionError(\n // 'Failed to delete product selection',\n // context,\n // error\n // );\n // }\n\n throw new ToolExecutionError('Not implemented', context);\n }\n}\n\n// Export individual functions for backward compatibility or direct usage\n// These functions wrap the handler methods and can be called directly\n\nexport async function readProductSelections<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<ProductSelection | ProductSelectionPagedQueryResponse> {\n const handler = new ProductSelectionsHandler<TConfig>(apiClientFactory);\n return handler.read(context);\n}\n\nexport async function createProductSelections<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<ProductSelection> {\n const handler = new ProductSelectionsHandler<TConfig>(apiClientFactory);\n return handler.create(context);\n}\n\nexport async function updateProductSelections<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<ProductSelection> {\n const handler = new ProductSelectionsHandler<TConfig>(apiClientFactory);\n return handler.update(context);\n}\n\nexport async function deleteProductSelections<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<ProductSelection> {\n const handler = new ProductSelectionsHandler<TConfig>(apiClientFactory);\n return handler.delete(context);\n}\n","import { z } from 'zod';\n\nexport const readProductTailoringParameters = z.object({\n id: z.string().optional().describe('Product Tailoring ID'),\n key: z.string().optional().describe('Product Tailoring key'),\n productId: z.string().optional().describe('Product ID'),\n productKey: z.string().optional().describe('Product key'),\n storeKey: z.string().optional().describe('Store key'),\n where: z\n .array(z.string())\n .optional()\n .describe(\n 'Query predicates specified as strings. Example: [\"productKey = \\\\\"product-123\\\\\"\"]'\n ),\n sort: z\n .array(z.string())\n .optional()\n .describe(\n 'Sort criteria for the results. Example: [\"productKey asc\", \"createdAt desc\"]'\n ),\n limit: z\n .number()\n .int()\n .min(1)\n .max(500)\n .optional()\n .describe(\n 'A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.'\n ),\n offset: z\n .number()\n .int()\n .min(0)\n .optional()\n .describe(\n 'The number of items to skip before starting to collect the result set.'\n ),\n expand: z\n .array(z.string())\n .optional()\n .describe('Fields to expand. Example: []'),\n});\n\nexport const createProductTailoringParameters = z.object({\n productKey: z.string().describe('Product key'),\n storeKey: z.string().describe('Store key'),\n name: z\n .record(z.string())\n .optional()\n .describe('Tailored product name (localized string)'),\n description: z\n .record(z.string())\n .optional()\n .describe('Tailored product description (localized string)'),\n slug: z\n .record(z.string())\n .optional()\n .describe('Tailored product slug (localized string)'),\n metaTitle: z\n .record(z.string())\n .optional()\n .describe('Tailored meta title (localized string)'),\n metaDescription: z\n .record(z.string())\n .optional()\n .describe('Tailored meta description (localized string)'),\n metaKeywords: z\n .record(z.string())\n .optional()\n .describe('Tailored meta keywords (localized string)'),\n variantTailoring: z\n .array(\n z.object({\n id: z.number().int().describe('Variant ID'),\n images: z\n .array(z.any())\n .optional()\n .describe('Tailored images for the variant'),\n assets: z\n .array(z.any())\n .optional()\n .describe('Tailored assets for the variant'),\n attributes: z\n .record(z.any())\n .optional()\n .describe('Tailored attributes for the variant'),\n })\n )\n .optional()\n .describe('Variant tailoring data'),\n});\n\nexport const updateProductTailoringParameters = z.object({\n id: z.string().optional().describe('Product Tailoring ID'),\n key: z.string().optional().describe('Product Tailoring key'),\n productId: z.string().optional().describe('Product ID'),\n productKey: z.string().optional().describe('Product key'),\n storeKey: z.string().optional().describe('Store key'),\n version: z\n .number()\n .int()\n .describe('The current version of the product tailoring'),\n actions: z\n .array(\n z\n .object({\n action: z\n .string()\n .describe('The name of the update action to perform'),\n })\n .and(z.record(z.string(), z.any()).optional())\n .describe(\n 'Array of update actions to perform on the product tailoring. Each action should have an \"action\" field and other fields specific to that action type.'\n )\n )\n .describe('Update actions'),\n});\n\nexport const deleteProductTailoringParameters = z.object({\n id: z.string().optional().describe('Product Tailoring ID'),\n key: z.string().optional().describe('Product Tailoring key'),\n productId: z.string().optional().describe('Product ID'),\n productKey: z.string().optional().describe('Product key'),\n storeKey: z.string().optional().describe('Store key'),\n version: z\n .number()\n .int()\n .describe('Current version (for optimistic locking)'),\n});\n","export const readProductTailoringPrompt = `\nThis tool will fetch Product Tailoring from commercetools. You can fetch by ID, key, product ID with store key, or product key with store key. If no specific identifier is provided, it will query all available product tailoring records.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the product tailoring to fetch.\n- key (string, optional): The key of the product tailoring to fetch.\n- productId (string, optional): The product ID to fetch tailoring for (requires storeKey).\n- productKey (string, optional): The product key to fetch tailoring for (requires storeKey).\n- storeKey (string, optional): The store key (required when using productId or productKey).\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"productKey = \\\\\"product-123\\\\\"\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"productKey asc\", \"createdAt desc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- expand (array of strings, optional): Fields to expand.\n`;\n\nexport const createProductTailoringPrompt = `\nThis tool will create a new Product Tailoring in commercetools.\n\nIt takes these required arguments:\n- productKey (string): Product key.\n- storeKey (string): Store key.\n\nIt takes these optional arguments:\n- name (object, optional): Tailored product name (localized string, object with language codes as keys).\n- description (object, optional): Tailored product description (localized string).\n- slug (object, optional): Tailored product slug (localized string).\n- metaTitle (object, optional): Tailored meta title (localized string).\n- metaDescription (object, optional): Tailored meta description (localized string).\n- metaKeywords (object, optional): Tailored meta keywords (localized string).\n- variantTailoring (array, optional): Variant tailoring data. Each variant tailoring should have:\n - id (integer): Variant ID.\n - images (array, optional): Tailored images for the variant.\n - assets (array, optional): Tailored assets for the variant.\n - attributes (object, optional): Tailored attributes for the variant.\n`;\n\nexport const updateProductTailoringPrompt = `\nThis tool will update a Product Tailoring in commercetools using update actions from the commercetools API.\n\nIt takes these required arguments:\n- version (integer): The current version of the product tailoring.\n- actions (array): An array of update actions to perform on the product tailoring. Each action should have an \"action\" field indicating the action type.\n\nIt takes these optional arguments (one of the following must be provided):\n- id (string, optional): The ID of the product tailoring to update.\n- key (string, optional): The key of the product tailoring to update.\n- productId (string, optional): The product ID (requires storeKey).\n- productKey (string, optional): The product key (requires storeKey).\n- storeKey (string, optional): The store key (required when using productId or productKey).\n\nExample actions from commercetools API include:\n- changeName\n- changeDescription\n- changeSlug\n- setMetaTitle\n- setMetaDescription\n- setMetaKeywords\n- setVariantImages\n- setVariantAssets\n- setVariantAttribute\n\nEach action type requires specific fields according to the commercetools API.\n`;\n\nexport const deleteProductTailoringPrompt = `\nThis tool will delete a Product Tailoring from commercetools.\n\nIt takes these required arguments:\n- version (integer): The current version of the product tailoring (for optimistic locking).\n\nIt takes these optional arguments (one of the following must be provided):\n- id (string, optional): The ID of the product tailoring to delete.\n- key (string, optional): The key of the product tailoring to delete.\n- productId (string, optional): The product ID (requires storeKey).\n- productKey (string, optional): The product key (requires storeKey).\n- storeKey (string, optional): The store key (required when using productId or productKey).\n`;\n","import { z } from 'zod';\nimport {\n type ProductTailoring,\n type ProductTailoringPagedQueryResponse,\n type ProductTailoringDraft,\n type ProductTailoringUpdate,\n type ProductTailoringUpdateAction,\n type ByProjectKeyRequestBuilder,\n} from '@commercetools/platform-sdk';\nimport {\n readProductTailoringParameters,\n createProductTailoringParameters,\n updateProductTailoringParameters,\n deleteProductTailoringParameters,\n} from './product-tailoring.schema';\nimport {\n readProductTailoringPrompt,\n createProductTailoringPrompt,\n updateProductTailoringPrompt,\n deleteProductTailoringPrompt,\n} from './product-tailoring.prompt';\nimport {\n IApiClientFactory,\n type ResourceMetadata,\n type ToolExecutionContext,\n ToolExecutionError,\n type Configuration,\n} from '../../shared';\nimport { CommercetoolsResourceHandler } from '../../handlers/commercetools.handler';\nimport { TOOL_NAME_PREFIX } from '../../utils/constants';\n\n/**\n * Product Tailoring Resource Handler\n * Generic over configuration type - defaults to CommercetoolsConfig\n */\nexport class ProductTailoringHandler<\n TConfig extends Configuration = Configuration,\n> extends CommercetoolsResourceHandler<TConfig> {\n protected readonly metadata: ResourceMetadata = {\n namespace: 'product-tailoring',\n description: 'Manage product tailoring in commercetools',\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readProductTailoringParameters,\n create: createProductTailoringParameters,\n update: updateProductTailoringParameters,\n delete: deleteProductTailoringParameters,\n },\n };\n\n constructor(apiClientFactory?: IApiClientFactory<TConfig>) {\n super(apiClientFactory);\n }\n\n override getToolDefinition(\n operation: 'read' | 'create' | 'update' | 'delete'\n ) {\n const prompts = {\n read: readProductTailoringPrompt,\n create: createProductTailoringPrompt,\n update: updateProductTailoringPrompt,\n delete: deleteProductTailoringPrompt,\n };\n\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation],\n };\n }\n\n protected getProductTailoringApi(\n api: ByProjectKeyRequestBuilder,\n storeKey?: string\n ) {\n return storeKey\n ? api.inStoreKeyWithStoreKeyValue({ storeKey }).productTailoring()\n : api.productTailoring();\n }\n\n async read(\n context: ToolExecutionContext<TConfig>\n ): Promise<ProductTailoring | ProductTailoringPagedQueryResponse> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n\n const params = context.parameters as z.infer<\n typeof readProductTailoringParameters\n >;\n\n try {\n // Read by ID\n if (params?.id) {\n const productTailoring = await api\n .productTailoring()\n .withId({ ID: params.id })\n .get({\n queryArgs: {\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n return productTailoring.body;\n }\n\n // Read by key\n if (params?.key) {\n const productTailoring = await api\n .productTailoring()\n .withKey({ key: params.key })\n .get({\n queryArgs: {\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n return productTailoring.body;\n }\n\n // Read by product ID and store key\n if (params?.productId && params?.storeKey) {\n const productTailoring = await api\n .inStoreKeyWithStoreKeyValue({ storeKey: params.storeKey })\n .products()\n .withProductId({ productID: params.productId })\n .productTailoring()\n .get({\n queryArgs: {\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n return productTailoring.body;\n }\n\n // Read by product key and store key\n if (params?.productKey && params?.storeKey) {\n const productTailoring = await api\n .inStoreKeyWithStoreKeyValue({ storeKey: params.storeKey })\n .products()\n .withProductKey({ productKey: params.productKey })\n .productTailoring()\n .get({\n queryArgs: {\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n return productTailoring.body;\n }\n\n // Query product tailoring entries\n const productTailorings = await this.getProductTailoringApi(\n api,\n params.storeKey\n )\n .get({\n queryArgs: {\n limit: params.limit || 20,\n ...(params.offset && { offset: params.offset }),\n ...(params.sort && { sort: params.sort }),\n ...(params.where && { where: params.where }),\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n\n return productTailorings.body;\n } catch (err: unknown) {\n throw new ToolExecutionError(\n (err as { message: string }).message ||\n 'Failed to read product tailoring',\n context,\n err\n );\n }\n }\n\n async create(\n context: ToolExecutionContext<TConfig>\n ): Promise<ProductTailoring> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<\n typeof createProductTailoringParameters\n >;\n\n try {\n const productTailoring = await this.getProductTailoringApi(\n api,\n params.storeKey\n )\n .post({\n body: params as ProductTailoringDraft,\n })\n .execute();\n\n return productTailoring.body;\n } catch (error: unknown) {\n throw new ToolExecutionError(\n 'Failed to create product tailoring',\n context,\n error\n );\n }\n }\n\n async update(\n context: ToolExecutionContext<TConfig>\n ): Promise<ProductTailoring> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n\n const params = context.parameters as z.infer<\n typeof updateProductTailoringParameters\n >;\n\n try {\n let productTailoring: ProductTailoring;\n let currentVersion: number;\n\n // Update by ID\n if (params.id) {\n const response = await api\n .productTailoring()\n .withId({ ID: params.id })\n .get()\n .execute();\n productTailoring = response.body;\n currentVersion = productTailoring.version;\n\n const updated = await api\n .productTailoring()\n .withId({ ID: params.id })\n .post({\n body: {\n version: currentVersion,\n actions: params.actions as ProductTailoringUpdateAction[],\n } as ProductTailoringUpdate,\n })\n .execute();\n return updated.body;\n }\n\n // Update by key\n if (params.key) {\n const response = await api\n .productTailoring()\n .withKey({ key: params.key })\n .get()\n .execute();\n productTailoring = response.body;\n currentVersion = productTailoring.version;\n\n const updated = await api\n .productTailoring()\n .withKey({ key: params.key })\n .post({\n body: {\n version: currentVersion,\n actions: params.actions as ProductTailoringUpdateAction[],\n } as ProductTailoringUpdate,\n })\n .execute();\n return updated.body;\n }\n\n // Update by product ID and store key\n if (params.productId && params.storeKey) {\n const response = await api\n .inStoreKeyWithStoreKeyValue({ storeKey: params.storeKey })\n .products()\n .withProductId({ productID: params.productId })\n .productTailoring()\n .get()\n .execute();\n productTailoring = response.body;\n currentVersion = productTailoring.version;\n\n const updated = await api\n .inStoreKeyWithStoreKeyValue({ storeKey: params.storeKey })\n .products()\n .withProductId({ productID: params.productId })\n .productTailoring()\n .post({\n body: {\n version: currentVersion,\n actions: params.actions as ProductTailoringUpdateAction[],\n } as ProductTailoringUpdate,\n })\n .execute();\n return updated.body;\n }\n\n // Update by product key and store key\n if (params.productKey && params.storeKey) {\n const response = await api\n .inStoreKeyWithStoreKeyValue({ storeKey: params.storeKey })\n .products()\n .withProductKey({ productKey: params.productKey })\n .productTailoring()\n .get()\n .execute();\n productTailoring = response.body;\n currentVersion = productTailoring.version;\n\n const updated = await api\n .inStoreKeyWithStoreKeyValue({ storeKey: params.storeKey })\n .products()\n .withProductKey({ productKey: params.productKey })\n .productTailoring()\n .post({\n body: {\n version: currentVersion,\n actions: params.actions as ProductTailoringUpdateAction[],\n } as ProductTailoringUpdate,\n })\n .execute();\n return updated.body;\n }\n\n throw new ToolExecutionError(\n 'Either id, key, or (productId/productKey with storeKey) must be provided',\n context\n );\n } catch (error: unknown) {\n throw new ToolExecutionError(\n 'Failed to update product tailoring',\n context,\n error\n );\n }\n }\n\n async delete(\n context: ToolExecutionContext<TConfig>\n ): Promise<ProductTailoring> {\n // const api = this.getApiRoot(context).withProjectKey({\n // projectKey: context.configuration.projectKey,\n // });\n\n // const params = context.parameters as z.infer<\n // typeof deleteProductTailoringParameters\n // >;\n\n // try {\n // let productTailoring: ProductTailoring;\n\n // // Delete by ID\n // if (params.id) {\n // productTailoring = await api\n // .productTailoring()\n // .withId({ ID: params.id })\n // .get()\n // .execute()\n // .then((r) => r.body);\n\n // const deleted = await api\n // .productTailoring()\n // .withId({ ID: params.id })\n // .delete({\n // queryArgs: {\n // version: params.version,\n // },\n // })\n // .execute();\n // return deleted.body;\n // }\n\n // // Delete by key\n // if (params.key) {\n // productTailoring = await api\n // .productTailoring()\n // .withKey({ key: params.key })\n // .get()\n // .execute()\n // .then((r) => r.body);\n\n // const deleted = await api\n // .productTailoring()\n // .withKey({ key: params.key })\n // .delete({\n // queryArgs: {\n // version: params.version,\n // },\n // })\n // .execute();\n // return deleted.body;\n // }\n\n // // Delete by product ID and store key\n // if (params.productId && params.storeKey) {\n // productTailoring = await api\n // .inStoreKeyWithStoreKeyValue({ storeKey: params.storeKey })\n // .products()\n // .withProductId({ productID: params.productId })\n // .productTailoring()\n // .get()\n // .execute()\n // .then((r) => r.body);\n\n // const deleted = await api\n // .inStoreKeyWithStoreKeyValue({ storeKey: params.storeKey })\n // .products()\n // .withProductId({ productID: params.productId })\n // .productTailoring()\n // .delete({\n // queryArgs: {\n // version: params.version,\n // },\n // })\n // .execute();\n // return deleted.body;\n // }\n\n // // Delete by product key and store key\n // if (params.productKey && params.storeKey) {\n // productTailoring = await api\n // .inStoreKeyWithStoreKeyValue({ storeKey: params.storeKey })\n // .products()\n // .withProductKey({ productKey: params.productKey })\n // .productTailoring()\n // .get()\n // .execute()\n // .then((r) => r.body);\n\n // const deleted = await api\n // .inStoreKeyWithStoreKeyValue({ storeKey: params.storeKey })\n // .products()\n // .withProductKey({ productKey: params.productKey })\n // .productTailoring()\n // .delete({\n // queryArgs: {\n // version: params.version,\n // },\n // })\n // .execute();\n // return deleted.body;\n // }\n\n // throw new ToolExecutionError(\n // 'Either id, key, or (productId/productKey with storeKey) must be provided',\n // context\n // );\n // } catch (error: unknown) {\n // throw new ToolExecutionError(\n // 'Failed to delete product tailoring',\n // context,\n // error\n // );\n // }\n\n throw new ToolExecutionError('Not implemented', context);\n }\n}\n\n// Export individual functions for backward compatibility or direct usage\n// These functions wrap the handler methods and can be called directly\n\nexport async function readProductTailoring<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<ProductTailoring | ProductTailoringPagedQueryResponse> {\n const handler = new ProductTailoringHandler<TConfig>(apiClientFactory);\n return handler.read(context);\n}\n\nexport async function createProductTailoring<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<ProductTailoring> {\n const handler = new ProductTailoringHandler<TConfig>(apiClientFactory);\n return handler.create(context);\n}\n\nexport async function updateProductTailoring<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<ProductTailoring> {\n const handler = new ProductTailoringHandler<TConfig>(apiClientFactory);\n return handler.update(context);\n}\n\nexport async function deleteProductTailoring<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<ProductTailoring> {\n const handler = new ProductTailoringHandler<TConfig>(apiClientFactory);\n return handler.delete(context);\n}\n","import { z } from 'zod';\n\nexport const readProductTypesParameters = z.object({\n id: z.string().optional().describe('Product Type ID'),\n key: z.string().optional().describe('Product Type key'),\n where: z\n .array(z.string())\n .optional()\n .describe(\n 'Query predicates specified as strings. Example: [\"key = \\\\\"my-product-type\\\\\"\"]'\n ),\n sort: z\n .array(z.string())\n .optional()\n .describe(\n 'Sort criteria for the results. Example: [\"key asc\", \"createdAt desc\"]'\n ),\n limit: z\n .number()\n .int()\n .min(1)\n .max(500)\n .optional()\n .describe(\n 'A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.'\n ),\n offset: z\n .number()\n .int()\n .min(0)\n .optional()\n .describe(\n 'The number of items to skip before starting to collect the result set.'\n ),\n expand: z\n .array(z.string())\n .optional()\n .describe('Fields to expand. Example: []'),\n});\n\nexport const createProductTypesParameters = z.object({\n key: z\n .string()\n .min(2)\n .max(256)\n .describe('User-defined unique identifier for the product type'),\n name: z.string().describe('Product Type name'),\n description: z.string().optional().describe('Product Type description'),\n attributes: z\n .array(\n z.object({\n name: z.string().describe('Attribute name'),\n label: z\n .record(z.string())\n .optional()\n .describe('Localized label for the attribute'),\n isRequired: z\n .boolean()\n .optional()\n .describe('Whether the attribute is required'),\n isSearchable: z\n .boolean()\n .optional()\n .describe('Whether the attribute is searchable'),\n type: z.any().describe('Attribute type definition'),\n attributeConstraint: z\n .enum(['None', 'Unique', 'CombinationUnique', 'SameForAll'])\n .optional()\n .describe('Attribute constraint'),\n inputHint: z\n .enum(['SingleLine', 'MultiLine'])\n .optional()\n .describe('Input hint for String attributes'),\n inputTip: z\n .record(z.string())\n .optional()\n .describe('Input tip for the attribute (localized)'),\n })\n )\n .optional()\n .describe('Array of attribute definitions'),\n});\n\nexport const updateProductTypesParameters = z.object({\n id: z.string().optional().describe('The ID of the product type to update'),\n key: z.string().optional().describe('The key of the product type to update'),\n version: z.number().int().describe('The current version of the product type'),\n actions: z\n .array(\n z\n .object({\n action: z\n .string()\n .describe('The name of the update action to perform'),\n })\n .and(z.record(z.string(), z.any()).optional())\n .describe(\n 'Array of update actions to perform on the product type. Each action should have an \"action\" field and other fields specific to that action type.'\n )\n )\n .describe('Update actions'),\n});\n\nexport const deleteProductTypesParameters = z.object({\n id: z.string().optional().describe('Product Type ID'),\n key: z.string().optional().describe('Product Type key'),\n version: z\n .number()\n .int()\n .describe('Current version (for optimistic locking)'),\n});\n","export const readProductTypesPrompt = `\nThis tool will fetch a Product Type by ID or key (if provided) from commercetools or query all available product types in a commercetools project if no arguments or parameters are provided.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the product type to fetch.\n- key (string, optional): The key of the product type to fetch.\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"key = \\\\\"my-product-type\\\\\"\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"key asc\", \"createdAt desc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- expand (array of strings, optional): Fields to expand.\n`;\n\nexport const createProductTypesPrompt = `\nThis tool will create a new Product Type in commercetools.\n\nIt takes these required arguments:\n- key (string): User-defined unique identifier for the product type (2-256 characters, alphanumeric with underscores/hyphens).\n- name (string): Product Type name.\n\nIt takes these optional arguments:\n- description (string, optional): Product Type description.\n- attributes (array, optional): Array of attribute definitions. Each attribute definition should have:\n - name (string): Attribute name.\n - label (object, optional): Localized label for the attribute (object with language codes as keys).\n - isRequired (boolean, optional): Whether the attribute is required.\n - isSearchable (boolean, optional): Whether the attribute is searchable.\n - type (object): Attribute type definition (Boolean, Text, LocalizedText, Enum, LocalizedEnum, Number, Money, Date, Time, DateTime, Reference, Set, Nested).\n - attributeConstraint (string, optional): Attribute constraint (\"None\", \"Unique\", \"CombinationUnique\", \"SameForAll\").\n - inputHint (string, optional): Input hint for String attributes (\"SingleLine\" or \"MultiLine\").\n - inputTip (object, optional): Input tip for the attribute (localized string).\n`;\n\nexport const updateProductTypesPrompt = `\nThis tool will update a Product Type in commercetools using update actions from the commercetools API.\n\nIt takes these required arguments:\n- id (string): The ID of the product type to update.\n- version (integer): The current version of the product type.\n- actions (array): An array of update actions to perform on the product type. Each action should have an \"action\" field indicating the action type.\n\nExample actions from commercetools API include:\n- addAttributeDefinition\n- addEnumValue\n- addLocalizedEnumValue\n- addPlainEnumValue\n- changeAttributeConstraint\n- changeAttributeName\n- changeAttributeOrder\n- changeDescription\n- changeEnumKey\n- changeEnumValueLabel\n- changeEnumValueOrder\n- changeInputHint\n- changeIsSearchable\n- changeLabel\n- changeLocalizedEnumValueLabel\n- changeLocalizedEnumValueOrder\n- changeName\n- removeAttributeDefinition\n- removeEnumValues\n- setInputTip\n\nEach action type requires specific fields according to the commercetools API.\n`;\n\nexport const deleteProductTypesPrompt = `\nThis tool will delete a Product Type from commercetools.\n\nIt takes these required arguments:\n- id (string): The ID of the product type to delete.\n- version (integer): The current version of the product type (for optimistic locking).\n`;\n","import { z } from 'zod';\nimport {\n type ProductType,\n type ProductTypePagedQueryResponse,\n type ProductTypeDraft,\n type ProductTypeUpdateAction,\n type ByProjectKeyRequestBuilder,\n} from '@commercetools/platform-sdk';\nimport {\n readProductTypesParameters,\n createProductTypesParameters,\n updateProductTypesParameters,\n deleteProductTypesParameters,\n} from './product-types.schema';\nimport {\n readProductTypesPrompt,\n createProductTypesPrompt,\n updateProductTypesPrompt,\n deleteProductTypesPrompt,\n} from './product-types.prompt';\nimport {\n IApiClientFactory,\n type ResourceMetadata,\n type ToolExecutionContext,\n ToolExecutionError,\n type Configuration,\n} from '../../shared';\nimport { CommercetoolsResourceHandler } from '../../handlers/commercetools.handler';\nimport { TOOL_NAME_PREFIX } from '../../utils/constants';\n\n/**\n * Product Types Resource Handler\n * Generic over configuration type - defaults to CommercetoolsConfig\n */\nexport class ProductTypesHandler<\n TConfig extends Configuration = Configuration,\n> extends CommercetoolsResourceHandler<TConfig> {\n protected readonly metadata: ResourceMetadata = {\n namespace: 'product-types',\n description: 'Manage product types in commercetools',\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readProductTypesParameters,\n create: createProductTypesParameters,\n update: updateProductTypesParameters,\n delete: deleteProductTypesParameters,\n },\n };\n\n constructor(apiClientFactory?: IApiClientFactory<TConfig>) {\n super(apiClientFactory);\n }\n\n override getToolDefinition(\n operation: 'read' | 'create' | 'update' | 'delete'\n ) {\n const prompts = {\n read: readProductTypesPrompt,\n create: createProductTypesPrompt,\n update: updateProductTypesPrompt,\n delete: deleteProductTypesPrompt,\n };\n\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation],\n };\n }\n\n protected getProductTypesApi(api: ByProjectKeyRequestBuilder) {\n return api.productTypes();\n }\n\n async read(\n context: ToolExecutionContext<TConfig>\n ): Promise<ProductType | ProductTypePagedQueryResponse> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n\n const params = context.parameters as z.infer<\n typeof readProductTypesParameters\n >;\n\n try {\n if (params?.id) {\n const productType = await this.getProductTypesApi(api)\n .withId({ ID: params.id })\n .get({\n queryArgs: {\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n\n return productType.body;\n } else if (params?.key) {\n const productType = await this.getProductTypesApi(api)\n .withKey({ key: params.key })\n .get()\n .execute();\n return productType.body;\n } else {\n const productTypes = await this.getProductTypesApi(api)\n .get({\n queryArgs: {\n limit: params.limit || 20,\n ...(params.offset && { offset: params.offset }),\n ...(params.sort && { sort: params.sort }),\n ...(params.where && { where: params.where }),\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n\n return productTypes.body;\n }\n } catch (err: unknown) {\n throw new ToolExecutionError(\n (err as { message: string }).message || 'Failed to read product types',\n context,\n err\n );\n }\n }\n\n async create(context: ToolExecutionContext<TConfig>): Promise<ProductType> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<\n typeof createProductTypesParameters\n >;\n\n try {\n const productType = await this.getProductTypesApi(api)\n .post({\n body: params as ProductTypeDraft,\n })\n .execute();\n\n return productType.body;\n } catch (error: unknown) {\n throw new ToolExecutionError(\n 'Failed to create product type',\n context,\n error\n );\n }\n }\n\n async update(context: ToolExecutionContext<TConfig>): Promise<ProductType> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n\n const params = context.parameters as z.infer<\n typeof updateProductTypesParameters\n >;\n\n try {\n let currentVersion: number;\n let productTypeId: string;\n\n if (params.id) {\n const productType = await this.getProductTypesApi(api)\n .withId({ ID: params.id })\n .get()\n .execute();\n currentVersion = productType.body.version;\n productTypeId = params.id;\n } else if (params.key) {\n const productType = await this.getProductTypesApi(api)\n .withKey({ key: params.key })\n .get()\n .execute();\n currentVersion = productType.body.version;\n productTypeId = productType.body.id;\n } else {\n throw new ToolExecutionError(\n 'Either id or key must be provided',\n context\n );\n }\n\n const updatedProductType = await this.getProductTypesApi(api)\n .withId({ ID: productTypeId })\n .post({\n body: {\n version: currentVersion,\n actions: params.actions as ProductTypeUpdateAction[],\n },\n })\n .execute();\n\n return updatedProductType.body;\n } catch (error: unknown) {\n throw new ToolExecutionError(\n 'Failed to update product type',\n context,\n error\n );\n }\n }\n\n async delete(context: ToolExecutionContext<TConfig>): Promise<ProductType> {\n // const api = this.getApiRoot(context).withProjectKey({\n // projectKey: context.configuration.projectKey,\n // });\n\n // const params = context.parameters as z.infer<\n // typeof deleteProductTypesParameters\n // >;\n\n // try {\n // let productTypeId: string;\n\n // if (params.id) {\n // productTypeId = params.id;\n // } else if (params.key) {\n // const productType = await this.getProductTypesApi(api)\n // .withKey({ key: params.key })\n // .get()\n // .execute();\n // productTypeId = productType.body.id;\n // } else {\n // throw new ToolExecutionError(\n // 'Either id or key must be provided',\n // context\n // );\n // }\n\n // const deletedProductType = await this.getProductTypesApi(api)\n // .withId({ ID: productTypeId })\n // .delete({\n // queryArgs: {\n // version: params.version,\n // },\n // })\n // .execute();\n\n // return deletedProductType.body;\n // } catch (error: unknown) {\n // throw new ToolExecutionError(\n // 'Failed to delete product type',\n // context,\n // error\n // );\n // }\n\n throw new ToolExecutionError('Not implemented', context);\n }\n}\n\n// Export individual functions for backward compatibility or direct usage\n// These functions wrap the handler methods and can be called directly\n\nexport async function readProductTypes<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<ProductType | ProductTypePagedQueryResponse> {\n const handler = new ProductTypesHandler<TConfig>(apiClientFactory);\n return handler.read(context);\n}\n\nexport async function createProductTypes<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<ProductType> {\n const handler = new ProductTypesHandler<TConfig>(apiClientFactory);\n return handler.create(context);\n}\n\nexport async function updateProductTypes<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<ProductType> {\n const handler = new ProductTypesHandler<TConfig>(apiClientFactory);\n return handler.update(context);\n}\n\nexport async function deleteProductTypes<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<ProductType> {\n const handler = new ProductTypesHandler<TConfig>(apiClientFactory);\n return handler.delete(context);\n}\n","import { z } from 'zod';\n\nexport const readProductsParameters = z.object({\n id: z.string().optional().describe('Product ID'),\n key: z.string().optional().describe('Product key'),\n where: z\n .array(z.string())\n .optional()\n .describe(\n 'Query predicates specified as strings. Example: [\"key = \\\\\"product-key\\\\\"\"]'\n ),\n sort: z\n .array(z.string())\n .optional()\n .describe(\n 'Sort criteria for the results. Example: [\"name asc\", \"createdAt desc\"]'\n ),\n limit: z\n .number()\n .int()\n .min(1)\n .max(500)\n .optional()\n .describe(\n 'A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.'\n ),\n offset: z\n .number()\n .int()\n .min(0)\n .optional()\n .describe(\n 'The number of items to skip before starting to collect the result set.'\n ),\n expand: z\n .array(z.string())\n .optional()\n .describe('Fields to expand. Example: [\"productType\", \"categories[*]\"]'),\n priceCurrency: z\n .string()\n .optional()\n .describe('Currency code for price selection'),\n priceCountry: z\n .string()\n .optional()\n .describe('Country code for price selection'),\n priceCustomerGroup: z\n .string()\n .optional()\n .describe('Customer group ID for price selection'),\n priceChannel: z\n .string()\n .optional()\n .describe('Channel ID for price selection'),\n localeProjection: z.string().optional().describe('Locale for projection'),\n storeProjection: z.string().optional().describe('Store key for projection'),\n});\n\nexport const createProductsParameters = z.object({\n key: z\n .string()\n .min(2)\n .max(256)\n .optional()\n .describe('User-defined unique identifier for the product'),\n productType: z\n .object({\n id: z.string().optional(),\n key: z.string().optional(),\n typeId: z.literal('product-type'),\n })\n .describe('Product Type reference'),\n name: z.record(z.string()).describe('Product name (localized string)'),\n description: z\n .record(z.string())\n .optional()\n .describe('Product description (localized string)'),\n slug: z.record(z.string()).describe('Product slug (localized string)'),\n categories: z\n .array(\n z.object({\n id: z.string().optional(),\n key: z.string().optional(),\n typeId: z.literal('category'),\n })\n )\n .optional()\n .describe('Array of category references'),\n categoryOrderHints: z\n .record(z.string())\n .optional()\n .describe('Category order hints'),\n metaTitle: z\n .record(z.string())\n .optional()\n .describe('Meta title (localized string)'),\n metaDescription: z\n .record(z.string())\n .optional()\n .describe('Meta description (localized string)'),\n metaKeywords: z\n .record(z.string())\n .optional()\n .describe('Meta keywords (localized string)'),\n masterVariant: z.any().optional().describe('Master variant'),\n variants: z.array(z.any()).optional().describe('Product variants'),\n taxCategory: z\n .object({\n id: z.string().optional(),\n key: z.string().optional(),\n typeId: z.literal('tax-category'),\n })\n .optional()\n .describe('Tax category reference'),\n state: z\n .object({\n id: z.string().optional(),\n key: z.string().optional(),\n typeId: z.literal('state'),\n })\n .optional()\n .describe('State reference'),\n reviewRatingStatistics: z\n .any()\n .optional()\n .describe('Review rating statistics'),\n publish: z.boolean().optional().describe('Whether to publish the product'),\n priceMode: z\n .enum(['Embedded', 'Standalone'])\n .optional()\n .describe('Price mode'),\n});\n\nexport const updateProductsParameters = z.object({\n id: z.string().optional().describe('The ID of the product to update'),\n key: z.string().optional().describe('The key of the product to update'),\n version: z.number().int().describe('The current version of the product'),\n actions: z\n .array(\n z\n .object({\n action: z\n .string()\n .describe('The name of the update action to perform'),\n })\n .and(z.record(z.string(), z.any()).optional())\n .describe(\n 'Array of update actions to perform on the product. Each action should have an \"action\" field and other fields specific to that action type.'\n )\n )\n .describe('Update actions'),\n});\n\nexport const deleteProductsParameters = z.object({\n id: z.string().optional().describe('Product ID'),\n key: z.string().optional().describe('Product key'),\n version: z\n .number()\n .int()\n .describe('Current version (for optimistic locking)'),\n priceMode: z\n .enum(['Embedded', 'Standalone'])\n .optional()\n .describe('Price mode'),\n});\n","export const readProductsPrompt = `\nThis tool will fetch a Product by ID or key (if provided) from commercetools or query all available products in a commercetools project if no arguments or parameters are provided.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the product to fetch.\n- key (string, optional): The key of the product to fetch.\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"key = \\\\\"product-key\\\\\"\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"name asc\", \"createdAt desc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- expand (array of strings, optional): Fields to expand. Example: [\"productType\", \"categories[*]\"]\n- priceCurrency (string, optional): Currency code for price selection.\n- priceCountry (string, optional): Country code for price selection.\n- priceCustomerGroup (string, optional): Customer group ID for price selection.\n- priceChannel (string, optional): Channel ID for price selection.\n- localeProjection (string, optional): Locale for projection.\n- storeProjection (string, optional): Store key for projection.\n`;\n\nexport const createProductsPrompt = `\nThis tool will create a new Product in commercetools.\n\nIt takes these required arguments:\n- productType (object): Product Type reference. Must have typeId \"product-type\" and either id or key.\n- name (object): Product name (localized string, object with language codes as keys).\n- slug (object): Product slug (localized string, object with language codes as keys).\n\nIt takes these optional arguments:\n- key (string, optional): User-defined unique identifier for the product (2-256 characters, alphanumeric with underscores/hyphens).\n- description (object, optional): Product description (localized string).\n- categories (array, optional): Array of category references. Each must have typeId \"category\" and either id or key.\n- categoryOrderHints (object, optional): Category order hints.\n- metaTitle (object, optional): Meta title (localized string).\n- metaDescription (object, optional): Meta description (localized string).\n- metaKeywords (object, optional): Meta keywords (localized string).\n- masterVariant (object, optional): Master variant definition.\n- variants (array, optional): Array of product variants.\n- taxCategory (object, optional): Tax category reference. Must have typeId \"tax-category\" and either id or key.\n- state (object, optional): State reference. Must have typeId \"state\" and either id or key.\n- reviewRatingStatistics (object, optional): Review rating statistics.\n- publish (boolean, optional): Whether to publish the product.\n- priceMode (string, optional): Price mode (\"Embedded\" or \"Standalone\").\n`;\n\nexport const updateProductsPrompt = `\nThis tool will update a Product in commercetools using update actions from the commercetools API.\n\nIt takes these required arguments:\n- version (integer): The current version of the product.\n- actions (array): An array of update actions to perform on the product. Each action should have an \"action\" field indicating the action type.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the product to update (required if key is not provided).\n- key (string, optional): The key of the product to update (required if id is not provided).\n\nExample actions from commercetools API include:\n- addAsset\n- addExternalImage\n- addPrice\n- addToCategory\n- changeAssetName\n- changeAssetOrder\n- changeImageLabel\n- changeMasterVariant\n- changeName\n- changePrice\n- changeSlug\n- moveImageToPosition\n- publish\n- removeAsset\n- removeFromCategory\n- removeImage\n- removePrice\n- removeVariant\n- revertStagedChanges\n- setAssetCustomField\n- setAssetCustomType\n- setAssetDescription\n- setAssetKey\n- setAssetSources\n- setAssetTags\n- setAttribute\n- setAttributeInAllVariants\n- setCategoryOrderHint\n- setDescription\n- setDiscountedPrice\n- setImageLabel\n- setKey\n- setMetaDescription\n- setMetaKeywords\n- setMetaTitle\n- setPriceMode\n- setPrices\n- setProductPriceCustomField\n- setProductPriceCustomType\n- setProductVariantKey\n- setSearchKeywords\n- setSku\n- setTaxCategory\n- transitionState\n- unpublish\n\nEach action type requires specific fields according to the commercetools API.\n`;\n\nexport const deleteProductsPrompt = `\nThis tool will delete a Product from commercetools.\n\nIt takes these required arguments:\n- version (integer): The current version of the product (for optimistic locking).\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the product to delete (required if key is not provided).\n- key (string, optional): The key of the product to delete (required if id is not provided).\n- priceMode (string, optional): Price mode (\"Embedded\" or \"Standalone\").\n`;\n","import { z } from 'zod';\nimport {\n type Product,\n type ProductPagedQueryResponse,\n type ProductDraft,\n type ProductUpdateAction,\n type ByProjectKeyRequestBuilder,\n} from '@commercetools/platform-sdk';\nimport {\n readProductsParameters,\n createProductsParameters,\n updateProductsParameters,\n deleteProductsParameters,\n} from './products.schema';\nimport {\n readProductsPrompt,\n createProductsPrompt,\n updateProductsPrompt,\n deleteProductsPrompt,\n} from './products.prompt';\nimport {\n IApiClientFactory,\n type ResourceMetadata,\n type ToolExecutionContext,\n ToolExecutionError,\n type Configuration,\n} from '../../shared';\nimport { CommercetoolsResourceHandler } from '../../handlers/commercetools.handler';\nimport { TOOL_NAME_PREFIX } from '../../utils/constants';\n\n/**\n * Products Resource Handler\n * Generic over configuration type - defaults to CommercetoolsConfig\n */\nexport class ProductsHandler<\n TConfig extends Configuration = Configuration,\n> extends CommercetoolsResourceHandler<TConfig> {\n protected readonly metadata: ResourceMetadata = {\n namespace: 'products',\n description: 'Manage products in commercetools',\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readProductsParameters,\n create: createProductsParameters,\n update: updateProductsParameters,\n delete: deleteProductsParameters,\n },\n };\n\n constructor(apiClientFactory?: IApiClientFactory<TConfig>) {\n super(apiClientFactory);\n }\n\n override getToolDefinition(\n operation: 'read' | 'create' | 'update' | 'delete'\n ) {\n const prompts = {\n read: readProductsPrompt,\n create: createProductsPrompt,\n update: updateProductsPrompt,\n delete: deleteProductsPrompt,\n };\n\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation],\n };\n }\n\n protected getProductsApi(api: ByProjectKeyRequestBuilder) {\n return api.products();\n }\n\n async read(\n context: ToolExecutionContext<TConfig>\n ): Promise<Product | ProductPagedQueryResponse> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n\n const params = context.parameters as z.infer<typeof readProductsParameters>;\n\n try {\n if (params?.id) {\n const product = await this.getProductsApi(api)\n .withId({ ID: params.id })\n .get({\n queryArgs: {\n ...(params.expand && { expand: params.expand }),\n ...(params.priceCurrency && {\n priceCurrency: params.priceCurrency,\n }),\n ...(params.priceCountry && { priceCountry: params.priceCountry }),\n ...(params.priceCustomerGroup && {\n priceCustomerGroup: params.priceCustomerGroup,\n }),\n ...(params.priceChannel && { priceChannel: params.priceChannel }),\n ...(params.localeProjection && {\n localeProjection: params.localeProjection,\n }),\n ...(params.storeProjection && {\n storeProjection: params.storeProjection,\n }),\n },\n })\n .execute();\n\n return product.body;\n } else if (params?.key) {\n const product = await this.getProductsApi(api)\n .withKey({ key: params.key })\n .get({\n queryArgs: {\n ...(params.expand && { expand: params.expand }),\n ...(params.priceCurrency && {\n priceCurrency: params.priceCurrency,\n }),\n ...(params.priceCountry && { priceCountry: params.priceCountry }),\n ...(params.priceCustomerGroup && {\n priceCustomerGroup: params.priceCustomerGroup,\n }),\n ...(params.priceChannel && { priceChannel: params.priceChannel }),\n ...(params.localeProjection && {\n localeProjection: params.localeProjection,\n }),\n ...(params.storeProjection && {\n storeProjection: params.storeProjection,\n }),\n },\n })\n .execute();\n return product.body;\n } else {\n const products = await this.getProductsApi(api)\n .get({\n queryArgs: {\n limit: params.limit || 20,\n ...(params.offset && { offset: params.offset }),\n ...(params.sort && { sort: params.sort }),\n ...(params.where && { where: params.where }),\n ...(params.expand && { expand: params.expand }),\n ...(params.priceCurrency && {\n priceCurrency: params.priceCurrency,\n }),\n ...(params.priceCountry && { priceCountry: params.priceCountry }),\n ...(params.priceCustomerGroup && {\n priceCustomerGroup: params.priceCustomerGroup,\n }),\n ...(params.priceChannel && { priceChannel: params.priceChannel }),\n ...(params.localeProjection && {\n localeProjection: params.localeProjection,\n }),\n ...(params.storeProjection && {\n storeProjection: params.storeProjection,\n }),\n },\n })\n .execute();\n\n return products.body;\n }\n } catch (err: unknown) {\n throw new ToolExecutionError(\n (err as { message: string }).message || 'Failed to read products',\n context,\n err\n );\n }\n }\n\n async create(context: ToolExecutionContext<TConfig>): Promise<Product> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<\n typeof createProductsParameters\n >;\n\n try {\n const product = await this.getProductsApi(api)\n .post({\n body: params as ProductDraft,\n })\n .execute();\n\n return product.body;\n } catch (error: unknown) {\n throw new ToolExecutionError('Failed to create product', context, error);\n }\n }\n\n async update(context: ToolExecutionContext<TConfig>): Promise<Product> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n\n const params = context.parameters as z.infer<\n typeof updateProductsParameters\n >;\n\n try {\n let currentVersion: number;\n let productId: string;\n\n if (params.id) {\n const product = await this.getProductsApi(api)\n .withId({ ID: params.id })\n .get()\n .execute();\n currentVersion = product.body.version;\n productId = params.id;\n } else if (params.key) {\n const product = await this.getProductsApi(api)\n .withKey({ key: params.key })\n .get()\n .execute();\n currentVersion = product.body.version;\n productId = product.body.id;\n } else {\n throw new ToolExecutionError(\n 'Either id or key must be provided',\n context\n );\n }\n\n const updatedProduct = await this.getProductsApi(api)\n .withId({ ID: productId })\n .post({\n body: {\n version: currentVersion,\n actions: params.actions as ProductUpdateAction[],\n },\n })\n .execute();\n\n return updatedProduct.body;\n } catch (error: unknown) {\n throw new ToolExecutionError('Failed to update product', context, error);\n }\n }\n\n async delete(context: ToolExecutionContext<TConfig>): Promise<Product> {\n // const api = this.getApiRoot(context).withProjectKey({\n // projectKey: context.configuration.projectKey,\n // });\n\n // const params = context.parameters as z.infer<typeof deleteProductsParameters>;\n\n // try {\n // let productId: string;\n\n // if (params.id) {\n // productId = params.id;\n // } else if (params.key) {\n // const product = await this.getProductsApi(api)\n // .withKey({ key: params.key })\n // .get()\n // .execute();\n // productId = product.body.id;\n // } else {\n // throw new ToolExecutionError(\n // 'Either id or key must be provided',\n // context\n // );\n // }\n\n // const deletedProduct = await this.getProductsApi(api)\n // .withId({ ID: productId })\n // .delete({\n // queryArgs: {\n // version: params.version,\n // ...(params.priceMode && { priceMode: params.priceMode }),\n // },\n // })\n // .execute();\n\n // return deletedProduct.body;\n // } catch (error: unknown) {\n // throw new ToolExecutionError('Failed to delete product', context, error);\n // }\n\n throw new ToolExecutionError('Not implemented', context);\n }\n}\n\n// Export individual functions for backward compatibility or direct usage\n// These functions wrap the handler methods and can be called directly\n\nexport async function readProducts<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Product | ProductPagedQueryResponse> {\n const handler = new ProductsHandler<TConfig>(apiClientFactory);\n return handler.read(context);\n}\n\nexport async function createProducts<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Product> {\n const handler = new ProductsHandler<TConfig>(apiClientFactory);\n return handler.create(context);\n}\n\nexport async function updateProducts<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Product> {\n const handler = new ProductsHandler<TConfig>(apiClientFactory);\n return handler.update(context);\n}\n\nexport async function deleteProducts<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Product> {\n const handler = new ProductsHandler<TConfig>(apiClientFactory);\n return handler.delete(context);\n}\n","import { z } from 'zod';\nimport { Project, ProjectUpdateAction } from '@commercetools/platform-sdk';\nimport {\n type Configuration,\n type IApiClientFactory,\n type ResourceMetadata,\n type ToolExecutionContext,\n ToolExecutionError,\n} from '../../shared';\nimport { CommercetoolsResourceHandler } from '../../handlers/commercetools.handler';\nimport {\n readProjectParameters,\n updateProjectParameters,\n} from './project.schema';\nimport { readProjectPrompt, updateProjectPrompt } from './project.prompt';\nimport { TOOL_NAME_PREFIX } from '../../utils/constants';\n\n/**\n * Project Resource Handler\n * Handles project read and update operations\n * Generic over configuration type - defaults to Configuration\n *\n * Automatically discovered via @ToolHandler() decorator\n */\nexport class ProjectHandler<\n TConfig extends Configuration = Configuration,\n> extends CommercetoolsResourceHandler<TConfig> {\n protected readonly metadata: ResourceMetadata = {\n namespace: 'project',\n description: 'Manage project in commercetools',\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readProjectParameters,\n update: updateProjectParameters,\n create: z.object({}), // Empty schema for unsupported operation\n delete: z.object({}), // Empty schema for unsupported operation\n },\n };\n\n constructor(apiClientFactory?: IApiClientFactory<TConfig>) {\n super(apiClientFactory);\n }\n\n override getToolDefinition(operation: 'read' | 'update') {\n const prompts = {\n read: readProjectPrompt,\n update: updateProjectPrompt,\n };\n\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation],\n };\n }\n\n async read(context: ToolExecutionContext<TConfig>): Promise<Project> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n\n try {\n const project = await api.get().execute();\n return project.body;\n } catch (error: unknown) {\n throw new ToolExecutionError('Failed to read project', context, error);\n }\n }\n\n async update(context: ToolExecutionContext<TConfig>): Promise<Project> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<\n typeof updateProjectParameters\n >;\n\n try {\n const project = await api\n .post({\n body: {\n version: params.version,\n actions: params.actions as ProjectUpdateAction[],\n },\n })\n .execute();\n\n return project.body;\n } catch (error: unknown) {\n throw new ToolExecutionError('Failed to update project', context, error);\n }\n }\n\n async create(_context: ToolExecutionContext<TConfig>): Promise<never> {\n throw new ToolExecutionError('Create operation not implemented', _context);\n }\n\n async delete(_context: ToolExecutionContext<TConfig>): Promise<never> {\n throw new ToolExecutionError('Delete operation not implemented', _context);\n }\n}\n\n// Export individual functions for backward compatibility or direct usage\n// These functions wrap the handler methods and can be called directly\n\nexport async function readProject<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Project> {\n const handler = new ProjectHandler<TConfig>(apiClientFactory);\n return handler.read(context);\n}\n\nexport async function updateProject<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Project> {\n const handler = new ProjectHandler<TConfig>(apiClientFactory);\n return handler.update(context);\n}\n","import { z } from 'zod';\n\nexport const readProjectParameters = z.object({\n projectKey: z\n .string()\n .optional()\n .describe(\n 'The key of the project to read. If not provided, the current project will be used.'\n ),\n});\n\nconst messagesConfigurationDraftSchema = z.object({\n enabled: z\n .boolean()\n .describe('When true, the Messages Query feature is active.'),\n deleteDaysAfterCreation: z\n .number()\n .min(1)\n .max(90)\n .optional()\n .describe(\n 'Specifies the number of days each Message should be available via the Messages Query API.'\n ),\n});\n\nconst cartsConfigurationSchema = z.object({\n deleteDaysAfterLastModification: z\n .number()\n .min(1)\n .optional()\n .describe(\n 'Default value for the deleteDaysAfterLastModification parameter of CartDraft and MyCartDraft.'\n ),\n countryTaxRateFallbackEnabled: z\n .boolean()\n .optional()\n .describe(\n 'Indicates if country - no state Tax Rate fallback should be used.'\n ),\n});\n\nconst shoppingListsConfigurationSchema = z.object({\n deleteDaysAfterLastModification: z\n .number()\n .min(1)\n .optional()\n .describe(\n 'Default value for the deleteDaysAfterLastModification parameter of ShoppingListDraft.'\n ),\n});\n\nconst customFieldLocalizedEnumValueSchema = z.object({\n key: z.string().describe('The key of the enum value.'),\n label: z\n .record(z.string(), z.string())\n .describe('The localized labels for the enum value.'),\n});\n\nconst shippingRateInputTypeSchema = z.discriminatedUnion('type', [\n z.object({\n type: z.literal('CartValue'),\n }),\n z.object({\n type: z.literal('CartClassification'),\n values: z\n .array(customFieldLocalizedEnumValueSchema)\n .describe('The classification items for ShippingRatePriceTier.'),\n }),\n z.object({\n type: z.literal('CartScore'),\n score: z\n .number()\n .describe('The score mapping for available shipping rate tiers.'),\n }),\n]);\n\nconst externalOAuthSchema = z.object({\n url: z\n .string()\n .url()\n .describe('The URL of the token introspection endpoint.'),\n authorizationHeader: z\n .string()\n .describe(\n 'The authorization header to authenticate against the introspection endpoint.'\n ),\n});\n\nconst customerSearchStatusSchema = z.enum(['Activated', 'Deactivated']);\nconst businessUnitSearchStatusSchema = z.enum(['Activated', 'Deactivated']);\nconst orderSearchStatusSchema = z.enum(['Activated', 'Deactivated']);\nconst productSearchIndexingModeSchema = z.enum([\n 'ProductProjectionsSearch',\n 'ProductsSearch',\n]);\nconst businessUnitConfigurationStatusSchema = z.enum([\n 'Active',\n 'Inactive',\n 'Verification',\n]);\n\nconst associateRoleResourceIdentifierSchema = z.object({\n typeId: z.literal('associate-role'),\n id: z.string().optional().describe('The ID of the associate role.'),\n key: z.string().optional().describe('The key of the associate role.'),\n});\n\n// Define action schemas based on the documentation\nconst changeNameSchema = z.object({\n action: z.literal('changeName'),\n name: z.string().describe('New value to set.'),\n});\n\nconst changeCountriesSchema = z.object({\n action: z.literal('changeCountries'),\n countries: z\n .array(z.string())\n .describe('New value to set. Must not be empty.'),\n});\n\nconst changeCurrenciesSchema = z.object({\n action: z.literal('changeCurrencies'),\n currencies: z\n .array(z.string())\n .describe('New value to set. Must not be empty.'),\n});\n\nconst changeLanguagesSchema = z.object({\n action: z.literal('changeLanguages'),\n languages: z\n .array(z.string())\n .describe('New value to set. Must not be empty.'),\n});\n\nconst changeMessagesConfigurationSchema = z.object({\n action: z.literal('changeMessagesConfiguration'),\n messagesConfiguration: messagesConfigurationDraftSchema.describe(\n 'Configuration for the Messages Query feature.'\n ),\n});\n\nconst changeCartsConfigurationSchema = z.object({\n action: z.literal('changeCartsConfiguration'),\n cartsConfiguration: cartsConfigurationSchema.describe(\n 'Configuration for the Carts feature.'\n ),\n});\n\nconst changeCountryTaxRateFallbackEnabledSchema = z.object({\n action: z.literal('changeCountryTaxRateFallbackEnabled'),\n countryTaxRateFallbackEnabled: z\n .boolean()\n .describe('When true, country - no state Tax Rate is used as fallback.'),\n});\n\nconst changeShoppingListsConfigurationSchema = z.object({\n action: z.literal('changeShoppingListsConfiguration'),\n shoppingListsConfiguration: shoppingListsConfigurationSchema.describe(\n 'Configuration for the Shopping Lists feature.'\n ),\n});\n\nconst changeMyBusinessUnitStatusOnCreationSchema = z.object({\n action: z.literal('changeMyBusinessUnitStatusOnCreation'),\n status: businessUnitConfigurationStatusSchema.describe(\n 'Status for Business Units created using the My Business Unit endpoint.'\n ),\n});\n\nconst setMyBusinessUnitAssociateRoleOnCreationSchema = z.object({\n action: z.literal('setMyBusinessUnitAssociateRoleOnCreation'),\n associateRole: associateRoleResourceIdentifierSchema.describe(\n 'Default Associate Role assigned to the Associate creating a Business Unit.'\n ),\n});\n\nconst setShippingRateInputTypeSchema = z.object({\n action: z.literal('setShippingRateInputType'),\n shippingRateInputType: shippingRateInputTypeSchema\n .optional()\n .describe('Value to set. If empty, any existing value will be removed.'),\n});\n\nconst setExternalOAuthSchema = z.object({\n action: z.literal('setExternalOAuth'),\n externalOAuth: externalOAuthSchema\n .optional()\n .describe('Value to set. If empty, any existing value will be removed.'),\n});\n\nconst changeProductSearchIndexingEnabledSchema = z.object({\n action: z.literal('changeProductSearchIndexingEnabled'),\n enabled: z\n .boolean()\n .describe('If false, the indexing of Product information will stop.'),\n mode: productSearchIndexingModeSchema\n .optional()\n .describe(\n 'Controls whether the action should apply to Product Projection Search or to Product Search.'\n ),\n});\n\nconst changeOrderSearchStatusSchema = z.object({\n action: z.literal('changeOrderSearchStatus'),\n status: orderSearchStatusSchema.describe(\n 'Activates or deactivates the Order Search feature.'\n ),\n});\n\nconst changeCustomerSearchStatusSchema = z.object({\n action: z.literal('changeCustomerSearchStatus'),\n status: customerSearchStatusSchema.describe(\n 'Activates or deactivates the Customer Search feature.'\n ),\n});\n\nconst changeBusinessUnitSearchStatusSchema = z.object({\n action: z.literal('changeBusinessUnitSearchStatus'),\n status: businessUnitSearchStatusSchema.describe(\n 'Activates or deactivates the Search Business Units feature.'\n ),\n});\n\n// Union of all possible update actions\nconst updateActionSchema = z.discriminatedUnion('action', [\n changeNameSchema,\n changeCountriesSchema,\n changeCurrenciesSchema,\n changeLanguagesSchema,\n changeMessagesConfigurationSchema,\n changeCartsConfigurationSchema,\n changeCountryTaxRateFallbackEnabledSchema,\n changeShoppingListsConfigurationSchema,\n changeMyBusinessUnitStatusOnCreationSchema,\n setMyBusinessUnitAssociateRoleOnCreationSchema,\n setShippingRateInputTypeSchema,\n setExternalOAuthSchema,\n changeProductSearchIndexingEnabledSchema,\n changeOrderSearchStatusSchema,\n changeCustomerSearchStatusSchema,\n changeBusinessUnitSearchStatusSchema,\n]);\n\nexport const updateProjectParameters = z.object({\n version: z\n .number()\n .describe(\n 'The current version of the project. If not provided, the current version will be fetched automatically.'\n ),\n actions: z\n .array(updateActionSchema)\n .describe('The list of update actions to apply to the project.'),\n projectKey: z\n .string()\n .optional()\n .describe(\n 'The key of the project to update. If not provided, the current project will be used.'\n ),\n});\n","export const readProjectPrompt = `\nThis tool will fetch information about a commercetools project.\n\nIt takes these optional arguments:\n- projectKey (string, optional): The key of the project to read. If not provided, the current projectKey from the configuration will be used.\n\nThe response will contain detailed information about the project including countries, currencies, languages, and more.\n`;\n\nexport const updateProjectPrompt = `\nThis tool will update settings for a commercetools project. This is an admin-only operation.\n\nIt takes these arguments:\n- version (number, optional): The current version of the project. If not provided, the current version will be fetched automatically.\n- actions (array, required): The list of update actions to apply to the project.\n- projectKey (string, optional): The key of the project to update. If not provided, the current project will be used.\n\nAvailable update actions include:\n- changeName: Update the project name\n- changeCountries: Update the list of countries\n- changeCurrencies: Update the list of currencies\n- changeLanguages: Update the list of languages\n- changeMessagesConfiguration: Update the Messages Query feature configuration\n- changeCartsConfiguration: Update the Carts feature configuration\n- changeCountryTaxRateFallbackEnabled: Change the country tax rate fallback setting\n- changeShoppingListsConfiguration: Update the Shopping Lists feature configuration\n- setShippingRateInputType: Set the shipping rate input type\n- setExternalOAuth: Configure an external OAuth provider\n- changeProductSearchIndexingEnabled: Enable/disable product search indexing\n- changeOrderSearchStatus: Change the Order Search status\n- changeCustomerSearchStatus: Change the Customer Search status\n- changeBusinessUnitSearchStatus: Change the Business Unit Search status\n- and more\n\nThe response will contain the updated project information.\n`;\n","import { z } from 'zod';\n\nexport const readReviewsParameters = z.object({\n id: z.string().optional().describe('Review ID'),\n key: z.string().optional().describe('Review key'),\n where: z\n .array(z.string())\n .optional()\n .describe(\n 'Query predicates specified as strings. Example: [\"rating > 50\"]'\n ),\n sort: z\n .array(z.string())\n .optional()\n .describe(\n 'Sort criteria for the results. Example: [\"rating desc\", \"createdAt asc\"]'\n ),\n limit: z\n .number()\n .int()\n .min(1)\n .max(500)\n .optional()\n .describe(\n 'A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.'\n ),\n offset: z\n .number()\n .int()\n .min(0)\n .optional()\n .describe(\n 'The number of items to skip before starting to collect the result set.'\n ),\n expand: z\n .array(z.string())\n .optional()\n .describe('Fields to expand. Example: [\"customer\", \"target\"]'),\n});\n\nexport const createReviewsParameters = z.object({\n key: z\n .string()\n .min(2)\n .max(256)\n .optional()\n .describe('User-defined unique identifier for the review'),\n uniquenessValue: z\n .string()\n .optional()\n .describe('Must be unique among reviews'),\n locale: z\n .string()\n .optional()\n .describe('Language in which the content is written'),\n authorName: z.string().optional().describe('Name of the author'),\n title: z.string().optional().describe('Title of the review'),\n text: z.string().optional().describe('Text content of the review'),\n target: z\n .object({\n id: z.string().optional(),\n key: z.string().optional(),\n typeId: z.enum(['product', 'channel']),\n })\n .optional()\n .describe('Identifies the target of the review (Product or Channel)'),\n state: z\n .object({\n id: z.string().optional(),\n key: z.string().optional(),\n typeId: z.literal('state'),\n })\n .optional()\n .describe('State of the review used for approval processes'),\n rating: z\n .number()\n .int()\n .min(-100)\n .max(100)\n .optional()\n .describe('Rating of the Product or Channel, range -100 to 100'),\n customer: z\n .object({\n id: z.string().optional(),\n key: z.string().optional(),\n typeId: z.literal('customer'),\n })\n .optional()\n .describe('Customer who created the review'),\n custom: z\n .object({\n type: z\n .object({\n id: z.string(),\n typeId: z.literal('type'),\n })\n .optional(),\n fields: z.record(z.string(), z.any()).optional(),\n })\n .optional()\n .describe('Custom fields for the review'),\n});\n\nexport const updateReviewsParameters = z.object({\n id: z.string().optional().describe('The ID of the review to update'),\n key: z.string().optional().describe('The key of the review to update'),\n version: z.number().int().describe('The current version of the review'),\n actions: z\n .array(\n z\n .object({\n action: z\n .string()\n .describe('The name of the update action to perform'),\n })\n .and(z.record(z.string(), z.any()).optional())\n .describe(\n 'Array of update actions to perform on the review. Each action should have an \"action\" field and other fields specific to that action type.'\n )\n )\n .describe('Update actions'),\n});\n\nexport const deleteReviewsParameters = z.object({\n id: z.string().optional().describe('Review ID'),\n key: z.string().optional().describe('Review key'),\n version: z\n .number()\n .int()\n .describe('Current version (for optimistic locking)'),\n dataErasure: z.boolean().optional().describe('Delete personal data'),\n});\n","export const readReviewsPrompt = `\nThis tool will fetch a Review by ID or key (if provided) from commercetools or query all available reviews in a commercetools project if no arguments or parameters are provided.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the review to fetch.\n- key (string, optional): The key of the review to fetch.\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"rating > 50\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"rating desc\", \"createdAt asc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- expand (array of strings, optional): Fields to expand. Example: [\"customer\", \"target\"]\n`;\n\nexport const createReviewsPrompt = `\nThis tool will create a new Review in commercetools.\n\nIt takes these optional arguments:\n- key (string, optional): User-defined unique identifier for the review (2-256 characters, alphanumeric with underscores/hyphens).\n- uniquenessValue (string, optional): Must be unique among reviews.\n- locale (string, optional): Language in which the content is written.\n- authorName (string, optional): Name of the author.\n- title (string, optional): Title of the review.\n- text (string, optional): Text content of the review.\n- target (object, optional): Identifies the target of the review. Must have typeId \"product\" or \"channel\" and either id or key.\n- state (object, optional): State of the review used for approval processes. Must have typeId \"state\" and either id or key.\n- rating (integer, optional): Rating of the Product or Channel, range -100 to 100.\n- customer (object, optional): Customer who created the review. Must have typeId \"customer\" and either id or key.\n- custom (object, optional): Custom fields for the review.\n`;\n\nexport const updateReviewsPrompt = `\nThis tool will update a Review in commercetools using update actions from the commercetools API.\n\nIt takes these required arguments:\n- version (integer): The current version of the review.\n- actions (array): An array of update actions to perform on the review. Each action should have an \"action\" field indicating the action type.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the review to update (required if key is not provided).\n- key (string, optional): The key of the review to update (required if id is not provided).\n\nExample actions from commercetools API include:\n- setKey\n- setAuthorName\n- setTitle\n- setText\n- setTarget\n- setRating\n- setCustomer\n- setState\n- transitionState\n- setCustomType\n- setCustomField\n\nEach action type requires specific fields according to the commercetools API.\n`;\n\nexport const deleteReviewsPrompt = `\nThis tool will delete a Review from commercetools.\n\nIt takes these required arguments:\n- version (integer): The current version of the review (for optimistic locking).\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the review to delete (required if key is not provided).\n- key (string, optional): The key of the review to delete (required if id is not provided).\n- dataErasure (boolean, optional): Delete personal data.\n`;\n","import { z } from 'zod';\nimport {\n type Review,\n type ReviewPagedQueryResponse,\n type ReviewDraft,\n type ReviewUpdateAction,\n type ByProjectKeyRequestBuilder,\n} from '@commercetools/platform-sdk';\nimport {\n readReviewsParameters,\n createReviewsParameters,\n updateReviewsParameters,\n deleteReviewsParameters,\n} from './reviews.schema';\nimport {\n readReviewsPrompt,\n createReviewsPrompt,\n updateReviewsPrompt,\n deleteReviewsPrompt,\n} from './reviews.prompt';\nimport {\n IApiClientFactory,\n type ResourceMetadata,\n type ToolExecutionContext,\n ToolExecutionError,\n type Configuration,\n} from '../../shared';\nimport { CommercetoolsResourceHandler } from '../../handlers/commercetools.handler';\nimport { TOOL_NAME_PREFIX } from '../../utils/constants';\n\n/**\n * Reviews Resource Handler\n * Generic over configuration type - defaults to CommercetoolsConfig\n */\nexport class ReviewsHandler<\n TConfig extends Configuration = Configuration,\n> extends CommercetoolsResourceHandler<TConfig> {\n protected readonly metadata: ResourceMetadata = {\n namespace: 'reviews',\n description: 'Manage reviews in commercetools',\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readReviewsParameters,\n create: createReviewsParameters,\n update: updateReviewsParameters,\n delete: deleteReviewsParameters,\n },\n };\n\n constructor(apiClientFactory?: IApiClientFactory<TConfig>) {\n super(apiClientFactory);\n }\n\n override getToolDefinition(\n operation: 'read' | 'create' | 'update' | 'delete'\n ) {\n const prompts = {\n read: readReviewsPrompt,\n create: createReviewsPrompt,\n update: updateReviewsPrompt,\n delete: deleteReviewsPrompt,\n };\n\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation],\n };\n }\n\n protected getReviewsApi(api: ByProjectKeyRequestBuilder) {\n return api.reviews();\n }\n\n async read(\n context: ToolExecutionContext<TConfig>\n ): Promise<Review | ReviewPagedQueryResponse> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n\n const params = context.parameters as z.infer<typeof readReviewsParameters>;\n\n try {\n if (params?.id) {\n const review = await this.getReviewsApi(api)\n .withId({ ID: params.id })\n .get({\n queryArgs: {\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n\n return review.body;\n } else if (params?.key) {\n const review = await this.getReviewsApi(api)\n .withKey({ key: params.key })\n .get({\n queryArgs: {\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n return review.body;\n } else {\n const reviews = await this.getReviewsApi(api)\n .get({\n queryArgs: {\n limit: params.limit || 20,\n ...(params.offset && { offset: params.offset }),\n ...(params.sort && { sort: params.sort }),\n ...(params.where && { where: params.where }),\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n\n return reviews.body;\n }\n } catch (err: unknown) {\n throw new ToolExecutionError(\n (err as { message: string }).message || 'Failed to read reviews',\n context,\n err\n );\n }\n }\n\n async create(context: ToolExecutionContext<TConfig>): Promise<Review> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<\n typeof createReviewsParameters\n >;\n\n try {\n const review = await this.getReviewsApi(api)\n .post({\n body: params as ReviewDraft,\n })\n .execute();\n\n return review.body;\n } catch (error: unknown) {\n throw new ToolExecutionError('Failed to create review', context, error);\n }\n }\n\n async update(context: ToolExecutionContext<TConfig>): Promise<Review> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n\n const params = context.parameters as z.infer<\n typeof updateReviewsParameters\n >;\n\n try {\n let currentVersion: number;\n let reviewId: string;\n\n if (params.id) {\n const review = await this.getReviewsApi(api)\n .withId({ ID: params.id })\n .get()\n .execute();\n currentVersion = review.body.version;\n reviewId = params.id;\n } else if (params.key) {\n const review = await this.getReviewsApi(api)\n .withKey({ key: params.key })\n .get()\n .execute();\n currentVersion = review.body.version;\n reviewId = review.body.id;\n } else {\n throw new ToolExecutionError(\n 'Either id or key must be provided',\n context\n );\n }\n\n const updatedReview = await this.getReviewsApi(api)\n .withId({ ID: reviewId })\n .post({\n body: {\n version: currentVersion,\n actions: params.actions as ReviewUpdateAction[],\n },\n })\n .execute();\n\n return updatedReview.body;\n } catch (error: unknown) {\n throw new ToolExecutionError('Failed to update review', context, error);\n }\n }\n\n async delete(context: ToolExecutionContext<TConfig>): Promise<Review> {\n // const api = this.getApiRoot(context).withProjectKey({\n // projectKey: context.configuration.projectKey,\n // });\n\n // const params = context.parameters as z.infer<typeof deleteReviewsParameters>;\n\n // try {\n // let reviewId: string;\n\n // if (params.id) {\n // reviewId = params.id;\n // } else if (params.key) {\n // const review = await this.getReviewsApi(api)\n // .withKey({ key: params.key })\n // .get()\n // .execute();\n // reviewId = review.body.id;\n // } else {\n // throw new ToolExecutionError(\n // 'Either id or key must be provided',\n // context\n // );\n // }\n\n // const deletedReview = await this.getReviewsApi(api)\n // .withId({ ID: reviewId })\n // .delete({\n // queryArgs: {\n // version: params.version,\n // ...(params.dataErasure && { dataErasure: params.dataErasure }),\n // },\n // })\n // .execute();\n\n // return deletedReview.body;\n // } catch (error: unknown) {\n // throw new ToolExecutionError('Failed to delete review', context, error);\n // }\n\n throw new ToolExecutionError('Not implemented', context);\n }\n}\n\n// Export individual functions for backward compatibility or direct usage\n// These functions wrap the handler methods and can be called directly\n\nexport async function readReviews<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Review | ReviewPagedQueryResponse> {\n const handler = new ReviewsHandler<TConfig>(apiClientFactory);\n return handler.read(context);\n}\n\nexport async function createReviews<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Review> {\n const handler = new ReviewsHandler<TConfig>(apiClientFactory);\n return handler.create(context);\n}\n\nexport async function updateReviews<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Review> {\n const handler = new ReviewsHandler<TConfig>(apiClientFactory);\n return handler.update(context);\n}\n\nexport async function deleteReviews<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Review> {\n const handler = new ReviewsHandler<TConfig>(apiClientFactory);\n return handler.delete(context);\n}\n","import { z } from 'zod';\n\nexport const readStandalonePricesParameters = z.object({\n id: z.string().optional(),\n key: z.string().optional(),\n sku: z.string().optional(),\n where: z.array(z.string()).optional(),\n sort: z.array(z.string()).optional(),\n limit: z.number().int().min(1).max(500).optional(),\n offset: z.number().int().optional(),\n expand: z.array(z.string()).optional(),\n});\n\nexport const createStandalonePricesParameters = z.object({\n body: z.record(z.any()),\n});\n\nexport const updateStandalonePricesParameters = z.object({\n id: z.string().optional(),\n key: z.string().optional(),\n version: z.number().optional(),\n actions: z.array(z.record(z.any())).optional(),\n});\n\nexport const deleteStandalonePricesParameters = z.object({\n id: z.string().optional(),\n key: z.string().optional(),\n version: z.number().optional(),\n});\n","export const readStandalonePricesPrompt = 'Read standalone prices parameters';\nexport const createStandalonePricesPrompt =\n 'Create standalone price parameters';\nexport const updateStandalonePricesPrompt =\n 'Update standalone price parameters';\nexport const deleteStandalonePricesPrompt =\n 'Delete standalone price parameters';\n","import { z } from 'zod';\nimport {\n type StandalonePrice,\n type StandalonePricePagedQueryResponse,\n type ByProjectKeyRequestBuilder,\n StandalonePriceDraft,\n StandalonePriceUpdateAction,\n} from '@commercetools/platform-sdk';\nimport {\n readStandalonePricesParameters,\n createStandalonePricesParameters,\n updateStandalonePricesParameters,\n deleteStandalonePricesParameters,\n} from './standalone-prices.schema';\nimport {\n readStandalonePricesPrompt,\n createStandalonePricesPrompt,\n updateStandalonePricesPrompt,\n deleteStandalonePricesPrompt,\n} from './standalone-prices.prompt';\nimport {\n IApiClientFactory,\n type ResourceMetadata,\n type ToolExecutionContext,\n ToolExecutionError,\n type Configuration,\n} from '../../shared';\nimport { CommercetoolsResourceHandler } from '../../handlers/commercetools.handler';\nimport { TOOL_NAME_PREFIX } from '../../utils/constants';\n\nexport class StandalonePricesHandler<\n TConfig extends Configuration = Configuration,\n> extends CommercetoolsResourceHandler<TConfig> {\n protected readonly metadata: ResourceMetadata = {\n namespace: 'standalone-prices',\n description: 'Manage standalone prices in commercetools',\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readStandalonePricesParameters,\n create: createStandalonePricesParameters,\n update: updateStandalonePricesParameters,\n delete: deleteStandalonePricesParameters,\n },\n };\n\n constructor(apiClientFactory?: IApiClientFactory<TConfig>) {\n super(apiClientFactory);\n }\n\n override getToolDefinition(\n operation: 'read' | 'create' | 'update' | 'delete'\n ) {\n const prompts = {\n read: readStandalonePricesPrompt,\n create: createStandalonePricesPrompt,\n update: updateStandalonePricesPrompt,\n delete: deleteStandalonePricesPrompt,\n };\n\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation],\n };\n }\n\n protected getStandalonePricesApi(api: ByProjectKeyRequestBuilder) {\n return api.standalonePrices();\n }\n\n async read(\n context: ToolExecutionContext<TConfig>\n ): Promise<StandalonePrice | StandalonePricePagedQueryResponse> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<\n typeof readStandalonePricesParameters\n >;\n try {\n if (params?.id) {\n const res = await this.getStandalonePricesApi(api)\n .withId({ ID: params.id })\n .get()\n .execute();\n return res.body;\n } else if (params?.key) {\n const res = await this.getStandalonePricesApi(api)\n .withKey({ key: params.key })\n .get()\n .execute();\n return res.body;\n } else {\n const res = await this.getStandalonePricesApi(api)\n .get({\n queryArgs: {\n ...(params.limit && { limit: params.limit }),\n ...(params.offset && { offset: params.offset }),\n ...(params.where && { where: params.where }),\n },\n })\n .execute();\n return res.body;\n }\n } catch (err: unknown) {\n throw new ToolExecutionError(\n 'Failed to read standalone prices',\n context,\n err\n );\n }\n }\n\n async create(\n context: ToolExecutionContext<TConfig>\n ): Promise<StandalonePrice> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<\n typeof createStandalonePricesParameters\n >;\n try {\n const created = await this.getStandalonePricesApi(api)\n .post({ body: params as StandalonePriceDraft })\n .execute();\n return created.body;\n } catch (err: unknown) {\n throw new ToolExecutionError(\n 'Failed to create standalone price',\n context,\n err\n );\n }\n }\n\n async update(\n context: ToolExecutionContext<TConfig>\n ): Promise<StandalonePrice> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<\n typeof updateStandalonePricesParameters\n >;\n try {\n let currentVersion = params.version;\n let id = params.id;\n if (!id && params.key) {\n const s = await this.getStandalonePricesApi(api)\n .withKey({ key: params.key })\n .get()\n .execute();\n id = s.body.id;\n currentVersion = s.body.version;\n }\n if (!id)\n throw new ToolExecutionError(\n 'Either id or key must be provided',\n context\n );\n const updated = await this.getStandalonePricesApi(api)\n .withId({ ID: id })\n .post({\n body: {\n version: currentVersion,\n actions: params.actions as StandalonePriceUpdateAction[],\n },\n })\n .execute();\n return updated.body;\n } catch (err: unknown) {\n throw new ToolExecutionError(\n 'Failed to update standalone price',\n context,\n err\n );\n }\n }\n\n async delete(\n context: ToolExecutionContext<TConfig>\n ): Promise<StandalonePrice> {\n // const api = this.getApiRoot(context).withProjectKey({ projectKey: context.configuration.projectKey });\n // const params = context.parameters as z.infer<typeof deleteStandalonePricesParameters>;\n // try {\n // let id = params.id;\n // if (!id && params.key) {\n // const s = await this.getStandalonePricesApi(api).withKey({ key: params.key }).get().execute();\n // id = s.body.id;\n // }\n // if (!id) throw new ToolExecutionError('Either id or key must be provided', context);\n // const deleted = await this.getStandalonePricesApi(api).withId({ ID: id }).delete({\n // queryArgs: { version: params.version },\n // }).execute();\n // return deleted.body;\n // } catch (err: unknown) {\n // throw new ToolExecutionError('Failed to delete standalone price', context, err);\n // }\n\n throw new ToolExecutionError(\n 'Delete not supported for standalone prices',\n context\n );\n }\n}\n\nexport async function readStandalonePrices<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<StandalonePrice | StandalonePricePagedQueryResponse> {\n const handler = new StandalonePricesHandler<TConfig>(apiClientFactory);\n return handler.read(context);\n}\n\nexport async function createStandalonePrices<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<StandalonePrice> {\n const handler = new StandalonePricesHandler<TConfig>(apiClientFactory);\n return handler.create(context);\n}\n\nexport async function updateStandalonePrices<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<StandalonePrice> {\n const handler = new StandalonePricesHandler<TConfig>(apiClientFactory);\n return handler.update(context);\n}\n\nexport async function deleteStandalonePrices<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<StandalonePrice> {\n const handler = new StandalonePricesHandler<TConfig>(apiClientFactory);\n return handler.delete(context);\n}\n","import { z } from 'zod';\n\nexport const readStatesParameters = z.object({\n id: z.string().optional(),\n key: z.string().optional(),\n where: z.array(z.string()).optional(),\n sort: z.array(z.string()).optional(),\n limit: z.number().int().min(1).max(500).optional(),\n offset: z.number().int().optional(),\n expand: z.array(z.string()).optional(),\n withTotal: z.boolean().optional(),\n});\n\nexport const createStatesParameters = z.object({\n body: z.record(z.any()),\n});\n\nexport const updateStatesParameters = z.object({\n id: z.string().optional(),\n key: z.string().optional(),\n version: z.number().optional(),\n actions: z.array(z.record(z.any())).optional(),\n});\n\nexport const deleteStatesParameters = z.object({\n id: z.string().optional(),\n key: z.string().optional(),\n version: z.number().optional(),\n});\n","export const readStatesPrompt = `\nRead States by ID, key, or query predicates. States model finite-state machines used for Orders, Products, Reviews, etc.\n\nOptional arguments:\n- id (string): fetch a single State by ID\n- key (string): fetch a single State by key\n- where (array[string]): query predicates, e.g. ['type=\"ProductState\"']\n- sort (array[string]): sort criteria\n- limit (int): 1-500\n- offset (int)\n- expand (array[string])\n- withTotal (boolean): include total count\n`;\n\nexport const createStatesPrompt = `\nCreate a new State in the project.\n\nRequired (in body):\n- key (string): unique key for the State\n- type (string): StateTypeEnum (e.g., ProductState, ReviewState)\n- name (object): Localized name, e.g. { \"en\": \"New State\" }\n\nOptional:\n- description (object)\n- initial (boolean)\n- roles (array[string])\n- transitions (array of state references)\n`;\n\nexport const updateStatesPrompt = `\nUpdate State by id or key using update actions.\n\nRequired:\n- version (int)\n- actions (array): update actions, each must include 'action' discriminator\n\nOptional:\n- id (string) or key (string) to resolve the State to update\n`;\n\nexport const deleteStatesPrompt = `\nDelete a State by id or key.\n\nRequired:\n- version (int)\n\nOptional:\n- id (string) or key (string)\n`;\n","import { z } from 'zod';\nimport {\n type State,\n type StatePagedQueryResponse,\n type ByProjectKeyRequestBuilder,\n StateUpdateAction,\n StateDraft,\n} from '@commercetools/platform-sdk';\nimport {\n readStatesParameters,\n createStatesParameters,\n updateStatesParameters,\n deleteStatesParameters,\n} from './states.schema';\nimport {\n readStatesPrompt,\n createStatesPrompt,\n updateStatesPrompt,\n deleteStatesPrompt,\n} from './states.prompt';\nimport {\n IApiClientFactory,\n type ResourceMetadata,\n type ToolExecutionContext,\n ToolExecutionError,\n type Configuration,\n} from '../../shared';\nimport { CommercetoolsResourceHandler } from '../../handlers/commercetools.handler';\nimport { TOOL_NAME_PREFIX } from '../../utils/constants';\n\nexport class StatesHandler<\n TConfig extends Configuration = Configuration,\n> extends CommercetoolsResourceHandler<TConfig> {\n protected readonly metadata: ResourceMetadata = {\n namespace: 'states',\n description: 'Manage states in commercetools',\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readStatesParameters,\n create: createStatesParameters,\n update: updateStatesParameters,\n delete: deleteStatesParameters,\n },\n };\n\n constructor(apiClientFactory?: IApiClientFactory<TConfig>) {\n super(apiClientFactory);\n }\n\n override getToolDefinition(\n operation: 'read' | 'create' | 'update' | 'delete'\n ) {\n const prompts = {\n read: readStatesPrompt,\n create: createStatesPrompt,\n update: updateStatesPrompt,\n delete: deleteStatesPrompt,\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation],\n };\n }\n\n protected getStatesApi(api: ByProjectKeyRequestBuilder) {\n return api.states();\n }\n\n async read(\n context: ToolExecutionContext<TConfig>\n ): Promise<State | StatePagedQueryResponse> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<typeof readStatesParameters>;\n try {\n if (params?.id) {\n const res = await this.getStatesApi(api)\n .withId({ ID: params.id })\n .get()\n .execute();\n return res.body;\n } else if (params?.key) {\n const res = await this.getStatesApi(api)\n .withKey({ key: params.key })\n .get()\n .execute();\n return res.body;\n } else {\n const res = await this.getStatesApi(api)\n .get({\n queryArgs: {\n ...(params.limit && { limit: params.limit }),\n ...(params.offset && { offset: params.offset }),\n ...(params.sort && { sort: params.sort }),\n ...(params.where && { where: params.where }),\n ...(params.withTotal !== undefined && {\n withTotal: params.withTotal,\n }),\n },\n })\n .execute();\n return res.body;\n }\n } catch (err: unknown) {\n throw new ToolExecutionError('Failed to read states', context, err);\n }\n }\n\n async create(context: ToolExecutionContext<TConfig>): Promise<State> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<typeof createStatesParameters>;\n try {\n const created = await this.getStatesApi(api)\n .post({ body: params as StateDraft })\n .execute();\n return created.body;\n } catch (err: unknown) {\n throw new ToolExecutionError('Failed to create state', context, err);\n }\n }\n\n async update(context: ToolExecutionContext<TConfig>): Promise<State> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<typeof updateStatesParameters>;\n try {\n let currentVersion = params.version;\n let stateId = params.id;\n if (!stateId && params.key) {\n const s = await this.getStatesApi(api)\n .withKey({ key: params.key })\n .get()\n .execute();\n stateId = s.body.id;\n currentVersion = s.body.version;\n }\n if (!stateId)\n throw new ToolExecutionError(\n 'Either id or key must be provided',\n context\n );\n const updated = await this.getStatesApi(api)\n .withId({ ID: stateId })\n .post({\n body: {\n version: currentVersion,\n actions: params.actions as StateUpdateAction[],\n },\n })\n .execute();\n return updated.body;\n } catch (err: unknown) {\n throw new ToolExecutionError('Failed to update state', context, err);\n }\n }\n\n async delete(context: ToolExecutionContext<TConfig>): Promise<State> {\n // const api = this.getApiRoot(context).withProjectKey({ projectKey: context.configuration.projectKey });\n // const params = context.parameters as z.infer<typeof deleteStatesParameters>;\n // try {\n // let stateId = params.id;\n // if (!stateId && params.key) {\n // const s = await this.getStatesApi(api).withKey({ key: params.key }).get().execute();\n // stateId = s.body.id;\n // }\n // if (!stateId) throw new ToolExecutionError('Either id or key must be provided', context);\n // const deleted = await this.getStatesApi(api).withId({ ID: stateId }).delete({ queryArgs: { version: params.version } }).execute();\n // return deleted.body;\n // } catch (err: unknown) {\n // throw new ToolExecutionError('Failed to delete state', context, err);\n // }\n\n throw new ToolExecutionError('Delete not supported for states', context);\n }\n}\n\nexport async function readStates<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<State | StatePagedQueryResponse> {\n const handler = new StatesHandler<TConfig>(apiClientFactory);\n return handler.read(context);\n}\n\nexport async function createStates<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<State> {\n const handler = new StatesHandler<TConfig>(apiClientFactory);\n return handler.create(context);\n}\n\nexport async function updateStates<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<State> {\n const handler = new StatesHandler<TConfig>(apiClientFactory);\n return handler.update(context);\n}\n\nexport async function deleteStates<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<State> {\n const handler = new StatesHandler<TConfig>(apiClientFactory);\n return handler.delete(context);\n}\n","import { z } from 'zod';\n\nexport const readStoresParameters = z.object({\n id: z.string().optional(),\n key: z.string().optional(),\n where: z.array(z.string()).optional(),\n sort: z.array(z.string()).optional(),\n limit: z.number().int().min(1).max(500).optional(),\n offset: z.number().int().optional(),\n expand: z.array(z.string()).optional(),\n});\n\nexport const createStoresParameters = z.object({\n body: z.record(z.any()),\n});\n\nexport const updateStoresParameters = z.object({\n id: z.string().optional(),\n key: z.string().optional(),\n version: z.number().optional(),\n actions: z.array(z.record(z.any())).optional(),\n});\n\nexport const deleteStoresParameters = z.object({\n id: z.string().optional(),\n key: z.string().optional(),\n version: z.number().optional(),\n});\n","export const readStoresPrompt = 'Read stores parameters';\nexport const createStoresPrompt = 'Create store parameters';\nexport const updateStoresPrompt = 'Update store parameters';\nexport const deleteStoresPrompt = 'Delete store parameters';\n","import { z } from 'zod';\nimport {\n type Store,\n type StorePagedQueryResponse,\n type ByProjectKeyRequestBuilder,\n StoreUpdateAction,\n StoreDraft,\n} from '@commercetools/platform-sdk';\nimport {\n readStoresParameters,\n createStoresParameters,\n updateStoresParameters,\n deleteStoresParameters,\n} from './stores.schema';\nimport {\n readStoresPrompt,\n createStoresPrompt,\n updateStoresPrompt,\n deleteStoresPrompt,\n} from './stores.prompt';\nimport {\n IApiClientFactory,\n type ResourceMetadata,\n type ToolExecutionContext,\n ToolExecutionError,\n type Configuration,\n} from '../../shared';\nimport { CommercetoolsResourceHandler } from '../../handlers/commercetools.handler';\nimport { TOOL_NAME_PREFIX } from '../../utils/constants';\n\nexport class StoresHandler<\n TConfig extends Configuration = Configuration,\n> extends CommercetoolsResourceHandler<TConfig> {\n protected readonly metadata: ResourceMetadata = {\n namespace: 'stores',\n description: 'Manage stores in commercetools',\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readStoresParameters,\n create: createStoresParameters,\n update: updateStoresParameters,\n delete: deleteStoresParameters,\n },\n };\n\n constructor(apiClientFactory?: IApiClientFactory<TConfig>) {\n super(apiClientFactory);\n }\n\n override getToolDefinition(\n operation: 'read' | 'create' | 'update' | 'delete'\n ) {\n const prompts = {\n read: readStoresPrompt,\n create: createStoresPrompt,\n update: updateStoresPrompt,\n delete: deleteStoresPrompt,\n };\n\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation],\n };\n }\n\n protected getStoresApi(api: ByProjectKeyRequestBuilder) {\n return api.stores();\n }\n\n async read(\n context: ToolExecutionContext<TConfig>\n ): Promise<Store | StorePagedQueryResponse> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<typeof readStoresParameters>;\n try {\n if (params?.id) {\n const res = await this.getStoresApi(api)\n .withId({ ID: params.id })\n .get()\n .execute();\n return res.body;\n } else if (params?.key) {\n const res = await this.getStoresApi(api)\n .withKey({ key: params.key })\n .get()\n .execute();\n return res.body;\n } else {\n const res = await this.getStoresApi(api)\n .get({\n queryArgs: {\n ...(params.limit && { limit: params.limit }),\n ...(params.offset && { offset: params.offset }),\n ...(params.sort && { sort: params.sort }),\n ...(params.where && { where: params.where }),\n },\n })\n .execute();\n return res.body;\n }\n } catch (err: unknown) {\n throw new ToolExecutionError('Failed to read stores', context, err);\n }\n }\n\n async create(context: ToolExecutionContext<TConfig>): Promise<Store> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<typeof createStoresParameters>;\n try {\n const created = await this.getStoresApi(api)\n .post({ body: params as StoreDraft })\n .execute();\n return created.body;\n } catch (err: unknown) {\n throw new ToolExecutionError('Failed to create store', context, err);\n }\n }\n\n async update(context: ToolExecutionContext<TConfig>): Promise<Store> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<typeof updateStoresParameters>;\n try {\n let currentVersion = params.version;\n let storeId = params.id;\n if (!storeId && params.key) {\n const s = await this.getStoresApi(api)\n .withKey({ key: params.key })\n .get()\n .execute();\n storeId = s.body.id;\n currentVersion = s.body.version;\n }\n if (!storeId)\n throw new ToolExecutionError(\n 'Either id or key must be provided',\n context\n );\n const updated = await this.getStoresApi(api)\n .withId({ ID: storeId })\n .post({\n body: {\n version: currentVersion,\n actions: params.actions as StoreUpdateAction[],\n },\n })\n .execute();\n return updated.body;\n } catch (err: unknown) {\n throw new ToolExecutionError('Failed to update store', context, err);\n }\n }\n\n async delete(context: ToolExecutionContext<TConfig>): Promise<Store> {\n // const api = this.getApiRoot(context).withProjectKey({ projectKey: context.configuration.projectKey });\n // const params = context.parameters as z.infer<typeof deleteStoresParameters>;\n // try {\n // let storeId = params.id;\n // if (!storeId && params.key) {\n // const s = await this.getStoresApi(api).withKey({ key: params.key }).get().execute();\n // storeId = s.body.id;\n // }\n // if (!storeId) throw new ToolExecutionError('Either id or key must be provided', context);\n // const deleted = await this.getStoresApi(api).withId({ ID: storeId }).delete({\n // queryArgs: {\n // version: params.version,\n // },\n // }).execute();\n // return deleted.body;\n // } catch (err: unknown) {\n // throw new ToolExecutionError('Failed to delete store', context, err);\n // }\n\n throw new ToolExecutionError('Delete not supported for stores', context);\n }\n}\n\nexport async function readStores<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Store | StorePagedQueryResponse> {\n const handler = new StoresHandler<TConfig>(apiClientFactory);\n return handler.read(context);\n}\n\nexport async function createStores<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Store> {\n const handler = new StoresHandler<TConfig>(apiClientFactory);\n return handler.create(context);\n}\n\nexport async function updateStores<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Store> {\n const handler = new StoresHandler<TConfig>(apiClientFactory);\n return handler.update(context);\n}\n\nexport async function deleteStores<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Store> {\n const handler = new StoresHandler<TConfig>(apiClientFactory);\n return handler.delete(context);\n}\n","import { z } from 'zod';\n\nexport const readSubscriptionsParameters = z.object({\n id: z.string().optional(),\n key: z.string().optional(),\n where: z.array(z.string()).optional(),\n sort: z.array(z.string()).optional(),\n limit: z.number().int().min(1).max(500).optional(),\n offset: z.number().int().optional(),\n expand: z.array(z.string()).optional(),\n});\n\nexport const createSubscriptionsParameters = z.object({\n body: z.record(z.any()),\n});\n\nexport const updateSubscriptionsParameters = z.object({\n id: z.string().optional(),\n key: z.string().optional(),\n version: z.number().optional(),\n actions: z.array(z.record(z.any())).optional(),\n});\n\nexport const deleteSubscriptionsParameters = z.object({\n id: z.string().optional(),\n key: z.string().optional(),\n version: z.number().optional(),\n});\n","export const readSubscriptionsPrompt = `\nRead Subscriptions by id, key or query. Subscriptions send notifications to external destinations (SQS/SNS/EventBridge/GooglePubSub/etc).\n\nOptional arguments:\n- id (string): fetch a single Subscription by ID\n- key (string): fetch a single Subscription by key\n- where (array[string]): query predicates\n- sort (array[string])\n- limit (int)\n- offset (int)\n- expand (array[string])\n\nNotes:\n- Subscriptions have complex destination configuration. Use create/update only if you supply a valid SubscriptionDraft.\n`;\n\nexport const createSubscriptionsPrompt = `\nCreate a Subscription in the project.\n\nRequired (in body):\n- destination (object): Destination configuration (SQS, SNS, GoogleCloudPubSub, AzureEventGrid, AzureServiceBus, ConfluentCloud, EventBridge) with provider-specific fields.\n\nOptional (in body):\n- key (string): user-defined identifier\n- messages (array): message subscriptions\n- changes (array): change subscriptions\n- events (array): event subscriptions (BETA)\n`;\n\nexport const updateSubscriptionsPrompt = `\nUpdate a Subscription by id or key using update actions.\n\nRequired:\n- version (int)\n- actions (array): update actions (e.g., setKey, changeDestination, setMessages, setChanges)\n\nOptional:\n- id (string) or key (string)\n`;\n\nexport const deleteSubscriptionsPrompt = `\nDelete a Subscription by id or key.\n\nRequired:\n- version (int)\n\nOptional:\n- id (string) or key (string)\n`;\n","import { z } from 'zod';\nimport {\n type Subscription,\n type SubscriptionPagedQueryResponse,\n type SubscriptionDraft,\n type SubscriptionUpdateAction,\n type ByProjectKeyRequestBuilder,\n} from '@commercetools/platform-sdk';\nimport {\n readSubscriptionsParameters,\n createSubscriptionsParameters,\n updateSubscriptionsParameters,\n deleteSubscriptionsParameters,\n} from './subscriptions.schema';\nimport {\n readSubscriptionsPrompt,\n createSubscriptionsPrompt,\n updateSubscriptionsPrompt,\n deleteSubscriptionsPrompt,\n} from './subscriptions.prompt';\nimport {\n IApiClientFactory,\n type ResourceMetadata,\n type ToolExecutionContext,\n ToolExecutionError,\n type Configuration,\n} from '../../shared';\nimport { CommercetoolsResourceHandler } from '../../handlers/commercetools.handler';\nimport { TOOL_NAME_PREFIX } from '../../utils/constants';\n\nexport class SubscriptionsHandler<\n TConfig extends Configuration = Configuration,\n> extends CommercetoolsResourceHandler<TConfig> {\n protected readonly metadata: ResourceMetadata = {\n namespace: 'subscriptions',\n description: 'Manage subscriptions in commercetools',\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readSubscriptionsParameters,\n create: createSubscriptionsParameters,\n update: updateSubscriptionsParameters,\n delete: deleteSubscriptionsParameters,\n },\n };\n\n constructor(apiClientFactory?: IApiClientFactory<TConfig>) {\n super(apiClientFactory);\n }\n\n override getToolDefinition(\n operation: 'read' | 'create' | 'update' | 'delete'\n ) {\n const prompts = {\n read: readSubscriptionsPrompt,\n create: createSubscriptionsPrompt,\n update: updateSubscriptionsPrompt,\n delete: deleteSubscriptionsPrompt,\n };\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation],\n };\n }\n\n protected getSubscriptionsApi(api: ByProjectKeyRequestBuilder) {\n return api.subscriptions();\n }\n\n async read(\n context: ToolExecutionContext<TConfig>\n ): Promise<Subscription | SubscriptionPagedQueryResponse> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<\n typeof readSubscriptionsParameters\n >;\n try {\n if (params?.id) {\n const res = await this.getSubscriptionsApi(api)\n .withId({ ID: params.id })\n .get()\n .execute();\n return res.body;\n } else if (params?.key) {\n const res = await this.getSubscriptionsApi(api)\n .withKey({ key: params.key })\n .get()\n .execute();\n return res.body;\n } else {\n const res = await this.getSubscriptionsApi(api)\n .get({\n queryArgs: {\n ...(params.limit && { limit: params.limit }),\n ...(params.offset && { offset: params.offset }),\n ...(params.sort && { sort: params.sort }),\n ...(params.where && { where: params.where }),\n },\n })\n .execute();\n return res.body;\n }\n } catch (err: unknown) {\n throw new ToolExecutionError(\n 'Failed to read subscriptions',\n context,\n err\n );\n }\n }\n\n async create(context: ToolExecutionContext<TConfig>): Promise<Subscription> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<\n typeof createSubscriptionsParameters\n >;\n try {\n const created = await this.getSubscriptionsApi(api)\n .post({ body: params as SubscriptionDraft })\n .execute();\n return created.body;\n } catch (err: unknown) {\n throw new ToolExecutionError(\n 'Failed to create subscription',\n context,\n err\n );\n }\n }\n\n async update(context: ToolExecutionContext<TConfig>): Promise<Subscription> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<\n typeof updateSubscriptionsParameters\n >;\n try {\n let currentVersion = params.version;\n let id = params.id;\n if (!id && params.key) {\n const s = await this.getSubscriptionsApi(api)\n .withKey({ key: params.key })\n .get()\n .execute();\n id = s.body.id;\n currentVersion = s.body.version;\n }\n if (!id)\n throw new ToolExecutionError(\n 'Either id or key must be provided',\n context\n );\n const updated = await this.getSubscriptionsApi(api)\n .withId({ ID: id })\n .post({\n body: {\n version: currentVersion,\n actions: params.actions as SubscriptionUpdateAction[],\n },\n })\n .execute();\n return updated.body;\n } catch (err: unknown) {\n throw new ToolExecutionError(\n 'Failed to update subscription',\n context,\n err\n );\n }\n }\n\n async delete(context: ToolExecutionContext<TConfig>): Promise<Subscription> {\n // const api = this.getApiRoot(context).withProjectKey({ projectKey: context.configuration.projectKey });\n // const params = context.parameters as z.infer<typeof deleteSubscriptionsParameters>;\n // try {\n // let id = params.id;\n // if (!id && params.key) {\n // const s = await this.getSubscriptionsApi(api).withKey({ key: params.key }).get().execute();\n // id = s.body.id;\n // }\n // if (!id) throw new ToolExecutionError('Either id or key must be provided', context);\n // const deleted = await this.getSubscriptionsApi(api).withId({ ID: id }).delete({ queryArgs: { version: params.version } }).execute();\n // return deleted.body;\n // } catch (err: unknown) {\n // throw new ToolExecutionError('Failed to delete subscription', context, err);\n // }\n\n throw new ToolExecutionError(\n 'Delete not supported for subscriptions',\n context\n );\n }\n}\n\nexport async function readSubscriptions<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Subscription | SubscriptionPagedQueryResponse> {\n const handler = new SubscriptionsHandler<TConfig>(apiClientFactory);\n return handler.read(context);\n}\n\nexport async function createSubscriptions<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Subscription> {\n const handler = new SubscriptionsHandler<TConfig>(apiClientFactory);\n return handler.create(context);\n}\n\nexport async function updateSubscriptions<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Subscription> {\n const handler = new SubscriptionsHandler<TConfig>(apiClientFactory);\n return handler.update(context);\n}\n\nexport async function deleteSubscriptions<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Subscription> {\n const handler = new SubscriptionsHandler<TConfig>(apiClientFactory);\n return handler.delete(context);\n}\n","import { z } from 'zod';\n\nexport const readTaxCategoriesParameters = z.object({\n id: z.string().optional().describe('Tax Category ID'),\n key: z.string().optional().describe('Tax Category key'),\n where: z\n .array(z.string())\n .optional()\n .describe(\n 'Query predicates specified as strings. Example: [\"name = \\\\\"Standard\\\\\"\"]'\n ),\n sort: z\n .array(z.string())\n .optional()\n .describe(\n 'Sort criteria for the results. Example: [\"name asc\", \"createdAt desc\"]'\n ),\n limit: z\n .number()\n .int()\n .min(1)\n .max(500)\n .optional()\n .describe(\n 'A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.'\n ),\n offset: z\n .number()\n .int()\n .min(0)\n .optional()\n .describe(\n 'The number of items to skip before starting to collect the result set.'\n ),\n expand: z\n .array(z.string())\n .optional()\n .describe('Fields to expand. Example: []'),\n});\n\nexport const createTaxCategoriesParameters = z.object({\n key: z\n .string()\n .min(2)\n .max(256)\n .optional()\n .describe('User-defined unique identifier for the tax category'),\n name: z.string().describe('Tax Category name'),\n description: z.string().optional().describe('Tax Category description'),\n rates: z\n .array(\n z.object({\n name: z.string().describe('Tax rate name'),\n amount: z\n .number()\n .min(0)\n .max(1)\n .optional()\n .describe('Tax rate amount (0-1)'),\n includedInPrice: z\n .boolean()\n .optional()\n .describe('Whether the tax is included in the price'),\n country: z.string().describe('Country code (ISO 3166-1 alpha-2)'),\n state: z.string().optional().describe('State within the country'),\n subRates: z\n .array(\n z.object({\n name: z.string(),\n amount: z.number().min(0).max(1).optional(),\n })\n )\n .optional()\n .describe('Sub-rates for the tax rate'),\n })\n )\n .optional()\n .describe('Array of tax rates'),\n});\n\nexport const updateTaxCategoriesParameters = z.object({\n id: z.string().optional().describe('The ID of the tax category to update'),\n key: z.string().optional().describe('The key of the tax category to update'),\n version: z.number().int().describe('The current version of the tax category'),\n actions: z\n .array(\n z\n .object({\n action: z\n .string()\n .describe('The name of the update action to perform'),\n })\n .and(z.record(z.string(), z.any()).optional())\n .describe(\n 'Array of update actions to perform on the tax category. Each action should have an \"action\" field and other fields specific to that action type.'\n )\n )\n .describe('Update actions'),\n});\n\nexport const deleteTaxCategoriesParameters = z.object({\n id: z.string().optional().describe('Tax Category ID'),\n key: z.string().optional().describe('Tax Category key'),\n version: z\n .number()\n .int()\n .describe('Current version (for optimistic locking)'),\n});\n","export const readTaxCategoriesPrompt = `\nThis tool will fetch a Tax Category by ID or key (if provided) from commercetools or query all available tax categories in a commercetools project if no arguments or parameters are provided.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the tax category to fetch.\n- key (string, optional): The key of the tax category to fetch.\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"name = \\\\\"Standard\\\\\"\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"name asc\", \"createdAt desc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- expand (array of strings, optional): Fields to expand.\n`;\n\nexport const createTaxCategoriesPrompt = `\nThis tool will create a new Tax Category in commercetools.\n\nIt takes these required arguments:\n- name (string): Tax Category name.\n\nIt takes these optional arguments:\n- key (string, optional): User-defined unique identifier for the tax category (2-256 characters, alphanumeric with underscores/hyphens).\n- description (string, optional): Tax Category description.\n- rates (array, optional): Array of tax rate objects. Each tax rate should have:\n - name (string): Tax rate name.\n - amount (number, optional): Tax rate amount (0-1).\n - includedInPrice (boolean, optional): Whether the tax is included in the price.\n - country (string): Country code (ISO 3166-1 alpha-2).\n - state (string, optional): State within the country.\n - subRates (array, optional): Array of sub-rate objects.\n`;\n\nexport const updateTaxCategoriesPrompt = `\nThis tool will update a Tax Category in commercetools using update actions from the commercetools API.\n\nIt takes these required arguments:\n- id (string): The ID of the tax category to update.\n- version (integer): The current version of the tax category.\n- actions (array): An array of update actions to perform on the tax category. Each action should have an \"action\" field indicating the action type.\n\nExample actions from commercetools API include:\n- addTaxRate\n- changeName\n- removeTaxRate\n- replaceTaxRate\n- setDescription\n- setKey\n\nEach action type requires specific fields according to the commercetools API.\n`;\n\nexport const deleteTaxCategoriesPrompt = `\nThis tool will delete a Tax Category from commercetools.\n\nIt takes these required arguments:\n- id (string): The ID of the tax category to delete.\n- version (integer): The current version of the tax category (for optimistic locking).\n`;\n","import { z } from 'zod';\nimport {\n type TaxCategory,\n type TaxCategoryPagedQueryResponse,\n type TaxCategoryDraft,\n type TaxCategoryUpdateAction,\n type ByProjectKeyRequestBuilder,\n} from '@commercetools/platform-sdk';\nimport {\n readTaxCategoriesParameters,\n createTaxCategoriesParameters,\n updateTaxCategoriesParameters,\n deleteTaxCategoriesParameters,\n} from './tax-categories.schema';\nimport {\n readTaxCategoriesPrompt,\n createTaxCategoriesPrompt,\n updateTaxCategoriesPrompt,\n deleteTaxCategoriesPrompt,\n} from './tax-categories.prompt';\nimport {\n IApiClientFactory,\n type ResourceMetadata,\n type ToolExecutionContext,\n ToolExecutionError,\n type Configuration,\n} from '../../shared';\nimport { CommercetoolsResourceHandler } from '../../handlers/commercetools.handler';\nimport { TOOL_NAME_PREFIX } from '../../utils/constants';\n\n/**\n * Tax Categories Resource Handler\n * Generic over configuration type - defaults to CommercetoolsConfig\n */\nexport class TaxCategoriesHandler<\n TConfig extends Configuration = Configuration,\n> extends CommercetoolsResourceHandler<TConfig> {\n protected readonly metadata: ResourceMetadata = {\n namespace: 'tax-categories',\n description: 'Manage tax categories in commercetools',\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readTaxCategoriesParameters,\n create: createTaxCategoriesParameters,\n update: updateTaxCategoriesParameters,\n delete: deleteTaxCategoriesParameters,\n },\n };\n\n constructor(apiClientFactory?: IApiClientFactory<TConfig>) {\n super(apiClientFactory);\n }\n\n override getToolDefinition(\n operation: 'read' | 'create' | 'update' | 'delete'\n ) {\n const prompts = {\n read: readTaxCategoriesPrompt,\n create: createTaxCategoriesPrompt,\n update: updateTaxCategoriesPrompt,\n delete: deleteTaxCategoriesPrompt,\n };\n\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation],\n };\n }\n\n protected getTaxCategoriesApi(api: ByProjectKeyRequestBuilder) {\n return api.taxCategories();\n }\n\n async read(\n context: ToolExecutionContext<TConfig>\n ): Promise<TaxCategory | TaxCategoryPagedQueryResponse> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n\n const params = context.parameters as z.infer<\n typeof readTaxCategoriesParameters\n >;\n\n try {\n if (params?.id) {\n const taxCategory = await this.getTaxCategoriesApi(api)\n .withId({ ID: params.id })\n .get({\n queryArgs: {\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n\n return taxCategory.body;\n } else if (params?.key) {\n const taxCategory = await this.getTaxCategoriesApi(api)\n .withKey({ key: params.key })\n .get()\n .execute();\n return taxCategory.body;\n } else {\n const taxCategories = await this.getTaxCategoriesApi(api)\n .get({\n queryArgs: {\n limit: params.limit || 20,\n ...(params.offset && { offset: params.offset }),\n ...(params.sort && { sort: params.sort }),\n ...(params.where && { where: params.where }),\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n\n return taxCategories.body;\n }\n } catch (err: unknown) {\n throw new ToolExecutionError(\n (err as { message: string }).message || 'Failed to read tax categories',\n context,\n err\n );\n }\n }\n\n async create(context: ToolExecutionContext<TConfig>): Promise<TaxCategory> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<\n typeof createTaxCategoriesParameters\n >;\n\n try {\n const taxCategory = await this.getTaxCategoriesApi(api)\n .post({\n body: params as TaxCategoryDraft,\n })\n .execute();\n\n return taxCategory.body;\n } catch (error: unknown) {\n throw new ToolExecutionError(\n 'Failed to create tax category',\n context,\n error\n );\n }\n }\n\n async update(context: ToolExecutionContext<TConfig>): Promise<TaxCategory> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n\n const params = context.parameters as z.infer<\n typeof updateTaxCategoriesParameters\n >;\n\n try {\n let currentVersion: number;\n let taxCategoryId: string;\n\n if (params.id) {\n const taxCategory = await this.getTaxCategoriesApi(api)\n .withId({ ID: params.id })\n .get()\n .execute();\n currentVersion = taxCategory.body.version;\n taxCategoryId = params.id;\n } else if (params.key) {\n const taxCategory = await this.getTaxCategoriesApi(api)\n .withKey({ key: params.key })\n .get()\n .execute();\n currentVersion = taxCategory.body.version;\n taxCategoryId = taxCategory.body.id;\n } else {\n throw new ToolExecutionError(\n 'Either id or key must be provided',\n context\n );\n }\n\n const updatedTaxCategory = await this.getTaxCategoriesApi(api)\n .withId({ ID: taxCategoryId })\n .post({\n body: {\n version: currentVersion,\n actions: params.actions as TaxCategoryUpdateAction[],\n },\n })\n .execute();\n\n return updatedTaxCategory.body;\n } catch (error: unknown) {\n throw new ToolExecutionError(\n 'Failed to update tax category',\n context,\n error\n );\n }\n }\n\n async delete(context: ToolExecutionContext<TConfig>): Promise<TaxCategory> {\n // const api = this.getApiRoot(context).withProjectKey({\n // projectKey: context.configuration.projectKey,\n // });\n\n // const params = context.parameters as z.infer<\n // typeof deleteTaxCategoriesParameters\n // >;\n\n // try {\n // let taxCategoryId: string;\n\n // if (params.id) {\n // taxCategoryId = params.id;\n // } else if (params.key) {\n // const taxCategory = await this.getTaxCategoriesApi(api)\n // .withKey({ key: params.key })\n // .get()\n // .execute();\n // taxCategoryId = taxCategory.body.id;\n // } else {\n // throw new ToolExecutionError(\n // 'Either id or key must be provided',\n // context\n // );\n // }\n\n // const deletedTaxCategory = await this.getTaxCategoriesApi(api)\n // .withId({ ID: taxCategoryId })\n // .delete({\n // queryArgs: {\n // version: params.version,\n // },\n // })\n // .execute();\n\n // return deletedTaxCategory.body;\n // } catch (error: unknown) {\n // throw new ToolExecutionError(\n // 'Failed to delete tax category',\n // context,\n // error\n // );\n // }\n\n throw new ToolExecutionError('Not implemented', context);\n }\n}\n\n// Export individual functions for backward compatibility or direct usage\n// These functions wrap the handler methods and can be called directly\n\nexport async function readTaxCategories<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<TaxCategory | TaxCategoryPagedQueryResponse> {\n const handler = new TaxCategoriesHandler<TConfig>(apiClientFactory);\n return handler.read(context);\n}\n\nexport async function createTaxCategories<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<TaxCategory> {\n const handler = new TaxCategoriesHandler<TConfig>(apiClientFactory);\n return handler.create(context);\n}\n\nexport async function updateTaxCategories<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<TaxCategory> {\n const handler = new TaxCategoriesHandler<TConfig>(apiClientFactory);\n return handler.update(context);\n}\n\nexport async function deleteTaxCategories<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<TaxCategory> {\n const handler = new TaxCategoriesHandler<TConfig>(apiClientFactory);\n return handler.delete(context);\n}\n","import { z } from 'zod';\n\nexport const readTypesParameters = z.object({\n id: z.string().optional().describe('Type ID'),\n key: z.string().optional().describe('Type key'),\n where: z\n .array(z.string())\n .optional()\n .describe(\n 'Query predicates specified as strings. Example: [\"key = \\\\\"my-type\\\\\"\"]'\n ),\n sort: z\n .array(z.string())\n .optional()\n .describe(\n 'Sort criteria for the results. Example: [\"key asc\", \"createdAt desc\"]'\n ),\n limit: z\n .number()\n .int()\n .min(1)\n .max(500)\n .optional()\n .describe(\n 'A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.'\n ),\n offset: z\n .number()\n .int()\n .min(0)\n .optional()\n .describe(\n 'The number of items to skip before starting to collect the result set.'\n ),\n expand: z\n .array(z.string())\n .optional()\n .describe('Fields to expand. Example: []'),\n});\n\nexport const createTypesParameters = z.object({\n key: z\n .string()\n .min(2)\n .max(256)\n .describe('User-defined unique identifier for the type'),\n name: z\n .record(z.string())\n .describe(\n 'Type name (localized string, object with language codes as keys)'\n ),\n description: z\n .record(z.string())\n .optional()\n .describe('Type description (localized string)'),\n resourceTypeIds: z\n .array(z.string())\n .describe(\n 'Resource types that can be customized with this type. Example: [\"category\", \"product\"]'\n ),\n fieldDefinitions: z\n .array(\n z.object({\n name: z.string().describe('Field name'),\n label: z.record(z.string()).describe('Localized label for the field'),\n required: z\n .boolean()\n .optional()\n .describe('Whether the field is required'),\n inputHint: z\n .enum(['SingleLine', 'MultiLine'])\n .optional()\n .describe('Input hint for String fields'),\n type: z.any().describe('Field type definition'),\n })\n )\n .optional()\n .describe('Array of field definitions'),\n});\n\nexport const updateTypesParameters = z.object({\n id: z.string().optional().describe('The ID of the type to update'),\n key: z.string().optional().describe('The key of the type to update'),\n version: z.number().int().describe('The current version of the type'),\n actions: z\n .array(\n z\n .object({\n action: z\n .string()\n .describe('The name of the update action to perform'),\n })\n .and(z.record(z.string(), z.any()).optional())\n .describe(\n 'Array of update actions to perform on the type. Each action should have an \"action\" field and other fields specific to that action type.'\n )\n )\n .describe('Update actions'),\n});\n\nexport const deleteTypesParameters = z.object({\n id: z.string().optional().describe('Type ID'),\n key: z.string().optional().describe('Type key'),\n version: z\n .number()\n .int()\n .describe('Current version (for optimistic locking)'),\n});\n","export const readTypesPrompt = `\nThis tool will fetch a Type by ID or key (if provided) from commercetools or query all available types in a commercetools project if no arguments or parameters are provided.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the type to fetch.\n- key (string, optional): The key of the type to fetch.\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"key = \\\\\"my-type\\\\\"\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"key asc\", \"createdAt desc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- expand (array of strings, optional): Fields to expand.\n`;\n\nexport const createTypesPrompt = `\nThis tool will create a new Type in commercetools.\n\nIt takes these required arguments:\n- key (string): User-defined unique identifier for the type (2-256 characters, alphanumeric with underscores/hyphens).\n- name (object): Type name (localized string, object with language codes as keys). Example: {\"en\": \"My Type\", \"de\": \"Mein Typ\"}\n- resourceTypeIds (array of strings): Resource types that can be customized with this type. Example: [\"category\", \"product\"]\n\nIt takes these optional arguments:\n- description (object, optional): Type description (localized string, object with language codes as keys).\n- fieldDefinitions (array, optional): Array of field definitions. Each field definition should have:\n - name (string): Field name.\n - label (object): Localized label for the field (object with language codes as keys).\n - required (boolean, optional): Whether the field is required.\n - inputHint (string, optional): Input hint for String fields (\"SingleLine\" or \"MultiLine\").\n - type (object): Field type definition (Boolean, String, LocalizedString, Enum, LocalizedEnum, Number, Money, Date, Time, DateTime, Reference, Set).\n`;\n\nexport const updateTypesPrompt = `\nThis tool will update a Type in commercetools using update actions from the commercetools API.\n\nIt takes these required arguments:\n- id (string): The ID of the type to update.\n- version (integer): The current version of the type.\n- actions (array): An array of update actions to perform on the type. Each action should have an \"action\" field indicating the action type.\n\nExample actions from commercetools API include:\n- addFieldDefinition\n- changeFieldDefinitionOrder\n- changeKey\n- changeLabel\n- changeName\n- removeFieldDefinition\n- setDescription\n- setInputHint\n\nEach action type requires specific fields according to the commercetools API.\n`;\n\nexport const deleteTypesPrompt = `\nThis tool will delete a Type from commercetools.\n\nIt takes these required arguments:\n- id (string): The ID of the type to delete.\n- version (integer): The current version of the type (for optimistic locking).\n`;\n","import { z } from 'zod';\nimport {\n type Type,\n type TypePagedQueryResponse,\n type TypeDraft,\n type TypeUpdateAction,\n type ByProjectKeyRequestBuilder,\n} from '@commercetools/platform-sdk';\nimport {\n readTypesParameters,\n createTypesParameters,\n updateTypesParameters,\n deleteTypesParameters,\n} from './types.schema';\nimport {\n readTypesPrompt,\n createTypesPrompt,\n updateTypesPrompt,\n deleteTypesPrompt,\n} from './types.prompt';\nimport {\n IApiClientFactory,\n type ResourceMetadata,\n type ToolExecutionContext,\n ToolExecutionError,\n type Configuration,\n} from '../../shared';\nimport { CommercetoolsResourceHandler } from '../../handlers/commercetools.handler';\nimport { TOOL_NAME_PREFIX } from '../../utils/constants';\n\n/**\n * Types Resource Handler\n * Generic over configuration type - defaults to CommercetoolsConfig\n */\nexport class TypesHandler<\n TConfig extends Configuration = Configuration,\n> extends CommercetoolsResourceHandler<TConfig> {\n protected readonly metadata: ResourceMetadata = {\n namespace: 'types',\n description: 'Manage types in commercetools',\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readTypesParameters,\n create: createTypesParameters,\n update: updateTypesParameters,\n delete: deleteTypesParameters,\n },\n };\n\n constructor(apiClientFactory?: IApiClientFactory<TConfig>) {\n super(apiClientFactory);\n }\n\n override getToolDefinition(\n operation: 'read' | 'create' | 'update' | 'delete'\n ) {\n const prompts = {\n read: readTypesPrompt,\n create: createTypesPrompt,\n update: updateTypesPrompt,\n delete: deleteTypesPrompt,\n };\n\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation],\n };\n }\n\n protected getTypesApi(api: ByProjectKeyRequestBuilder) {\n return api.types();\n }\n\n async read(\n context: ToolExecutionContext<TConfig>\n ): Promise<Type | TypePagedQueryResponse> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n\n const params = context.parameters as z.infer<typeof readTypesParameters>;\n\n try {\n if (params?.id) {\n const type = await this.getTypesApi(api)\n .withId({ ID: params.id })\n .get({\n queryArgs: {\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n\n return type.body;\n } else if (params?.key) {\n const type = await this.getTypesApi(api)\n .withKey({ key: params.key })\n .get()\n .execute();\n return type.body;\n } else {\n const types = await this.getTypesApi(api)\n .get({\n queryArgs: {\n limit: params.limit || 20,\n ...(params.offset && { offset: params.offset }),\n ...(params.sort && { sort: params.sort }),\n ...(params.where && { where: params.where }),\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n\n return types.body;\n }\n } catch (err: unknown) {\n throw new ToolExecutionError(\n (err as { message: string }).message || 'Failed to read types',\n context,\n err\n );\n }\n }\n\n async create(context: ToolExecutionContext<TConfig>): Promise<Type> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<typeof createTypesParameters>;\n\n try {\n const type = await this.getTypesApi(api)\n .post({\n body: params as TypeDraft,\n })\n .execute();\n\n return type.body;\n } catch (error: unknown) {\n throw new ToolExecutionError('Failed to create type', context, error);\n }\n }\n\n async update(context: ToolExecutionContext<TConfig>): Promise<Type> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n\n const params = context.parameters as z.infer<typeof updateTypesParameters>;\n\n try {\n let currentVersion: number;\n let typeId: string;\n\n if (params.id) {\n const type = await this.getTypesApi(api)\n .withId({ ID: params.id })\n .get()\n .execute();\n currentVersion = type.body.version;\n typeId = params.id;\n } else if (params.key) {\n const type = await this.getTypesApi(api)\n .withKey({ key: params.key })\n .get()\n .execute();\n currentVersion = type.body.version;\n typeId = type.body.id;\n } else {\n throw new ToolExecutionError(\n 'Either id or key must be provided',\n context\n );\n }\n\n const updatedType = await this.getTypesApi(api)\n .withId({ ID: typeId })\n .post({\n body: {\n version: currentVersion,\n actions: params.actions as TypeUpdateAction[],\n },\n })\n .execute();\n\n return updatedType.body;\n } catch (error: unknown) {\n throw new ToolExecutionError('Failed to update type', context, error);\n }\n }\n\n async delete(context: ToolExecutionContext<TConfig>): Promise<Type> {\n // const api = this.getApiRoot(context).withProjectKey({\n // projectKey: context.configuration.projectKey,\n // });\n\n // const params = context.parameters as z.infer<typeof deleteTypesParameters>;\n\n // try {\n // let typeId: string;\n\n // if (params.id) {\n // typeId = params.id;\n // } else if (params.key) {\n // const type = await this.getTypesApi(api)\n // .withKey({ key: params.key })\n // .get()\n // .execute();\n // typeId = type.body.id;\n // } else {\n // throw new ToolExecutionError(\n // 'Either id or key must be provided',\n // context\n // );\n // }\n\n // const deletedType = await this.getTypesApi(api)\n // .withId({ ID: typeId })\n // .delete({\n // queryArgs: {\n // version: params.version,\n // },\n // })\n // .execute();\n\n // return deletedType.body;\n // } catch (error: unknown) {\n // throw new ToolExecutionError('Failed to delete type', context, error);\n // }\n\n throw new ToolExecutionError('Not implemented', context);\n }\n}\n\n// Export individual functions for backward compatibility or direct usage\n// These functions wrap the handler methods and can be called directly\n\nexport async function readTypes<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Type | TypePagedQueryResponse> {\n const handler = new TypesHandler<TConfig>(apiClientFactory);\n return handler.read(context);\n}\n\nexport async function createTypes<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Type> {\n const handler = new TypesHandler<TConfig>(apiClientFactory);\n return handler.create(context);\n}\n\nexport async function updateTypes<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Type> {\n const handler = new TypesHandler<TConfig>(apiClientFactory);\n return handler.update(context);\n}\n\nexport async function deleteTypes<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Type> {\n const handler = new TypesHandler<TConfig>(apiClientFactory);\n return handler.delete(context);\n}\n","import { z } from 'zod';\n\nexport const readZonesParameters = z.object({\n id: z.string().optional().describe('Zone ID'),\n key: z.string().optional().describe('Zone key'),\n where: z\n .array(z.string())\n .optional()\n .describe(\n 'Query predicates specified as strings. Example: [\"name = \\\\\"Europe\\\\\"\"]'\n ),\n sort: z\n .array(z.string())\n .optional()\n .describe(\n 'Sort criteria for the results. Example: [\"name asc\", \"createdAt desc\"]'\n ),\n limit: z\n .number()\n .int()\n .min(1)\n .max(500)\n .optional()\n .describe(\n 'A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.'\n ),\n offset: z\n .number()\n .int()\n .min(0)\n .optional()\n .describe(\n 'The number of items to skip before starting to collect the result set.'\n ),\n expand: z\n .array(z.string())\n .optional()\n .describe('Fields to expand. Example: []'),\n});\n\nexport const createZonesParameters = z.object({\n key: z\n .string()\n .min(2)\n .max(256)\n .optional()\n .describe('User-defined unique identifier for the zone'),\n name: z.string().describe('Zone name'),\n description: z.string().optional().describe('Zone description'),\n locations: z\n .array(\n z.object({\n country: z.string().describe('Country code (ISO 3166-1 alpha-2)'),\n state: z.string().optional().describe('State within the country'),\n })\n )\n .optional()\n .describe('Array of locations (countries and optionally states)'),\n});\n\nexport const updateZonesParameters = z.object({\n id: z.string().optional().describe('The ID of the zone to update'),\n key: z.string().optional().describe('The key of the zone to update'),\n version: z.number().int().describe('The current version of the zone'),\n actions: z\n .array(\n z\n .object({\n action: z\n .string()\n .describe('The name of the update action to perform'),\n })\n .and(z.record(z.string(), z.any()).optional())\n .describe(\n 'Array of update actions to perform on the zone. Each action should have an \"action\" field and other fields specific to that action type.'\n )\n )\n .describe('Update actions'),\n});\n\nexport const deleteZonesParameters = z.object({\n id: z.string().optional().describe('Zone ID'),\n key: z.string().optional().describe('Zone key'),\n version: z\n .number()\n .int()\n .describe('Current version (for optimistic locking)'),\n});\n","export const readZonesPrompt = `\nThis tool will fetch a Zone by ID or key (if provided) from commercetools or query all available zones in a commercetools project if no arguments or parameters are provided.\n\nIt takes these optional arguments:\n- id (string, optional): The ID of the zone to fetch.\n- key (string, optional): The key of the zone to fetch.\n- where (array of strings, optional): Query predicates specified as strings. Example: [\"name = \\\\\"Europe\\\\\"\"]\n- sort (array of strings, optional): Sort criteria for the results. Example: [\"name asc\", \"createdAt desc\"]\n- limit (integer, optional): A limit on the number of objects to be returned. Limit can range between 1 and 500, and the default is 20.\n- offset (integer, optional): The number of items to skip before starting to collect the result set.\n- expand (array of strings, optional): Fields to expand.\n`;\n\nexport const createZonesPrompt = `\nThis tool will create a new Zone in commercetools.\n\nIt takes these required arguments:\n- name (string): Zone name.\n\nIt takes these optional arguments:\n- key (string, optional): User-defined unique identifier for the zone (2-256 characters, alphanumeric with underscores/hyphens).\n- description (string, optional): Zone description.\n- locations (array, optional): Array of location objects. Each location should have:\n - country (string): Country code (ISO 3166-1 alpha-2).\n - state (string, optional): State within the country.\n`;\n\nexport const updateZonesPrompt = `\nThis tool will update a Zone in commercetools using update actions from the commercetools API.\n\nIt takes these required arguments:\n- id (string): The ID of the zone to update.\n- version (integer): The current version of the zone.\n- actions (array): An array of update actions to perform on the zone. Each action should have an \"action\" field indicating the action type.\n\nExample actions from commercetools API include:\n- addLocation\n- changeName\n- setDescription\n- setKey\n- removeLocation\n\nEach action type requires specific fields according to the commercetools API.\n`;\n\nexport const deleteZonesPrompt = `\nThis tool will delete a Zone from commercetools.\n\nIt takes these required arguments:\n- id (string): The ID of the zone to delete.\n- version (integer): The current version of the zone (for optimistic locking).\n`;\n","import { z } from 'zod';\nimport {\n type Zone,\n type ZonePagedQueryResponse,\n type ZoneDraft,\n type ZoneUpdateAction,\n type ByProjectKeyRequestBuilder,\n} from '@commercetools/platform-sdk';\nimport {\n readZonesParameters,\n createZonesParameters,\n updateZonesParameters,\n deleteZonesParameters,\n} from './zones.schema';\nimport {\n readZonesPrompt,\n createZonesPrompt,\n updateZonesPrompt,\n deleteZonesPrompt,\n} from './zones.prompt';\nimport {\n IApiClientFactory,\n type ResourceMetadata,\n type ToolExecutionContext,\n ToolExecutionError,\n type Configuration,\n} from '../../shared';\nimport { CommercetoolsResourceHandler } from '../../handlers/commercetools.handler';\nimport { TOOL_NAME_PREFIX } from '../../utils/constants';\n\n/**\n * Zones Resource Handler\n * Generic over configuration type - defaults to CommercetoolsConfig\n */\nexport class ZonesHandler<\n TConfig extends Configuration = Configuration,\n> extends CommercetoolsResourceHandler<TConfig> {\n protected readonly metadata: ResourceMetadata = {\n namespace: 'zones',\n description: 'Manage zones in commercetools',\n toolNamePrefix: TOOL_NAME_PREFIX,\n schemas: {\n read: readZonesParameters,\n create: createZonesParameters,\n update: updateZonesParameters,\n delete: deleteZonesParameters,\n },\n };\n\n constructor(apiClientFactory?: IApiClientFactory<TConfig>) {\n super(apiClientFactory);\n }\n\n override getToolDefinition(\n operation: 'read' | 'create' | 'update' | 'delete'\n ) {\n const prompts = {\n read: readZonesPrompt,\n create: createZonesPrompt,\n update: updateZonesPrompt,\n delete: deleteZonesPrompt,\n };\n\n return {\n name: this.getToolName(operation),\n description: prompts[operation],\n inputSchema: this.metadata.schemas[operation],\n };\n }\n\n protected getZonesApi(api: ByProjectKeyRequestBuilder) {\n return api.zones();\n }\n\n async read(\n context: ToolExecutionContext<TConfig>\n ): Promise<Zone | ZonePagedQueryResponse> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n\n const params = context.parameters as z.infer<typeof readZonesParameters>;\n\n try {\n if (params?.id) {\n const zone = await this.getZonesApi(api)\n .withId({ ID: params.id })\n .get({\n queryArgs: {\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n\n return zone.body;\n } else if (params?.key) {\n const zone = await this.getZonesApi(api)\n .withKey({ key: params.key })\n .get()\n .execute();\n return zone.body;\n } else {\n const zones = await this.getZonesApi(api)\n .get({\n queryArgs: {\n limit: params.limit || 20,\n ...(params.offset && { offset: params.offset }),\n ...(params.sort && { sort: params.sort }),\n ...(params.where && { where: params.where }),\n ...(params.expand && { expand: params.expand }),\n },\n })\n .execute();\n\n return zones.body;\n }\n } catch (err: unknown) {\n throw new ToolExecutionError(\n (err as { message: string }).message || 'Failed to read zones',\n context,\n err\n );\n }\n }\n\n async create(context: ToolExecutionContext<TConfig>): Promise<Zone> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n const params = context.parameters as z.infer<typeof createZonesParameters>;\n\n try {\n const zone = await this.getZonesApi(api)\n .post({\n body: params as ZoneDraft,\n })\n .execute();\n\n return zone.body;\n } catch (error: unknown) {\n throw new ToolExecutionError('Failed to create zone', context, error);\n }\n }\n\n async update(context: ToolExecutionContext<TConfig>): Promise<Zone> {\n const api = this.getApiRoot(context).withProjectKey({\n projectKey: context.configuration.projectKey,\n });\n\n const params = context.parameters as z.infer<typeof updateZonesParameters>;\n\n try {\n let currentVersion: number;\n let zoneId: string;\n\n if (params.id) {\n const zone = await this.getZonesApi(api)\n .withId({ ID: params.id })\n .get()\n .execute();\n currentVersion = zone.body.version;\n zoneId = params.id;\n } else if (params.key) {\n const zone = await this.getZonesApi(api)\n .withKey({ key: params.key })\n .get()\n .execute();\n currentVersion = zone.body.version;\n zoneId = zone.body.id;\n } else {\n throw new ToolExecutionError(\n 'Either id or key must be provided',\n context\n );\n }\n\n const updatedZone = await this.getZonesApi(api)\n .withId({ ID: zoneId })\n .post({\n body: {\n version: currentVersion,\n actions: params.actions as ZoneUpdateAction[],\n },\n })\n .execute();\n\n return updatedZone.body;\n } catch (error: unknown) {\n throw new ToolExecutionError('Failed to update zone', context, error);\n }\n }\n\n async delete(context: ToolExecutionContext<TConfig>): Promise<Zone> {\n // const api = this.getApiRoot(context).withProjectKey({\n // projectKey: context.configuration.projectKey,\n // });\n\n // const params = context.parameters as z.infer<typeof deleteZonesParameters>;\n\n // try {\n // let zoneId: string;\n\n // if (params.id) {\n // zoneId = params.id;\n // } else if (params.key) {\n // const zone = await this.getZonesApi(api)\n // .withKey({ key: params.key })\n // .get()\n // .execute();\n // zoneId = zone.body.id;\n // } else {\n // throw new ToolExecutionError(\n // 'Either id or key must be provided',\n // context\n // );\n // }\n\n // const deletedZone = await this.getZonesApi(api)\n // .withId({ ID: zoneId })\n // .delete({\n // queryArgs: {\n // version: params.version,\n // },\n // })\n // .execute();\n\n // return deletedZone.body;\n // } catch (error: unknown) {\n // throw new ToolExecutionError('Failed to delete zone', context, error);\n // }\n\n throw new ToolExecutionError('Not implemented', context);\n }\n}\n\n// Export individual functions for backward compatibility or direct usage\n// These functions wrap the handler methods and can be called directly\n\nexport async function readZones<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Zone | ZonePagedQueryResponse> {\n const handler = new ZonesHandler<TConfig>(apiClientFactory);\n return handler.read(context);\n}\n\nexport async function createZones<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Zone> {\n const handler = new ZonesHandler<TConfig>(apiClientFactory);\n return handler.create(context);\n}\n\nexport async function updateZones<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Zone> {\n const handler = new ZonesHandler<TConfig>(apiClientFactory);\n return handler.update(context);\n}\n\nexport async function deleteZones<TConfig extends Configuration>(\n context: ToolExecutionContext<TConfig>,\n apiClientFactory?: IApiClientFactory<TConfig>\n): Promise<Zone> {\n const handler = new ZonesHandler<TConfig>(apiClientFactory);\n return handler.delete(context);\n}\n"]}
|