@diviops/mcp-server 0.2.9 → 0.2.11
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 +1 -1
- package/dist/compatibility.d.ts +1 -1
- package/dist/compatibility.js +1 -1
- package/dist/index.js +65 -52
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -141,7 +141,7 @@ The server connects via standard WordPress REST API and works with any environme
|
|
|
141
141
|
| `diviops_save_to_library` | Save block markup to Divi Library |
|
|
142
142
|
| `diviops_update_tb_layout` | Update a Theme Builder layout's block markup |
|
|
143
143
|
| `diviops_create_tb_template` | Create Theme Builder template with header/footer and conditions |
|
|
144
|
-
| `diviops_create_variable` | Create a design token variable. For `type=numbers` fluid tokens, pass `min`+`max` shorthand (anchors default to 320px/1920px) or explicit `targets` like `{"320px":"20px","1920px":"60px"}` — server generates arithmetically-correct `clamp()` instead of hand-written math that silently under-reaches the stated max.
|
|
144
|
+
| `diviops_create_variable` | Create a design token variable. For `type=numbers` fluid tokens, pass `min`+`max` shorthand (anchors default to 320px/1920px) or explicit `targets` like `{"320px":"20px","1920px":"60px"}` — server generates arithmetically-correct `clamp()` instead of hand-written math that silently under-reaches the stated max. All-px inputs emit px (root-agnostic). Rem inputs OR rem output require explicit opt-in: pass `output_unit="rem"` (accepts the 1rem=16px default) or `root_font_size_px:N` (declares your site's actual root font-size, e.g. `10` for `html { font-size: 62.5% }`, `20` for `html { font-size: 20px }`) |
|
|
145
145
|
| `diviops_delete_variable` | Delete a variable by ID. Returns HTTP 409 when live references exist unless `force=true` (use `diviops_variables_scan_orphans` to find reference locations). Returns HTTP 403 for Divi's customizer-bound defaults (`gcid-primary-color`, `gcid-secondary-color`, `gcid-heading-color`, `gcid-body-color`, `gcid-link-color` — managed via WP Customizer) |
|
|
146
146
|
| `diviops_create_canvas` | Create a canvas page |
|
|
147
147
|
| `diviops_update_canvas` | Update canvas content |
|
package/dist/compatibility.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Version compatibility between MCP server and WP plugin.
|
|
3
3
|
*/
|
|
4
4
|
/** Minimum WP plugin version this server requires. */
|
|
5
|
-
export declare const MIN_PLUGIN_VERSION = "1.0.0-beta.
|
|
5
|
+
export declare const MIN_PLUGIN_VERSION = "1.0.0-beta.30";
|
|
6
6
|
/**
|
|
7
7
|
* Compare two semver-like version strings (supports pre-release tags).
|
|
8
8
|
*
|
package/dist/compatibility.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Version compatibility between MCP server and WP plugin.
|
|
3
3
|
*/
|
|
4
4
|
/** Minimum WP plugin version this server requires. */
|
|
5
|
-
export const MIN_PLUGIN_VERSION = '1.0.0-beta.
|
|
5
|
+
export const MIN_PLUGIN_VERSION = '1.0.0-beta.30';
|
|
6
6
|
/**
|
|
7
7
|
* Compare two semver-like version strings (supports pre-release tags).
|
|
8
8
|
*
|
package/dist/index.js
CHANGED
|
@@ -107,7 +107,7 @@ server.registerTool("diviops_list_pages", {
|
|
|
107
107
|
});
|
|
108
108
|
return {
|
|
109
109
|
content: [
|
|
110
|
-
{ type: "text", text: JSON.stringify(result
|
|
110
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
111
111
|
],
|
|
112
112
|
};
|
|
113
113
|
});
|
|
@@ -120,7 +120,7 @@ server.registerTool("diviops_get_page", {
|
|
|
120
120
|
const result = await wp.request(`/page/${page_id}`);
|
|
121
121
|
return {
|
|
122
122
|
content: [
|
|
123
|
-
{ type: "text", text: JSON.stringify(result
|
|
123
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
124
124
|
],
|
|
125
125
|
};
|
|
126
126
|
});
|
|
@@ -140,7 +140,7 @@ server.registerTool("diviops_get_page_layout", {
|
|
|
140
140
|
});
|
|
141
141
|
return {
|
|
142
142
|
content: [
|
|
143
|
-
{ type: "text", text: JSON.stringify(result
|
|
143
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
144
144
|
],
|
|
145
145
|
};
|
|
146
146
|
});
|
|
@@ -150,7 +150,7 @@ server.registerTool("diviops_list_modules", {
|
|
|
150
150
|
const result = await wp.request("/modules");
|
|
151
151
|
return {
|
|
152
152
|
content: [
|
|
153
|
-
{ type: "text", text: JSON.stringify(result
|
|
153
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
154
154
|
],
|
|
155
155
|
};
|
|
156
156
|
});
|
|
@@ -171,7 +171,7 @@ server.registerTool("diviops_get_module_schema", {
|
|
|
171
171
|
const output = raw ? result : optimizeSchema(result);
|
|
172
172
|
return {
|
|
173
173
|
content: [
|
|
174
|
-
{ type: "text", text: JSON.stringify(output
|
|
174
|
+
{ type: "text", text: JSON.stringify(output) },
|
|
175
175
|
],
|
|
176
176
|
};
|
|
177
177
|
});
|
|
@@ -181,7 +181,7 @@ server.registerTool("diviops_get_settings", {
|
|
|
181
181
|
const result = await wp.request("/settings");
|
|
182
182
|
return {
|
|
183
183
|
content: [
|
|
184
|
-
{ type: "text", text: JSON.stringify(result
|
|
184
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
185
185
|
],
|
|
186
186
|
};
|
|
187
187
|
});
|
|
@@ -191,7 +191,7 @@ server.registerTool("diviops_get_global_colors", {
|
|
|
191
191
|
const result = await wp.request("/global-colors");
|
|
192
192
|
return {
|
|
193
193
|
content: [
|
|
194
|
-
{ type: "text", text: JSON.stringify(result
|
|
194
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
195
195
|
],
|
|
196
196
|
};
|
|
197
197
|
});
|
|
@@ -201,7 +201,7 @@ server.registerTool("diviops_get_global_fonts", {
|
|
|
201
201
|
const result = await wp.request("/global-fonts");
|
|
202
202
|
return {
|
|
203
203
|
content: [
|
|
204
|
-
{ type: "text", text: JSON.stringify(result
|
|
204
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
205
205
|
],
|
|
206
206
|
};
|
|
207
207
|
});
|
|
@@ -226,7 +226,7 @@ server.registerTool("diviops_find_icon", {
|
|
|
226
226
|
const result = await wp.request(`/icons/search?q=${encodeURIComponent(query)}&type=${type ?? "all"}&limit=${limit ?? 10}`);
|
|
227
227
|
return {
|
|
228
228
|
content: [
|
|
229
|
-
{ type: "text", text: JSON.stringify(result
|
|
229
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
230
230
|
],
|
|
231
231
|
};
|
|
232
232
|
});
|
|
@@ -246,7 +246,7 @@ server.registerTool("diviops_update_page_content", {
|
|
|
246
246
|
});
|
|
247
247
|
return {
|
|
248
248
|
content: [
|
|
249
|
-
{ type: "text", text: JSON.stringify(result
|
|
249
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
250
250
|
],
|
|
251
251
|
};
|
|
252
252
|
});
|
|
@@ -262,7 +262,7 @@ server.registerTool("diviops_render_preview", {
|
|
|
262
262
|
});
|
|
263
263
|
return {
|
|
264
264
|
content: [
|
|
265
|
-
{ type: "text", text: JSON.stringify(result
|
|
265
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
266
266
|
],
|
|
267
267
|
};
|
|
268
268
|
});
|
|
@@ -278,7 +278,7 @@ server.registerTool("diviops_validate_blocks", {
|
|
|
278
278
|
});
|
|
279
279
|
return {
|
|
280
280
|
content: [
|
|
281
|
-
{ type: "text", text: JSON.stringify(result
|
|
281
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
282
282
|
],
|
|
283
283
|
};
|
|
284
284
|
});
|
|
@@ -302,7 +302,7 @@ server.registerTool("diviops_append_section", {
|
|
|
302
302
|
});
|
|
303
303
|
return {
|
|
304
304
|
content: [
|
|
305
|
-
{ type: "text", text: JSON.stringify(result
|
|
305
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
306
306
|
],
|
|
307
307
|
};
|
|
308
308
|
});
|
|
@@ -341,7 +341,7 @@ server.registerTool("diviops_replace_section", {
|
|
|
341
341
|
});
|
|
342
342
|
return {
|
|
343
343
|
content: [
|
|
344
|
-
{ type: "text", text: JSON.stringify(result
|
|
344
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
345
345
|
],
|
|
346
346
|
};
|
|
347
347
|
});
|
|
@@ -377,7 +377,7 @@ server.registerTool("diviops_remove_section", {
|
|
|
377
377
|
});
|
|
378
378
|
return {
|
|
379
379
|
content: [
|
|
380
|
-
{ type: "text", text: JSON.stringify(result
|
|
380
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
381
381
|
],
|
|
382
382
|
};
|
|
383
383
|
});
|
|
@@ -411,7 +411,7 @@ server.registerTool("diviops_get_section", {
|
|
|
411
411
|
const result = await wp.request(`/page/${page_id}/get-section?${qs}`);
|
|
412
412
|
return {
|
|
413
413
|
content: [
|
|
414
|
-
{ type: "text", text: JSON.stringify(result
|
|
414
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
415
415
|
],
|
|
416
416
|
};
|
|
417
417
|
});
|
|
@@ -458,7 +458,7 @@ server.registerTool("diviops_update_module", {
|
|
|
458
458
|
});
|
|
459
459
|
return {
|
|
460
460
|
content: [
|
|
461
|
-
{ type: "text", text: JSON.stringify(result
|
|
461
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
462
462
|
],
|
|
463
463
|
};
|
|
464
464
|
});
|
|
@@ -532,7 +532,7 @@ server.registerTool("diviops_move_module", {
|
|
|
532
532
|
});
|
|
533
533
|
return {
|
|
534
534
|
content: [
|
|
535
|
-
{ type: "text", text: JSON.stringify(result
|
|
535
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
536
536
|
],
|
|
537
537
|
};
|
|
538
538
|
});
|
|
@@ -558,7 +558,7 @@ server.registerTool("diviops_create_page", {
|
|
|
558
558
|
});
|
|
559
559
|
return {
|
|
560
560
|
content: [
|
|
561
|
-
{ type: "text", text: JSON.stringify(result
|
|
561
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
562
562
|
],
|
|
563
563
|
};
|
|
564
564
|
});
|
|
@@ -569,7 +569,7 @@ server.registerTool("diviops_preset_audit", {
|
|
|
569
569
|
const result = await wp.request("/preset-audit");
|
|
570
570
|
return {
|
|
571
571
|
content: [
|
|
572
|
-
{ type: "text", text: JSON.stringify(result
|
|
572
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
573
573
|
],
|
|
574
574
|
};
|
|
575
575
|
});
|
|
@@ -615,7 +615,7 @@ server.registerTool("diviops_preset_cleanup", {
|
|
|
615
615
|
});
|
|
616
616
|
return {
|
|
617
617
|
content: [
|
|
618
|
-
{ type: "text", text: JSON.stringify(result
|
|
618
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
619
619
|
],
|
|
620
620
|
};
|
|
621
621
|
});
|
|
@@ -641,7 +641,7 @@ server.registerTool("diviops_preset_update", {
|
|
|
641
641
|
});
|
|
642
642
|
return {
|
|
643
643
|
content: [
|
|
644
|
-
{ type: "text", text: JSON.stringify(result
|
|
644
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
645
645
|
],
|
|
646
646
|
};
|
|
647
647
|
});
|
|
@@ -657,7 +657,7 @@ server.registerTool("diviops_preset_delete", {
|
|
|
657
657
|
});
|
|
658
658
|
return {
|
|
659
659
|
content: [
|
|
660
|
-
{ type: "text", text: JSON.stringify(result
|
|
660
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
661
661
|
],
|
|
662
662
|
};
|
|
663
663
|
});
|
|
@@ -703,7 +703,7 @@ server.registerTool("diviops_preset_create", {
|
|
|
703
703
|
const result = await wp.request("/preset-create", { method: "POST", body });
|
|
704
704
|
return {
|
|
705
705
|
content: [
|
|
706
|
-
{ type: "text", text: JSON.stringify(result
|
|
706
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
707
707
|
],
|
|
708
708
|
};
|
|
709
709
|
});
|
|
@@ -741,7 +741,7 @@ server.registerTool("diviops_preset_reassign", {
|
|
|
741
741
|
});
|
|
742
742
|
return {
|
|
743
743
|
content: [
|
|
744
|
-
{ type: "text", text: JSON.stringify(result
|
|
744
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
745
745
|
],
|
|
746
746
|
};
|
|
747
747
|
});
|
|
@@ -751,7 +751,7 @@ server.registerTool("diviops_preset_scan_orphans", {
|
|
|
751
751
|
const result = await wp.request("/preset-scan-orphans");
|
|
752
752
|
return {
|
|
753
753
|
content: [
|
|
754
|
-
{ type: "text", text: JSON.stringify(result
|
|
754
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
755
755
|
],
|
|
756
756
|
};
|
|
757
757
|
});
|
|
@@ -784,7 +784,7 @@ server.registerTool("diviops_list_library", {
|
|
|
784
784
|
const result = await wp.request("/library", { params });
|
|
785
785
|
return {
|
|
786
786
|
content: [
|
|
787
|
-
{ type: "text", text: JSON.stringify(result
|
|
787
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
788
788
|
],
|
|
789
789
|
};
|
|
790
790
|
});
|
|
@@ -797,7 +797,7 @@ server.registerTool("diviops_get_library_item", {
|
|
|
797
797
|
const result = await wp.request(`/library/${item_id}`);
|
|
798
798
|
return {
|
|
799
799
|
content: [
|
|
800
|
-
{ type: "text", text: JSON.stringify(result
|
|
800
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
801
801
|
],
|
|
802
802
|
};
|
|
803
803
|
});
|
|
@@ -831,7 +831,7 @@ server.registerTool("diviops_save_to_library", {
|
|
|
831
831
|
});
|
|
832
832
|
return {
|
|
833
833
|
content: [
|
|
834
|
-
{ type: "text", text: JSON.stringify(result
|
|
834
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
835
835
|
],
|
|
836
836
|
};
|
|
837
837
|
});
|
|
@@ -856,7 +856,7 @@ server.registerTool("diviops_list_tb_templates", {
|
|
|
856
856
|
const result = await wp.request("/theme-builder/templates", { params });
|
|
857
857
|
return {
|
|
858
858
|
content: [
|
|
859
|
-
{ type: "text", text: JSON.stringify(result
|
|
859
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
860
860
|
],
|
|
861
861
|
};
|
|
862
862
|
});
|
|
@@ -871,7 +871,7 @@ server.registerTool("diviops_get_tb_layout", {
|
|
|
871
871
|
const result = await wp.request(`/theme-builder/layout/${layout_id}`);
|
|
872
872
|
return {
|
|
873
873
|
content: [
|
|
874
|
-
{ type: "text", text: JSON.stringify(result
|
|
874
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
875
875
|
],
|
|
876
876
|
};
|
|
877
877
|
});
|
|
@@ -888,7 +888,7 @@ server.registerTool("diviops_update_tb_layout", {
|
|
|
888
888
|
});
|
|
889
889
|
return {
|
|
890
890
|
content: [
|
|
891
|
-
{ type: "text", text: JSON.stringify(result
|
|
891
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
892
892
|
],
|
|
893
893
|
};
|
|
894
894
|
});
|
|
@@ -917,7 +917,7 @@ server.registerTool("diviops_create_tb_template", {
|
|
|
917
917
|
});
|
|
918
918
|
return {
|
|
919
919
|
content: [
|
|
920
|
-
{ type: "text", text: JSON.stringify(result
|
|
920
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
921
921
|
],
|
|
922
922
|
};
|
|
923
923
|
});
|
|
@@ -962,7 +962,7 @@ server.registerTool("diviops_create_canvas", {
|
|
|
962
962
|
const result = await wp.request("/canvas/create", { method: "POST", body });
|
|
963
963
|
return {
|
|
964
964
|
content: [
|
|
965
|
-
{ type: "text", text: JSON.stringify(result
|
|
965
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
966
966
|
],
|
|
967
967
|
};
|
|
968
968
|
});
|
|
@@ -991,7 +991,7 @@ server.registerTool("diviops_list_canvases", {
|
|
|
991
991
|
const result = await wp.request("/canvases", { params });
|
|
992
992
|
return {
|
|
993
993
|
content: [
|
|
994
|
-
{ type: "text", text: JSON.stringify(result
|
|
994
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
995
995
|
],
|
|
996
996
|
};
|
|
997
997
|
});
|
|
@@ -1006,7 +1006,7 @@ server.registerTool("diviops_get_canvas", {
|
|
|
1006
1006
|
const result = await wp.request(`/canvas/${canvas_post_id}`);
|
|
1007
1007
|
return {
|
|
1008
1008
|
content: [
|
|
1009
|
-
{ type: "text", text: JSON.stringify(result
|
|
1009
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
1010
1010
|
],
|
|
1011
1011
|
};
|
|
1012
1012
|
});
|
|
@@ -1041,7 +1041,7 @@ server.registerTool("diviops_update_canvas", {
|
|
|
1041
1041
|
});
|
|
1042
1042
|
return {
|
|
1043
1043
|
content: [
|
|
1044
|
-
{ type: "text", text: JSON.stringify(result
|
|
1044
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
1045
1045
|
],
|
|
1046
1046
|
};
|
|
1047
1047
|
});
|
|
@@ -1056,7 +1056,7 @@ server.registerTool("diviops_delete_canvas", {
|
|
|
1056
1056
|
});
|
|
1057
1057
|
return {
|
|
1058
1058
|
content: [
|
|
1059
|
-
{ type: "text", text: JSON.stringify(result
|
|
1059
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
1060
1060
|
],
|
|
1061
1061
|
};
|
|
1062
1062
|
});
|
|
@@ -1092,7 +1092,7 @@ server.registerTool("diviops_test_connection", {
|
|
|
1092
1092
|
const result = await wp.testConnection();
|
|
1093
1093
|
return {
|
|
1094
1094
|
content: [
|
|
1095
|
-
{ type: "text", text: JSON.stringify(result
|
|
1095
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
1096
1096
|
],
|
|
1097
1097
|
};
|
|
1098
1098
|
});
|
|
@@ -1121,7 +1121,7 @@ server.registerTool("diviops_server_info", {
|
|
|
1121
1121
|
};
|
|
1122
1122
|
return {
|
|
1123
1123
|
content: [
|
|
1124
|
-
{ type: "text", text: JSON.stringify(info
|
|
1124
|
+
{ type: "text", text: JSON.stringify(info) },
|
|
1125
1125
|
],
|
|
1126
1126
|
};
|
|
1127
1127
|
});
|
|
@@ -1229,7 +1229,7 @@ server.registerTool("diviops_list_templates", {
|
|
|
1229
1229
|
requires_css: t.requires_css ?? false,
|
|
1230
1230
|
}));
|
|
1231
1231
|
return {
|
|
1232
|
-
content: [{ type: "text", text: JSON.stringify(list
|
|
1232
|
+
content: [{ type: "text", text: JSON.stringify(list) }],
|
|
1233
1233
|
};
|
|
1234
1234
|
});
|
|
1235
1235
|
server.registerTool("diviops_get_template", {
|
|
@@ -1254,7 +1254,7 @@ server.registerTool("diviops_get_template", {
|
|
|
1254
1254
|
}
|
|
1255
1255
|
return {
|
|
1256
1256
|
content: [
|
|
1257
|
-
{ type: "text", text: JSON.stringify(template
|
|
1257
|
+
{ type: "text", text: JSON.stringify(template) },
|
|
1258
1258
|
],
|
|
1259
1259
|
};
|
|
1260
1260
|
});
|
|
@@ -1280,12 +1280,12 @@ server.registerTool("diviops_list_variables", {
|
|
|
1280
1280
|
const result = await wp.request("/variables", { params });
|
|
1281
1281
|
return {
|
|
1282
1282
|
content: [
|
|
1283
|
-
{ type: "text", text: JSON.stringify(result
|
|
1283
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
1284
1284
|
],
|
|
1285
1285
|
};
|
|
1286
1286
|
});
|
|
1287
1287
|
server.registerTool("diviops_create_variable", {
|
|
1288
|
-
description: 'Create a design token variable in the Divi Variable Manager. Colors (type "colors") use gcid-* IDs and hex values. Numbers/strings/etc use gvid-* IDs. For type="numbers" fluid tokens, pass min+max shorthand (anchors default to 320px/1920px) or explicit targets — server generates arithmetically-correct clamp() formulas.
|
|
1288
|
+
description: 'Create a design token variable in the Divi Variable Manager. Colors (type "colors") use gcid-* IDs and hex values. Numbers/strings/etc use gvid-* IDs. For type="numbers" fluid tokens, pass min+max shorthand (anchors default to 320px/1920px) or explicit targets — server generates arithmetically-correct clamp() formulas. All-px inputs emit px (safe default, root-agnostic). Rem inputs OR rem output require explicit opt-in: pass output_unit="rem" (accepts the 1rem=16px default) or root_font_size_px:N (declares your site\'s actual root font-size for correct rem emission on non-16px-root sites). Mutually exclusive with value.',
|
|
1289
1289
|
inputSchema: {
|
|
1290
1290
|
type: z
|
|
1291
1291
|
.enum(["colors", "numbers", "strings", "images", "links", "fonts"])
|
|
@@ -1304,20 +1304,29 @@ server.registerTool("diviops_create_variable", {
|
|
|
1304
1304
|
min: z
|
|
1305
1305
|
.string()
|
|
1306
1306
|
.optional()
|
|
1307
|
-
.describe('Fluid minimum value
|
|
1307
|
+
.describe('Fluid minimum value (e.g. "20px" or "1.25rem"). Paired with max. Anchors default to 320px/1920px. Rem inputs require explicit opt-in via output_unit or root_font_size_px. type="numbers" only.'),
|
|
1308
1308
|
max: z
|
|
1309
1309
|
.string()
|
|
1310
1310
|
.optional()
|
|
1311
|
-
.describe('Fluid maximum value
|
|
1311
|
+
.describe('Fluid maximum value (e.g. "60px" or "3.75rem"). Paired with min.'),
|
|
1312
1312
|
targets: z
|
|
1313
1313
|
.record(z.string(), z.string())
|
|
1314
1314
|
.refine((m) => !m || Object.keys(m).length === 2, {
|
|
1315
1315
|
message: "targets must contain exactly 2 viewport entries",
|
|
1316
1316
|
})
|
|
1317
1317
|
.optional()
|
|
1318
|
-
.describe('Explicit two-anchor fluid spec, px only. Example: {"320px":"20px","1920px":"60px"} → clamp(20px, 12px + 2.5vw, 60px). Exactly 2 entries required. type="numbers" only. Mutually exclusive with min/max.'),
|
|
1318
|
+
.describe('Explicit two-anchor fluid spec, object keyed by viewport width (px only). Example: {"320px":"20px","1920px":"60px"} → clamp(20px, 12px + 2.5vw, 60px). Exactly 2 entries required. type="numbers" only. Mutually exclusive with min/max. Rem values require explicit opt-in via output_unit or root_font_size_px.'),
|
|
1319
|
+
output_unit: z
|
|
1320
|
+
.enum(["rem", "px"])
|
|
1321
|
+
.optional()
|
|
1322
|
+
.describe('Unit for generated clamp formula. Omit for all-px inputs (safe default — emits px, root-agnostic). Pass "rem" to emit rem (accepts the 1rem=16px assumption unless root_font_size_px is also passed); required when inputs include rem unless root_font_size_px is passed. Pass "px" to force px output regardless of input unit.'),
|
|
1323
|
+
root_font_size_px: z
|
|
1324
|
+
.number()
|
|
1325
|
+
.positive()
|
|
1326
|
+
.optional()
|
|
1327
|
+
.describe("Site's root font-size in px (positive number), used for correct rem↔px conversion in the generated clamp() formula. Defaults to 16 (standard browser default) when omitted. Pass explicitly for sites that customize `html { font-size }` (e.g. 10 for `html { font-size: 62.5% }`, 20 for `html { font-size: 20px }`). Also counts as an opt-in signal for rem emission — passing it alone (without output_unit) implies rem output. Only applies when min/max/targets is used."),
|
|
1319
1328
|
},
|
|
1320
|
-
}, async ({ type, id, label, value, min, max, targets }) => {
|
|
1329
|
+
}, async ({ type, id, label, value, min, max, targets, output_unit, root_font_size_px, }) => {
|
|
1321
1330
|
const body = { type, label };
|
|
1322
1331
|
if (value !== undefined)
|
|
1323
1332
|
body.value = value;
|
|
@@ -1329,13 +1338,17 @@ server.registerTool("diviops_create_variable", {
|
|
|
1329
1338
|
body.max = max;
|
|
1330
1339
|
if (targets !== undefined)
|
|
1331
1340
|
body.targets = targets;
|
|
1341
|
+
if (output_unit !== undefined)
|
|
1342
|
+
body.output_unit = output_unit;
|
|
1343
|
+
if (root_font_size_px !== undefined)
|
|
1344
|
+
body.root_font_size_px = root_font_size_px;
|
|
1332
1345
|
const result = await wp.request("/variable/create", {
|
|
1333
1346
|
method: "POST",
|
|
1334
1347
|
body,
|
|
1335
1348
|
});
|
|
1336
1349
|
return {
|
|
1337
1350
|
content: [
|
|
1338
|
-
{ type: "text", text: JSON.stringify(result
|
|
1351
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
1339
1352
|
],
|
|
1340
1353
|
};
|
|
1341
1354
|
});
|
|
@@ -1358,7 +1371,7 @@ server.registerTool("diviops_delete_variable", {
|
|
|
1358
1371
|
});
|
|
1359
1372
|
return {
|
|
1360
1373
|
content: [
|
|
1361
|
-
{ type: "text", text: JSON.stringify(result
|
|
1374
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
1362
1375
|
],
|
|
1363
1376
|
};
|
|
1364
1377
|
});
|
|
@@ -1368,7 +1381,7 @@ server.registerTool("diviops_variables_scan_orphans", {
|
|
|
1368
1381
|
const result = await wp.request("/variables-scan-orphans");
|
|
1369
1382
|
return {
|
|
1370
1383
|
content: [
|
|
1371
|
-
{ type: "text", text: JSON.stringify(result
|
|
1384
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
1372
1385
|
],
|
|
1373
1386
|
};
|
|
1374
1387
|
});
|
|
@@ -1407,7 +1420,7 @@ server.registerTool("diviops_flush_static_cache", {
|
|
|
1407
1420
|
});
|
|
1408
1421
|
return {
|
|
1409
1422
|
content: [
|
|
1410
|
-
{ type: "text", text: JSON.stringify(result
|
|
1423
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
1411
1424
|
],
|
|
1412
1425
|
};
|
|
1413
1426
|
});
|