@diviops/mcp-server 1.5.27 → 1.5.29
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 +193 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2722,7 +2722,7 @@ registerPluginTool("diviops_variable_list", {
|
|
|
2722
2722
|
description: "List all design token variables from the Divi Variable Manager. Colors (gcid-*) come from et_global_data, numbers/strings/etc (gvid-*) from et_divi_global_variables. Filter by type or ID prefix. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; invalid `type` returns ok:false with code 'invalid_input'.",
|
|
2723
2723
|
inputSchema: {
|
|
2724
2724
|
type: z
|
|
2725
|
-
.enum(["colors", "numbers", "strings", "images", "links", "fonts"])
|
|
2725
|
+
.enum(["colors", "numbers", "strings", "images", "links", "fonts", "gradients"])
|
|
2726
2726
|
.optional()
|
|
2727
2727
|
.describe("Filter by variable type"),
|
|
2728
2728
|
prefix: z
|
|
@@ -2750,7 +2750,7 @@ registerPluginTool("diviops_variable_create", {
|
|
|
2750
2750
|
DRY_RUN_DESC_SUFFIX,
|
|
2751
2751
|
inputSchema: {
|
|
2752
2752
|
type: z
|
|
2753
|
-
.enum(["colors", "numbers", "strings", "images", "links", "fonts"])
|
|
2753
|
+
.enum(["colors", "numbers", "strings", "images", "links", "fonts", "gradients"])
|
|
2754
2754
|
.describe("Variable type"),
|
|
2755
2755
|
id: z
|
|
2756
2756
|
.string()
|
|
@@ -2762,7 +2762,25 @@ registerPluginTool("diviops_variable_create", {
|
|
|
2762
2762
|
value: z
|
|
2763
2763
|
.string()
|
|
2764
2764
|
.optional()
|
|
2765
|
-
.describe('Variable value (required unless using fluid min/max/targets for type=numbers): hex color for colors (e.g. "#3a7a6a"), CSS value for numbers (e.g. "clamp(30px, 8vw, 100px)" or "2rem")'),
|
|
2765
|
+
.describe('Variable value (required unless using fluid min/max/targets for type=numbers, OR the structured `gradient` object for type=gradients): hex color for colors (e.g. "#3a7a6a"), CSS value for numbers (e.g. "clamp(30px, 8vw, 100px)" or "2rem"), arbitrary text/URL for strings/links/images. For type=gradients do NOT pass a CSS gradient string here — it stores an unrenderable variable; use the `gradient` object instead (or pass a full $variable({"type":"gradient",…})$ token verbatim).'),
|
|
2766
|
+
gradient: z
|
|
2767
|
+
.object({
|
|
2768
|
+
stops: z
|
|
2769
|
+
.array(z.object({ position: z.union([z.string(), z.number()]), color: z.string() }))
|
|
2770
|
+
.min(2)
|
|
2771
|
+
.describe('Gradient color stops, min 2. position = unitless number 0–100 (string or number; PHP normalizes to string); color = hex or a $variable(gcid-…)$ token.'),
|
|
2772
|
+
type: z
|
|
2773
|
+
.enum(["linear", "circular", "elliptical", "conic"])
|
|
2774
|
+
.optional()
|
|
2775
|
+
.describe('Gradient type (default linear). circular/elliptical render as radial-gradient(circle|ellipse …); conic as conic-gradient. NOTE: the enum is circular/elliptical, NOT "radial".'),
|
|
2776
|
+
direction: z.string().optional().describe('CSS angle for linear/conic (default "180deg"), e.g. "90deg".'),
|
|
2777
|
+
directionRadial: z.string().optional().describe('Position keyword for circular/elliptical/conic (default "center"), e.g. "top left".'),
|
|
2778
|
+
length: z.string().optional().describe('Gradient length (default "100%").'),
|
|
2779
|
+
repeat: z.enum(["on", "off"]).optional().describe('Repeat the gradient (default "off").'),
|
|
2780
|
+
overlaysImage: z.enum(["on", "off"]).optional().describe('Place gradient above a background image (default "off").'),
|
|
2781
|
+
})
|
|
2782
|
+
.optional()
|
|
2783
|
+
.describe('Structured gradient settings for type="gradients" (5.7.4). The server serializes the canonical $variable({"type":"gradient",value:{name:"gradient",settings:{…}}})$ token that Divi resolves to a defined --gvid-* custom property. REQUIRED for a renderable gradient variable — a raw CSS-string `value` is rejected. Ignored for non-gradient types.'),
|
|
2766
2784
|
min: z
|
|
2767
2785
|
.string()
|
|
2768
2786
|
.optional()
|
|
@@ -2791,10 +2809,18 @@ registerPluginTool("diviops_variable_create", {
|
|
|
2791
2809
|
},
|
|
2792
2810
|
annotations: { idempotentHint: false },
|
|
2793
2811
|
_meta: { idempotent: "false" },
|
|
2794
|
-
}, async ({ type, id, label, value, min, max, targets, output_unit, root_font_size_px, dry_run, }) => {
|
|
2812
|
+
}, async ({ type, id, label, value, gradient, min, max, targets, output_unit, root_font_size_px, dry_run, }) => {
|
|
2813
|
+
// Structured gradient serialization is a plugin-side capability (#921).
|
|
2814
|
+
// Gate it so a new server + old plugin fails with a clear "update plugin"
|
|
2815
|
+
// error instead of the confusing "value must be scalar" the old callback
|
|
2816
|
+
// would emit for a gradient-without-value request.
|
|
2817
|
+
if (gradient !== undefined)
|
|
2818
|
+
requireCapability("variable_create_gradient");
|
|
2795
2819
|
const body = { type, label };
|
|
2796
2820
|
if (value !== undefined)
|
|
2797
2821
|
body.value = value;
|
|
2822
|
+
if (gradient !== undefined)
|
|
2823
|
+
body.gradient = gradient;
|
|
2798
2824
|
if (id)
|
|
2799
2825
|
body.id = id;
|
|
2800
2826
|
if (min !== undefined)
|
|
@@ -3639,6 +3665,169 @@ function registerProTools() {
|
|
|
3639
3665
|
target: "fluentcart",
|
|
3640
3666
|
capabilityKey: "fluentcart_license_settings_update",
|
|
3641
3667
|
});
|
|
3668
|
+
// ── V3.4 — downloadable artifact metadata + license changelog ──────
|
|
3669
|
+
//
|
|
3670
|
+
// Store-deployment helper surface. This intentionally complements
|
|
3671
|
+
// FluentCart's native MCP by focusing on DiviOps-specific launch
|
|
3672
|
+
// readiness: metadata-only download rows, attaching an already-present
|
|
3673
|
+
// server-side ZIP, and the FCP Pro updater changelog field. No binary
|
|
3674
|
+
// upload and no signed buyer URLs.
|
|
3675
|
+
// diviops_fc_download_list — POST /diviops/v1/pro/fluentcart/products/{id}/downloads
|
|
3676
|
+
registerProTool("diviops_fc_download_list", {
|
|
3677
|
+
description: "List FluentCart downloadable-file rows for a product (Pro tier; V3.4; requires FluentCart Pro installed + activated). Read-only metadata surface for store artifact deployment. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; success payload is { product_id, downloads: DownloadRow[] }. DownloadRow is { id, title, file_name, driver, file_size, type, variation_ids, is_update_file } — metadata only, never file_path, file_url, download_identifier, signed URLs, or buyer URLs. `is_update_file` is derived from the product's license_settings.global_update_file pointer when present. Use this before `diviops_fc_license_settings_update` so the updater pointer can be set to the plugin ZIP row, not the suite ZIP row. Error codes: invalid_input (400), not_found (404), fluentcart.module_inactive (412), fluentcart.query_failed (500). Idempotency: read-only.",
|
|
3678
|
+
inputSchema: {
|
|
3679
|
+
product_id: z
|
|
3680
|
+
.number()
|
|
3681
|
+
.int()
|
|
3682
|
+
.positive()
|
|
3683
|
+
.describe("FluentCart product ID (the post ID of the fluent_products CPT entry)."),
|
|
3684
|
+
},
|
|
3685
|
+
annotations: { idempotentHint: true },
|
|
3686
|
+
_meta: { idempotent: "true" },
|
|
3687
|
+
}, async ({ product_id }) => {
|
|
3688
|
+
const result = await wp.requestEnveloped(`/pro/fluentcart/products/${product_id}/downloads`, { method: "POST" });
|
|
3689
|
+
return {
|
|
3690
|
+
content: [
|
|
3691
|
+
{
|
|
3692
|
+
type: "text",
|
|
3693
|
+
text: serializeEnvelope(result, "diviops_fc_download_list"),
|
|
3694
|
+
},
|
|
3695
|
+
],
|
|
3696
|
+
};
|
|
3697
|
+
}, { target: "fluentcart", capabilityKey: "fluentcart_download_list" });
|
|
3698
|
+
// diviops_fc_download_attach — POST /diviops/v1/pro/fluentcart/products/{id}/downloads/attach
|
|
3699
|
+
registerProTool("diviops_fc_download_attach", {
|
|
3700
|
+
description: "Attach an already-present server-side ZIP as a FluentCart downloadable-file row (Pro tier; V3.4; requires FluentCart Pro installed + activated). This is NOT a binary upload tool: `file_path` must resolve to a readable .zip on the WordPress server under ABSPATH or the uploads directory. The response never exposes file paths, file URLs, download identifiers, signed URLs, or buyer URLs. Required: product_id, file_path. Optional: file_name (defaults to basename(file_path), must end in .zip), title (defaults to filename without .zip), variation_ids (must belong to this product; empty means all variants), expected_sha1, expected_size, allow_duplicate (default false), dry_run. Duplicate detection rejects an existing row with the same file_name or title unless allow_duplicate:true is passed. Expected hash/size let operators verify the server-side file matches the locally built artifact before creating the row. Apply-mode success payload is { product_id, created: DownloadRow, downloads: DownloadRow[] } with DownloadRow metadata only. This tool only creates the download row and enables manage_downloadable; it does NOT set license_settings.global_update_file — follow with diviops_fc_license_settings_update using the created row ID. Error codes: invalid_input (400), not_found (404), fluentcart.download_duplicate (409), fluentcart.module_inactive (412), fluentcart.command_failed (500). Idempotency: false; repeat calls are rejected by duplicate detection unless allow_duplicate:true." +
|
|
3701
|
+
DRY_RUN_DESC_SUFFIX,
|
|
3702
|
+
inputSchema: {
|
|
3703
|
+
product_id: z
|
|
3704
|
+
.number()
|
|
3705
|
+
.int()
|
|
3706
|
+
.positive()
|
|
3707
|
+
.describe("FluentCart product ID (the post ID of the fluent_products CPT entry)."),
|
|
3708
|
+
file_path: z
|
|
3709
|
+
.string()
|
|
3710
|
+
.min(1)
|
|
3711
|
+
.describe("Server-side .zip path under ABSPATH or wp_upload_dir().basedir. Relative paths resolve under ABSPATH. No local-client upload occurs."),
|
|
3712
|
+
file_name: z
|
|
3713
|
+
.string()
|
|
3714
|
+
.min(1)
|
|
3715
|
+
.optional()
|
|
3716
|
+
.describe("Download filename shown to buyers/admins. Defaults to basename(file_path). Must end in .zip."),
|
|
3717
|
+
title: z
|
|
3718
|
+
.string()
|
|
3719
|
+
.min(1)
|
|
3720
|
+
.optional()
|
|
3721
|
+
.describe("FluentCart download title. Defaults to file_name without the .zip suffix."),
|
|
3722
|
+
variation_ids: z
|
|
3723
|
+
.array(z.number().int().positive())
|
|
3724
|
+
.optional()
|
|
3725
|
+
.describe("Optional product variation IDs this download applies to. Omit or pass [] for all variants."),
|
|
3726
|
+
expected_sha1: z
|
|
3727
|
+
.string()
|
|
3728
|
+
.regex(/^[a-fA-F0-9]{40}$/)
|
|
3729
|
+
.optional()
|
|
3730
|
+
.describe("Optional SHA1 of the expected server-side file. Mismatch aborts before mutation."),
|
|
3731
|
+
expected_size: z
|
|
3732
|
+
.number()
|
|
3733
|
+
.int()
|
|
3734
|
+
.min(0)
|
|
3735
|
+
.optional()
|
|
3736
|
+
.describe("Optional byte size of the expected server-side file. Mismatch aborts before mutation."),
|
|
3737
|
+
allow_duplicate: z
|
|
3738
|
+
.boolean()
|
|
3739
|
+
.optional()
|
|
3740
|
+
.describe("Default false. When false, an existing row with the same file_name or title returns fluentcart.download_duplicate."),
|
|
3741
|
+
dry_run: DRY_RUN_FIELD,
|
|
3742
|
+
},
|
|
3743
|
+
annotations: { idempotentHint: false },
|
|
3744
|
+
_meta: { idempotent: "false" },
|
|
3745
|
+
}, async ({ product_id, file_path, file_name, title, variation_ids, expected_sha1, expected_size, allow_duplicate, dry_run, }) => {
|
|
3746
|
+
const body = { file_path };
|
|
3747
|
+
if (file_name !== undefined)
|
|
3748
|
+
body.file_name = file_name;
|
|
3749
|
+
if (title !== undefined)
|
|
3750
|
+
body.title = title;
|
|
3751
|
+
if (variation_ids !== undefined)
|
|
3752
|
+
body.variation_ids = variation_ids;
|
|
3753
|
+
if (expected_sha1 !== undefined)
|
|
3754
|
+
body.expected_sha1 = expected_sha1;
|
|
3755
|
+
if (expected_size !== undefined)
|
|
3756
|
+
body.expected_size = expected_size;
|
|
3757
|
+
if (allow_duplicate !== undefined)
|
|
3758
|
+
body.allow_duplicate = allow_duplicate;
|
|
3759
|
+
if (dry_run !== undefined)
|
|
3760
|
+
body.dry_run = dry_run;
|
|
3761
|
+
const result = await wp.requestEnveloped(`/pro/fluentcart/products/${product_id}/downloads/attach`, { method: "POST", body });
|
|
3762
|
+
return {
|
|
3763
|
+
content: [
|
|
3764
|
+
{
|
|
3765
|
+
type: "text",
|
|
3766
|
+
text: serializeEnvelope(result, "diviops_fc_download_attach"),
|
|
3767
|
+
},
|
|
3768
|
+
],
|
|
3769
|
+
};
|
|
3770
|
+
}, { target: "fluentcart", capabilityKey: "fluentcart_download_attach" });
|
|
3771
|
+
// diviops_fc_license_changelog_get — POST /diviops/v1/pro/fluentcart/products/{id}/license-changelog
|
|
3772
|
+
registerProTool("diviops_fc_license_changelog_get", {
|
|
3773
|
+
description: "Read the FluentCart Pro software-license changelog HTML for a product (Pro tier; V3.4; requires FluentCart Pro installed + activated). This reads ProductMeta meta_key='_fluent_sl_changelog', the field FluentCart Pro shows in Product → License Settings → Changelog Description. Read-only. Returns the standardized envelope { ok, data?, error }; success payload is { product_id, changelog_html, is_empty, storage_meta_key }. Error codes: invalid_input (400), not_found (404), fluentcart.module_inactive (412), fluentcart.query_failed (500). Idempotency: read-only.",
|
|
3774
|
+
inputSchema: {
|
|
3775
|
+
product_id: z
|
|
3776
|
+
.number()
|
|
3777
|
+
.int()
|
|
3778
|
+
.positive()
|
|
3779
|
+
.describe("FluentCart product ID (the post ID of the fluent_products CPT entry)."),
|
|
3780
|
+
},
|
|
3781
|
+
annotations: { idempotentHint: true },
|
|
3782
|
+
_meta: { idempotent: "true" },
|
|
3783
|
+
}, async ({ product_id }) => {
|
|
3784
|
+
const result = await wp.requestEnveloped(`/pro/fluentcart/products/${product_id}/license-changelog`, { method: "POST" });
|
|
3785
|
+
return {
|
|
3786
|
+
content: [
|
|
3787
|
+
{
|
|
3788
|
+
type: "text",
|
|
3789
|
+
text: serializeEnvelope(result, "diviops_fc_license_changelog_get"),
|
|
3790
|
+
},
|
|
3791
|
+
],
|
|
3792
|
+
};
|
|
3793
|
+
}, {
|
|
3794
|
+
target: "fluentcart",
|
|
3795
|
+
capabilityKey: "fluentcart_license_changelog_get",
|
|
3796
|
+
});
|
|
3797
|
+
// diviops_fc_license_changelog_update — POST /diviops/v1/pro/fluentcart/products/{id}/license-changelog/update
|
|
3798
|
+
registerProTool("diviops_fc_license_changelog_update", {
|
|
3799
|
+
description: "Write the FluentCart Pro software-license changelog HTML for a product (Pro tier; V3.4; requires FluentCart Pro installed + activated). This writes ProductMeta meta_key='_fluent_sl_changelog', the field FluentCart Pro shows in Product → License Settings → Changelog Description. Input is sanitized by WordPress wp_kses_post on the plugin side. Supports dry_run and no-op detection. Success payload is { product_id, changed, changelog_html } or { noop:true, dry_run, product_id, changelog_html }. Error codes: invalid_input (400), not_found (404), fluentcart.module_inactive (412), fluentcart.command_failed (500). Idempotency: conditional — identical repeat is a no-op." +
|
|
3800
|
+
DRY_RUN_DESC_SUFFIX,
|
|
3801
|
+
inputSchema: {
|
|
3802
|
+
product_id: z
|
|
3803
|
+
.number()
|
|
3804
|
+
.int()
|
|
3805
|
+
.positive()
|
|
3806
|
+
.describe("FluentCart product ID (the post ID of the fluent_products CPT entry)."),
|
|
3807
|
+
changelog_html: z
|
|
3808
|
+
.string()
|
|
3809
|
+
.describe("Buyer/update-facing changelog HTML. Sanitized with wp_kses_post before storage."),
|
|
3810
|
+
dry_run: DRY_RUN_FIELD,
|
|
3811
|
+
},
|
|
3812
|
+
annotations: { idempotentHint: false },
|
|
3813
|
+
_meta: { idempotent: "conditional" },
|
|
3814
|
+
}, async ({ product_id, changelog_html, dry_run, }) => {
|
|
3815
|
+
const body = { changelog_html };
|
|
3816
|
+
if (dry_run !== undefined)
|
|
3817
|
+
body.dry_run = dry_run;
|
|
3818
|
+
const result = await wp.requestEnveloped(`/pro/fluentcart/products/${product_id}/license-changelog/update`, { method: "POST", body });
|
|
3819
|
+
return {
|
|
3820
|
+
content: [
|
|
3821
|
+
{
|
|
3822
|
+
type: "text",
|
|
3823
|
+
text: serializeEnvelope(result, "diviops_fc_license_changelog_update"),
|
|
3824
|
+
},
|
|
3825
|
+
],
|
|
3826
|
+
};
|
|
3827
|
+
}, {
|
|
3828
|
+
target: "fluentcart",
|
|
3829
|
+
capabilityKey: "fluentcart_license_changelog_update",
|
|
3830
|
+
});
|
|
3642
3831
|
// ── V3.1 — order/license/activation read + guarded mark-paid ───────
|
|
3643
3832
|
//
|
|
3644
3833
|
// FluentCart commerce-artifact readback surface plus a single
|