@diviops/mcp-server 1.5.41 → 1.5.42
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 +19 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4506,7 +4506,7 @@ function registerProTools() {
|
|
|
4506
4506
|
}, { target: "fluentcart", capabilityKey: "fluentcart_product_list" });
|
|
4507
4507
|
// diviops_fc_product_get — bridges /diviops/v1/pro/fluentcart/products/{id}
|
|
4508
4508
|
registerProTool("diviops_fc_product_get", {
|
|
4509
|
-
description: "Fetch a single FluentCart Pro product by ID, including the ProductDetail row,
|
|
4509
|
+
description: "Fetch a single FluentCart Pro product by ID, including the ProductDetail row, default-variation read-back fields, a compact value-free shape-readiness verdict, buyer-safe storefront links, and a list of variation IDs (Pro tier; requires FluentCart Pro installed + activated). Read-only. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; the success payload is { product: { id, title, slug, status, created_at, modified_at, variation_type, variants_count, min_price, max_price, stock_availability, excerpt, content, author_id, view_url, edit_url }, detail: { fulfillment_type, variation_type, min_price, max_price, manage_stock, manage_downloadable, stock_availability, default_variation_id, ... } | null, default_variation: { id, sku, item_price, compare_price } | null, storefront_links: { view_url: string|null, checkout_url: string|null, checkout_variation_id: number|null, ready: boolean, problems: string[], draft_preview_available: false }, shape_readiness: { profile: \"simple_onetime\"|\"simple_annual_subscription\"|\"unsupported\", ready: boolean, problems: string[] }, variation_ids: number[], variations_count }. storefront_links is ready only for a published, shape-ready product whose exact default variation passes FluentCart's native canPurchase(1) check. Its checkout_url comes from FluentCart's native getPurchaseUrl() query-string route; DiviOps does not invent add-to-cart URLs. Draft, pending, and private products return both buyer URLs as null. storefront_links.problems uses finite codes: product_not_published, product_shape_not_ready, default_variation_missing, variation_not_purchasable, checkout_url_unavailable. product.view_url remains unchanged for backward-compatible administrative readback and is not a buyer-safety verdict. shape_readiness never returns raw other_info; problems contains only finite codes: detail_missing, variation_type_unsupported, variation_count_not_one, default_variation_pointer_missing, default_variation_pointer_dangling, detail_defaults_drift, payment_profile_unsupported, payment_type_drift, variation_defaults_drift. An intentionally independent variation_title is supported and does not affect readiness. The default_variation block closes the read-after-write loop for the V2 simple-product write tools — sku and compare_price round-trip cleanly without a FluentCart admin fallback. Unit asymmetry: product_create / product_update accept price and compare_price in currency units (e.g. 29.99); product_get returns min_price, max_price, default_variation.item_price, and default_variation.compare_price in stored cents (e.g. 2999). default_variation.sku is null when the stored SKU is SQL NULL; clearing a SKU with sku: \"\" on update reads back as null. default_variation itself is null when the product has no default variation row. Apply/no-op product_create and product_update responses include the same storefront_links projection. Use the variation_ids list to follow up with diviops_fc_variation_list. Error codes: invalid_input (HTTP 400) when id is not a positive integer; not_found (HTTP 404) when no product matches the ID (or it's filtered out by the FluentCart auto-draft global scope); fluentcart.module_inactive (HTTP 412) when FluentCart is uninstalled or the module toggle is off; fluentcart.query_failed (HTTP 500) when the FluentCart model query raises an exception.",
|
|
4510
4510
|
inputSchema: {
|
|
4511
4511
|
id: z
|
|
4512
4512
|
.number()
|
|
@@ -4536,7 +4536,7 @@ function registerProTools() {
|
|
|
4536
4536
|
// surface can own multi-variant complexity cleanly.
|
|
4537
4537
|
// diviops_fc_product_create — POST /diviops/v1/pro/fluentcart/products/create
|
|
4538
4538
|
registerProTool("diviops_fc_product_create", {
|
|
4539
|
-
description: "Create a simple FluentCart Pro product (Pro tier; requires FluentCart Pro installed + activated). V2 scope: simple onetime products only — one default variant, `detail.variation_type=\"simple\"`, `payment_type=\"onetime\"`, `fulfillment_type=\"digital\"|\"physical\"`. Multi-variation, subscriptions, downloadables, gallery, taxonomies, activation_limit, and license-flow fields ship in later verticals and are refused here. Required: `title` (1-200 chars). Optional: `status` (`draft`|`publish`|`pending`|`private`; default `draft`), `content`, `excerpt`, `fulfillment_type` (default `digital`), `price` (≥0; default 0), `compare_price` (≥0; must be ≥ `price` when provided), `sku` (optional; must be unique across FluentCart variations and at most 30 characters because FluentCart stores `fct_product_variations.sku` as `VARCHAR(30)` — overlong values are rejected before mutation rather than silently truncated). Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; apply-mode success payload is { product, detail, default_variation: { id, sku, item_price, compare_price } | null, variation_ids, variations_count, product_id, detail_id, default_variation_id } (HTTP 201). The default_variation block mirrors the diviops_fc_product_get read-back shape so callers don't need a follow-up read to confirm sku / compare_price / item_price after a write. Unit asymmetry: write inputs (price, compare_price) are in currency units (e.g. 29.99); the default_variation block returns item_price + compare_price in stored cents (e.g. 2999), matching detail.min_price / max_price. default_variation.compare_price is null when no compare price is stored (FCP persists \"no compare\" as 0, normalized to null on read); default_variation.sku is null when the SKU column is SQL NULL or an empty string (the create path stores omitted SKU as NULL). Error codes: invalid_input (400) when any input violates the constraints above (including SKU > 30 chars — error.data carries { field: \"sku\", max_length: 30, actual_length }); fluentcart.sku_conflict (409) when the provided SKU is already in use; fluentcart.module_inactive (412); fluentcart.command_failed (500) when wp_insert_post/ProductDetail/ProductVariation creation raises. Idempotency: NOT idempotent — repeat calls create distinct products." +
|
|
4539
|
+
description: "Create a simple FluentCart Pro product (Pro tier; requires FluentCart Pro installed + activated). V2 scope: simple onetime products only — one exact default variant, `detail.variation_type=\"simple\"`, `payment_type=\"onetime\"`, `fulfillment_type=\"digital\"|\"physical\"`. Creation writes FluentCart's current finite simple-product detail/variation other_info defaults and persists an exact nonzero pointer to the sole variant. Multi-variation, subscriptions, downloadables, gallery, taxonomies, activation_limit, and license-flow fields ship in later verticals and are refused here. Required: `title` (1-200 chars). Optional: `status` (`draft`|`publish`|`pending`|`private`; default `draft`), `content`, `excerpt`, `fulfillment_type` (default `digital`), `price` (≥0; default 0), `compare_price` (≥0; must be ≥ `price` when provided), `sku` (optional; must be unique across FluentCart variations and at most 30 characters because FluentCart stores `fct_product_variations.sku` as `VARCHAR(30)` — overlong values are rejected before mutation rather than silently truncated). Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; apply-mode success payload is { product, detail, default_variation: { id, sku, item_price, compare_price } | null, storefront_links: { view_url, checkout_url, checkout_variation_id, ready, problems, draft_preview_available }, shape_readiness: { profile, ready, problems }, variation_ids, variations_count, product_id, detail_id, default_variation_id } (HTTP 201). The default_variation block mirrors the diviops_fc_product_get read-back shape so callers don't need a follow-up read to confirm sku / compare_price / item_price after a write; storefront_links and shape_readiness mirror its buyer-safety and value-free readiness projections. Unit asymmetry: write inputs (price, compare_price) are in currency units (e.g. 29.99); the default_variation block returns item_price + compare_price in stored cents (e.g. 2999), matching detail.min_price / max_price. default_variation.compare_price is null when no compare price is stored (FCP persists \"no compare\" as 0, normalized to null on read); default_variation.sku is null when the SKU column is SQL NULL or an empty string (the create path stores omitted SKU as NULL). Error codes: invalid_input (400) when any input violates the constraints above (including SKU > 30 chars — error.data carries { field: \"sku\", max_length: 30, actual_length }); fluentcart.sku_conflict (409) when the provided SKU is already in use; fluentcart.module_inactive (412); fluentcart.command_failed (500) when wp_insert_post/ProductDetail/ProductVariation creation raises. Idempotency: NOT idempotent — repeat calls create distinct products." +
|
|
4540
4540
|
DRY_RUN_DESC_SUFFIX,
|
|
4541
4541
|
inputSchema: {
|
|
4542
4542
|
title: z
|
|
@@ -4608,7 +4608,7 @@ function registerProTools() {
|
|
|
4608
4608
|
}, { target: "fluentcart", capabilityKey: "fluentcart_product_create" });
|
|
4609
4609
|
// diviops_fc_product_update — POST /diviops/v1/pro/fluentcart/products/{id}/update
|
|
4610
4610
|
registerProTool("diviops_fc_product_update", {
|
|
4611
|
-
description: "Update a simple FluentCart Pro product (Pro tier; requires FluentCart Pro installed + activated).
|
|
4611
|
+
description: "Update a simple FluentCart Pro product (Pro tier; requires FluentCart Pro installed + activated). Product-level title, status, content, and excerpt updates are supported for both onetime and subscription products; changing title also keeps the default variation's variation_title coherent. On simple onetime products, fulfillment_type, price, compare_price, and sku remain supported. On subscription products those variation-level fields are refused with `fluentcart.unsupported_product_shape` (HTTP 422): pricing and SKU must use diviops_fc_variation_update, while subscription fulfillment changes remain out of scope. This ensures subscription pricing never flows through the V2 product path. Multi-variation products remain refused. Supported updates preserve initialized detail/variation defaults and unrelated existing other_info keys; they report but do not auto-repair legacy drift. SKU constraint on onetime products: unique across FluentCart variations and at most 30 characters; `sku: \"\"` clears it and reads back as `null`. Required: `id` (positive integer; the post ID of the fluent_products CPT entry). All other fields optional; only changed fields are applied. When no field actually changes, returns `ok:true` with `data.noop: true` (apply mode) or an empty-plan dry-run summary. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; apply-mode success payload is { product, detail, default_variation: { id, sku, item_price, compare_price } | null, storefront_links: { view_url, checkout_url, checkout_variation_id, ready, problems, draft_preview_available }, shape_readiness: { profile, ready, problems }, variation_ids, variations_count, changed_fields[] } (or { noop: true, product, detail, default_variation, storefront_links, shape_readiness, ... } on a no-op). The default_variation, storefront_links, and value-free shape_readiness blocks reflect the post-update state. Unit asymmetry for onetime pricing: write inputs are currency units; readback prices are stored cents. Error codes: invalid_input (400); not_found (404); fluentcart.unsupported_product_shape (422) for non-simple products, unsupported payment types, or subscription variation fields; fluentcart.sku_conflict (409); fluentcart.module_inactive (412); fluentcart.command_failed (500). Idempotency: conditional — repeating an identical update is a no-op." +
|
|
4612
4612
|
DRY_RUN_DESC_SUFFIX,
|
|
4613
4613
|
inputSchema: {
|
|
4614
4614
|
id: z
|
|
@@ -4621,7 +4621,7 @@ function registerProTools() {
|
|
|
4621
4621
|
.min(1)
|
|
4622
4622
|
.max(200)
|
|
4623
4623
|
.optional()
|
|
4624
|
-
.describe("New product title. 1-200 chars."),
|
|
4624
|
+
.describe("New product title. 1-200 chars. Also updates the default variation title for both onetime and subscription products."),
|
|
4625
4625
|
status: z
|
|
4626
4626
|
.enum(["draft", "publish", "pending", "private"])
|
|
4627
4627
|
.optional()
|
|
@@ -4631,21 +4631,21 @@ function registerProTools() {
|
|
|
4631
4631
|
fulfillment_type: z
|
|
4632
4632
|
.enum(["digital", "physical"])
|
|
4633
4633
|
.optional()
|
|
4634
|
-
.describe("New fulfillment shape."),
|
|
4634
|
+
.describe("New fulfillment shape. Simple onetime products only."),
|
|
4635
4635
|
price: z
|
|
4636
4636
|
.number()
|
|
4637
4637
|
.min(0)
|
|
4638
4638
|
.optional()
|
|
4639
|
-
.describe("New default-variation item_price (currency units). Non-negative."),
|
|
4639
|
+
.describe("New default-variation item_price (currency units). Non-negative. Simple onetime products only; use diviops_fc_variation_update for subscriptions."),
|
|
4640
4640
|
compare_price: z
|
|
4641
4641
|
.number()
|
|
4642
4642
|
.min(0)
|
|
4643
4643
|
.optional()
|
|
4644
|
-
.describe("New compare-at price. Must be ≥ `price` when both provided."),
|
|
4644
|
+
.describe("New compare-at price. Must be ≥ `price` when both provided. Simple onetime products only."),
|
|
4645
4645
|
sku: z
|
|
4646
4646
|
.string()
|
|
4647
4647
|
.optional()
|
|
4648
|
-
.describe("New SKU for the default variation.
|
|
4648
|
+
.describe("New SKU for the default variation. Simple onetime products only. Must be unique across all FluentCart variations and at most 30 characters. Empty string clears the SKU (reads back as null)."),
|
|
4649
4649
|
dry_run: DRY_RUN_FIELD,
|
|
4650
4650
|
},
|
|
4651
4651
|
annotations: { idempotentHint: false },
|
|
@@ -4745,7 +4745,7 @@ function registerProTools() {
|
|
|
4745
4745
|
}, { target: "fluentcart", capabilityKey: "fluentcart_variation_list" });
|
|
4746
4746
|
// diviops_fc_variation_update — POST /diviops/v1/pro/fluentcart/products/{product_id}/variations/{variation_id}/update
|
|
4747
4747
|
registerProTool("diviops_fc_variation_update", {
|
|
4748
|
-
description: "Update the default variation of a simple FluentCart Pro product (Pro tier; V3; requires FluentCart Pro installed + activated). V3 scope: writes the product's default variation only; refuses non-simple products and non-default variations with `fluentcart.unsupported_product_shape` (HTTP 422). Multi-variation create/delete remains out of scope. Accepts partial updates on price, compare_price, sku, payment_type, and the subscription shape (repeat_interval, times, trial_days, manage_setup_fee). Switching `payment_type: \"subscription\"` requires `repeat_interval` (yearly/half_yearly/quarterly/monthly/weekly/daily) — either supplied in the same call or already stored. Switching to `onetime`
|
|
4748
|
+
description: "Update the default variation of a simple FluentCart Pro product (Pro tier; V3; requires FluentCart Pro installed + activated). V3 scope: writes the product's default variation only; refuses non-simple products and non-default variations with `fluentcart.unsupported_product_shape` (HTTP 422). Multi-variation create/delete remains out of scope. Accepts partial updates on variation_title (non-empty, 1-200 chars), price, compare_price, sku, payment_type, and the subscription shape (repeat_interval, times, trial_days, manage_setup_fee). variation_title changes only the default variation label; use diviops_fc_product_update.title when the product title and default variation label should stay aligned. Switching `payment_type: \"subscription\"` requires `repeat_interval` (yearly/half_yearly/quarterly/monthly/weekly/daily) — either supplied in the same call or already stored. Switching to `onetime` restores FluentCart's initialized one-time values for the finite subscription-related keys while preserving unrelated other_info. `manage_setup_fee: \"yes\"` remains out of scope. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; apply-mode success payload is { product_id, variation_id, changed_fields[], variation: VariationRow, product_price_range: { min_price, max_price } | null } (or { noop: true, product_id, variation_id, variation } when nothing changes). VariationRow provides direct readback including variation_title. Error codes: invalid_input (400); not_found (404); fluentcart.unsupported_product_shape (422); fluentcart.sku_conflict (409); fluentcart.module_inactive (412); fluentcart.command_failed (500). Idempotency: conditional — identical repeat is a no-op." +
|
|
4749
4749
|
DRY_RUN_DESC_SUFFIX,
|
|
4750
4750
|
inputSchema: {
|
|
4751
4751
|
product_id: z
|
|
@@ -4758,6 +4758,12 @@ function registerProTools() {
|
|
|
4758
4758
|
.int()
|
|
4759
4759
|
.positive()
|
|
4760
4760
|
.describe("FluentCart variation ID. Must be the product's default variation (V3 constraint)."),
|
|
4761
|
+
variation_title: z
|
|
4762
|
+
.string()
|
|
4763
|
+
.min(1)
|
|
4764
|
+
.max(200)
|
|
4765
|
+
.optional()
|
|
4766
|
+
.describe("Default variation label. 1-200 chars. This does not change the product title."),
|
|
4761
4767
|
price: z
|
|
4762
4768
|
.number()
|
|
4763
4769
|
.min(0)
|
|
@@ -4775,7 +4781,7 @@ function registerProTools() {
|
|
|
4775
4781
|
payment_type: z
|
|
4776
4782
|
.enum(["onetime", "subscription"])
|
|
4777
4783
|
.optional()
|
|
4778
|
-
.describe("Variation payment_type. Switching to 'subscription' requires repeat_interval. Switching to 'onetime'
|
|
4784
|
+
.describe("Variation payment_type. Switching to 'subscription' requires repeat_interval. Switching to 'onetime' restores initialized one-time values for the finite subscription-related keys and preserves unrelated other_info."),
|
|
4779
4785
|
repeat_interval: z
|
|
4780
4786
|
.enum([
|
|
4781
4787
|
"yearly",
|
|
@@ -4808,8 +4814,10 @@ function registerProTools() {
|
|
|
4808
4814
|
},
|
|
4809
4815
|
annotations: { idempotentHint: false },
|
|
4810
4816
|
_meta: { idempotent: "conditional" },
|
|
4811
|
-
}, async ({ product_id, variation_id, price, compare_price, sku, payment_type, repeat_interval, times, trial_days, manage_setup_fee, dry_run, }) => {
|
|
4817
|
+
}, async ({ product_id, variation_id, variation_title, price, compare_price, sku, payment_type, repeat_interval, times, trial_days, manage_setup_fee, dry_run, }) => {
|
|
4812
4818
|
const body = {};
|
|
4819
|
+
if (variation_title !== undefined)
|
|
4820
|
+
body.variation_title = variation_title;
|
|
4813
4821
|
if (price !== undefined)
|
|
4814
4822
|
body.price = price;
|
|
4815
4823
|
if (compare_price !== undefined)
|