@yoryoboy/bi-mcp 1.9.0 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1373,7 +1373,7 @@ server.tool(
1373
1373
  server.tool(
1374
1374
  {
1375
1375
  name: "meli_estimate_product_profitability",
1376
- description: "Estimate whether a MercadoLibre product is profitable, using precise fee quotes, historical order/shipping data, and optional Billing ML audit. If user costs are missing, returns break-even limits and guided questions instead of failing.",
1376
+ description: "Estimate whether a MercadoLibre product is profitable, using precise fee quotes plus historical order and shipping data. Best when you already have the itemId; if you only have the product name/title, use meli_search_items first to find the correct itemId. If user costs are missing, returns break-even limits and guided questions instead of failing.",
1377
1377
  schema: meliEstimateProductProfitabilitySchema,
1378
1378
  annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true }
1379
1379
  },
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../index.ts"],
4
- "sourcesContent": ["import { createRequire } from \"node:module\";\nimport { pathToFileURL } from \"node:url\";\nimport { MCPServer } from \"mcp-use/server\";\n\nimport {\n reporteVentasPromptHandler,\n reporteVentasPromptSchema,\n} from \"./src/prompts/reporte-ventas.js\";\nimport { getBenchmarksHandler, getBenchmarksSchema } from \"./src/config/benchmarks.js\";\nimport {\n checkDatabaseConnectionHandler,\n checkDatabaseConnectionSchema,\n listProfilesHandler,\n listProfilesSchema,\n googleAdsAccountRisksHandler,\n googleAdsAccountRisksSchema,\n googleAdsAccountOverviewHandler,\n googleAdsAccountOverviewSchema,\n googleAdsBreakEvenAnalysisHandler,\n googleAdsBreakEvenAnalysisSchema,\n googleAdsCampaignPerformanceHandler,\n googleAdsCampaignPerformanceSchema,\n googleAdsChannelMixHandler,\n googleAdsChannelMixSchema,\n googleAdsCompareAccountsHandler,\n googleAdsCompareAccountsSchema,\n googleAdsCustomerClientsHandler,\n googleAdsCustomerClientsSchema,\n googleAdsCustomerInfoHandler,\n googleAdsCustomerInfoSchema,\n googleAdsSearchTermsSummaryHandler,\n googleAdsSearchTermsSummarySchema,\n googleAdsScalingHealthHandler,\n googleAdsScalingHealthSchema,\n googleAdsTimeSeriesHandler,\n googleAdsTimeSeriesSchema,\n listAccessibleSitesHandler,\n listAccessibleSitesSchema,\n attributionGapsHandler,\n attributionGapsSchema,\n activateSkuHandler,\n activateSkuSchema,\n addOrderTrackingHandler,\n addOrderTrackingSchema,\n associateSpecificationHandler,\n associateSpecificationSchema,\n attachCatalogImageHandler,\n attachCatalogImageSchema,\n cancelOrderHandler,\n cancelOrderSchema,\n channelMixHandler,\n channelMixSchema,\n computedPriceHandler,\n computedPriceSchema,\n createBrandHandler,\n createBrandSchema,\n createCategoryHandler,\n createCategorySchema,\n createProductHandler,\n createProductSchema,\n createProductWithSkuHandler,\n createProductWithSkuSchema,\n createSkuHandler,\n createSkuSchema,\n createSpecificationHandler,\n createSpecificationSchema,\n createSpecificationValueHandler,\n createSpecificationValueSchema,\n deactivateSkuHandler,\n deactivateSkuSchema,\n deleteFixedPriceHandler,\n deleteFixedPriceSchema,\n ecommerceTrackingHealthHandler,\n ecommerceTrackingHealthSchema,\n engagementOverviewHandler,\n engagementOverviewSchema,\n invoiceOrderHandler,\n invoiceOrderSchema,\n inventoryCheckHandler,\n inventoryCheckSchema,\n listAccessiblePropertiesHandler,\n listAccessiblePropertiesSchema,\n metaAccountOverviewHandler,\n metaAccountOverviewSchema,\n metaAdAccountInfoHandler,\n metaAdAccountInfoSchema,\n metaAdsPerformanceHandler,\n metaAdsPerformanceSchema,\n metaCampaignPerformanceHandler,\n metaCampaignPerformanceSchema,\n metaListAccessibleAdAccountsHandler,\n metaListAccessibleAdAccountsSchema,\n metaListAccessibleBusinessesHandler,\n metaListAccessibleBusinessesSchema,\n metaPlacementMixHandler,\n metaPlacementMixSchema,\n metaTimeSeriesHandler,\n metaTimeSeriesSchema,\n searchConsoleCountryBreakdownHandler,\n searchConsoleCountryBreakdownSchema,\n searchConsoleDeviceBreakdownHandler,\n searchConsoleDeviceBreakdownSchema,\n searchConsoleHighImpressionLowClickQueriesHandler,\n searchConsoleHighImpressionLowClickQueriesSchema,\n searchConsoleLowCtrOpportunitiesHandler,\n searchConsoleLowCtrOpportunitiesSchema,\n searchConsolePagePerformanceHandler,\n searchConsolePagePerformanceSchema,\n searchConsoleProductDemandLowCaptureQueriesHandler,\n searchConsoleProductDemandLowCaptureQueriesSchema,\n searchConsoleQueryPageMatrixHandler,\n searchConsoleQueryPageMatrixSchema,\n searchConsoleQueryPerformanceHandler,\n searchConsoleQueryPerformanceSchema,\n searchConsoleQuickWinOpportunitiesHandler,\n searchConsoleQuickWinOpportunitiesSchema,\n searchConsoleRisingNonBrandQueriesHandler,\n searchConsoleRisingNonBrandQueriesSchema,\n searchConsoleSearchPerformanceHandler,\n searchConsoleSearchPerformanceSchema,\n searchConsoleSiteContextHandler,\n searchConsoleSiteContextSchema,\n searchConsoleVisibilityDeclinesHandler,\n searchConsoleVisibilityDeclinesSchema,\n orderDetailsHandler,\n orderDetailsSchema,\n ordersSummaryHandler,\n ordersSummarySchema,\n propertyInfoHandler,\n propertyInfoSchema,\n productOffersHandler,\n productOffersSchema,\n revenueByChannelHandler,\n revenueByChannelSchema,\n revenueOverviewHandler,\n revenueOverviewSchema,\n revenueTrendHandler,\n revenueTrendSchema,\n skuOffersHandler,\n skuOffersSchema,\n toggleUnlimitedQuantityHandler,\n toggleUnlimitedQuantitySchema,\n skuPriceHandler,\n skuPriceSchema,\n sourceMediumBreakdownHandler,\n sourceMediumBreakdownSchema,\n topLandingPagesHandler,\n topLandingPagesSchema,\n updateInventoryHandler,\n updateInventorySchema,\n updateLeadTimeHandler,\n updateLeadTimeSchema,\n updateProductBasicFieldsHandler,\n updateProductBasicFieldsSchema,\n updateSkuBasicFieldsHandler,\n updateSkuBasicFieldsSchema,\n updateSkuPriceHandler,\n updateSkuPriceSchema,\n upsertFixedPriceHandler,\n upsertFixedPriceSchema,\n warehouseInventoryHandler,\n warehouseInventorySchema,\n} from \"./src/tools/index.js\";\nimport {\n meliAnswerQuestionHandler,\n meliAnswerQuestionSchema,\n meliCreateItemHandler,\n meliCreateItemSchema,\n meliEstimateListingFeeHandler,\n meliEstimateListingFeeSchema,\n meliEstimateProductProfitabilityHandler,\n meliEstimateProductProfitabilitySchema,\n meliGetAccountContextHandler,\n meliGetAccountContextSchema,\n meliGetCategoryRequirementsHandler,\n meliGetCategoryRequirementsSchema,\n meliGetSiteCategoriesAndListingTypesHandler,\n meliGetSiteCategoriesAndListingTypesSchema,\n meliGetItemDetailsHandler,\n meliGetItemDetailsSchema,\n meliGetItemVisitsHandler,\n meliGetItemVisitsSchema,\n meliGetListingQualityHandler,\n meliGetListingQualitySchema,\n meliGetOrderDetailsHandler,\n meliGetOrderDetailsSchema,\n meliGetOrdersSummaryHandler,\n meliGetOrdersSummarySchema,\n meliGetSalesByItemHandler,\n meliGetSalesByItemSchema,\n meliGetSalesTrendHandler,\n meliGetSalesTrendSchema,\n meliGetShippingSummaryHandler,\n meliGetShippingSummarySchema,\n meliGetStorePerformanceHandler,\n meliGetStorePerformanceSchema,\n meliPauseOrReactivateItemHandler,\n meliPauseOrReactivateItemSchema,\n meliPredictCategoryHandler,\n meliPredictCategorySchema,\n meliSearchItemsHandler,\n meliSearchItemsSchema,\n meliSearchQuestionsHandler,\n meliSearchQuestionsSchema,\n meliUpdateItemBasicFieldsHandler,\n meliUpdateItemBasicFieldsSchema,\n meliUpdateItemDescriptionHandler,\n meliUpdateItemDescriptionSchema,\n meliUpdateItemPicturesHandler,\n meliUpdateItemPicturesSchema,\n meliValidateConnectionHandler,\n meliValidateConnectionSchema,\n} from \"./src/tools/index.js\";\n\nconst server = new MCPServer({\n name: \"bi-mcp\",\n title: \"BI MCP\",\n version: \"1.0.0\",\n description:\n \"Business Intelligence MCP server with VTEX, Google, and Meta Ads tools for ecommerce analysis.\",\n baseUrl: process.env.MCP_URL || \"http://localhost:3000\",\n favicon: \"favicon.ico\",\n icons: [\n {\n src: \"icon.svg\",\n mimeType: \"image/svg+xml\",\n sizes: [\"512x512\"],\n },\n ],\n});\n\nserver.tool(\n {\n name: \"meta_list_accessible_businesses\",\n description:\n \"List Meta businesses accessible with the configured token, useful for onboarding and permission validation.\",\n schema: metaListAccessibleBusinessesSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n metaListAccessibleBusinessesHandler\n);\n\nserver.tool(\n {\n name: \"meta_list_accessible_ad_accounts\",\n description:\n \"List Meta ad accounts accessible with the configured token, including IDs, currencies, business context, and status.\",\n schema: metaListAccessibleAdAccountsSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n metaListAccessibleAdAccountsHandler\n);\n\nserver.tool(\n {\n name: \"meta_get_ad_account_info\",\n description:\n \"Get summary information for one Meta ad account, including name, currency, timezone, business, and account status.\",\n schema: metaAdAccountInfoSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n metaAdAccountInfoHandler\n);\n\nserver.tool(\n {\n name: \"meta_get_account_overview\",\n description:\n \"Get a Meta Ads overview for one or more ad accounts over a date range, including spend, clicks, impressions, purchases, purchase value, CPC, CPM, and ROAS.\",\n schema: metaAccountOverviewSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n metaAccountOverviewHandler\n);\n\nserver.tool(\n {\n name: \"meta_get_campaign_performance\",\n description:\n \"Get Meta Ads campaign-level performance for one or more ad accounts over a date range with spend, clicks, impressions, purchases, purchase value, CPC, CPM, and ROAS.\",\n schema: metaCampaignPerformanceSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n metaCampaignPerformanceHandler\n);\n\nserver.tool(\n {\n name: \"meta_get_ads_performance\",\n description:\n \"Get Meta Ads ad-level performance for one or more ad accounts over a date range, useful for creative review and performance diagnostics.\",\n schema: metaAdsPerformanceSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n metaAdsPerformanceHandler\n);\n\nserver.tool(\n {\n name: \"meta_get_time_series\",\n description:\n \"Get a Meta Ads time series for one or more ad accounts over a date range, with daily, weekly, or monthly granularity.\",\n schema: metaTimeSeriesSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n metaTimeSeriesHandler\n);\n\nserver.tool(\n {\n name: \"meta_get_placement_mix\",\n description:\n \"Get Meta Ads placement mix for one or more ad accounts over a date range, including publisher platform and platform position performance.\",\n schema: metaPlacementMixSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n metaPlacementMixHandler\n);\n\nserver.tool(\n {\n name: \"vtex_get_orders_summary\",\n description: \"Get aggregated orders summary by date range with currency-aware BI metrics.\",\n schema: ordersSummarySchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n ordersSummaryHandler\n);\n\nserver.tool(\n {\n name: \"vtex_get_order_details\",\n description: \"Get BI-focused detailed information for one or more orders.\",\n schema: orderDetailsSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n orderDetailsHandler\n);\n\nserver.tool(\n {\n name: \"vtex_check_inventory\",\n description: \"Check global SKU inventory and infer stock health status.\",\n schema: inventoryCheckSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n inventoryCheckHandler\n);\n\nserver.tool(\n {\n name: \"vtex_get_warehouse_inventory\",\n description: \"Get SKU inventory details for a specific warehouse.\",\n schema: warehouseInventorySchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n warehouseInventoryHandler\n);\n\nserver.tool(\n {\n name: \"vtex_update_inventory\",\n description:\n \"Update the stock quantity and unlimited-quantity mode for one SKU in one warehouse. This overwrites the current quantity and availability mode stored in VTEX for that warehouse.\",\n schema: updateInventorySchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n updateInventoryHandler\n);\n\nserver.tool(\n {\n name: \"vtex_update_lead_time\",\n description:\n \"Update the lead time for one SKU in one warehouse. This overwrites the current lead time value in VTEX for that warehouse.\",\n schema: updateLeadTimeSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n updateLeadTimeHandler\n);\n\nserver.tool(\n {\n name: \"vtex_toggle_unlimited_quantity\",\n description:\n \"Toggle only the unlimited-quantity mode for one SKU in one warehouse. This keeps the current stock quantity and overwrites only the unlimited availability flag.\",\n schema: toggleUnlimitedQuantitySchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n toggleUnlimitedQuantityHandler\n);\n\nserver.tool(\n {\n name: \"vtex_update_sku_price\",\n description:\n \"Update base pricing fields for one SKU in VTEX Pricing. This can overwrite base price, list price, cost price, markup, and, if fixedPrices is sent, it also replaces any fixed prices not included in the payload.\",\n schema: updateSkuPriceSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n updateSkuPriceHandler\n);\n\nserver.tool(\n {\n name: \"vtex_upsert_fixed_price\",\n description:\n \"Create or replace fixed prices for one SKU inside one price table or trade policy. The provided fixed prices overwrite the current entries for that price table.\",\n schema: upsertFixedPriceSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n upsertFixedPriceHandler\n);\n\nserver.tool(\n {\n name: \"vtex_delete_fixed_price\",\n description:\n \"Delete all fixed prices configured for one SKU inside one price table or trade policy.\",\n schema: deleteFixedPriceSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n deleteFixedPriceHandler\n);\n\nserver.tool(\n {\n name: \"vtex_activate_sku\",\n description:\n \"Activate one SKU by setting its active flag to true. This updates the SKU record in VTEX and preserves the current operational fields.\",\n schema: activateSkuSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n activateSkuHandler\n);\n\nserver.tool(\n {\n name: \"vtex_deactivate_sku\",\n description:\n \"Deactivate one SKU by setting its active flag to false. This updates the SKU record in VTEX and preserves the current operational fields.\",\n schema: deactivateSkuSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n deactivateSkuHandler\n);\n\nserver.tool(\n {\n name: \"vtex_update_product_basic_fields\",\n description:\n \"Update core product fields such as name, description, category, brand, visibility, and SEO fields. Only the provided fields are changed; the tool keeps the current VTEX values for the rest.\",\n schema: updateProductBasicFieldsSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n updateProductBasicFieldsHandler\n);\n\nserver.tool(\n {\n name: \"vtex_update_sku_basic_fields\",\n description:\n \"Update core SKU fields such as name, reference, EAN, dimensions, weight, measurement unit, and active flags. Only the provided fields are changed; the tool keeps the current VTEX values for the rest.\",\n schema: updateSkuBasicFieldsSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n updateSkuBasicFieldsHandler\n);\n\nserver.tool(\n {\n name: \"vtex_create_product\",\n description:\n \"Create one product in VTEX Catalog. You can point it to existing category and brand IDs, or ask VTEX Catalog to use categoryPath and brandName when those entities are not already mapped.\",\n schema: createProductSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n createProductHandler\n);\n\nserver.tool(\n {\n name: \"vtex_create_sku\",\n description:\n \"Create one SKU under an existing VTEX product. This creates the SKU record and can optionally attach one EAN after creation.\",\n schema: createSkuSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n createSkuHandler\n);\n\nserver.tool(\n {\n name: \"vtex_create_product_with_sku\",\n description:\n \"Create one VTEX product and one SKU in a single operation. Use this when the product does not exist yet and you want the initial SKU created immediately after the product.\",\n schema: createProductWithSkuSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n createProductWithSkuHandler\n);\n\nserver.tool(\n {\n name: \"vtex_create_brand\",\n description:\n \"Create one brand in VTEX Catalog using the official brand contract. This creates the brand record and returns the created brand payload.\",\n schema: createBrandSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n createBrandHandler\n);\n\nserver.tool(\n {\n name: \"vtex_create_category\",\n description:\n \"Create one category in VTEX Catalog. This writes a new category record and can be used for top-level or child categories depending on fatherCategoryId.\",\n schema: createCategorySchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n createCategoryHandler\n);\n\nserver.tool(\n {\n name: \"vtex_create_specification\",\n description:\n \"Create one specification field in VTEX Catalog, including its field type, group, and visibility flags.\",\n schema: createSpecificationSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n createSpecificationHandler\n);\n\nserver.tool(\n {\n name: \"vtex_create_specification_value\",\n description:\n \"Create one specification value for an existing VTEX specification field.\",\n schema: createSpecificationValueSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n createSpecificationValueHandler\n);\n\nserver.tool(\n {\n name: \"vtex_associate_specification\",\n description:\n \"Associate one specification to one product or one SKU. This writes a single specification association using either a fieldValueId or raw text, depending on the field type.\",\n schema: associateSpecificationSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n associateSpecificationHandler\n);\n\nserver.tool(\n {\n name: \"vtex_attach_catalog_image\",\n description:\n \"Attach one catalog image to one SKU using a public image URL. This adds a new SKU file entry in VTEX Catalog.\",\n schema: attachCatalogImageSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n attachCatalogImageHandler\n);\n\nserver.tool(\n {\n name: \"vtex_cancel_order\",\n description:\n \"Cancel one order in VTEX Orders API. Before using this tool, the assistant must explain what will be canceled, mention that invoiced orders cannot be canceled and cancellations cannot be reversed, and obtain explicit confirmation from the user. Only then should the tool be called with confirmed=true.\",\n schema: cancelOrderSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n cancelOrderHandler\n);\n\nserver.tool(\n {\n name: \"vtex_invoice_order\",\n description:\n \"Invoice one order in VTEX Orders API. Before using this tool, the assistant must explain that invoicing changes the order's logistics and financial state, mention that the tool writes invoice data into VTEX, and obtain explicit confirmation from the user. Only then should the tool be called with confirmed=true.\",\n schema: invoiceOrderSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n invoiceOrderHandler\n);\n\nserver.tool(\n {\n name: \"vtex_add_order_tracking\",\n description:\n \"Add tracking data to one invoiced order in VTEX. Before using this tool, the assistant must explain which invoice and tracking data will be updated, mention that this affects the operational communication sent to the customer, and obtain explicit confirmation from the user. Only then should the tool be called with confirmed=true.\",\n schema: addOrderTrackingSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n addOrderTrackingHandler\n);\n\nserver.tool(\n {\n name: \"vtex_get_sku_price\",\n description: \"Get base pricing information for one SKU.\",\n schema: skuPriceSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n skuPriceHandler\n);\n\nserver.tool(\n {\n name: \"vtex_get_computed_price\",\n description: \"Get computed SKU price by price table context.\",\n schema: computedPriceSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n computedPriceHandler\n);\n\nserver.tool(\n {\n name: \"vtex_get_product_offers\",\n description: \"Get offers for all SKUs under a product.\",\n schema: productOffersSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n productOffersHandler\n);\n\nserver.tool(\n {\n name: \"vtex_get_sku_offers\",\n description: \"Get offers for a specific SKU under a product.\",\n schema: skuOffersSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n skuOffersHandler\n);\n\nserver.tool(\n {\n name: \"config_check_database_connection\",\n description:\n \"Check whether the MCP can reach its configured database and whether critical tables are present.\",\n schema: checkDatabaseConnectionSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: false,\n },\n },\n checkDatabaseConnectionHandler\n);\n\nserver.tool(\n {\n name: \"config_list_profiles\",\n description: \"List client profiles currently available in the MCP database.\",\n schema: listProfilesSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: false,\n },\n },\n listProfilesHandler\n);\n\nserver.tool(\n {\n name: \"config_get_benchmarks\",\n description:\n \"Devuelve benchmarks de Argentina para c\u00E1lculos financieros: IIBB por provincia, costos de cuotas sin inter\u00E9s (Ahora 12, Plan Z), fees de pasarelas de pago (Mercado Pago, Mobbex, Payway, dLocal), costos log\u00EDsticos por zona y calendario comercial con impacto de revenue.\",\n schema: getBenchmarksSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: false,\n },\n },\n getBenchmarksHandler\n);\n\nserver.tool(\n {\n name: \"gads_get_channel_mix\",\n description:\n \"Get Google Ads mix by advertising channel type for a date range, including spend, clicks, impressions, conversions, conversion value, and channel share.\",\n schema: googleAdsChannelMixSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n googleAdsChannelMixHandler\n);\n\nserver.tool(\n {\n name: \"gads_get_customer_info\",\n description:\n \"Get summary information for one Google Ads customer account, including name, currency, timezone, and whether the account is a manager (MCC).\",\n schema: googleAdsCustomerInfoSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n googleAdsCustomerInfoHandler\n);\n\nserver.tool(\n {\n name: \"gads_list_customer_clients\",\n description:\n \"List visible child accounts for a Google Ads customer account, usually used to inspect manager (MCC) account structure.\",\n schema: googleAdsCustomerClientsSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n googleAdsCustomerClientsHandler\n);\n\nserver.tool(\n {\n name: \"gads_get_account_overview\",\n description:\n \"Get a Google Ads account overview for a date range, including spend, clicks, impressions, conversions, conversion value, CTR, CPC, CPA, and ROAS.\",\n schema: googleAdsAccountOverviewSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n googleAdsAccountOverviewHandler\n);\n\nserver.tool(\n {\n name: \"gads_get_campaign_performance\",\n description:\n \"Get Google Ads campaign-level performance for a date range with spend, clicks, impressions, conversions, conversion value, CTR, CPC, CPA, and ROAS.\",\n schema: googleAdsCampaignPerformanceSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n googleAdsCampaignPerformanceHandler\n);\n\nserver.tool(\n {\n name: \"gads_get_time_series\",\n description:\n \"Get Google Ads daily or weekly time series for a date range with spend, clicks, impressions, conversions, conversion value, CPA, and ROAS.\",\n schema: googleAdsTimeSeriesSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n googleAdsTimeSeriesHandler\n);\n\nserver.tool(\n {\n name: \"gads_get_search_terms_summary\",\n description:\n \"Get a ranked summary of Google Ads search terms for a date range, including spend, clicks, impressions, conversions, conversion value, CPA, and ROAS.\",\n schema: googleAdsSearchTermsSummarySchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n googleAdsSearchTermsSummaryHandler\n);\n\nserver.tool(\n {\n name: \"gads_get_account_risks\",\n description:\n \"Evaluate Google Ads account risks for a date range, including concentration, low efficiency, weak conversion volume, and recent deterioration signals.\",\n schema: googleAdsAccountRisksSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n googleAdsAccountRisksHandler\n);\n\nserver.tool(\n {\n name: \"gads_get_break_even_analysis\",\n description:\n \"Compare current Google Ads performance against a user-provided break-even ROAS and optional CPA target.\",\n schema: googleAdsBreakEvenAnalysisSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n googleAdsBreakEvenAnalysisHandler\n);\n\nserver.tool(\n {\n name: \"gads_get_scaling_health\",\n description:\n \"Assess whether a Google Ads account is ready to scale using break-even ROAS, optional CPA target, concentration, stability, and conversion volume.\",\n schema: googleAdsScalingHealthSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n googleAdsScalingHealthHandler\n);\n\nserver.tool(\n {\n name: \"gads_compare_accounts\",\n description:\n \"Compare multiple Google Ads accounts across the same date range and rank them by basic risk and efficiency signals.\",\n schema: googleAdsCompareAccountsSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n googleAdsCompareAccountsHandler\n);\n\nserver.tool(\n {\n name: \"gsc_list_accessible_sites\",\n description: \"List all Search Console sites accessible with the configured Google credentials.\",\n schema: listAccessibleSitesSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n listAccessibleSitesHandler\n);\n\nserver.tool(\n {\n name: \"gsc_get_site_context\",\n description: \"Validate one Search Console site and return the resolved site context used by the module.\",\n schema: searchConsoleSiteContextSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n searchConsoleSiteContextHandler\n);\n\nserver.tool(\n {\n name: \"gsc_get_search_performance\",\n description: \"Run a flexible Search Console performance query with custom dimensions and filters.\",\n schema: searchConsoleSearchPerformanceSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n searchConsoleSearchPerformanceHandler\n);\n\nserver.tool(\n {\n name: \"gsc_get_query_performance\",\n description: \"Get Search Console performance grouped by search query for a date range.\",\n schema: searchConsoleQueryPerformanceSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n searchConsoleQueryPerformanceHandler\n);\n\nserver.tool(\n {\n name: \"gsc_get_page_performance\",\n description: \"Get Search Console performance grouped by landing page for a date range.\",\n schema: searchConsolePagePerformanceSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n searchConsolePagePerformanceHandler\n);\n\nserver.tool(\n {\n name: \"gsc_get_query_page_matrix\",\n description: \"Get a Search Console matrix crossing queries and landing pages for a date range.\",\n schema: searchConsoleQueryPageMatrixSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n searchConsoleQueryPageMatrixHandler\n);\n\nserver.tool(\n {\n name: \"gsc_get_device_breakdown\",\n description: \"Break down Search Console performance by device for a date range.\",\n schema: searchConsoleDeviceBreakdownSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n searchConsoleDeviceBreakdownHandler\n);\n\nserver.tool(\n {\n name: \"gsc_get_country_breakdown\",\n description: \"Break down Search Console performance by country for a date range.\",\n schema: searchConsoleCountryBreakdownSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n searchConsoleCountryBreakdownHandler\n);\n\nserver.tool(\n {\n name: \"gsc_find_high_impression_low_click_queries\",\n description: \"Find queries with high Search Console impression volume but weak click capture.\",\n schema: searchConsoleHighImpressionLowClickQueriesSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n searchConsoleHighImpressionLowClickQueriesHandler\n);\n\nserver.tool(\n {\n name: \"gsc_find_low_ctr_opportunities\",\n description: \"Find Search Console queries that rank reasonably well but underperform on CTR.\",\n schema: searchConsoleLowCtrOpportunitiesSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n searchConsoleLowCtrOpportunitiesHandler\n);\n\nserver.tool(\n {\n name: \"gsc_detect_visibility_declines\",\n description: \"Detect Search Console pages that are losing visibility between two periods.\",\n schema: searchConsoleVisibilityDeclinesSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n searchConsoleVisibilityDeclinesHandler\n);\n\nserver.tool(\n {\n name: \"gsc_find_product_demand_low_capture_queries\",\n description: \"Find product-intent queries with demand in Search Console but weak click capture.\",\n schema: searchConsoleProductDemandLowCaptureQueriesSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n searchConsoleProductDemandLowCaptureQueriesHandler\n);\n\nserver.tool(\n {\n name: \"gsc_find_rising_non_brand_queries\",\n description: \"Find non-branded Search Console queries growing between two periods.\",\n schema: searchConsoleRisingNonBrandQueriesSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n searchConsoleRisingNonBrandQueriesHandler\n);\n\nserver.tool(\n {\n name: \"gsc_find_quick_win_opportunities\",\n description: \"Prioritize Search Console quick wins across CTR improvements and ranking gains.\",\n schema: searchConsoleQuickWinOpportunitiesSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n searchConsoleQuickWinOpportunitiesHandler\n);\n\nserver.tool(\n {\n name: \"ga4_list_accessible_properties\",\n description: \"List all Google Analytics 4 accounts and properties accessible with the configured OAuth credentials.\",\n schema: listAccessiblePropertiesSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n listAccessiblePropertiesHandler\n);\n\nserver.tool(\n {\n name: \"ga4_get_property_info\",\n description: \"Get summary information and capabilities for one GA4 property, including ecommerce and attribution support.\",\n schema: propertyInfoSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n propertyInfoHandler\n);\n\nserver.tool(\n {\n name: \"ga4_get_channel_mix\",\n description: \"Get traffic mix by default channel group with shares of sessions and users for a date range.\",\n schema: channelMixSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n channelMixHandler\n);\n\nserver.tool(\n {\n name: \"ga4_get_source_medium_breakdown\",\n description: \"Get traffic breakdown by session source / medium with session and user share for a date range.\",\n schema: sourceMediumBreakdownSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n sourceMediumBreakdownHandler\n);\n\nserver.tool(\n {\n name: \"ga4_get_revenue_overview\",\n description: \"Get GA4 ecommerce overview for a date range including transactions, revenue, purchasers, and rates.\",\n schema: revenueOverviewSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n revenueOverviewHandler\n);\n\nserver.tool(\n {\n name: \"ga4_get_revenue_trend\",\n description: \"Get daily GA4 revenue and transactions trend for a date range.\",\n schema: revenueTrendSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n revenueTrendHandler\n);\n\nserver.tool(\n {\n name: \"ga4_get_revenue_by_channel\",\n description: \"Get GA4 revenue and transactions by default channel group for a date range.\",\n schema: revenueByChannelSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n revenueByChannelHandler\n);\n\nserver.tool(\n {\n name: \"ga4_get_top_landing_pages\",\n description: \"Get top landing pages by sessions and users for a date range.\",\n schema: topLandingPagesSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n topLandingPagesHandler\n);\n\nserver.tool(\n {\n name: \"ga4_get_engagement_overview\",\n description: \"Get GA4 engagement metrics for a date range, including engagement rate, bounce rate, and session duration.\",\n schema: engagementOverviewSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n engagementOverviewHandler\n);\n\nserver.tool(\n {\n name: \"ga4_detect_attribution_gaps\",\n description: \"Detect unattributed traffic, unassigned channels, and not-set source / medium values in GA4.\",\n schema: attributionGapsSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n attributionGapsHandler\n);\n\nserver.tool(\n {\n name: \"ga4_check_ecommerce_tracking_health\",\n description: \"Evaluate whether GA4 ecommerce tracking appears complete by checking item views, carts, checkouts, purchases, and refunds.\",\n schema: ecommerceTrackingHealthSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n ecommerceTrackingHealthHandler\n);\n\nserver.tool(\n {\n name: \"meli_get_account_context\",\n description: \"Get MercadoLibre account context for the selected profile, including seller id, nickname, scopes, and token expiry.\",\n schema: meliGetAccountContextSchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliGetAccountContextHandler\n);\n\nserver.tool(\n {\n name: \"meli_validate_connection\",\n description: \"Validate the MercadoLibre connection for a profile, refreshing tokens if needed and returning the resulting status.\",\n schema: meliValidateConnectionSchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliValidateConnectionHandler\n);\n\nserver.tool(\n {\n name: \"meli_get_orders_summary\",\n description: \"Get MercadoLibre order KPIs or compact order detail chunks for a date range. For reports, summaries, calculations, analysis, KPIs, metrics, performance, revenue, cancellations, refunds, discounts, shipping, trends, flows, or SKU economics, default to responseMode=calculations (calculations-only output, no order rows). Use responseMode=orders_chunk only when the user explicitly needs order-level detail or a question cannot be answered from calculations; it returns up to 15 pages of compact order rows with continuation metadata so the model can fetch more chunks if needed.\",\n schema: meliGetOrdersSummarySchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliGetOrdersSummaryHandler\n);\n\nserver.tool(\n {\n name: \"meli_get_order_details\",\n description: \"Get MercadoLibre order details for one or more order ids with partial-failure handling.\",\n schema: meliGetOrderDetailsSchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliGetOrderDetailsHandler\n);\n\nserver.tool(\n {\n name: \"meli_get_sales_by_item\",\n description: \"Aggregate MercadoLibre sales by item and variation for a date range, split by currency. Returns sales_by_item_schema plus compact positional rows to minimize tokens. The tool fan-outs internally across all order-search pages for the range when possible and returns metadata that makes partial coverage explicit if some pages fail.\",\n schema: meliGetSalesByItemSchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliGetSalesByItemHandler\n);\n\nserver.tool(\n {\n name: \"meli_get_sales_trend\",\n description: \"Build a MercadoLibre sales trend by day or week for a date range, split by currency.\",\n schema: meliGetSalesTrendSchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliGetSalesTrendHandler\n);\n\nserver.tool(\n {\n name: \"meli_get_shipping_summary\",\n description: \"Build a MercadoLibre shipping report for a date range. Default responseMode=calculations returns aggregate delivery health, logistics mix, cost, and daily trend KPIs; responseMode=shipments_chunk returns compact shipment rows with continuation metadata.\",\n schema: meliGetShippingSummarySchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliGetShippingSummaryHandler\n);\n\nserver.tool(\n {\n name: \"meli_get_item_visits\",\n description: \"Get MercadoLibre visits totals for seller-level date ranges or item-level time windows.\",\n schema: meliGetItemVisitsSchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliGetItemVisitsHandler\n);\n\nserver.tool(\n {\n name: \"meli_get_store_performance\",\n description: \"Combine MercadoLibre orders, items, and visits into an executive store performance summary.\",\n schema: meliGetStorePerformanceSchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliGetStorePerformanceHandler\n);\n\nserver.tool(\n {\n name: \"meli_search_items\",\n description: \"Search MercadoLibre seller items with compact detailed rows. Defaults to status=active, supports title text search, and returns items_schema plus compact item rows instead of raw item ids.\",\n schema: meliSearchItemsSchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliSearchItemsHandler\n);\n\nserver.tool(\n {\n name: \"meli_get_item_details\",\n description: \"Get rich MercadoLibre item details for one or more item ids with multiget and fallback batch handling. Returns near-raw listing context including attributes, sale terms, shipping, seller/location, dates, tags, and status, excluding pictures.\",\n schema: meliGetItemDetailsSchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliGetItemDetailsHandler\n);\n\nserver.tool(\n {\n name: \"meli_get_listing_quality\",\n description: \"Get listing quality and performance signals for a MercadoLibre item.\",\n schema: meliGetListingQualitySchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliGetListingQualityHandler\n);\n\nserver.tool(\n {\n name: \"meli_predict_category\",\n description: \"Predict candidate MercadoLibre categories and domains from a product query.\",\n schema: meliPredictCategorySchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliPredictCategoryHandler\n);\n\nserver.tool(\n {\n name: \"meli_get_category_requirements\",\n description: \"Get MercadoLibre category attribute requirements and shipping preferences for a category.\",\n schema: meliGetCategoryRequirementsSchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliGetCategoryRequirementsHandler\n);\n\nserver.tool(\n {\n name: \"meli_get_site_categories_and_listing_types\",\n description: \"Get MercadoLibre Argentina site categories and available listing types in a single catalog response.\",\n schema: meliGetSiteCategoriesAndListingTypesSchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliGetSiteCategoriesAndListingTypesHandler\n);\n\nserver.tool(\n {\n name: \"meli_estimate_listing_fee\",\n description: \"Estimate MercadoLibre selling fees with guided precision. Accepts an itemId to autocomplete listing parameters or manual price/category/listing/logistics/weight inputs, and returns missing params when precision can improve.\",\n schema: meliEstimateListingFeeSchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliEstimateListingFeeHandler\n);\n\nserver.tool(\n {\n name: \"meli_estimate_product_profitability\",\n description: \"Estimate whether a MercadoLibre product is profitable, using precise fee quotes, historical order/shipping data, and optional Billing ML audit. If user costs are missing, returns break-even limits and guided questions instead of failing.\",\n schema: meliEstimateProductProfitabilitySchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliEstimateProductProfitabilityHandler\n);\n\nserver.tool(\n {\n name: \"meli_create_item\",\n description: \"Create a MercadoLibre item directly for the selected profile, optionally publishing its description too.\",\n schema: meliCreateItemSchema,\n annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: true },\n },\n meliCreateItemHandler\n);\n\nserver.tool(\n {\n name: \"meli_update_item_basic_fields\",\n description: \"Update MercadoLibre item fields such as title, price, quantity, attributes, shipping, and status.\",\n schema: meliUpdateItemBasicFieldsSchema,\n annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: true },\n },\n meliUpdateItemBasicFieldsHandler\n);\n\nserver.tool(\n {\n name: \"meli_update_item_description\",\n description: \"Create or replace the published MercadoLibre plain-text item description.\",\n schema: meliUpdateItemDescriptionSchema,\n annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: true },\n },\n meliUpdateItemDescriptionHandler\n);\n\nserver.tool(\n {\n name: \"meli_update_item_pictures\",\n description: \"Add or replace MercadoLibre item pictures using public image URLs.\",\n schema: meliUpdateItemPicturesSchema,\n annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: true },\n },\n meliUpdateItemPicturesHandler\n);\n\nserver.tool(\n {\n name: \"meli_pause_or_reactivate_item\",\n description: \"Pause or reactivate a MercadoLibre item by changing its listing status.\",\n schema: meliPauseOrReactivateItemSchema,\n annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: true },\n },\n meliPauseOrReactivateItemHandler\n);\n\nserver.tool(\n {\n name: \"meli_search_questions\",\n description: \"Search MercadoLibre buyer questions for the selected seller with compact pagination-aware output.\",\n schema: meliSearchQuestionsSchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliSearchQuestionsHandler\n);\n\nserver.tool(\n {\n name: \"meli_answer_question\",\n description: \"Publish a MercadoLibre answer for a specific buyer question.\",\n schema: meliAnswerQuestionSchema,\n annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: true },\n },\n meliAnswerQuestionHandler\n);\n\nserver.prompt(\n {\n name: \"vtex-reporte-ventas\",\n description:\n \"Genera un prompt de reporte de ventas VTEX usando una sola entrada temporal en lenguaje natural.\",\n schema: reporteVentasPromptSchema,\n },\n reporteVentasPromptHandler\n);\n\nasync function createStdioTransportFromMcpUseDependency() {\n const requireFromHere = createRequire(import.meta.url);\n const mcpUseServerEntry = requireFromHere.resolve(\"mcp-use/server\");\n const requireFromMcpUse = createRequire(mcpUseServerEntry);\n const stdioModulePath = requireFromMcpUse.resolve(\"@modelcontextprotocol/sdk/server/stdio.js\");\n const stdioModule = (await import(pathToFileURL(stdioModulePath).href)) as {\n StdioServerTransport: new () => unknown;\n };\n\n return new stdioModule.StdioServerTransport();\n}\n\nasync function startServer() {\n const transport = (process.env.MCP_TRANSPORT ?? \"http\").trim().toLowerCase();\n\n if (transport === \"stdio\") {\n const stdioTransport = await createStdioTransportFromMcpUseDependency();\n await server.nativeServer.connect(stdioTransport as any);\n console.error(\"MCP server running on stdio transport\");\n return;\n }\n\n if (transport === \"http\") {\n const port = process.env.PORT ? Number.parseInt(process.env.PORT, 10) : 3000;\n if (Number.isNaN(port)) {\n throw new Error(`Invalid PORT value: ${process.env.PORT}`);\n }\n\n console.error(`MCP server running on http transport (port ${port})`);\n await server.listen(port);\n return;\n }\n\n throw new Error(`Invalid MCP_TRANSPORT \"${process.env.MCP_TRANSPORT}\". Use \"http\" or \"stdio\".`);\n}\n\nstartServer().catch((error) => {\n console.error(\"Failed to start MCP server\", error);\n process.exit(1);\n});\n"],
4
+ "sourcesContent": ["import { createRequire } from \"node:module\";\nimport { pathToFileURL } from \"node:url\";\nimport { MCPServer } from \"mcp-use/server\";\n\nimport {\n reporteVentasPromptHandler,\n reporteVentasPromptSchema,\n} from \"./src/prompts/reporte-ventas.js\";\nimport { getBenchmarksHandler, getBenchmarksSchema } from \"./src/config/benchmarks.js\";\nimport {\n checkDatabaseConnectionHandler,\n checkDatabaseConnectionSchema,\n listProfilesHandler,\n listProfilesSchema,\n googleAdsAccountRisksHandler,\n googleAdsAccountRisksSchema,\n googleAdsAccountOverviewHandler,\n googleAdsAccountOverviewSchema,\n googleAdsBreakEvenAnalysisHandler,\n googleAdsBreakEvenAnalysisSchema,\n googleAdsCampaignPerformanceHandler,\n googleAdsCampaignPerformanceSchema,\n googleAdsChannelMixHandler,\n googleAdsChannelMixSchema,\n googleAdsCompareAccountsHandler,\n googleAdsCompareAccountsSchema,\n googleAdsCustomerClientsHandler,\n googleAdsCustomerClientsSchema,\n googleAdsCustomerInfoHandler,\n googleAdsCustomerInfoSchema,\n googleAdsSearchTermsSummaryHandler,\n googleAdsSearchTermsSummarySchema,\n googleAdsScalingHealthHandler,\n googleAdsScalingHealthSchema,\n googleAdsTimeSeriesHandler,\n googleAdsTimeSeriesSchema,\n listAccessibleSitesHandler,\n listAccessibleSitesSchema,\n attributionGapsHandler,\n attributionGapsSchema,\n activateSkuHandler,\n activateSkuSchema,\n addOrderTrackingHandler,\n addOrderTrackingSchema,\n associateSpecificationHandler,\n associateSpecificationSchema,\n attachCatalogImageHandler,\n attachCatalogImageSchema,\n cancelOrderHandler,\n cancelOrderSchema,\n channelMixHandler,\n channelMixSchema,\n computedPriceHandler,\n computedPriceSchema,\n createBrandHandler,\n createBrandSchema,\n createCategoryHandler,\n createCategorySchema,\n createProductHandler,\n createProductSchema,\n createProductWithSkuHandler,\n createProductWithSkuSchema,\n createSkuHandler,\n createSkuSchema,\n createSpecificationHandler,\n createSpecificationSchema,\n createSpecificationValueHandler,\n createSpecificationValueSchema,\n deactivateSkuHandler,\n deactivateSkuSchema,\n deleteFixedPriceHandler,\n deleteFixedPriceSchema,\n ecommerceTrackingHealthHandler,\n ecommerceTrackingHealthSchema,\n engagementOverviewHandler,\n engagementOverviewSchema,\n invoiceOrderHandler,\n invoiceOrderSchema,\n inventoryCheckHandler,\n inventoryCheckSchema,\n listAccessiblePropertiesHandler,\n listAccessiblePropertiesSchema,\n metaAccountOverviewHandler,\n metaAccountOverviewSchema,\n metaAdAccountInfoHandler,\n metaAdAccountInfoSchema,\n metaAdsPerformanceHandler,\n metaAdsPerformanceSchema,\n metaCampaignPerformanceHandler,\n metaCampaignPerformanceSchema,\n metaListAccessibleAdAccountsHandler,\n metaListAccessibleAdAccountsSchema,\n metaListAccessibleBusinessesHandler,\n metaListAccessibleBusinessesSchema,\n metaPlacementMixHandler,\n metaPlacementMixSchema,\n metaTimeSeriesHandler,\n metaTimeSeriesSchema,\n searchConsoleCountryBreakdownHandler,\n searchConsoleCountryBreakdownSchema,\n searchConsoleDeviceBreakdownHandler,\n searchConsoleDeviceBreakdownSchema,\n searchConsoleHighImpressionLowClickQueriesHandler,\n searchConsoleHighImpressionLowClickQueriesSchema,\n searchConsoleLowCtrOpportunitiesHandler,\n searchConsoleLowCtrOpportunitiesSchema,\n searchConsolePagePerformanceHandler,\n searchConsolePagePerformanceSchema,\n searchConsoleProductDemandLowCaptureQueriesHandler,\n searchConsoleProductDemandLowCaptureQueriesSchema,\n searchConsoleQueryPageMatrixHandler,\n searchConsoleQueryPageMatrixSchema,\n searchConsoleQueryPerformanceHandler,\n searchConsoleQueryPerformanceSchema,\n searchConsoleQuickWinOpportunitiesHandler,\n searchConsoleQuickWinOpportunitiesSchema,\n searchConsoleRisingNonBrandQueriesHandler,\n searchConsoleRisingNonBrandQueriesSchema,\n searchConsoleSearchPerformanceHandler,\n searchConsoleSearchPerformanceSchema,\n searchConsoleSiteContextHandler,\n searchConsoleSiteContextSchema,\n searchConsoleVisibilityDeclinesHandler,\n searchConsoleVisibilityDeclinesSchema,\n orderDetailsHandler,\n orderDetailsSchema,\n ordersSummaryHandler,\n ordersSummarySchema,\n propertyInfoHandler,\n propertyInfoSchema,\n productOffersHandler,\n productOffersSchema,\n revenueByChannelHandler,\n revenueByChannelSchema,\n revenueOverviewHandler,\n revenueOverviewSchema,\n revenueTrendHandler,\n revenueTrendSchema,\n skuOffersHandler,\n skuOffersSchema,\n toggleUnlimitedQuantityHandler,\n toggleUnlimitedQuantitySchema,\n skuPriceHandler,\n skuPriceSchema,\n sourceMediumBreakdownHandler,\n sourceMediumBreakdownSchema,\n topLandingPagesHandler,\n topLandingPagesSchema,\n updateInventoryHandler,\n updateInventorySchema,\n updateLeadTimeHandler,\n updateLeadTimeSchema,\n updateProductBasicFieldsHandler,\n updateProductBasicFieldsSchema,\n updateSkuBasicFieldsHandler,\n updateSkuBasicFieldsSchema,\n updateSkuPriceHandler,\n updateSkuPriceSchema,\n upsertFixedPriceHandler,\n upsertFixedPriceSchema,\n warehouseInventoryHandler,\n warehouseInventorySchema,\n} from \"./src/tools/index.js\";\nimport {\n meliAnswerQuestionHandler,\n meliAnswerQuestionSchema,\n meliCreateItemHandler,\n meliCreateItemSchema,\n meliEstimateListingFeeHandler,\n meliEstimateListingFeeSchema,\n meliEstimateProductProfitabilityHandler,\n meliEstimateProductProfitabilitySchema,\n meliGetAccountContextHandler,\n meliGetAccountContextSchema,\n meliGetCategoryRequirementsHandler,\n meliGetCategoryRequirementsSchema,\n meliGetSiteCategoriesAndListingTypesHandler,\n meliGetSiteCategoriesAndListingTypesSchema,\n meliGetItemDetailsHandler,\n meliGetItemDetailsSchema,\n meliGetItemVisitsHandler,\n meliGetItemVisitsSchema,\n meliGetListingQualityHandler,\n meliGetListingQualitySchema,\n meliGetOrderDetailsHandler,\n meliGetOrderDetailsSchema,\n meliGetOrdersSummaryHandler,\n meliGetOrdersSummarySchema,\n meliGetSalesByItemHandler,\n meliGetSalesByItemSchema,\n meliGetSalesTrendHandler,\n meliGetSalesTrendSchema,\n meliGetShippingSummaryHandler,\n meliGetShippingSummarySchema,\n meliGetStorePerformanceHandler,\n meliGetStorePerformanceSchema,\n meliPauseOrReactivateItemHandler,\n meliPauseOrReactivateItemSchema,\n meliPredictCategoryHandler,\n meliPredictCategorySchema,\n meliSearchItemsHandler,\n meliSearchItemsSchema,\n meliSearchQuestionsHandler,\n meliSearchQuestionsSchema,\n meliUpdateItemBasicFieldsHandler,\n meliUpdateItemBasicFieldsSchema,\n meliUpdateItemDescriptionHandler,\n meliUpdateItemDescriptionSchema,\n meliUpdateItemPicturesHandler,\n meliUpdateItemPicturesSchema,\n meliValidateConnectionHandler,\n meliValidateConnectionSchema,\n} from \"./src/tools/index.js\";\n\nconst server = new MCPServer({\n name: \"bi-mcp\",\n title: \"BI MCP\",\n version: \"1.0.0\",\n description:\n \"Business Intelligence MCP server with VTEX, Google, and Meta Ads tools for ecommerce analysis.\",\n baseUrl: process.env.MCP_URL || \"http://localhost:3000\",\n favicon: \"favicon.ico\",\n icons: [\n {\n src: \"icon.svg\",\n mimeType: \"image/svg+xml\",\n sizes: [\"512x512\"],\n },\n ],\n});\n\nserver.tool(\n {\n name: \"meta_list_accessible_businesses\",\n description:\n \"List Meta businesses accessible with the configured token, useful for onboarding and permission validation.\",\n schema: metaListAccessibleBusinessesSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n metaListAccessibleBusinessesHandler\n);\n\nserver.tool(\n {\n name: \"meta_list_accessible_ad_accounts\",\n description:\n \"List Meta ad accounts accessible with the configured token, including IDs, currencies, business context, and status.\",\n schema: metaListAccessibleAdAccountsSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n metaListAccessibleAdAccountsHandler\n);\n\nserver.tool(\n {\n name: \"meta_get_ad_account_info\",\n description:\n \"Get summary information for one Meta ad account, including name, currency, timezone, business, and account status.\",\n schema: metaAdAccountInfoSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n metaAdAccountInfoHandler\n);\n\nserver.tool(\n {\n name: \"meta_get_account_overview\",\n description:\n \"Get a Meta Ads overview for one or more ad accounts over a date range, including spend, clicks, impressions, purchases, purchase value, CPC, CPM, and ROAS.\",\n schema: metaAccountOverviewSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n metaAccountOverviewHandler\n);\n\nserver.tool(\n {\n name: \"meta_get_campaign_performance\",\n description:\n \"Get Meta Ads campaign-level performance for one or more ad accounts over a date range with spend, clicks, impressions, purchases, purchase value, CPC, CPM, and ROAS.\",\n schema: metaCampaignPerformanceSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n metaCampaignPerformanceHandler\n);\n\nserver.tool(\n {\n name: \"meta_get_ads_performance\",\n description:\n \"Get Meta Ads ad-level performance for one or more ad accounts over a date range, useful for creative review and performance diagnostics.\",\n schema: metaAdsPerformanceSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n metaAdsPerformanceHandler\n);\n\nserver.tool(\n {\n name: \"meta_get_time_series\",\n description:\n \"Get a Meta Ads time series for one or more ad accounts over a date range, with daily, weekly, or monthly granularity.\",\n schema: metaTimeSeriesSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n metaTimeSeriesHandler\n);\n\nserver.tool(\n {\n name: \"meta_get_placement_mix\",\n description:\n \"Get Meta Ads placement mix for one or more ad accounts over a date range, including publisher platform and platform position performance.\",\n schema: metaPlacementMixSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n metaPlacementMixHandler\n);\n\nserver.tool(\n {\n name: \"vtex_get_orders_summary\",\n description: \"Get aggregated orders summary by date range with currency-aware BI metrics.\",\n schema: ordersSummarySchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n ordersSummaryHandler\n);\n\nserver.tool(\n {\n name: \"vtex_get_order_details\",\n description: \"Get BI-focused detailed information for one or more orders.\",\n schema: orderDetailsSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n orderDetailsHandler\n);\n\nserver.tool(\n {\n name: \"vtex_check_inventory\",\n description: \"Check global SKU inventory and infer stock health status.\",\n schema: inventoryCheckSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n inventoryCheckHandler\n);\n\nserver.tool(\n {\n name: \"vtex_get_warehouse_inventory\",\n description: \"Get SKU inventory details for a specific warehouse.\",\n schema: warehouseInventorySchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n warehouseInventoryHandler\n);\n\nserver.tool(\n {\n name: \"vtex_update_inventory\",\n description:\n \"Update the stock quantity and unlimited-quantity mode for one SKU in one warehouse. This overwrites the current quantity and availability mode stored in VTEX for that warehouse.\",\n schema: updateInventorySchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n updateInventoryHandler\n);\n\nserver.tool(\n {\n name: \"vtex_update_lead_time\",\n description:\n \"Update the lead time for one SKU in one warehouse. This overwrites the current lead time value in VTEX for that warehouse.\",\n schema: updateLeadTimeSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n updateLeadTimeHandler\n);\n\nserver.tool(\n {\n name: \"vtex_toggle_unlimited_quantity\",\n description:\n \"Toggle only the unlimited-quantity mode for one SKU in one warehouse. This keeps the current stock quantity and overwrites only the unlimited availability flag.\",\n schema: toggleUnlimitedQuantitySchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n toggleUnlimitedQuantityHandler\n);\n\nserver.tool(\n {\n name: \"vtex_update_sku_price\",\n description:\n \"Update base pricing fields for one SKU in VTEX Pricing. This can overwrite base price, list price, cost price, markup, and, if fixedPrices is sent, it also replaces any fixed prices not included in the payload.\",\n schema: updateSkuPriceSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n updateSkuPriceHandler\n);\n\nserver.tool(\n {\n name: \"vtex_upsert_fixed_price\",\n description:\n \"Create or replace fixed prices for one SKU inside one price table or trade policy. The provided fixed prices overwrite the current entries for that price table.\",\n schema: upsertFixedPriceSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n upsertFixedPriceHandler\n);\n\nserver.tool(\n {\n name: \"vtex_delete_fixed_price\",\n description:\n \"Delete all fixed prices configured for one SKU inside one price table or trade policy.\",\n schema: deleteFixedPriceSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n deleteFixedPriceHandler\n);\n\nserver.tool(\n {\n name: \"vtex_activate_sku\",\n description:\n \"Activate one SKU by setting its active flag to true. This updates the SKU record in VTEX and preserves the current operational fields.\",\n schema: activateSkuSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n activateSkuHandler\n);\n\nserver.tool(\n {\n name: \"vtex_deactivate_sku\",\n description:\n \"Deactivate one SKU by setting its active flag to false. This updates the SKU record in VTEX and preserves the current operational fields.\",\n schema: deactivateSkuSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n deactivateSkuHandler\n);\n\nserver.tool(\n {\n name: \"vtex_update_product_basic_fields\",\n description:\n \"Update core product fields such as name, description, category, brand, visibility, and SEO fields. Only the provided fields are changed; the tool keeps the current VTEX values for the rest.\",\n schema: updateProductBasicFieldsSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n updateProductBasicFieldsHandler\n);\n\nserver.tool(\n {\n name: \"vtex_update_sku_basic_fields\",\n description:\n \"Update core SKU fields such as name, reference, EAN, dimensions, weight, measurement unit, and active flags. Only the provided fields are changed; the tool keeps the current VTEX values for the rest.\",\n schema: updateSkuBasicFieldsSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n updateSkuBasicFieldsHandler\n);\n\nserver.tool(\n {\n name: \"vtex_create_product\",\n description:\n \"Create one product in VTEX Catalog. You can point it to existing category and brand IDs, or ask VTEX Catalog to use categoryPath and brandName when those entities are not already mapped.\",\n schema: createProductSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n createProductHandler\n);\n\nserver.tool(\n {\n name: \"vtex_create_sku\",\n description:\n \"Create one SKU under an existing VTEX product. This creates the SKU record and can optionally attach one EAN after creation.\",\n schema: createSkuSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n createSkuHandler\n);\n\nserver.tool(\n {\n name: \"vtex_create_product_with_sku\",\n description:\n \"Create one VTEX product and one SKU in a single operation. Use this when the product does not exist yet and you want the initial SKU created immediately after the product.\",\n schema: createProductWithSkuSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n createProductWithSkuHandler\n);\n\nserver.tool(\n {\n name: \"vtex_create_brand\",\n description:\n \"Create one brand in VTEX Catalog using the official brand contract. This creates the brand record and returns the created brand payload.\",\n schema: createBrandSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n createBrandHandler\n);\n\nserver.tool(\n {\n name: \"vtex_create_category\",\n description:\n \"Create one category in VTEX Catalog. This writes a new category record and can be used for top-level or child categories depending on fatherCategoryId.\",\n schema: createCategorySchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n createCategoryHandler\n);\n\nserver.tool(\n {\n name: \"vtex_create_specification\",\n description:\n \"Create one specification field in VTEX Catalog, including its field type, group, and visibility flags.\",\n schema: createSpecificationSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n createSpecificationHandler\n);\n\nserver.tool(\n {\n name: \"vtex_create_specification_value\",\n description:\n \"Create one specification value for an existing VTEX specification field.\",\n schema: createSpecificationValueSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n createSpecificationValueHandler\n);\n\nserver.tool(\n {\n name: \"vtex_associate_specification\",\n description:\n \"Associate one specification to one product or one SKU. This writes a single specification association using either a fieldValueId or raw text, depending on the field type.\",\n schema: associateSpecificationSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n associateSpecificationHandler\n);\n\nserver.tool(\n {\n name: \"vtex_attach_catalog_image\",\n description:\n \"Attach one catalog image to one SKU using a public image URL. This adds a new SKU file entry in VTEX Catalog.\",\n schema: attachCatalogImageSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n attachCatalogImageHandler\n);\n\nserver.tool(\n {\n name: \"vtex_cancel_order\",\n description:\n \"Cancel one order in VTEX Orders API. Before using this tool, the assistant must explain what will be canceled, mention that invoiced orders cannot be canceled and cancellations cannot be reversed, and obtain explicit confirmation from the user. Only then should the tool be called with confirmed=true.\",\n schema: cancelOrderSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n cancelOrderHandler\n);\n\nserver.tool(\n {\n name: \"vtex_invoice_order\",\n description:\n \"Invoice one order in VTEX Orders API. Before using this tool, the assistant must explain that invoicing changes the order's logistics and financial state, mention that the tool writes invoice data into VTEX, and obtain explicit confirmation from the user. Only then should the tool be called with confirmed=true.\",\n schema: invoiceOrderSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n invoiceOrderHandler\n);\n\nserver.tool(\n {\n name: \"vtex_add_order_tracking\",\n description:\n \"Add tracking data to one invoiced order in VTEX. Before using this tool, the assistant must explain which invoice and tracking data will be updated, mention that this affects the operational communication sent to the customer, and obtain explicit confirmation from the user. Only then should the tool be called with confirmed=true.\",\n schema: addOrderTrackingSchema,\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n openWorldHint: true,\n },\n },\n addOrderTrackingHandler\n);\n\nserver.tool(\n {\n name: \"vtex_get_sku_price\",\n description: \"Get base pricing information for one SKU.\",\n schema: skuPriceSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n skuPriceHandler\n);\n\nserver.tool(\n {\n name: \"vtex_get_computed_price\",\n description: \"Get computed SKU price by price table context.\",\n schema: computedPriceSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n computedPriceHandler\n);\n\nserver.tool(\n {\n name: \"vtex_get_product_offers\",\n description: \"Get offers for all SKUs under a product.\",\n schema: productOffersSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n productOffersHandler\n);\n\nserver.tool(\n {\n name: \"vtex_get_sku_offers\",\n description: \"Get offers for a specific SKU under a product.\",\n schema: skuOffersSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n skuOffersHandler\n);\n\nserver.tool(\n {\n name: \"config_check_database_connection\",\n description:\n \"Check whether the MCP can reach its configured database and whether critical tables are present.\",\n schema: checkDatabaseConnectionSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: false,\n },\n },\n checkDatabaseConnectionHandler\n);\n\nserver.tool(\n {\n name: \"config_list_profiles\",\n description: \"List client profiles currently available in the MCP database.\",\n schema: listProfilesSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: false,\n },\n },\n listProfilesHandler\n);\n\nserver.tool(\n {\n name: \"config_get_benchmarks\",\n description:\n \"Devuelve benchmarks de Argentina para c\u00E1lculos financieros: IIBB por provincia, costos de cuotas sin inter\u00E9s (Ahora 12, Plan Z), fees de pasarelas de pago (Mercado Pago, Mobbex, Payway, dLocal), costos log\u00EDsticos por zona y calendario comercial con impacto de revenue.\",\n schema: getBenchmarksSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: false,\n },\n },\n getBenchmarksHandler\n);\n\nserver.tool(\n {\n name: \"gads_get_channel_mix\",\n description:\n \"Get Google Ads mix by advertising channel type for a date range, including spend, clicks, impressions, conversions, conversion value, and channel share.\",\n schema: googleAdsChannelMixSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n googleAdsChannelMixHandler\n);\n\nserver.tool(\n {\n name: \"gads_get_customer_info\",\n description:\n \"Get summary information for one Google Ads customer account, including name, currency, timezone, and whether the account is a manager (MCC).\",\n schema: googleAdsCustomerInfoSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n googleAdsCustomerInfoHandler\n);\n\nserver.tool(\n {\n name: \"gads_list_customer_clients\",\n description:\n \"List visible child accounts for a Google Ads customer account, usually used to inspect manager (MCC) account structure.\",\n schema: googleAdsCustomerClientsSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n googleAdsCustomerClientsHandler\n);\n\nserver.tool(\n {\n name: \"gads_get_account_overview\",\n description:\n \"Get a Google Ads account overview for a date range, including spend, clicks, impressions, conversions, conversion value, CTR, CPC, CPA, and ROAS.\",\n schema: googleAdsAccountOverviewSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n googleAdsAccountOverviewHandler\n);\n\nserver.tool(\n {\n name: \"gads_get_campaign_performance\",\n description:\n \"Get Google Ads campaign-level performance for a date range with spend, clicks, impressions, conversions, conversion value, CTR, CPC, CPA, and ROAS.\",\n schema: googleAdsCampaignPerformanceSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n googleAdsCampaignPerformanceHandler\n);\n\nserver.tool(\n {\n name: \"gads_get_time_series\",\n description:\n \"Get Google Ads daily or weekly time series for a date range with spend, clicks, impressions, conversions, conversion value, CPA, and ROAS.\",\n schema: googleAdsTimeSeriesSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n googleAdsTimeSeriesHandler\n);\n\nserver.tool(\n {\n name: \"gads_get_search_terms_summary\",\n description:\n \"Get a ranked summary of Google Ads search terms for a date range, including spend, clicks, impressions, conversions, conversion value, CPA, and ROAS.\",\n schema: googleAdsSearchTermsSummarySchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n googleAdsSearchTermsSummaryHandler\n);\n\nserver.tool(\n {\n name: \"gads_get_account_risks\",\n description:\n \"Evaluate Google Ads account risks for a date range, including concentration, low efficiency, weak conversion volume, and recent deterioration signals.\",\n schema: googleAdsAccountRisksSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n googleAdsAccountRisksHandler\n);\n\nserver.tool(\n {\n name: \"gads_get_break_even_analysis\",\n description:\n \"Compare current Google Ads performance against a user-provided break-even ROAS and optional CPA target.\",\n schema: googleAdsBreakEvenAnalysisSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n googleAdsBreakEvenAnalysisHandler\n);\n\nserver.tool(\n {\n name: \"gads_get_scaling_health\",\n description:\n \"Assess whether a Google Ads account is ready to scale using break-even ROAS, optional CPA target, concentration, stability, and conversion volume.\",\n schema: googleAdsScalingHealthSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n googleAdsScalingHealthHandler\n);\n\nserver.tool(\n {\n name: \"gads_compare_accounts\",\n description:\n \"Compare multiple Google Ads accounts across the same date range and rank them by basic risk and efficiency signals.\",\n schema: googleAdsCompareAccountsSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n googleAdsCompareAccountsHandler\n);\n\nserver.tool(\n {\n name: \"gsc_list_accessible_sites\",\n description: \"List all Search Console sites accessible with the configured Google credentials.\",\n schema: listAccessibleSitesSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n listAccessibleSitesHandler\n);\n\nserver.tool(\n {\n name: \"gsc_get_site_context\",\n description: \"Validate one Search Console site and return the resolved site context used by the module.\",\n schema: searchConsoleSiteContextSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n searchConsoleSiteContextHandler\n);\n\nserver.tool(\n {\n name: \"gsc_get_search_performance\",\n description: \"Run a flexible Search Console performance query with custom dimensions and filters.\",\n schema: searchConsoleSearchPerformanceSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n searchConsoleSearchPerformanceHandler\n);\n\nserver.tool(\n {\n name: \"gsc_get_query_performance\",\n description: \"Get Search Console performance grouped by search query for a date range.\",\n schema: searchConsoleQueryPerformanceSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n searchConsoleQueryPerformanceHandler\n);\n\nserver.tool(\n {\n name: \"gsc_get_page_performance\",\n description: \"Get Search Console performance grouped by landing page for a date range.\",\n schema: searchConsolePagePerformanceSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n searchConsolePagePerformanceHandler\n);\n\nserver.tool(\n {\n name: \"gsc_get_query_page_matrix\",\n description: \"Get a Search Console matrix crossing queries and landing pages for a date range.\",\n schema: searchConsoleQueryPageMatrixSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n searchConsoleQueryPageMatrixHandler\n);\n\nserver.tool(\n {\n name: \"gsc_get_device_breakdown\",\n description: \"Break down Search Console performance by device for a date range.\",\n schema: searchConsoleDeviceBreakdownSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n searchConsoleDeviceBreakdownHandler\n);\n\nserver.tool(\n {\n name: \"gsc_get_country_breakdown\",\n description: \"Break down Search Console performance by country for a date range.\",\n schema: searchConsoleCountryBreakdownSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n searchConsoleCountryBreakdownHandler\n);\n\nserver.tool(\n {\n name: \"gsc_find_high_impression_low_click_queries\",\n description: \"Find queries with high Search Console impression volume but weak click capture.\",\n schema: searchConsoleHighImpressionLowClickQueriesSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n searchConsoleHighImpressionLowClickQueriesHandler\n);\n\nserver.tool(\n {\n name: \"gsc_find_low_ctr_opportunities\",\n description: \"Find Search Console queries that rank reasonably well but underperform on CTR.\",\n schema: searchConsoleLowCtrOpportunitiesSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n searchConsoleLowCtrOpportunitiesHandler\n);\n\nserver.tool(\n {\n name: \"gsc_detect_visibility_declines\",\n description: \"Detect Search Console pages that are losing visibility between two periods.\",\n schema: searchConsoleVisibilityDeclinesSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n searchConsoleVisibilityDeclinesHandler\n);\n\nserver.tool(\n {\n name: \"gsc_find_product_demand_low_capture_queries\",\n description: \"Find product-intent queries with demand in Search Console but weak click capture.\",\n schema: searchConsoleProductDemandLowCaptureQueriesSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n searchConsoleProductDemandLowCaptureQueriesHandler\n);\n\nserver.tool(\n {\n name: \"gsc_find_rising_non_brand_queries\",\n description: \"Find non-branded Search Console queries growing between two periods.\",\n schema: searchConsoleRisingNonBrandQueriesSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n searchConsoleRisingNonBrandQueriesHandler\n);\n\nserver.tool(\n {\n name: \"gsc_find_quick_win_opportunities\",\n description: \"Prioritize Search Console quick wins across CTR improvements and ranking gains.\",\n schema: searchConsoleQuickWinOpportunitiesSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n searchConsoleQuickWinOpportunitiesHandler\n);\n\nserver.tool(\n {\n name: \"ga4_list_accessible_properties\",\n description: \"List all Google Analytics 4 accounts and properties accessible with the configured OAuth credentials.\",\n schema: listAccessiblePropertiesSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n listAccessiblePropertiesHandler\n);\n\nserver.tool(\n {\n name: \"ga4_get_property_info\",\n description: \"Get summary information and capabilities for one GA4 property, including ecommerce and attribution support.\",\n schema: propertyInfoSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n propertyInfoHandler\n);\n\nserver.tool(\n {\n name: \"ga4_get_channel_mix\",\n description: \"Get traffic mix by default channel group with shares of sessions and users for a date range.\",\n schema: channelMixSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n channelMixHandler\n);\n\nserver.tool(\n {\n name: \"ga4_get_source_medium_breakdown\",\n description: \"Get traffic breakdown by session source / medium with session and user share for a date range.\",\n schema: sourceMediumBreakdownSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n sourceMediumBreakdownHandler\n);\n\nserver.tool(\n {\n name: \"ga4_get_revenue_overview\",\n description: \"Get GA4 ecommerce overview for a date range including transactions, revenue, purchasers, and rates.\",\n schema: revenueOverviewSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n revenueOverviewHandler\n);\n\nserver.tool(\n {\n name: \"ga4_get_revenue_trend\",\n description: \"Get daily GA4 revenue and transactions trend for a date range.\",\n schema: revenueTrendSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n revenueTrendHandler\n);\n\nserver.tool(\n {\n name: \"ga4_get_revenue_by_channel\",\n description: \"Get GA4 revenue and transactions by default channel group for a date range.\",\n schema: revenueByChannelSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n revenueByChannelHandler\n);\n\nserver.tool(\n {\n name: \"ga4_get_top_landing_pages\",\n description: \"Get top landing pages by sessions and users for a date range.\",\n schema: topLandingPagesSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n topLandingPagesHandler\n);\n\nserver.tool(\n {\n name: \"ga4_get_engagement_overview\",\n description: \"Get GA4 engagement metrics for a date range, including engagement rate, bounce rate, and session duration.\",\n schema: engagementOverviewSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n engagementOverviewHandler\n);\n\nserver.tool(\n {\n name: \"ga4_detect_attribution_gaps\",\n description: \"Detect unattributed traffic, unassigned channels, and not-set source / medium values in GA4.\",\n schema: attributionGapsSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n attributionGapsHandler\n);\n\nserver.tool(\n {\n name: \"ga4_check_ecommerce_tracking_health\",\n description: \"Evaluate whether GA4 ecommerce tracking appears complete by checking item views, carts, checkouts, purchases, and refunds.\",\n schema: ecommerceTrackingHealthSchema,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n openWorldHint: true,\n },\n },\n ecommerceTrackingHealthHandler\n);\n\nserver.tool(\n {\n name: \"meli_get_account_context\",\n description: \"Get MercadoLibre account context for the selected profile, including seller id, nickname, scopes, and token expiry.\",\n schema: meliGetAccountContextSchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliGetAccountContextHandler\n);\n\nserver.tool(\n {\n name: \"meli_validate_connection\",\n description: \"Validate the MercadoLibre connection for a profile, refreshing tokens if needed and returning the resulting status.\",\n schema: meliValidateConnectionSchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliValidateConnectionHandler\n);\n\nserver.tool(\n {\n name: \"meli_get_orders_summary\",\n description: \"Get MercadoLibre order KPIs or compact order detail chunks for a date range. For reports, summaries, calculations, analysis, KPIs, metrics, performance, revenue, cancellations, refunds, discounts, shipping, trends, flows, or SKU economics, default to responseMode=calculations (calculations-only output, no order rows). Use responseMode=orders_chunk only when the user explicitly needs order-level detail or a question cannot be answered from calculations; it returns up to 15 pages of compact order rows with continuation metadata so the model can fetch more chunks if needed.\",\n schema: meliGetOrdersSummarySchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliGetOrdersSummaryHandler\n);\n\nserver.tool(\n {\n name: \"meli_get_order_details\",\n description: \"Get MercadoLibre order details for one or more order ids with partial-failure handling.\",\n schema: meliGetOrderDetailsSchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliGetOrderDetailsHandler\n);\n\nserver.tool(\n {\n name: \"meli_get_sales_by_item\",\n description: \"Aggregate MercadoLibre sales by item and variation for a date range, split by currency. Returns sales_by_item_schema plus compact positional rows to minimize tokens. The tool fan-outs internally across all order-search pages for the range when possible and returns metadata that makes partial coverage explicit if some pages fail.\",\n schema: meliGetSalesByItemSchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliGetSalesByItemHandler\n);\n\nserver.tool(\n {\n name: \"meli_get_sales_trend\",\n description: \"Build a MercadoLibre sales trend by day or week for a date range, split by currency.\",\n schema: meliGetSalesTrendSchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliGetSalesTrendHandler\n);\n\nserver.tool(\n {\n name: \"meli_get_shipping_summary\",\n description: \"Build a MercadoLibre shipping report for a date range. Default responseMode=calculations returns aggregate delivery health, logistics mix, cost, and daily trend KPIs; responseMode=shipments_chunk returns compact shipment rows with continuation metadata.\",\n schema: meliGetShippingSummarySchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliGetShippingSummaryHandler\n);\n\nserver.tool(\n {\n name: \"meli_get_item_visits\",\n description: \"Get MercadoLibre visits totals for seller-level date ranges or item-level time windows.\",\n schema: meliGetItemVisitsSchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliGetItemVisitsHandler\n);\n\nserver.tool(\n {\n name: \"meli_get_store_performance\",\n description: \"Combine MercadoLibre orders, items, and visits into an executive store performance summary.\",\n schema: meliGetStorePerformanceSchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliGetStorePerformanceHandler\n);\n\nserver.tool(\n {\n name: \"meli_search_items\",\n description: \"Search MercadoLibre seller items with compact detailed rows. Defaults to status=active, supports title text search, and returns items_schema plus compact item rows instead of raw item ids.\",\n schema: meliSearchItemsSchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliSearchItemsHandler\n);\n\nserver.tool(\n {\n name: \"meli_get_item_details\",\n description: \"Get rich MercadoLibre item details for one or more item ids with multiget and fallback batch handling. Returns near-raw listing context including attributes, sale terms, shipping, seller/location, dates, tags, and status, excluding pictures.\",\n schema: meliGetItemDetailsSchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliGetItemDetailsHandler\n);\n\nserver.tool(\n {\n name: \"meli_get_listing_quality\",\n description: \"Get listing quality and performance signals for a MercadoLibre item.\",\n schema: meliGetListingQualitySchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliGetListingQualityHandler\n);\n\nserver.tool(\n {\n name: \"meli_predict_category\",\n description: \"Predict candidate MercadoLibre categories and domains from a product query.\",\n schema: meliPredictCategorySchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliPredictCategoryHandler\n);\n\nserver.tool(\n {\n name: \"meli_get_category_requirements\",\n description: \"Get MercadoLibre category attribute requirements and shipping preferences for a category.\",\n schema: meliGetCategoryRequirementsSchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliGetCategoryRequirementsHandler\n);\n\nserver.tool(\n {\n name: \"meli_get_site_categories_and_listing_types\",\n description: \"Get MercadoLibre Argentina site categories and available listing types in a single catalog response.\",\n schema: meliGetSiteCategoriesAndListingTypesSchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliGetSiteCategoriesAndListingTypesHandler\n);\n\nserver.tool(\n {\n name: \"meli_estimate_listing_fee\",\n description: \"Estimate MercadoLibre selling fees with guided precision. Accepts an itemId to autocomplete listing parameters or manual price/category/listing/logistics/weight inputs, and returns missing params when precision can improve.\",\n schema: meliEstimateListingFeeSchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliEstimateListingFeeHandler\n);\n\nserver.tool(\n {\n name: \"meli_estimate_product_profitability\",\n description: \"Estimate whether a MercadoLibre product is profitable, using precise fee quotes plus historical order and shipping data. Best when you already have the itemId; if you only have the product name/title, use meli_search_items first to find the correct itemId. If user costs are missing, returns break-even limits and guided questions instead of failing.\",\n schema: meliEstimateProductProfitabilitySchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliEstimateProductProfitabilityHandler\n);\n\nserver.tool(\n {\n name: \"meli_create_item\",\n description: \"Create a MercadoLibre item directly for the selected profile, optionally publishing its description too.\",\n schema: meliCreateItemSchema,\n annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: true },\n },\n meliCreateItemHandler\n);\n\nserver.tool(\n {\n name: \"meli_update_item_basic_fields\",\n description: \"Update MercadoLibre item fields such as title, price, quantity, attributes, shipping, and status.\",\n schema: meliUpdateItemBasicFieldsSchema,\n annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: true },\n },\n meliUpdateItemBasicFieldsHandler\n);\n\nserver.tool(\n {\n name: \"meli_update_item_description\",\n description: \"Create or replace the published MercadoLibre plain-text item description.\",\n schema: meliUpdateItemDescriptionSchema,\n annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: true },\n },\n meliUpdateItemDescriptionHandler\n);\n\nserver.tool(\n {\n name: \"meli_update_item_pictures\",\n description: \"Add or replace MercadoLibre item pictures using public image URLs.\",\n schema: meliUpdateItemPicturesSchema,\n annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: true },\n },\n meliUpdateItemPicturesHandler\n);\n\nserver.tool(\n {\n name: \"meli_pause_or_reactivate_item\",\n description: \"Pause or reactivate a MercadoLibre item by changing its listing status.\",\n schema: meliPauseOrReactivateItemSchema,\n annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: true },\n },\n meliPauseOrReactivateItemHandler\n);\n\nserver.tool(\n {\n name: \"meli_search_questions\",\n description: \"Search MercadoLibre buyer questions for the selected seller with compact pagination-aware output.\",\n schema: meliSearchQuestionsSchema,\n annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },\n },\n meliSearchQuestionsHandler\n);\n\nserver.tool(\n {\n name: \"meli_answer_question\",\n description: \"Publish a MercadoLibre answer for a specific buyer question.\",\n schema: meliAnswerQuestionSchema,\n annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: true },\n },\n meliAnswerQuestionHandler\n);\n\nserver.prompt(\n {\n name: \"vtex-reporte-ventas\",\n description:\n \"Genera un prompt de reporte de ventas VTEX usando una sola entrada temporal en lenguaje natural.\",\n schema: reporteVentasPromptSchema,\n },\n reporteVentasPromptHandler\n);\n\nasync function createStdioTransportFromMcpUseDependency() {\n const requireFromHere = createRequire(import.meta.url);\n const mcpUseServerEntry = requireFromHere.resolve(\"mcp-use/server\");\n const requireFromMcpUse = createRequire(mcpUseServerEntry);\n const stdioModulePath = requireFromMcpUse.resolve(\"@modelcontextprotocol/sdk/server/stdio.js\");\n const stdioModule = (await import(pathToFileURL(stdioModulePath).href)) as {\n StdioServerTransport: new () => unknown;\n };\n\n return new stdioModule.StdioServerTransport();\n}\n\nasync function startServer() {\n const transport = (process.env.MCP_TRANSPORT ?? \"http\").trim().toLowerCase();\n\n if (transport === \"stdio\") {\n const stdioTransport = await createStdioTransportFromMcpUseDependency();\n await server.nativeServer.connect(stdioTransport as any);\n console.error(\"MCP server running on stdio transport\");\n return;\n }\n\n if (transport === \"http\") {\n const port = process.env.PORT ? Number.parseInt(process.env.PORT, 10) : 3000;\n if (Number.isNaN(port)) {\n throw new Error(`Invalid PORT value: ${process.env.PORT}`);\n }\n\n console.error(`MCP server running on http transport (port ${port})`);\n await server.listen(port);\n return;\n }\n\n throw new Error(`Invalid MCP_TRANSPORT \"${process.env.MCP_TRANSPORT}\". Use \"http\" or \"stdio\".`);\n}\n\nstartServer().catch((error) => {\n console.error(\"Failed to start MCP server\", error);\n process.exit(1);\n});\n"],
5
5
  "mappings": "AAAA,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB;AAE1B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB,2BAA2B;AAC1D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;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}
package/dist/mcp-use.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "includeInspector": false,
3
- "buildTime": "2026-05-14T20:47:30.369Z",
4
- "buildId": "ed22d4fb3aa472a7",
3
+ "buildTime": "2026-05-14T21:35:22.476Z",
4
+ "buildId": "293f25bfbca93ecd",
5
5
  "entryPoint": "dist/index.js",
6
6
  "widgets": {},
7
7
  "tunnel": {
@@ -1,7 +1,6 @@
1
1
  import { error, object } from "mcp-use/server";
2
2
  import { z } from "zod";
3
3
  import { formatMercadoLibreError, normalizeMercadoLibrePaging } from "../../services/mercadolibre/mercadolibre-api.js";
4
- import { getMercadoLibreBillingDetails } from "../../services/mercadolibre/mercadolibre-billing.js";
5
4
  import {
6
5
  getMercadoLibreShipmentCostsBatch,
7
6
  searchMercadoLibreOrders,
@@ -26,8 +25,6 @@ const DEFAULT_AUDIT_DAYS = 30;
26
25
  const ORDERS_PAGE_LIMIT = 50;
27
26
  const PAGE_FETCH_CONCURRENCY = 12;
28
27
  const PAGE_FETCH_MAX_RETRIES = 2;
29
- const BILLING_PAGE_LIMIT = 150;
30
- const BILLING_MAX_PAGES_PER_PERIOD = 20;
31
28
  const meliEstimateProductProfitabilitySchema = z.object({
32
29
  profileId: mercadolibreProfileIdSchemaField,
33
30
  mode: z.enum(["current_item", "target_margin"]).describe("Profitability mode. current_item analyzes an existing listing; target_margin estimates the price needed for a desired margin."),
@@ -40,7 +37,7 @@ const meliEstimateProductProfitabilitySchema = z.object({
40
37
  operatingCost: z.number().nonnegative().optional().describe("Additional internal operating cost per sold unit. MercadoLibre does not provide this; defaults to zero when omitted."),
41
38
  replacementCost: z.number().nonnegative().optional().describe("Current replacement cost per unit. Used as cost basis if unitCost is omitted and useful for future pricing decisions."),
42
39
  returnReservePct: z.number().min(0).max(100).optional().describe("Reserve for returns, refunds, and post-sale friction as percentage of selling price. Defaults to zero when omitted."),
43
- taxRatePct: z.number().min(0).max(100).optional().describe("Optional tax/withholding reserve as percentage of selling price. Use when Billing ML is not enough or for simulations."),
40
+ taxRatePct: z.number().min(0).max(100).optional().describe("Optional tax/withholding reserve as percentage of selling price for simulations or conservative margin planning."),
44
41
  shippingCost: z.number().nonnegative().optional().describe("Optional shipping cost per unit to use in profitability. Overrides historical shipping average when provided."),
45
42
  categoryId: z.string().trim().min(1).optional().describe("MercadoLibre category id override for fee estimation."),
46
43
  listingTypeId: z.string().trim().min(1).optional().describe("MercadoLibre listing type id override for fee estimation."),
@@ -49,7 +46,6 @@ const meliEstimateProductProfitabilitySchema = z.object({
49
46
  billableWeight: z.number().positive().optional().describe("Billable package weight in grams for fee estimation."),
50
47
  currencyId: z.string().trim().min(3).optional().describe("Currency id. Defaults to item currency or ARS."),
51
48
  tags: z.array(z.string().trim().min(1)).optional().describe("Optional MercadoLibre fee tags such as campaign or installment tags."),
52
- useBillingAudit: z.boolean().optional().describe("When true, includes MercadoLibre Billing details as historical audit. Defaults to true for current_item with itemId."),
53
49
  auditStartDate: z.string().regex(mercadoLibreDateRegex).optional().describe("Historical audit start date in YYYY-MM-DD. Defaults to the last 30 days for current_item."),
54
50
  auditEndDate: z.string().regex(mercadoLibreDateRegex).optional().describe("Historical audit end date in YYYY-MM-DD. Defaults to today for current_item.")
55
51
  });
@@ -65,25 +61,6 @@ function defaultAuditWindow() {
65
61
  endDate: isoDate(end)
66
62
  };
67
63
  }
68
- function parseDate(value) {
69
- return /* @__PURE__ */ new Date(`${value}T00:00:00.000Z`);
70
- }
71
- function monthKeysBetween(startDate, endDate) {
72
- const start = parseDate(startDate);
73
- const end = parseDate(endDate);
74
- const keys = /* @__PURE__ */ new Set();
75
- const cursor = new Date(Date.UTC(start.getUTCFullYear(), start.getUTCMonth(), 1));
76
- const last = new Date(Date.UTC(end.getUTCFullYear(), end.getUTCMonth(), 1));
77
- while (cursor <= last) {
78
- keys.add(`${cursor.getUTCFullYear()}-${String(cursor.getUTCMonth() + 1).padStart(2, "0")}-01`);
79
- cursor.setUTCMonth(cursor.getUTCMonth() + 1);
80
- }
81
- return [...keys];
82
- }
83
- function dateInRange(dateTime, startDate, endDate) {
84
- const date = dateTime.slice(0, 10);
85
- return date >= startDate && date <= endDate;
86
- }
87
64
  function extractShipmentCost(costs) {
88
65
  const senders = asArray(costs.senders);
89
66
  const senderCost = senders.reduce((sum, sender) => sum + toNumber(sender.cost), 0);
@@ -237,88 +214,6 @@ async function buildHistoricalOrderAudit(profileId, params) {
237
214
  failures: [...fetched.failures, ...shippingFailures]
238
215
  });
239
216
  }
240
- function extractBillingOrderIds(row) {
241
- return asArray(row.sales_info).map((sale) => normalizeScalarString(sale.order_id)).filter(Boolean);
242
- }
243
- function extractBillingSaleDates(row) {
244
- return asArray(row.sales_info).map((sale) => normalizeString(sale.sale_date_time)).filter(Boolean);
245
- }
246
- function billingRowMatchesItem(row, itemId, startDate, endDate) {
247
- const itemMatches = asArray(row.items_info).some(
248
- (item) => normalizeString(item.item_id) === itemId
249
- );
250
- const dateMatches = extractBillingSaleDates(row).some((date) => dateInRange(date, startDate, endDate));
251
- return itemMatches && dateMatches;
252
- }
253
- async function buildBillingAudit(profileId, params) {
254
- const periodKeys = monthKeysBetween(params.startDate, params.endDate);
255
- const rowsByDetailId = /* @__PURE__ */ new Map();
256
- const periodResults = [];
257
- const failures = [];
258
- for (const periodKey of periodKeys) {
259
- const result = await getMercadoLibreBillingDetails(profileId, {
260
- periodKey,
261
- group: "ML",
262
- documentType: "BILL",
263
- limit: BILLING_PAGE_LIMIT,
264
- maxPages: BILLING_MAX_PAGES_PER_PERIOD
265
- });
266
- periodResults.push({
267
- period_key: result.period_key,
268
- total_reported: result.total_reported,
269
- rows_fetched: result.rows.length,
270
- pages_requested: result.pages_requested,
271
- pages_succeeded: result.pages_succeeded,
272
- pages_failed: result.pages_failed
273
- });
274
- failures.push(...result.failures.map((failure) => ({ period_key: periodKey, ...failure })));
275
- for (const row of result.rows) {
276
- if (!billingRowMatchesItem(row, params.itemId, params.startDate, params.endDate)) {
277
- continue;
278
- }
279
- const detailId = normalizeScalarString(asRecord(row.charge_info).detail_id);
280
- rowsByDetailId.set(detailId || `${periodKey}:${rowsByDetailId.size}`, row);
281
- }
282
- }
283
- const breakdown = /* @__PURE__ */ new Map();
284
- let totalCharges = 0;
285
- const orderIds = /* @__PURE__ */ new Set();
286
- for (const row of rowsByDetailId.values()) {
287
- const chargeInfo = asRecord(row.charge_info);
288
- const subtype = normalizeString(chargeInfo.detail_sub_type, "UNKNOWN");
289
- const label = normalizeString(chargeInfo.transaction_detail, subtype);
290
- const amount = toNumber(chargeInfo.detail_amount);
291
- const current = breakdown.get(subtype) ?? { amount: 0, rows: 0, label };
292
- current.amount += amount;
293
- current.rows += 1;
294
- breakdown.set(subtype, current);
295
- totalCharges += amount;
296
- extractBillingOrderIds(row).forEach((orderId) => orderIds.add(orderId));
297
- }
298
- return stripNulls({
299
- enabled: true,
300
- window: {
301
- start_date: params.startDate,
302
- end_date: params.endDate,
303
- period_keys: periodKeys
304
- },
305
- coverage: {
306
- periods_requested: periodKeys.length,
307
- rows_matched: rowsByDetailId.size,
308
- orders_matched: orderIds.size,
309
- total_charge_amount: roundMoney(totalCharges),
310
- partial: failures.length > 0,
311
- period_results: periodResults
312
- },
313
- charge_breakdown: Array.from(breakdown.entries()).sort((left, right) => Math.abs(right[1].amount) - Math.abs(left[1].amount)).map(([detail_sub_type, data]) => ({
314
- detail_sub_type,
315
- transaction_detail: data.label,
316
- rows: data.rows,
317
- amount: roundMoney(data.amount)
318
- })),
319
- failures
320
- });
321
- }
322
217
  function buildMissingUserInputs(params) {
323
218
  const missing = [];
324
219
  if (params.unitCost === void 0 && params.replacementCost === void 0) {
@@ -362,7 +257,7 @@ function chooseFeeForProfitability(feeEstimate) {
362
257
  return feeEstimate.selected_quote ?? feeEstimate.quotes.find((quote) => quote.listing_type_id === "gold_special") ?? feeEstimate.quotes[0];
363
258
  }
364
259
  function inferConfidence(params) {
365
- if (params.feePrecision === "high" && params.hasCostBasis && params.hasShipping && params.hasBillingAudit) {
260
+ if (params.feePrecision === "high" && params.hasCostBasis && params.hasShipping && params.hasHistoricalAudit) {
366
261
  return "high";
367
262
  }
368
263
  if (params.feePrecision !== "low" && (params.hasCostBasis || params.hasHistoricalAudit)) {
@@ -410,7 +305,6 @@ async function meliEstimateProductProfitabilityHandler(params) {
410
305
  const defaultWindow = defaultAuditWindow();
411
306
  const auditStartDate = params.auditStartDate ?? defaultWindow.startDate;
412
307
  const auditEndDate = params.auditEndDate ?? defaultWindow.endDate;
413
- const useBillingAudit = params.useBillingAudit ?? (params.mode === "current_item" && Boolean(params.itemId));
414
308
  const feeEstimate = await buildMercadoLibreListingFeeEstimate({
415
309
  profileId,
416
310
  itemId: params.itemId,
@@ -430,22 +324,6 @@ async function meliEstimateProductProfitabilityHandler(params) {
430
324
  startDate: auditStartDate,
431
325
  endDate: auditEndDate
432
326
  }) : void 0;
433
- let billingAudit;
434
- if (useBillingAudit && params.itemId) {
435
- try {
436
- billingAudit = await buildBillingAudit(profileId, {
437
- itemId: params.itemId,
438
- startDate: auditStartDate,
439
- endDate: auditEndDate
440
- });
441
- } catch (billingError) {
442
- billingAudit = {
443
- enabled: true,
444
- failed: true,
445
- message: formatMercadoLibreError(billingError, "Failed to build MercadoLibre billing audit")
446
- };
447
- }
448
- }
449
327
  const price = params.price ?? selectedQuote?.price ?? toNumber(feeEstimate.context.used_params.price);
450
328
  const estimatedSaleFee = selectedQuote?.sale_fee_amount ?? 0;
451
329
  const historicalMetrics = asRecord(orderAudit?.item_metrics);
@@ -478,7 +356,6 @@ async function meliEstimateProductProfitabilityHandler(params) {
478
356
  feePrecision: feeEstimate.context.precision,
479
357
  hasCostBasis: costBasis !== void 0,
480
358
  hasHistoricalAudit: Boolean(orderAudit && toNumber(historicalMetrics.units) > 0),
481
- hasBillingAudit: Boolean(billingAudit && !billingAudit.failed),
482
359
  hasShipping: shippingCost > 0
483
360
  });
484
361
  return object(
@@ -504,8 +381,7 @@ async function meliEstimateProductProfitabilityHandler(params) {
504
381
  missing_params: feeEstimate.context.missing_params
505
382
  },
506
383
  historical_audit: stripNulls({
507
- orders: orderAudit,
508
- billing: billingAudit
384
+ orders: orderAudit
509
385
  }),
510
386
  profitability: {
511
387
  status: profitAmount === void 0 ? "needs_user_costs" : profitAmount >= 0 ? "profitable" : "not_profitable",
@@ -529,7 +405,7 @@ async function meliEstimateProductProfitabilityHandler(params) {
529
405
  assumptions: [
530
406
  "COGS, packaging, costos operativos y costo de reposici\xF3n no los provee MercadoLibre; se toman de inputs del usuario.",
531
407
  "Si no se informa returnReservePct o taxRatePct, se usa 0 y se avisa como menor precisi\xF3n.",
532
- "La rentabilidad estimada usa listing_prices para fee futuro; la auditor\xEDa hist\xF3rica usa \xF3rdenes, shipments y Billing ML cuando est\xE1 habilitado.",
408
+ "La rentabilidad estimada usa listing_prices para fee futuro; la auditor\xEDa hist\xF3rica usa \xF3rdenes y shipments hist\xF3ricos del item cuando est\xE1n disponibles.",
533
409
  "El precio objetivo usa la estructura porcentual/fija del quote seleccionado; si MercadoLibre cambia el tramo de costo fijo, conviene recalcular con el precio propuesto."
534
410
  ],
535
411
  confidence