@diviops/mcp-server 1.5.6 → 1.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/dist/envelope.d.ts +14 -10
- package/dist/index.js +31 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -64,7 +64,7 @@ The skill enforces the Divi block format, the design system, and the response co
|
|
|
64
64
|
|
|
65
65
|
## Tools at a glance
|
|
66
66
|
|
|
67
|
-
The server exposes **
|
|
67
|
+
The server exposes **67 tools** across the categories below. Each category links to representative tools; the full table lives in [server-reference.md](../docs/server-reference.md).
|
|
68
68
|
|
|
69
69
|
| Category | Use case | Tool prefixes |
|
|
70
70
|
|----------|----------|---------------|
|
|
@@ -108,6 +108,10 @@ Tools return a standardized envelope. The shape lets clients branch on `ok` and
|
|
|
108
108
|
|
|
109
109
|
Namespaces extend the vocabulary using the `<namespace>.<reason>` convention — e.g. `meta_wp_cli.command_failed`, `scf.not_configured`, `preset.bucket_mismatch`, `variable.customizer_default_immutable`. Namespace-prefixed codes carry structured `error.data` documenting the failure (exit codes, conflicting fields, reference counts, etc.). Per-tool descriptions name the codes each tool emits and the `error.data` shape that accompanies them.
|
|
110
110
|
|
|
111
|
+
### Per-tool `error.data` extensions
|
|
112
|
+
|
|
113
|
+
Some tools attach a structured `error.data` payload alongside the `code`/`message`/`hint` envelope — e.g. `meta_wp_cli` carries `{ exit_code, stdout, stderr }` on `meta_wp_cli.command_failed`, `global_color_delete` carries `{ id, ref_count, locations[], scan_truncated, scanned_posts[] }` on `conflict`, and conflict-class adopters across `canvas_*`/`library_*`/`variable_*` echo the conflicting fields. The shape is per-tool and documented in each tool's description prose, not in this canonical envelope summary. The summary stays terse because (a) most tools never emit `error.data` and advertising it universally would be misleading, and (b) the per-tool shape diverges and `data?: unknown` would be information-free. The runtime mechanism is `withCode`'s 4th `data` argument (server-local) / `envelope_error()`'s `$data` parameter (plugin-routed); both flow through `wrapResponse` to land on `error.data`.
|
|
114
|
+
|
|
111
115
|
### `dry_run` plan shape
|
|
112
116
|
|
|
113
117
|
Every write tool accepts `dry_run: boolean` (default `false`). When `true`, the response carries a uniform plan shape and no state is mutated:
|
package/dist/envelope.d.ts
CHANGED
|
@@ -24,17 +24,21 @@ export type DiviopsErrorBody = {
|
|
|
24
24
|
message: string;
|
|
25
25
|
hint?: string;
|
|
26
26
|
/**
|
|
27
|
-
* Optional structured payload attached to the error envelope.
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* `
|
|
31
|
-
*
|
|
32
|
-
*
|
|
27
|
+
* Optional structured payload attached to the error envelope. Carried
|
|
28
|
+
* via `withCode`'s 4th `data` argument (server-local) or the plugin's
|
|
29
|
+
* `envelope_error()` `$data` parameter (plugin-routed) — e.g.
|
|
30
|
+
* `meta_wp_cli` emits `{ exit_code, stdout, stderr }`,
|
|
31
|
+
* `global_color_delete` emits `{ id, ref_count, locations[], ... }` on
|
|
32
|
+
* `conflict`, and conflict-class adopters echo conflicting fields.
|
|
33
33
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
34
|
+
* The shape is per-tool and documented in each tool's description
|
|
35
|
+
* prose, not in this canonical type. The type stays `unknown` because
|
|
36
|
+
* (a) most tools never emit `error.data` so advertising it universally
|
|
37
|
+
* would be misleading, and (b) the per-tool shape diverges and a
|
|
38
|
+
* concrete union here would be information-free for consumers.
|
|
39
|
+
*
|
|
40
|
+
* See `diviops-server/README.md` "Per-tool error.data extensions" for
|
|
41
|
+
* the codified convention.
|
|
38
42
|
*/
|
|
39
43
|
data?: unknown;
|
|
40
44
|
};
|
package/dist/index.js
CHANGED
|
@@ -1525,6 +1525,37 @@ registerPluginTool("diviops_tb_template_create", {
|
|
|
1525
1525
|
],
|
|
1526
1526
|
};
|
|
1527
1527
|
});
|
|
1528
|
+
registerPluginTool("diviops_tb_template_trash", {
|
|
1529
|
+
description: "Trash (or permanently delete) a Theme Builder template AND its linked header/body/footer layouts AND scrub the `_et_template` meta refs on the Theme Builder master post. Closes the orphan-meta gap left by `diviops_page_trash` / wp-cli `post delete` on linked layouts: the typed wrapper does the cleanup atomically. Defaults to trash (reversible via WP Admin → Trash). Pass `force=true` to permanently delete (wp_delete_post — irreversible, one-shot: a repeat call after a successful force-delete returns 'not_found' because the template post is gone from the DB). Idempotency applies to the default trash mode only: a repeat call after a successful trash-mode cleanup returns ok:true with `data.already_trashed = true` (mirrors `diviops_page_trash`). If a prior trash-mode call partially succeeded (some layouts already trashed, master meta still carries refs), the next call detects already-trashed targets via pre-state checks, skips the no-op WP destructor calls (which would otherwise return false), and still runs the meta scrub — `data.linked_layouts[].skipped` and `data.template_skipped` flag the targets that were already at the end-state. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; missing template_id returns 'not_found' (HTTP 404), delete-permission failures return 'forbidden' (HTTP 403); per-step trash/delete/meta-scrub failures return the namespaced 'tb_template.command_failed' (HTTP 500) with `error.data.failed_step` ∈ { 'layout_destroy', 'template_destroy', 'meta_scrub' } plus `template_id` and `force`." +
|
|
1530
|
+
DRY_RUN_DESC_SUFFIX,
|
|
1531
|
+
inputSchema: {
|
|
1532
|
+
template_id: z
|
|
1533
|
+
.number()
|
|
1534
|
+
.int()
|
|
1535
|
+
.describe("Theme Builder template post ID (the `et_template` post). Discover via diviops_tb_template_list — NOT the linked layout IDs."),
|
|
1536
|
+
force: z
|
|
1537
|
+
.boolean()
|
|
1538
|
+
.optional()
|
|
1539
|
+
.default(false)
|
|
1540
|
+
.describe("When true, permanently delete (skips trash). Default false moves to trash."),
|
|
1541
|
+
dry_run: DRY_RUN_FIELD,
|
|
1542
|
+
},
|
|
1543
|
+
annotations: { idempotentHint: false },
|
|
1544
|
+
_meta: { idempotent: "conditional" },
|
|
1545
|
+
}, async ({ template_id, force, dry_run }) => {
|
|
1546
|
+
const result = await wp.requestEnveloped(`/theme-builder/template/trash/${template_id}`, {
|
|
1547
|
+
method: "POST",
|
|
1548
|
+
body: {
|
|
1549
|
+
force: force ?? false,
|
|
1550
|
+
dry_run: dry_run ?? false,
|
|
1551
|
+
},
|
|
1552
|
+
});
|
|
1553
|
+
return {
|
|
1554
|
+
content: [
|
|
1555
|
+
{ type: "text", text: serializeEnvelope(result, "diviops_tb_template_trash") },
|
|
1556
|
+
],
|
|
1557
|
+
};
|
|
1558
|
+
});
|
|
1528
1559
|
// ── Canvas Tools ────────────────────────────────────────────────────
|
|
1529
1560
|
registerPluginTool("diviops_canvas_create", {
|
|
1530
1561
|
description: "Create a canvas (off-canvas workspace) linked to a page. Used for popups, off-canvas menus, modals. Content uses standard Divi block markup. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; missing parent_page_id returns ok:false with code 'not_found'; non-string content / malformed canvas_id / append_to_main outside {above, below} returns 'invalid_input'. Returns code 'conflict' (HTTP 409) when a canvas with the same title already exists under the same parent_page_id — error.data = { existing_canvas_id, parent_page_id, title }. Mirrors diviops_preset_create's uniqueness contract." +
|