@umbraco-cms/mcp-editor 17.6.0-beta.7 → 18.0.0-beta.10

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
@@ -9,7 +9,7 @@ import { resolve } from 'path';
9
9
 
10
10
  // package.json
11
11
  var package_default = {
12
- version: "17.6.0-beta.7"};
12
+ version: "18.0.0-beta.10"};
13
13
 
14
14
  // src/auth/chained-deps.generated.ts
15
15
  var CHAINED_DEPS = {
@@ -27,6 +27,7 @@ var CHAINED_DEPS = {
27
27
  "bulk-unpublish": ["get-document-by-id", "unpublish-document"],
28
28
  "cancel-schedule": ["get-document-by-id", "publish-document"],
29
29
  "copy-variant": ["get-document-by-id", "update-document"],
30
+ "create-and-publish-page": ["create-and-publish-document", "get-data-types-by-id-array", "get-document-type-by-id"],
30
31
  "create-blueprint": ["create-document-blueprint-from-document", "get-document-blueprint-root", "get-document-by-id"],
31
32
  "create-dictionary": ["create-dictionary"],
32
33
  "create-language": ["create-language"],
@@ -100,7 +101,7 @@ var CHAINED_DEPS = {
100
101
  "restore-media": ["get-media-by-id", "restore-media-from-recycle-bin"],
101
102
  "restore-page": ["get-document-by-id"],
102
103
  "rollback-page": ["create-document-version-rollback", "get-document-by-id", "get-document-version", "get-user-by-id"],
103
- "save-and-publish": ["get-document-by-id", "publish-document", "publish-document-with-descendants", "update-document-properties"],
104
+ "save-and-publish": ["get-document-by-id", "publish-document", "publish-document-with-descendants", "update-and-publish-document", "update-document-properties"],
104
105
  "schedule-publish": ["get-document-by-id", "publish-document"],
105
106
  "search-content": ["search-document"],
106
107
  "search-dictionary": ["find-dictionary"],
@@ -120,8 +121,7 @@ var CHAINED_DEPS = {
120
121
 
121
122
  // src/config/mcp-servers.ts
122
123
  async function buildServers() {
123
- const isWorkersRuntime = typeof navigator !== "undefined" && navigator.userAgent === "Cloudflare-Workers";
124
- if (isWorkersRuntime || typeof process === "undefined" || !process.env) return [];
124
+ if (typeof process === "undefined" || !process.env) return [];
125
125
  const useMockChain = process.env.USE_MOCK_MCP_CHAIN === "true";
126
126
  if (useMockChain) {
127
127
  const path2 = await import('path');
@@ -223,14 +223,6 @@ function truncateAvailableTools(message) {
223
223
  }
224
224
  return message.slice(0, availableToolsIndex + 1);
225
225
  }
226
- async function isCmsToolAvailable(toolName) {
227
- try {
228
- const { tools } = await mcpClientManager.listTools("cms");
229
- return (tools ?? []).some((t) => t.name === toolName);
230
- } catch {
231
- return true;
232
- }
233
- }
234
226
  async function chainCms(toolName, args) {
235
227
  let result;
236
228
  try {
@@ -254,78 +246,21 @@ async function chainCms(toolName, args) {
254
246
  }
255
247
  return { ok: true, data: extractChainedResult(result) };
256
248
  }
257
- function buildChainedCursor(skip, take) {
258
- return encodeCursor({ s: skip, t: take });
259
- }
260
- function stripHtml(html) {
261
- return (html || "").replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();
262
- }
263
- function countWords(text) {
264
- const stripped = stripHtml(text);
265
- if (!stripped) return 0;
266
- return stripped.split(/\s+/).filter(Boolean).length;
267
- }
268
- function extractTextFromBlockValues(innerValues) {
269
- const parts = [];
270
- for (const v of innerValues || []) {
271
- const text = extractTextFromValue(v.value, v.editorAlias);
272
- if (text) parts.push(text);
273
- }
274
- return parts.join(" ");
275
- }
276
- function extractTextFromValue(value, editorAlias) {
277
- if (typeof value === "string") {
278
- return stripHtml(value);
279
- }
280
- if (value && typeof value === "object" && typeof value.markup === "string") {
281
- const markupText = stripHtml(value.markup);
282
- const blockText = extractTextFromContentData(value.blocks?.contentData);
283
- return [markupText, blockText].filter(Boolean).join(" ");
284
- }
285
- if (value && typeof value === "object" && Array.isArray(value.contentData)) {
286
- return extractTextFromContentData(value.contentData);
287
- }
288
- return "";
289
- }
290
- function extractTextFromContentData(contentData) {
291
- const parts = [];
292
- for (const block of contentData || []) {
293
- const blockText = extractTextFromBlockValues(block.values || []);
294
- if (blockText) parts.push(blockText);
295
- }
296
- return parts.join(" ");
297
- }
298
- function extractTextContent(values) {
299
- const parts = [];
300
- for (const v of values || []) {
301
- const text = extractTextFromValue(v.value, v.editorAlias);
302
- if (text) parts.push(text);
303
- }
304
- return parts.filter(Boolean).join(" ").replace(/\s+/g, " ").trim();
305
- }
306
- function extractHeadings(html) {
307
- const headings = [];
308
- const regex = /<h([1-6])[^>]*>(.*?)<\/h[1-6]>/gi;
309
- let match;
310
- while ((match = regex.exec(html)) !== null) {
311
- headings.push({ level: parseInt(match[1]), text: stripHtml(match[2]) });
312
- }
313
- return headings;
249
+ var DEFAULT_PROVIDER_ALIAS = "umbDocumentUrlProvider";
250
+ var URL_BATCH_CHUNK_SIZE = 40;
251
+ function describeChainError(errorResult) {
252
+ const problem = extractInnerProblemDetails(errorResult);
253
+ const title = typeof problem.title === "string" ? problem.title : void 0;
254
+ const detail = typeof problem.detail === "string" ? problem.detail : void 0;
255
+ return [title, detail].filter(Boolean).join(": ") || "unknown error";
314
256
  }
315
- function extractImages(html) {
316
- const images = [];
317
- const regex = /<img[^>]*>/gi;
318
- let match;
319
- while ((match = regex.exec(html)) !== null) {
320
- const srcMatch = match[0].match(/src="([^"]*)"/i);
321
- const altMatch = match[0].match(/alt="([^"]*)"/i);
322
- const src = srcMatch?.[1] ?? "";
323
- const alt = altMatch?.[1] ?? "";
324
- images.push({ src, alt, hasAlt: !!altMatch && alt.length > 0 });
257
+ function chunkIds(ids, size) {
258
+ const chunks = [];
259
+ for (let i = 0; i < ids.length; i += size) {
260
+ chunks.push(ids.slice(i, i + size));
325
261
  }
326
- return images;
262
+ return chunks;
327
263
  }
328
- var DEFAULT_PROVIDER_ALIAS = "umbDocumentUrlProvider";
329
264
  var cachedBaseUrl = null;
330
265
  var cachedMtimeMs = null;
331
266
  function readBaseUrlFromEnvFile(envPath) {
@@ -431,26 +366,131 @@ function flattenPublishedUrls(urls) {
431
366
  async function fetchPublishedUrls(id) {
432
367
  try {
433
368
  const result = await chainCms("get-document-urls", { id: [id] });
434
- if (!result.ok) return [];
369
+ if (!result.ok) {
370
+ console.warn(
371
+ `fetchPublishedUrls: get-document-urls failed for id ${id} \u2014 returning no published URLs: ${describeChainError(result.errorResult)}`
372
+ );
373
+ return [];
374
+ }
435
375
  return flattenPublishedUrls(result.data.items);
436
- } catch {
376
+ } catch (error) {
377
+ const message = error instanceof Error ? error.message : String(error);
378
+ console.warn(
379
+ `fetchPublishedUrls: unexpected error fetching published URLs for id ${id} \u2014 returning no published URLs: ${message}`
380
+ );
437
381
  return [];
438
382
  }
439
383
  }
440
384
  async function fetchPublishedUrlsBatch(ids) {
441
385
  const out = /* @__PURE__ */ new Map();
442
386
  if (ids.length === 0) return out;
443
- try {
444
- const result = await chainCms("get-document-urls", { id: ids });
445
- if (!result.ok) return out;
446
- for (const entry of result.data.items ?? []) {
447
- if (!entry?.id) continue;
448
- out.set(entry.id, flattenPublishedUrls([entry]));
387
+ for (const idChunk of chunkIds(ids, URL_BATCH_CHUNK_SIZE)) {
388
+ try {
389
+ const result = await chainCms("get-document-urls", { id: idChunk });
390
+ if (!result.ok) {
391
+ console.warn(
392
+ `fetchPublishedUrlsBatch: get-document-urls failed for a chunk of ${idChunk.length} ids \u2014 those ids will have no published URL: ${describeChainError(result.errorResult)}`
393
+ );
394
+ continue;
395
+ }
396
+ for (const entry of result.data.items ?? []) {
397
+ if (!entry?.id) continue;
398
+ out.set(entry.id, flattenPublishedUrls([entry]));
399
+ }
400
+ } catch (error) {
401
+ const message = error instanceof Error ? error.message : String(error);
402
+ console.warn(
403
+ `fetchPublishedUrlsBatch: unexpected error processing a chunk of ${idChunk.length} ids \u2014 those ids will have no published URL: ${message}`
404
+ );
449
405
  }
450
- } catch {
451
406
  }
452
407
  return out;
453
408
  }
409
+ async function fetchPrimaryPublishedUrl(id) {
410
+ const urls = await fetchPublishedUrls(id);
411
+ return urls[0] ?? "";
412
+ }
413
+ async function fetchPrimaryPublishedUrlsBatch(ids) {
414
+ const batch = await fetchPublishedUrlsBatch(ids);
415
+ const out = /* @__PURE__ */ new Map();
416
+ for (const id of ids) {
417
+ out.set(id, batch.get(id)?.[0] ?? "");
418
+ }
419
+ return out;
420
+ }
421
+
422
+ // src/umbraco-api/tools/helpers/tree-walker.ts
423
+ function buildChainedCursor(skip, take) {
424
+ return encodeCursor({ s: skip, t: take });
425
+ }
426
+ function stripHtml(html) {
427
+ return (html || "").replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();
428
+ }
429
+ function countWords(text) {
430
+ const stripped = stripHtml(text);
431
+ if (!stripped) return 0;
432
+ return stripped.split(/\s+/).filter(Boolean).length;
433
+ }
434
+ function extractTextFromBlockValues(innerValues) {
435
+ const parts = [];
436
+ for (const v of innerValues || []) {
437
+ const text = extractTextFromValue(v.value, v.editorAlias);
438
+ if (text) parts.push(text);
439
+ }
440
+ return parts.join(" ");
441
+ }
442
+ function extractTextFromValue(value, editorAlias) {
443
+ if (typeof value === "string") {
444
+ return stripHtml(value);
445
+ }
446
+ if (value && typeof value === "object" && typeof value.markup === "string") {
447
+ const markupText = stripHtml(value.markup);
448
+ const blockText = extractTextFromContentData(value.blocks?.contentData);
449
+ return [markupText, blockText].filter(Boolean).join(" ");
450
+ }
451
+ if (value && typeof value === "object" && Array.isArray(value.contentData)) {
452
+ return extractTextFromContentData(value.contentData);
453
+ }
454
+ return "";
455
+ }
456
+ function extractTextFromContentData(contentData) {
457
+ const parts = [];
458
+ for (const block of contentData || []) {
459
+ const blockText = extractTextFromBlockValues(block.values || []);
460
+ if (blockText) parts.push(blockText);
461
+ }
462
+ return parts.join(" ");
463
+ }
464
+ function extractTextContent(values) {
465
+ const parts = [];
466
+ for (const v of values || []) {
467
+ const text = extractTextFromValue(v.value, v.editorAlias);
468
+ if (text) parts.push(text);
469
+ }
470
+ return parts.filter(Boolean).join(" ").replace(/\s+/g, " ").trim();
471
+ }
472
+ function extractHeadings(html) {
473
+ const headings = [];
474
+ const regex = /<h([1-6])[^>]*>(.*?)<\/h[1-6]>/gi;
475
+ let match;
476
+ while ((match = regex.exec(html)) !== null) {
477
+ headings.push({ level: parseInt(match[1]), text: stripHtml(match[2]) });
478
+ }
479
+ return headings;
480
+ }
481
+ function extractImages(html) {
482
+ const images = [];
483
+ const regex = /<img[^>]*>/gi;
484
+ let match;
485
+ while ((match = regex.exec(html)) !== null) {
486
+ const srcMatch = match[0].match(/src="([^"]*)"/i);
487
+ const altMatch = match[0].match(/alt="([^"]*)"/i);
488
+ const src = srcMatch?.[1] ?? "";
489
+ const alt = altMatch?.[1] ?? "";
490
+ images.push({ src, alt, hasAlt: !!altMatch && alt.length > 0 });
491
+ }
492
+ return images;
493
+ }
454
494
 
455
495
  // src/umbraco-api/tools/content/get/search-content.ts
456
496
  var inputSchema = {
@@ -469,7 +509,7 @@ var outputSchema = z.object({
469
509
  });
470
510
  var tool = {
471
511
  name: "search-content",
472
- description: "Search for content pages by name or text. Returns a list of matching pages with their names and IDs. Use get-page with an ID from the results to retrieve full page content.",
512
+ description: "Search for content pages by name only \u2014 it does not match body text or other field values (tracked in #234). Returns a list of matching pages with their names and IDs. For body text, use list-children + get-page instead. Use get-page with an ID from the results to retrieve full page content.",
473
513
  inputSchema,
474
514
  outputSchema,
475
515
  slices: ["search"],
@@ -545,8 +585,10 @@ var tool2 = {
545
585
  })),
546
586
  variants: doc.variants ?? [],
547
587
  previewUrl: buildPreviewUrl(doc.id),
548
- // GetDocumentByIdOutput doesn't include `urls` — runtime field, not in the upstream Zod schema.
549
- publishedUrls: flattenPublishedUrls(doc.urls)
588
+ // Umbraco 18's get-document-by-id response no longer carries `urls` —
589
+ // published URLs now come only from the separate get-document-urls
590
+ // endpoint via fetchPublishedUrls.
591
+ publishedUrls: await fetchPublishedUrls(id)
550
592
  });
551
593
  }
552
594
  };
@@ -870,13 +912,13 @@ async function validateDocumentState(id, doc) {
870
912
  culture: v.culture ?? null,
871
913
  segment: v.segment ?? null
872
914
  }));
873
- const ancestorsResult = await chainCms("get-document-ancestors", { descendantId: id });
874
- const parent = ancestorsResult.ok ? (ancestorsResult.data.items ?? []).find((item) => item.id === id)?.parent ?? null : null;
915
+ const itemResult = await chainCms("get-item-document", { id: [id] });
916
+ const parent = itemResult.ok ? itemResult.data.items[0]?.parent ?? null : null;
875
917
  const result = await chainCms("validate-document", {
876
918
  id,
877
919
  documentType: { id: target.documentType.id },
878
920
  template: target.template ? { id: target.template.id } : null,
879
- parent,
921
+ parent: parent ? { id: parent.id } : null,
880
922
  values,
881
923
  variants
882
924
  });
@@ -1020,6 +1062,30 @@ function isBlockListOrGridValue(value) {
1020
1062
  function isRteWithBlocks(value) {
1021
1063
  return value !== null && typeof value === "object" && !Array.isArray(value) && typeof value.markup === "string" && value.blocks !== null && typeof value.blocks === "object" && Array.isArray(value.blocks?.contentData);
1022
1064
  }
1065
+
1066
+ // src/umbraco-api/tools/helpers/block-inspector.ts
1067
+ function blockPropertiesSchema(editTool) {
1068
+ return z.array(z.object({
1069
+ propertyAlias: z.string().describe("The property containing these blocks"),
1070
+ editorAlias: z.string().optional(),
1071
+ blocks: z.array(z.object({
1072
+ contentKey: z.string().describe(`The block's unique key \u2014 use this with ${editTool}`),
1073
+ contentTypeKey: z.string().describe("The block's element type ID"),
1074
+ settingsKey: z.string().optional().describe("The key of the block's settings entry. Absent when the block has no settings."),
1075
+ properties: z.array(z.object({
1076
+ alias: z.string(),
1077
+ value: z.any()
1078
+ }))
1079
+ }))
1080
+ }));
1081
+ }
1082
+ function extractBlocks(contentData) {
1083
+ return contentData.map((block) => ({
1084
+ contentKey: block?.key ?? "",
1085
+ contentTypeKey: block?.contentTypeKey ?? "",
1086
+ properties: Array.isArray(block?.values) ? block.values.map((v) => ({ alias: v?.alias ?? "", value: v?.value })) : []
1087
+ }));
1088
+ }
1023
1089
  function findSettingsKey(container, contentKey) {
1024
1090
  const layout = container?.layout;
1025
1091
  if (!layout || typeof layout !== "object") return void 0;
@@ -1046,92 +1112,133 @@ function searchLayout(entries, contentKey) {
1046
1112
  }
1047
1113
  return void 0;
1048
1114
  }
1049
-
1050
- // src/umbraco-api/tools/content/get/inspect-blocks.ts
1051
- var inputSchema6 = {
1052
- id: z.string().uuid().describe("The ID of the page to inspect"),
1053
- propertyAlias: z.string().optional().describe("Specific property alias to inspect. If omitted, all block-based properties are shown.")
1054
- };
1055
- var outputSchema6 = z.object({
1056
- id: z.string(),
1057
- name: z.string(),
1058
- previewUrl: previewUrlSchema,
1059
- blockProperties: z.array(z.object({
1060
- propertyAlias: z.string().describe("The document property containing these blocks"),
1061
- editorAlias: z.string().optional(),
1062
- blocks: z.array(z.object({
1063
- contentKey: z.string().describe("The block's unique key \u2014 use this with edit-block"),
1064
- contentTypeKey: z.string().describe("The block's element type ID"),
1065
- settingsKey: z.string().optional().describe("The key of the block's settings entry. Absent when the block has no settings."),
1066
- properties: z.array(z.object({
1067
- alias: z.string(),
1068
- value: z.any()
1069
- }))
1070
- }))
1071
- }))
1072
- });
1073
- function isBlockListOrGridValue2(value) {
1074
- return value !== null && typeof value === "object" && !Array.isArray(value) && Array.isArray(value.contentData);
1075
- }
1076
- function isRteWithBlocks2(value) {
1077
- return value !== null && typeof value === "object" && !Array.isArray(value) && typeof value.markup === "string" && value.blocks !== null && typeof value.blocks === "object" && Array.isArray(value.blocks?.contentData);
1078
- }
1079
- function extractBlocks(contentData, container) {
1080
- return contentData.map((block) => {
1081
- const contentKey = block.key ?? "";
1082
- const settingsKey = findSettingsKey(container, contentKey);
1115
+ function collectBlockProperties(values, propertyAlias) {
1116
+ const filtered = propertyAlias ? values.filter((v) => v.alias === propertyAlias) : values;
1117
+ return filtered.filter((v) => isBlockListOrGridValue(v.value) || isRteWithBlocks(v.value)).map((v) => {
1118
+ const value = v.value;
1119
+ const container = isRteWithBlocks(value) ? value.blocks : value;
1083
1120
  return {
1084
- contentKey,
1085
- contentTypeKey: block.contentTypeKey ?? "",
1086
- ...settingsKey ? { settingsKey } : {},
1087
- properties: Array.isArray(block.values) ? block.values.map((v) => ({ alias: v.alias ?? "", value: v.value })) : []
1121
+ propertyAlias: v.alias,
1122
+ editorAlias: isRteWithBlocks(value) ? "Umbraco.RichText" : v.editorAlias ?? void 0,
1123
+ blocks: withSettingsKeys(extractBlocks(container.contentData), container)
1088
1124
  };
1089
1125
  });
1090
1126
  }
1091
- var tool6 = {
1092
- name: "inspect-blocks",
1093
- description: "Inspect the block structure of a content page. Shows each block's type, unique key, and property values. Use this to understand how content is structured inside BlockList, BlockGrid, or Rich Text properties before using edit-block to make changes.",
1094
- inputSchema: inputSchema6,
1095
- outputSchema: outputSchema6,
1096
- slices: ["read"],
1097
- annotations: { readOnlyHint: true },
1098
- handler: async ({ id, propertyAlias }) => {
1099
- const result = await chainCms("get-document-by-id", { id });
1100
- if (!result.ok) return result.errorResult;
1101
- const doc = result.data;
1102
- const allValues = doc.values ?? [];
1103
- const filtered = propertyAlias ? allValues.filter((v) => v.alias === propertyAlias) : allValues;
1104
- const blockProperties = filtered.filter((v) => isBlockListOrGridValue2(v.value) || isRteWithBlocks2(v.value)).map((v) => {
1105
- const value = v.value;
1106
- if (isRteWithBlocks2(value)) {
1107
- return {
1108
- propertyAlias: v.alias,
1109
- editorAlias: "Umbraco.RichText",
1110
- blocks: extractBlocks(value.blocks.contentData, value.blocks)
1111
- };
1112
- }
1113
- return {
1114
- propertyAlias: v.alias,
1115
- editorAlias: v.editorAlias ?? void 0,
1116
- blocks: extractBlocks(value.contentData, value)
1117
- };
1118
- });
1119
- return createToolResult({
1120
- id: doc.id,
1121
- name: doc.variants?.[0]?.name ?? "Unknown",
1122
- previewUrl: buildPreviewUrl(doc.id),
1123
- blockProperties
1124
- });
1127
+ var MAX_ENRICHED_BLOCKS = 50;
1128
+ var MAX_BLOCK_WALK_DEPTH = 20;
1129
+ function enrichBlockNotFoundError(errorResult, values, options = {}) {
1130
+ const problem = extractInnerProblemDetails(errorResult);
1131
+ const availableBlocks = problem.availableBlocks;
1132
+ if (!Array.isArray(availableBlocks)) return errorResult;
1133
+ const { propertyAlias, note } = options;
1134
+ const filtered = propertyAlias ? values.filter((v) => v.alias === propertyAlias) : values;
1135
+ const typeByKey = /* @__PURE__ */ new Map();
1136
+ for (const v of filtered) {
1137
+ const container = isRteWithBlocks(v.value) ? v.value.blocks : v.value;
1138
+ if (isBlockListOrGridValue(container)) {
1139
+ collectBlockEntryTypes(container, typeByKey, 0);
1140
+ }
1125
1141
  }
1126
- };
1127
- var inspect_blocks_default = withStandardDecorators(tool6);
1128
- var inputSchema7 = {
1129
- id: z.string().uuid().describe("The ID of the page to find references for"),
1130
- take: z.number().optional().default(50).describe("Number of references to return (default 50)"),
1131
- skip: z.number().optional().default(0).describe("Number of references to skip for pagination")
1132
- };
1133
- var outputSchema7 = z.object({
1134
- total: z.number(),
1142
+ const truncated = availableBlocks.length > MAX_ENRICHED_BLOCKS;
1143
+ const limitedBlocks = truncated ? availableBlocks.slice(0, MAX_ENRICHED_BLOCKS) : availableBlocks;
1144
+ const enrichedBlocks = limitedBlocks.map(
1145
+ (b) => b && typeof b === "object" && typeof b.key === "string" ? { ...b, contentTypeKey: typeByKey.get(b.key) ?? null } : b
1146
+ );
1147
+ return createToolResultError({
1148
+ ...problem,
1149
+ availableBlocks: enrichedBlocks,
1150
+ ...truncated ? { availableBlocksNote: `Showing ${MAX_ENRICHED_BLOCKS} of ${availableBlocks.length} available blocks \u2014 use inspect-blocks for the full list.` } : {},
1151
+ ...note ? { note } : {}
1152
+ });
1153
+ }
1154
+ function collectBlockEntryTypes(container, into, depth) {
1155
+ if (depth > MAX_BLOCK_WALK_DEPTH) return;
1156
+ for (const list of [container.contentData, container.settingsData]) {
1157
+ if (!Array.isArray(list)) continue;
1158
+ for (const block of list) {
1159
+ if (!block || typeof block !== "object") continue;
1160
+ const key = block.key;
1161
+ const contentTypeKey = block.contentTypeKey;
1162
+ if (typeof key === "string" && typeof contentTypeKey === "string") into.set(key, contentTypeKey);
1163
+ const nestedValues = block.values;
1164
+ if (!Array.isArray(nestedValues)) continue;
1165
+ for (const nested of nestedValues) {
1166
+ const nestedRaw = nested?.value;
1167
+ const nestedContainer = isRteWithBlocks(nestedRaw) ? nestedRaw.blocks : nestedRaw;
1168
+ if (isBlockListOrGridValue(nestedContainer)) {
1169
+ collectBlockEntryTypes(nestedContainer, into, depth + 1);
1170
+ }
1171
+ }
1172
+ }
1173
+ }
1174
+ }
1175
+ function withSettingsKeys(blocks, container) {
1176
+ return blocks.map((block) => {
1177
+ const settingsKey = findSettingsKey(container, block.contentKey);
1178
+ return settingsKey ? { ...block, settingsKey } : block;
1179
+ });
1180
+ }
1181
+ var blockPropertyAliasSchema = z.string().regex(
1182
+ /^[A-Za-z_][A-Za-z0-9_]*$/,
1183
+ "Property alias must be a valid identifier (letters, digits, underscore; not starting with a digit)"
1184
+ );
1185
+ function classifyBlockUpdateResults(results, requestedCount, requestedAliases = [], expectedEntryCount = 1) {
1186
+ const list = results ?? [];
1187
+ const processedCount = list.reduce((sum, r) => sum + (r.updatedCount ?? 0) + (r.addedCount ?? 0), 0);
1188
+ const updatedEntryCount = list.filter((r) => (r.updatedCount ?? 0) + (r.addedCount ?? 0) > 0).length;
1189
+ const errors = list.flatMap((r) => r.errors ?? []);
1190
+ const warnings = list.flatMap((r) => r.warnings ?? []);
1191
+ const failureText = [...errors, ...warnings].join("; ");
1192
+ const unresolvedEntries = list.filter(
1193
+ (r) => (r.updatedCount ?? 0) + (r.addedCount ?? 0) === 0 && !r.errors?.length && !r.warnings?.length
1194
+ );
1195
+ const missingEntryCount = Math.max(0, expectedEntryCount - list.length);
1196
+ const unresolvedBlockCount = unresolvedEntries.length + missingEntryCount;
1197
+ const detail = [...errors, ...warnings, ...unresolvedEntries.map((r) => r.message).filter(Boolean)].join("; ") || list.map((r) => r.message).filter(Boolean).join("; ") || "no detail returned";
1198
+ const outcome = processedCount === 0 ? "failed" : processedCount < requestedCount ? "partial" : "clean";
1199
+ const failedFields = requestedAliases.filter((alias) => failureText.includes(`'${alias}'`));
1200
+ const savedFields = unresolvedBlockCount > 0 ? [] : requestedAliases.filter((alias) => !failedFields.includes(alias));
1201
+ return { outcome, processedCount, updatedEntryCount, detail, warnings, savedFields, failedFields, unresolvedBlockCount };
1202
+ }
1203
+
1204
+ // src/umbraco-api/tools/content/get/inspect-blocks.ts
1205
+ var inputSchema6 = {
1206
+ id: z.string().uuid().describe("The ID of the page to inspect"),
1207
+ propertyAlias: z.string().optional().describe("Specific property alias to inspect. If omitted, all block-based properties are shown.")
1208
+ };
1209
+ var outputSchema6 = z.object({
1210
+ id: z.string(),
1211
+ name: z.string(),
1212
+ previewUrl: previewUrlSchema,
1213
+ blockProperties: blockPropertiesSchema("edit-block")
1214
+ });
1215
+ var tool6 = {
1216
+ name: "inspect-blocks",
1217
+ description: "Inspect the block structure of a content page. Shows each block's type, unique key, and property values. Use this to understand how content is structured inside BlockList, BlockGrid, or Rich Text properties before using edit-block to make changes. Content pages only \u2014 for blocks on a Library element use inspect-element-blocks instead.",
1218
+ inputSchema: inputSchema6,
1219
+ outputSchema: outputSchema6,
1220
+ slices: ["read"],
1221
+ annotations: { readOnlyHint: true },
1222
+ handler: async ({ id, propertyAlias }) => {
1223
+ const result = await chainCms("get-document-by-id", { id });
1224
+ if (!result.ok) return result.errorResult;
1225
+ const doc = result.data;
1226
+ return createToolResult({
1227
+ id: doc.id,
1228
+ name: doc.variants?.[0]?.name ?? "Unknown",
1229
+ previewUrl: buildPreviewUrl(doc.id),
1230
+ blockProperties: collectBlockProperties(doc.values ?? [], propertyAlias)
1231
+ });
1232
+ }
1233
+ };
1234
+ var inspect_blocks_default = withStandardDecorators(tool6);
1235
+ var inputSchema7 = {
1236
+ id: z.string().uuid().describe("The ID of the page to find references for"),
1237
+ take: z.number().optional().default(50).describe("Number of references to return (default 50)"),
1238
+ skip: z.number().optional().default(0).describe("Number of references to skip for pagination")
1239
+ };
1240
+ var outputSchema7 = z.object({
1241
+ total: z.number(),
1135
1242
  items: z.array(z.object({
1136
1243
  id: z.string(),
1137
1244
  name: z.string(),
@@ -1448,7 +1555,8 @@ ${aliases.join("\n")}`
1448
1555
  const schemaResult = await chainCms("get-data-type-schema", { id: match.id });
1449
1556
  if (!schemaResult.ok) return schemaResult.errorResult;
1450
1557
  return createToolResult({
1451
- message: JSON.stringify(schemaResult.data, null, 2),
1558
+ message: `Value-shape template for ${editorAlias}:
1559
+ ${JSON.stringify(schemaResult.data, null, 2)}`,
1452
1560
  editorAlias
1453
1561
  });
1454
1562
  }
@@ -1595,7 +1703,7 @@ var outputSchema12 = z.object({
1595
1703
  });
1596
1704
  var tool12 = {
1597
1705
  name: "create-and-publish-page",
1598
- description: "Create a new content page and publish it \u2014 mirrors clicking 'Save and publish' (instead of 'Save') on the create screen in the Umbraco backoffice. This is a single atomic operation when the connected Umbraco instance supports it (17.6+); otherwise a two-call create-then-publish sequence is used. Call list-document-types first to find a valid documentTypeId. Use this as a starting point: pass `name`, `documentTypeId`, optional `parentId`, and at most a small number of simple initial values. Required-property validation runs at publish time, not create time: on the atomic path a validation failure leaves no page behind, but on the fallback path the draft can already have been created before publish fails, leaving an unpublished draft. Either way, check the response `message` before retrying \u2014 don't retry blindly, or you may pile up duplicate drafts. Use create-page followed by save-and-publish instead when you need to build up content across multiple calls before publishing.",
1706
+ description: "Create a new content page and publish it in one atomic operation \u2014 mirrors clicking 'Save and publish' (instead of 'Save') on the create screen in the Umbraco backoffice. Call list-document-types first to find a valid documentTypeId. Use this as a starting point: pass `name`, `documentTypeId`, optional `parentId`, and at most a small number of simple initial values. If the document type requires properties this doesn't set, or if the values fail validation, the whole operation fails and no page is created \u2014 use create-page followed by save-and-publish instead when you need to build up content across multiple calls before publishing.",
1599
1707
  inputSchema: inputSchema12,
1600
1708
  outputSchema: outputSchema12,
1601
1709
  slices: ["create", "publish"],
@@ -1603,42 +1711,14 @@ var tool12 = {
1603
1711
  handler: async ({ name, documentTypeId, parentId, values }) => {
1604
1712
  const resolved = await resolveEditorAliases(documentTypeId, values);
1605
1713
  if (!resolved.ok) return resolved.errorResult;
1606
- if (await isCmsToolAvailable("create-and-publish-document")) {
1607
- const createResult = await chainCms("create-and-publish-document", {
1608
- documentTypeId,
1609
- name,
1610
- values: resolved.values,
1611
- ...parentId ? { parentId } : {}
1612
- });
1613
- if (!createResult.ok) return createResult.errorResult;
1614
- const createdId2 = createResult.data.id;
1615
- return createToolResult({
1616
- message: `Created and published "${name}"`,
1617
- id: createdId2,
1618
- name,
1619
- publishedUrls: createdId2 ? await fetchPublishedUrls(createdId2) : []
1620
- });
1621
- }
1622
- const createDocumentResult = await chainCms("create-document", {
1714
+ const createResult = await chainCms("create-and-publish-document", {
1623
1715
  documentTypeId,
1624
1716
  name,
1625
1717
  values: resolved.values,
1626
1718
  ...parentId ? { parentId } : {}
1627
1719
  });
1628
- if (!createDocumentResult.ok) return createDocumentResult.errorResult;
1629
- const createdId = createDocumentResult.data.id;
1630
- const publishResult = await chainCms("publish-document", {
1631
- id: createdId,
1632
- data: { publishSchedules: [{ culture: null }] }
1633
- });
1634
- if (!publishResult.ok) {
1635
- return createToolResult({
1636
- message: `Created "${name}" as a draft but publish failed: ${publishResult.errorResult.content?.[0]?.text ?? "unknown error"}`,
1637
- id: createdId,
1638
- name,
1639
- publishedUrls: []
1640
- });
1641
- }
1720
+ if (!createResult.ok) return createResult.errorResult;
1721
+ const createdId = createResult.data.id;
1642
1722
  return createToolResult({
1643
1723
  message: `Created and published "${name}"`,
1644
1724
  id: createdId,
@@ -1976,78 +2056,6 @@ var tool17 = {
1976
2056
  }
1977
2057
  };
1978
2058
  var edit_page_default = withStandardDecorators(tool17);
1979
- var MAX_ENRICHED_BLOCKS = 50;
1980
- var MAX_BLOCK_WALK_DEPTH = 20;
1981
- function enrichBlockNotFoundError(errorResult, values, options = {}) {
1982
- const problem = extractInnerProblemDetails(errorResult);
1983
- const availableBlocks = problem.availableBlocks;
1984
- if (!Array.isArray(availableBlocks)) return errorResult;
1985
- const { propertyAlias, note } = options;
1986
- const filtered = propertyAlias ? values.filter((v) => v.alias === propertyAlias) : values;
1987
- const typeByKey = /* @__PURE__ */ new Map();
1988
- for (const v of filtered) {
1989
- const container = isRteWithBlocks(v.value) ? v.value.blocks : v.value;
1990
- if (isBlockListOrGridValue(container)) {
1991
- collectBlockEntryTypes(container, typeByKey, 0);
1992
- }
1993
- }
1994
- const truncated = availableBlocks.length > MAX_ENRICHED_BLOCKS;
1995
- const limitedBlocks = truncated ? availableBlocks.slice(0, MAX_ENRICHED_BLOCKS) : availableBlocks;
1996
- const enrichedBlocks = limitedBlocks.map(
1997
- (b) => b && typeof b === "object" && typeof b.key === "string" ? { ...b, contentTypeKey: typeByKey.get(b.key) ?? null } : b
1998
- );
1999
- return createToolResultError({
2000
- ...problem,
2001
- availableBlocks: enrichedBlocks,
2002
- ...truncated ? { availableBlocksNote: `Showing ${MAX_ENRICHED_BLOCKS} of ${availableBlocks.length} available blocks \u2014 use inspect-blocks for the full list.` } : {},
2003
- ...note ? { note } : {}
2004
- });
2005
- }
2006
- function collectBlockEntryTypes(container, into, depth) {
2007
- if (depth > MAX_BLOCK_WALK_DEPTH) return;
2008
- for (const list of [container.contentData, container.settingsData]) {
2009
- if (!Array.isArray(list)) continue;
2010
- for (const block of list) {
2011
- if (!block || typeof block !== "object") continue;
2012
- const key = block.key;
2013
- const contentTypeKey = block.contentTypeKey;
2014
- if (typeof key === "string" && typeof contentTypeKey === "string") into.set(key, contentTypeKey);
2015
- const nestedValues = block.values;
2016
- if (!Array.isArray(nestedValues)) continue;
2017
- for (const nested of nestedValues) {
2018
- const nestedRaw = nested?.value;
2019
- const nestedContainer = isRteWithBlocks(nestedRaw) ? nestedRaw.blocks : nestedRaw;
2020
- if (isBlockListOrGridValue(nestedContainer)) {
2021
- collectBlockEntryTypes(nestedContainer, into, depth + 1);
2022
- }
2023
- }
2024
- }
2025
- }
2026
- }
2027
- var blockPropertyAliasSchema = z.string().regex(
2028
- /^[A-Za-z_][A-Za-z0-9_]*$/,
2029
- "Property alias must be a valid identifier (letters, digits, underscore; not starting with a digit)"
2030
- );
2031
- function classifyBlockUpdateResults(results, requestedCount, requestedAliases = [], expectedEntryCount = 1) {
2032
- const list = results ?? [];
2033
- const processedCount = list.reduce((sum, r) => sum + (r.updatedCount ?? 0) + (r.addedCount ?? 0), 0);
2034
- const updatedEntryCount = list.filter((r) => (r.updatedCount ?? 0) + (r.addedCount ?? 0) > 0).length;
2035
- const errors = list.flatMap((r) => r.errors ?? []);
2036
- const warnings = list.flatMap((r) => r.warnings ?? []);
2037
- const failureText = [...errors, ...warnings].join("; ");
2038
- const unresolvedEntries = list.filter(
2039
- (r) => (r.updatedCount ?? 0) + (r.addedCount ?? 0) === 0 && !r.errors?.length && !r.warnings?.length
2040
- );
2041
- const missingEntryCount = Math.max(0, expectedEntryCount - list.length);
2042
- const unresolvedBlockCount = unresolvedEntries.length + missingEntryCount;
2043
- const detail = [...errors, ...warnings, ...unresolvedEntries.map((r) => r.message).filter(Boolean)].join("; ") || list.map((r) => r.message).filter(Boolean).join("; ") || "no detail returned";
2044
- const outcome = processedCount === 0 ? "failed" : processedCount < requestedCount ? "partial" : "clean";
2045
- const failedFields = requestedAliases.filter((alias) => failureText.includes(`'${alias}'`));
2046
- const savedFields = unresolvedBlockCount > 0 ? [] : requestedAliases.filter((alias) => !failedFields.includes(alias));
2047
- return { outcome, processedCount, updatedEntryCount, detail, warnings, savedFields, failedFields, unresolvedBlockCount };
2048
- }
2049
-
2050
- // src/umbraco-api/tools/content/put/edit-block.ts
2051
2059
  var inputSchema18 = {
2052
2060
  id: z.string().uuid().describe("The ID of the page containing the block"),
2053
2061
  propertyAlias: z.string().describe("The document property alias containing the blocks (e.g. 'mainContent'). Use inspect-blocks to find this."),
@@ -2072,7 +2080,7 @@ var outputSchema18 = z.object({
2072
2080
  });
2073
2081
  var tool18 = {
2074
2082
  name: "edit-block",
2075
- description: "Update properties within a specific block (BlockList, BlockGrid, or Rich Text block). Use inspect-blocks first to find the propertyAlias and contentKey. Pass blockType='settings' to edit a block's settings instead of its content. For non-block page properties, use edit-page instead. For structured property values inside the block (media pickers, content pickers, image cropper, slider, color, date, etc.) call get-property-value-template with the editor alias first to see the expected JSON shape. Culture/segment applies to the document property level \u2014 use separate calls for mixed-variant blocks. Changes are saved but NOT published. The response includes a `validation` field \u2014 if `validation.valid` is false the changes were saved but the parent page cannot be published until the listed errors are resolved.",
2083
+ description: "Update properties within a specific block (BlockList, BlockGrid, or Rich Text block). Use inspect-blocks first to find the propertyAlias and contentKey. Pass blockType='settings' to edit a block's settings instead of its content. For non-block page properties, use edit-page instead. Content pages only \u2014 for a block on a Library element use inspect-element-blocks then edit-element-block, not this tool. For structured property values inside the block (media pickers, content pickers, image cropper, slider, color, date, etc.) call get-property-value-template with the editor alias first to see the expected JSON shape. Culture/segment applies to the document property level \u2014 use separate calls for mixed-variant blocks. Changes are saved but NOT published. The response includes a `validation` field \u2014 if `validation.valid` is false the changes were saved but the parent page cannot be published until the listed errors are resolved.",
2076
2084
  inputSchema: inputSchema18,
2077
2085
  outputSchema: outputSchema18,
2078
2086
  slices: ["update"],
@@ -2184,7 +2192,8 @@ var tool19 = {
2184
2192
  const targetCulture = culture ?? null;
2185
2193
  const docResult = await chainCms("get-document-by-id", { id });
2186
2194
  if (!docResult.ok) return docResult.errorResult;
2187
- const variants = docResult.data.variants ?? [];
2195
+ const doc = docResult.data;
2196
+ const variants = doc.variants ?? [];
2188
2197
  const targetVariant = variants.find((v) => matchesCulture(v, targetCulture));
2189
2198
  if (!targetVariant) {
2190
2199
  if (targetCulture) {
@@ -2218,8 +2227,8 @@ var tool19 = {
2218
2227
  previewUrl: buildPreviewUrl(id)
2219
2228
  });
2220
2229
  }
2221
- const renameResult = await chainCms("update-document-name", { id, name, culture: targetCulture });
2222
- if (!renameResult.ok) return renameResult.errorResult;
2230
+ const updateResult = await chainCms("update-document-name", { id, name, culture: targetCulture });
2231
+ if (!updateResult.ok) return updateResult.errorResult;
2223
2232
  return createToolResult({
2224
2233
  message: `Renamed page${cultureLabel} from "${previousName}" to "${name}" (saved, not published)`,
2225
2234
  id,
@@ -2699,17 +2708,36 @@ var outputSchema27 = z.object({
2699
2708
  updatedFields: z.array(z.string()),
2700
2709
  publishedUrls: publishedUrlsSchema
2701
2710
  });
2702
- function mergeValues(existing, updates) {
2703
- const key = (v) => `${v.alias}::${v.culture ?? ""}::${v.segment ?? ""}`;
2704
- const merged = new Map(existing.map((v) => [key(v), { alias: v.alias, value: v.value, culture: v.culture ?? null, segment: v.segment ?? null }]));
2705
- for (const u of updates) {
2706
- merged.set(key(u), { alias: u.alias, value: u.value, culture: u.culture ?? null, segment: u.segment ?? null });
2711
+ function valueKey2(value) {
2712
+ return `${value.alias}|${value.culture ?? ""}|${value.segment ?? ""}`;
2713
+ }
2714
+ function normaliseValue(value) {
2715
+ return {
2716
+ alias: value.alias,
2717
+ value: value.value,
2718
+ culture: value.culture ?? null,
2719
+ segment: value.segment ?? null
2720
+ };
2721
+ }
2722
+ function mergeValues(current, incoming) {
2723
+ const merged = current.map(normaliseValue);
2724
+ const indexByKey = new Map(merged.map((value, index) => [valueKey2(value), index]));
2725
+ for (const value of incoming) {
2726
+ const next = normaliseValue(value);
2727
+ const key = valueKey2(next);
2728
+ const existingIndex = indexByKey.get(key);
2729
+ if (existingIndex !== void 0) {
2730
+ merged[existingIndex] = next;
2731
+ } else {
2732
+ indexByKey.set(key, merged.length);
2733
+ merged.push(next);
2734
+ }
2707
2735
  }
2708
- return [...merged.values()];
2736
+ return merged;
2709
2737
  }
2710
2738
  var tool27 = {
2711
2739
  name: "save-and-publish",
2712
- description: "Save property changes and publish a content page \u2014 mirrors the 'Save and publish' button in the Umbraco backoffice. If `values` is provided the changes are saved first; then the page is published. This is a single atomic operation when the connected Umbraco instance supports it (17.6+), otherwise a two-call save-then-publish sequence is used. Optionally publish descendants. Call get-page or get-document-type first to discover valid property aliases.",
2740
+ description: "Save property changes and publish a content page in one atomic operation \u2014 mirrors the 'Save and publish' button in the Umbraco backoffice. If `values` is provided the changes are saved and published in a single call; otherwise the current draft is published as-is. Optionally publish descendants. Call get-page or get-document-type first to discover valid property aliases.",
2713
2741
  inputSchema: inputSchema27,
2714
2742
  outputSchema: outputSchema27,
2715
2743
  slices: ["publish", "update"],
@@ -2720,6 +2748,7 @@ var tool27 = {
2720
2748
  const doc = docResult.data;
2721
2749
  const pageName = doc.variants?.[0]?.name ?? "Unknown";
2722
2750
  const fieldNames = (values ?? []).map((v) => v.alias);
2751
+ const hasValues = (values?.length ?? 0) > 0;
2723
2752
  if (includeDescendants) {
2724
2753
  if (!await requestApproval(extra, `Publish "${pageName}" and all its descendants?`)) {
2725
2754
  return createToolResult({
@@ -2734,9 +2763,9 @@ var tool27 = {
2734
2763
  }
2735
2764
  }
2736
2765
  const variantCultures = (doc.variants ?? []).length ? doc.variants.map((v) => v.culture ?? null) : [null];
2737
- const saved = !!(values && values.length > 0);
2738
2766
  if (includeDescendants) {
2739
- if (saved) {
2767
+ let saved = false;
2768
+ if (hasValues) {
2740
2769
  const properties = values.map((v) => ({
2741
2770
  alias: v.alias,
2742
2771
  value: v.value,
@@ -2745,6 +2774,7 @@ var tool27 = {
2745
2774
  }));
2746
2775
  const updateResult = await chainCms("update-document-properties", { id, properties });
2747
2776
  if (!updateResult.ok) return updateResult.errorResult;
2777
+ saved = true;
2748
2778
  }
2749
2779
  const publishResult = await chainCms("publish-document-with-descendants", {
2750
2780
  id,
@@ -2767,85 +2797,74 @@ var tool27 = {
2767
2797
  }
2768
2798
  return publishResult.errorResult;
2769
2799
  }
2770
- } else {
2771
- const mergedValues = mergeValues(doc.values ?? [], values ?? []);
2772
- const variants = (doc.variants ?? []).map((v) => ({
2773
- culture: v.culture ?? null,
2774
- segment: v.segment ?? null,
2775
- name: v.name
2776
- }));
2777
- if (await isCmsToolAvailable("update-and-publish-document")) {
2778
- const updateAndPublishResult = await chainCms("update-and-publish-document", {
2779
- id,
2780
- data: {
2781
- values: mergedValues,
2782
- variants,
2783
- template: doc.template ?? null,
2784
- culturesToPublish: variantCultures.filter((c) => c !== null)
2785
- }
2786
- });
2787
- if (!updateAndPublishResult.ok) return updateAndPublishResult.errorResult;
2788
- } else {
2789
- const updateResult = await chainCms("update-document", {
2790
- id,
2791
- data: {
2792
- values: mergedValues,
2793
- variants,
2794
- template: doc.template ?? null
2795
- }
2796
- });
2797
- if (!updateResult.ok) return updateResult.errorResult;
2798
- const publishResult = await chainCms("publish-document", {
2799
- id,
2800
- data: {
2801
- publishSchedules: variantCultures.map((c) => ({ culture: c }))
2802
- }
2803
- });
2804
- if (!publishResult.ok) {
2805
- if (saved) {
2806
- return createToolResult({
2807
- message: `Saved ${fieldNames.length} field(s) on "${pageName}" but publish failed: ${publishResult.errorResult.content?.[0]?.text ?? "unknown error"}`,
2808
- id,
2809
- name: pageName,
2810
- saved: true,
2811
- published: false,
2812
- updatedFields: fieldNames,
2813
- publishedUrls: []
2814
- });
2815
- }
2816
- return publishResult.errorResult;
2817
- }
2818
- }
2800
+ const savedPart2 = saved ? `Saved ${fieldNames.length} field(s) and ` : "";
2801
+ return createToolResult({
2802
+ message: `${savedPart2}published "${pageName}" and all descendants`,
2803
+ id,
2804
+ name: pageName,
2805
+ saved,
2806
+ published: true,
2807
+ updatedFields: fieldNames,
2808
+ publishedUrls: await fetchPublishedUrls(id)
2809
+ });
2819
2810
  }
2820
- if (!includeDescendants) {
2821
- const verifyError = await verifyDocumentPublished(id, variantCultures);
2822
- if (verifyError) {
2823
- if (saved) {
2824
- return createToolResult({
2825
- message: `Saved ${fieldNames.length} field(s) on "${pageName}" but publish did not take effect: ${verifyError}`,
2826
- id,
2827
- name: pageName,
2828
- saved: true,
2829
- published: false,
2830
- updatedFields: fieldNames,
2831
- publishedUrls: []
2832
- });
2811
+ if (hasValues) {
2812
+ const updateAndPublishResult = await chainCms("update-and-publish-document", {
2813
+ id,
2814
+ data: {
2815
+ culturesToPublish: [...new Set(variantCultures.filter((c) => c !== null))],
2816
+ template: doc.template ?? null,
2817
+ values: mergeValues(doc.values ?? [], values),
2818
+ variants: (doc.variants ?? []).map((v) => ({
2819
+ culture: v.culture ?? null,
2820
+ segment: v.segment ?? null,
2821
+ name: v.name
2822
+ }))
2833
2823
  }
2824
+ });
2825
+ if (!updateAndPublishResult.ok) {
2826
+ const rolledBack = `No changes were saved to "${pageName}" \u2014 save-and-publish is a single atomic operation, so the field updates were rolled back along with the publish.`;
2827
+ const problem = extractInnerProblemDetails(updateAndPublishResult.errorResult);
2834
2828
  return createToolResultError({
2835
- status: 500,
2836
- title: "Publish did not take effect",
2837
- detail: `"${pageName}": ${verifyError}`
2829
+ ...problem,
2830
+ status: typeof problem?.status === "number" ? problem.status : 500,
2831
+ title: "Save and publish failed",
2832
+ detail: problem?.detail ? `${String(problem.detail)} ${rolledBack}` : rolledBack
2833
+ });
2834
+ }
2835
+ } else {
2836
+ const publishResult = await chainCms("publish-document", {
2837
+ id,
2838
+ data: { publishSchedules: variantCultures.map((c) => ({ culture: c })) }
2839
+ });
2840
+ if (!publishResult.ok) return publishResult.errorResult;
2841
+ }
2842
+ const verifyError = await verifyDocumentPublished(id, variantCultures);
2843
+ if (verifyError) {
2844
+ if (hasValues) {
2845
+ return createToolResult({
2846
+ message: `Saved ${fieldNames.length} field(s) on "${pageName}" but publish did not take effect: ${verifyError}`,
2847
+ id,
2848
+ name: pageName,
2849
+ saved: true,
2850
+ published: false,
2851
+ updatedFields: fieldNames,
2852
+ publishedUrls: []
2838
2853
  });
2839
2854
  }
2855
+ return createToolResultError({
2856
+ status: 500,
2857
+ title: "Publish did not take effect",
2858
+ detail: `"${pageName}": ${verifyError}`
2859
+ });
2840
2860
  }
2841
2861
  const publishedUrls = await fetchPublishedUrls(id);
2842
- const savedPart = saved ? `Saved ${fieldNames.length} field(s) and ` : "";
2843
- const descPart = includeDescendants ? " and all descendants" : "";
2862
+ const savedPart = hasValues ? `Saved ${fieldNames.length} field(s) and ` : "";
2844
2863
  return createToolResult({
2845
- message: `${savedPart}published "${pageName}"${descPart}`,
2864
+ message: `${savedPart}published "${pageName}"`,
2846
2865
  id,
2847
2866
  name: pageName,
2848
- saved,
2867
+ saved: hasValues,
2849
2868
  published: true,
2850
2869
  updatedFields: fieldNames,
2851
2870
  publishedUrls
@@ -3916,23 +3935,537 @@ var collection5 = {
3916
3935
  };
3917
3936
  var media_management_default = collection5;
3918
3937
  var inputSchema46 = {
3919
- parentId: z.string().uuid().optional().describe("The ID of a blueprint folder to list children of. If omitted, lists root-level blueprints."),
3920
- take: z.number().optional().default(50).describe("Number of results to return"),
3921
- skip: z.number().optional().default(0).describe("Number of results to skip")
3938
+ id: z.string().uuid().describe("The unique ID of the element to retrieve")
3922
3939
  };
3923
3940
  var outputSchema46 = z.object({
3924
- items: z.array(z.object({
3925
- id: z.string(),
3926
- name: z.string(),
3927
- documentType: z.string().optional().describe("The document type alias or name this blueprint is based on")
3928
- })).describe("Available page blueprints"),
3929
- total: z.number()
3930
- });
3941
+ id: z.string(),
3942
+ name: z.string(),
3943
+ elementType: z.object({ id: z.string() }).describe("The element type (document type) this element is based on"),
3944
+ values: z.array(z.object({ alias: z.string(), value: z.any() }).passthrough()).describe("Property field values"),
3945
+ variants: z.array(z.object({ name: z.string() }).passthrough()).describe("Language/culture variants")
3946
+ });
3931
3947
  var tool46 = {
3948
+ name: "get-element",
3949
+ description: "Get the full details of a Library element \u2014 its element type, all property values, and culture variants. Elements are the document-like reusable content items that live in the Library section. Use this after search-elements or list-element-children to see what an element contains, and before edit-element to discover valid property aliases.",
3950
+ inputSchema: inputSchema46,
3951
+ outputSchema: outputSchema46,
3952
+ slices: ["read"],
3953
+ annotations: { readOnlyHint: true },
3954
+ handler: async ({ id }) => {
3955
+ const result = await chainCms("get-element-by-id", { id });
3956
+ if (!result.ok) return result.errorResult;
3957
+ const el = result.data;
3958
+ return createToolResult({
3959
+ id: el.id,
3960
+ name: el.variants?.[0]?.name ?? "Unknown",
3961
+ elementType: { id: el.documentType?.id ?? el.elementType?.id ?? "" },
3962
+ values: el.values ?? [],
3963
+ variants: el.variants ?? []
3964
+ });
3965
+ }
3966
+ };
3967
+ var get_element_default = withStandardDecorators(tool46);
3968
+ var inputSchema47 = {
3969
+ parentId: z.string().uuid().optional().describe("Parent folder ID in the Library. Omit to list the root of the Library (top-level folders and elements)."),
3970
+ take: z.number().optional().default(20).describe("Number of results to return"),
3971
+ skip: z.number().optional().default(0).describe("Number of results to skip")
3972
+ };
3973
+ var outputSchema47 = z.object({
3974
+ items: z.array(z.object({
3975
+ id: z.string(),
3976
+ name: z.string(),
3977
+ isFolder: z.boolean().describe("True if this node is a folder that organises elements, false if it is an element item"),
3978
+ hasChildren: z.boolean()
3979
+ })).describe("Child folders and elements"),
3980
+ total: z.number().describe("Total number of children")
3981
+ });
3982
+ var tool47 = {
3983
+ name: "list-element-children",
3984
+ description: "Browse the Library tree \u2014 list the folders and elements under a folder, or the Library root when no parentId is given. Elements are the document-like reusable content items in the Library section (Umbraco 18). Use this to navigate the Library, then get-element to see an element's details.",
3985
+ inputSchema: inputSchema47,
3986
+ outputSchema: outputSchema47,
3987
+ slices: ["tree"],
3988
+ annotations: { readOnlyHint: true },
3989
+ handler: async ({ parentId, take, skip }) => {
3990
+ const cursor = buildChainedCursor(skip, take);
3991
+ const result = parentId ? await chainCms("get-element-children", { parentId, cursor }) : await chainCms("get-element-root", { cursor });
3992
+ if (!result.ok) return result.errorResult;
3993
+ const data = result.data;
3994
+ const items = data.items ?? [];
3995
+ return createToolResult({
3996
+ items: items.map((item) => ({
3997
+ id: item.id,
3998
+ name: item.variants?.[0]?.name ?? item.name ?? "Unknown",
3999
+ isFolder: item.isFolder ?? false,
4000
+ hasChildren: item.hasChildren ?? false
4001
+ })),
4002
+ total: data.total ?? items.length
4003
+ });
4004
+ }
4005
+ };
4006
+ var list_element_children_default = withStandardDecorators(tool47);
4007
+ var inputSchema48 = {
4008
+ query: z.string().describe("Search term to find Library elements by name"),
4009
+ take: z.number().optional().default(10).describe("Number of results to return (default 10)"),
4010
+ skip: z.number().optional().default(0).describe("Number of results to skip for pagination")
4011
+ };
4012
+ var outputSchema48 = z.object({
4013
+ items: z.array(z.object({
4014
+ id: z.string(),
4015
+ name: z.string()
4016
+ })).describe("Matching Library elements"),
4017
+ total: z.number().describe("Total number of matches")
4018
+ });
4019
+ var tool48 = {
4020
+ name: "search-elements",
4021
+ description: "Search for Library elements by name. Returns matching elements with their names and IDs. Use get-element with an ID from the results to retrieve an element's full details. Elements are the document-like reusable content items in the Library section (Umbraco 18).",
4022
+ inputSchema: inputSchema48,
4023
+ outputSchema: outputSchema48,
4024
+ slices: ["search"],
4025
+ annotations: { readOnlyHint: true },
4026
+ handler: async ({ query, take, skip }) => {
4027
+ const result = await chainCms("search-element", { query, cursor: buildChainedCursor(skip, take) });
4028
+ if (!result.ok) return result.errorResult;
4029
+ const data = result.data;
4030
+ const items = data.items ?? [];
4031
+ return createToolResult({
4032
+ items: items.map((item) => ({
4033
+ id: item.id,
4034
+ name: item.variants?.[0]?.name ?? item.name ?? "Unknown"
4035
+ })),
4036
+ total: data.total ?? items.length
4037
+ });
4038
+ }
4039
+ };
4040
+ var search_elements_default = withStandardDecorators(tool48);
4041
+ var inputSchema49 = {
4042
+ id: z.string().uuid().describe("The ID of the Library element to inspect"),
4043
+ propertyAlias: z.string().optional().describe("Specific property alias to inspect. If omitted, all block-based properties are shown.")
4044
+ };
4045
+ var outputSchema49 = z.object({
4046
+ id: z.string(),
4047
+ name: z.string(),
4048
+ blockProperties: blockPropertiesSchema("edit-element-block")
4049
+ });
4050
+ var tool49 = {
4051
+ name: "inspect-element-blocks",
4052
+ description: "Inspect the block structure of a Library element. Shows each block's type, unique key, and property values inside the element's BlockList, BlockGrid, or Rich Text properties. Use this to find the propertyAlias and contentKey that edit-element-block needs. Library elements only \u2014 for blocks on a content page use inspect-blocks instead. Elements are the document-like reusable content items in the Library section (Umbraco 18).",
4053
+ inputSchema: inputSchema49,
4054
+ outputSchema: outputSchema49,
4055
+ slices: ["read"],
4056
+ annotations: { readOnlyHint: true },
4057
+ handler: async ({ id, propertyAlias }) => {
4058
+ const result = await chainCms("get-element-by-id", { id });
4059
+ if (!result.ok) return result.errorResult;
4060
+ const element = result.data;
4061
+ return createToolResult({
4062
+ id: element.id,
4063
+ name: element.variants?.[0]?.name ?? "Unknown",
4064
+ blockProperties: collectBlockProperties(element.values ?? [], propertyAlias)
4065
+ });
4066
+ }
4067
+ };
4068
+ var inspect_element_blocks_default = withStandardDecorators(tool49);
4069
+ var inputSchema50 = {
4070
+ name: z.string().describe("The name of the element to create"),
4071
+ elementTypeId: z.string().uuid().describe("The ID of the element type (document type) to use. Elements are created from element types \u2014 find valid IDs from an existing element (get-element) or the element configuration."),
4072
+ parentId: z.string().uuid().optional().describe("The ID of the parent folder in the Library. Elements live inside folders; omit only if creating at a location that allows root items."),
4073
+ values: z.array(z.object({
4074
+ alias: z.string().describe("The property alias"),
4075
+ value: z.any().describe("The property value"),
4076
+ culture: z.string().nullable().optional().describe("The culture code for variant content"),
4077
+ segment: z.string().nullable().optional().describe("The segment for segmented content")
4078
+ })).optional().describe("Initial property values to set on the new element")
4079
+ };
4080
+ var outputSchema50 = z.object({
4081
+ message: z.string(),
4082
+ id: z.string(),
4083
+ name: z.string()
4084
+ });
4085
+ var tool50 = {
4086
+ name: "create-element",
4087
+ description: "Create a new Library element as a draft \u2014 it is NOT published automatically. Elements are the document-like reusable content items in the Library section. Pass `name`, `elementTypeId`, an optional parent folder `parentId`, and at most a few simple initial values. For everything else, follow up after creation with edit-element for property updates. Publish separately with publish-element.",
4088
+ inputSchema: inputSchema50,
4089
+ outputSchema: outputSchema50,
4090
+ slices: ["create"],
4091
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
4092
+ handler: async ({ name, elementTypeId, parentId, values }) => {
4093
+ const resolved = await resolveEditorAliases(elementTypeId, values);
4094
+ if (!resolved.ok) return resolved.errorResult;
4095
+ const createResult = await chainCms("create-element", {
4096
+ documentTypeId: elementTypeId,
4097
+ name,
4098
+ values: resolved.values,
4099
+ ...parentId ? { parentId } : {}
4100
+ });
4101
+ if (!createResult.ok) return createResult.errorResult;
4102
+ return createToolResult({
4103
+ message: `Created draft element "${name}"`,
4104
+ id: createResult.data.id ?? "",
4105
+ name
4106
+ });
4107
+ }
4108
+ };
4109
+ var create_element_default = withStandardDecorators(tool50);
4110
+ var inputSchema51 = {
4111
+ name: z.string().describe("The name of the element to create"),
4112
+ elementTypeId: z.string().uuid().describe("The ID of the element type (document type) to use. Elements are created from element types \u2014 find valid IDs from an existing element (get-element) or the element configuration."),
4113
+ parentId: z.string().uuid().optional().describe("The ID of the parent folder in the Library. Elements live inside folders; omit only if creating at a location that allows root items."),
4114
+ values: z.array(z.object({
4115
+ alias: z.string().describe("The property alias"),
4116
+ value: z.any().describe("The property value"),
4117
+ culture: z.string().nullable().optional().describe("The culture code for variant content"),
4118
+ segment: z.string().nullable().optional().describe("The segment for segmented content")
4119
+ })).optional().describe("Initial property values to set on the new element")
4120
+ };
4121
+ var outputSchema51 = z.object({
4122
+ message: z.string(),
4123
+ id: z.string(),
4124
+ name: z.string()
4125
+ });
4126
+ var tool51 = {
4127
+ name: "create-and-publish-element",
4128
+ description: "Create a new Library element and publish it in one atomic operation \u2014 mirrors clicking 'Save and publish' (instead of 'Save') on the element create screen. Elements are the document-like reusable content items in the Library section. Pass `name`, `elementTypeId`, an optional parent folder `parentId`, and at most a few simple initial values. If the element type requires properties this doesn't set, or if the values fail validation, the whole operation fails and no element is created \u2014 use create-element followed by publish-element instead when you need to build up content across multiple calls before publishing.",
4129
+ inputSchema: inputSchema51,
4130
+ outputSchema: outputSchema51,
4131
+ slices: ["create", "publish"],
4132
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
4133
+ handler: async ({ name, elementTypeId, parentId, values }) => {
4134
+ const createResult = await chainCms("create-and-publish-element", {
4135
+ documentTypeId: elementTypeId,
4136
+ name,
4137
+ values: (values ?? []).map((v) => ({
4138
+ alias: v.alias,
4139
+ value: v.value,
4140
+ culture: v.culture ?? null,
4141
+ segment: v.segment ?? null
4142
+ })),
4143
+ ...parentId ? { parentId } : {}
4144
+ });
4145
+ if (!createResult.ok) return createResult.errorResult;
4146
+ return createToolResult({
4147
+ message: `Created and published element "${name}"`,
4148
+ id: createResult.data.id ?? "",
4149
+ name
4150
+ });
4151
+ }
4152
+ };
4153
+ var create_and_publish_element_default = withStandardDecorators(tool51);
4154
+ var inputSchema52 = {
4155
+ name: z.string().describe("Name of the new folder"),
4156
+ parentId: z.string().uuid().optional().describe("ID of the parent folder in the Library (omit to create at the root)")
4157
+ };
4158
+ var outputSchema52 = z.object({
4159
+ message: z.string(),
4160
+ id: z.string(),
4161
+ name: z.string()
4162
+ });
4163
+ var tool52 = {
4164
+ name: "create-element-folder",
4165
+ description: "Create a folder in the Library to organise elements (Umbraco 18 Library section). Folders are the primary way the Library tree is structured; the returned ID can be used as parentId in list-element-children or create-element.",
4166
+ inputSchema: inputSchema52,
4167
+ outputSchema: outputSchema52,
4168
+ slices: ["create"],
4169
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
4170
+ handler: async ({ name, parentId }) => {
4171
+ const createResult = await chainCms("create-element-folder", { name, parent: parentId ? { id: parentId } : null });
4172
+ if (!createResult.ok) return createResult.errorResult;
4173
+ let createdId = createResult.data?.id ?? "";
4174
+ let location = "at the root";
4175
+ if (!createdId) {
4176
+ const listResult = parentId ? await chainCms("get-element-children", { parentId }) : await chainCms("get-element-root", {});
4177
+ if (listResult.ok) {
4178
+ const match = (listResult.data.items ?? []).filter((i) => i.isFolder).find((i) => (i.variants?.[0]?.name ?? i.name) === name);
4179
+ if (match) createdId = match.id;
4180
+ }
4181
+ }
4182
+ if (parentId) {
4183
+ const folderResult = await chainCms("get-element-folder", { id: parentId });
4184
+ if (folderResult.ok) location = `under "${folderResult.data.name ?? "Unknown"}"`;
4185
+ }
4186
+ return createToolResult({
4187
+ message: `Created Library folder "${name}" ${location}`,
4188
+ id: createdId,
4189
+ name
4190
+ });
4191
+ }
4192
+ };
4193
+ var create_element_folder_default = withStandardDecorators(tool52);
4194
+ var inputSchema53 = {
4195
+ id: z.string().uuid().describe("The ID of the element to publish")
4196
+ };
4197
+ var outputSchema53 = z.object({
4198
+ message: z.string(),
4199
+ id: z.string(),
4200
+ name: z.string()
4201
+ });
4202
+ var tool53 = {
4203
+ name: "publish-element",
4204
+ description: "Publish a Library element to make its current draft live (mirrors the back office 'Save and publish' action). Edit the element first with edit-element if it needs changes. Use unpublish-element to take it back offline. NOTE: this publishes directly \u2014 if the site requires workflow approval, that must be handled separately.",
4205
+ inputSchema: inputSchema53,
4206
+ outputSchema: outputSchema53,
4207
+ slices: ["publish"],
4208
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
4209
+ handler: async ({ id }) => {
4210
+ const elResult = await chainCms("get-element-by-id", { id });
4211
+ if (!elResult.ok) return elResult.errorResult;
4212
+ const el = elResult.data;
4213
+ const elementName = el.variants?.[0]?.name ?? "Unknown";
4214
+ const variantCultures = (el.variants ?? []).length ? el.variants.map((v) => v.culture ?? null) : [null];
4215
+ const publishResult = await chainCms("publish-element", {
4216
+ id,
4217
+ data: { publishSchedules: variantCultures.map((c) => ({ culture: c })) }
4218
+ });
4219
+ if (!publishResult.ok) return publishResult.errorResult;
4220
+ return createToolResult({
4221
+ message: `Published element "${elementName}"`,
4222
+ id,
4223
+ name: elementName
4224
+ });
4225
+ }
4226
+ };
4227
+ var publish_element_default = withStandardDecorators(tool53);
4228
+ var inputSchema54 = {
4229
+ id: z.string().uuid().describe("The ID of the element to unpublish")
4230
+ };
4231
+ var outputSchema54 = z.object({
4232
+ message: z.string(),
4233
+ id: z.string(),
4234
+ name: z.string()
4235
+ });
4236
+ var tool54 = {
4237
+ name: "unpublish-element",
4238
+ description: "Unpublish a Library element, taking it offline. The element still exists as a draft. You will be asked to confirm before unpublishing.",
4239
+ inputSchema: inputSchema54,
4240
+ outputSchema: outputSchema54,
4241
+ slices: ["publish"],
4242
+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
4243
+ handler: async ({ id }, extra) => {
4244
+ const elResult = await chainCms("get-element-by-id", { id });
4245
+ if (!elResult.ok) return elResult.errorResult;
4246
+ const el = elResult.data;
4247
+ const elementName = el.variants?.[0]?.name ?? "Unknown";
4248
+ if (!await requestApproval(extra, `Unpublish element "${elementName}"? This will take it offline.`)) {
4249
+ return createToolResult({ message: "Unpublish cancelled", id, name: elementName });
4250
+ }
4251
+ const cultures = (el.variants ?? []).filter((v) => v.culture).map((v) => v.culture);
4252
+ const result = await chainCms("unpublish-element", {
4253
+ id,
4254
+ data: { cultures: cultures.length > 0 ? cultures : null }
4255
+ });
4256
+ if (!result.ok) return result.errorResult;
4257
+ return createToolResult({ message: `Unpublished element "${elementName}" \u2014 it is now a draft only`, id, name: elementName });
4258
+ }
4259
+ };
4260
+ var unpublish_element_default = withStandardDecorators(tool54);
4261
+ var inputSchema55 = {
4262
+ id: z.string().uuid().describe("The ID of the element to edit"),
4263
+ values: z.array(z.object({
4264
+ alias: z.string().describe("The property alias"),
4265
+ value: z.any().describe("The new property value"),
4266
+ culture: z.string().nullable().optional().describe("The culture code for variant content"),
4267
+ segment: z.string().nullable().optional().describe("The segment for segmented content")
4268
+ })).describe("Property values to update on the element")
4269
+ };
4270
+ var outputSchema55 = z.object({
4271
+ message: z.string(),
4272
+ id: z.string(),
4273
+ name: z.string(),
4274
+ updatedFields: z.array(z.string())
4275
+ });
4276
+ var tool55 = {
4277
+ name: "edit-element",
4278
+ description: "Update property values on a Library element. Changes are saved but NOT published \u2014 publish separately with publish-element. Call get-element first to discover valid property aliases. For structured non-block property values (media pickers, pickers, etc.) call get-property-value-template with the editor alias first to see the expected JSON shape. To change a property INSIDE a block on the element (BlockList, BlockGrid, or Rich Text block) use inspect-element-blocks then edit-element-block instead \u2014 passing a whole block value here would overwrite the property's entire block structure. Elements are the document-like reusable content items in the Library section (Umbraco 18).",
4279
+ inputSchema: inputSchema55,
4280
+ outputSchema: outputSchema55,
4281
+ slices: ["update"],
4282
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
4283
+ handler: async ({ id, values }) => {
4284
+ const elResult = await chainCms("get-element-by-id", { id });
4285
+ if (!elResult.ok) return elResult.errorResult;
4286
+ const elementName = elResult.data.variants?.[0]?.name ?? "Unknown";
4287
+ const fieldNames = values.map((v) => v.alias);
4288
+ const properties = values.map((v) => ({
4289
+ alias: v.alias,
4290
+ value: v.value,
4291
+ culture: v.culture ?? null,
4292
+ segment: v.segment ?? null
4293
+ }));
4294
+ const updateResult = await chainCms("update-element-properties", { id, properties });
4295
+ if (!updateResult.ok) return updateResult.errorResult;
4296
+ return createToolResult({
4297
+ message: `Updated ${fieldNames.length} field(s) on element "${elementName}" (saved, not published)`,
4298
+ id,
4299
+ name: elementName,
4300
+ updatedFields: fieldNames
4301
+ });
4302
+ }
4303
+ };
4304
+ var edit_element_default = withStandardDecorators(tool55);
4305
+ var inputSchema56 = {
4306
+ id: z.string().uuid().describe("The ID of the Library element containing the block"),
4307
+ propertyAlias: z.string().describe("The element property alias containing the blocks (e.g. 'mainContent'). Use inspect-element-blocks to find this."),
4308
+ contentKey: z.string().uuid().describe("The unique key of the block to edit \u2014 always the block's contentKey as reported by inspect-element-blocks, including when blockType is 'settings'."),
4309
+ values: z.array(z.object({
4310
+ alias: blockPropertyAliasSchema.describe("The property alias within the block"),
4311
+ value: z.any().describe("The new value for the property")
4312
+ })).min(1).describe("Properties to update within the block"),
4313
+ blockType: z.enum(["content", "settings"]).optional().describe("Whether to update the block's content or its settings. Defaults to 'content'."),
4314
+ culture: z.string().nullable().optional().describe("Culture code if the element property is variant"),
4315
+ segment: z.string().nullable().optional().describe("Segment if the element property is variant")
4316
+ };
4317
+ var outputSchema56 = z.object({
4318
+ message: z.string(),
4319
+ id: z.string(),
4320
+ name: z.string(),
4321
+ contentKey: z.string(),
4322
+ updatedFields: z.array(z.string()),
4323
+ warnings: z.array(z.string()).optional()
4324
+ });
4325
+ var tool56 = {
4326
+ name: "edit-element-block",
4327
+ description: "Update properties within a specific block (BlockList, BlockGrid, or Rich Text block) on a Library element. Use inspect-element-blocks first to find the propertyAlias and contentKey. Pass blockType='settings' to edit a block's settings instead of its content \u2014 still pass the block's contentKey, this tool resolves the settings entry itself. For non-block element properties use edit-element instead; for blocks on a content page use edit-block instead. For structured property values inside the block (media pickers, content pickers, image cropper, slider, color, date, etc.) call get-property-value-template with the editor alias first to see the expected JSON shape. Culture/segment applies to the element property level \u2014 use separate calls for mixed-variant blocks. Changes are saved but NOT published \u2014 publish separately with publish-element. Elements are the document-like reusable content items in the Library section (Umbraco 18).",
4328
+ inputSchema: inputSchema56,
4329
+ outputSchema: outputSchema56,
4330
+ slices: ["update"],
4331
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
4332
+ handler: async ({ id, propertyAlias, contentKey, values, blockType, culture, segment }) => {
4333
+ const elResult = await chainCms("get-element-by-id", { id });
4334
+ if (!elResult.ok) return elResult.errorResult;
4335
+ const elementName = elResult.data.variants?.[0]?.name ?? "Unknown";
4336
+ const fieldNames = values.map((v) => v.alias);
4337
+ const resolvedBlockType = blockType ?? "content";
4338
+ let targetKey = contentKey;
4339
+ if (resolvedBlockType === "settings") {
4340
+ const rawValue = (elResult.data.values ?? []).find(
4341
+ (v) => v.alias === propertyAlias && (v.culture ?? null) === (culture ?? null) && (v.segment ?? null) === (segment ?? null)
4342
+ )?.value;
4343
+ const container = isRteWithBlocks(rawValue) ? rawValue.blocks : rawValue;
4344
+ const settingsKey = findSettingsKey(container, contentKey);
4345
+ if (!settingsKey) {
4346
+ return createToolResultError(
4347
+ `Block ${contentKey} in property "${propertyAlias}" has no settings entry, so its settings cannot be edited. Use inspect-element-blocks to check for a settingsKey, or omit blockType to edit the block's content.`
4348
+ );
4349
+ }
4350
+ targetKey = settingsKey;
4351
+ }
4352
+ const propsTuple = values.map((v) => ({ alias: v.alias, value: v.value }));
4353
+ const updateResult = await chainCms("update-element-block-property", {
4354
+ elementId: id,
4355
+ propertyAlias,
4356
+ culture: culture ?? null,
4357
+ segment: segment ?? null,
4358
+ updates: [{
4359
+ contentKey: targetKey,
4360
+ blockType: resolvedBlockType,
4361
+ properties: propsTuple
4362
+ }]
4363
+ });
4364
+ if (!updateResult.ok) return updateResult.errorResult;
4365
+ const results = updateResult.data.results;
4366
+ if (!results || results.length === 0) {
4367
+ return createToolResultError(
4368
+ "update-element-block-property returned no per-block result \u2014 cannot confirm the write succeeded."
4369
+ );
4370
+ }
4371
+ const classification = classifyBlockUpdateResults(results, fieldNames.length, fieldNames, 1);
4372
+ if (classification.outcome === "failed") {
4373
+ return createToolResultError(
4374
+ `Block update failed: ${classification.detail || updateResult.data.message || "no detail returned"}`
4375
+ );
4376
+ }
4377
+ if (classification.outcome === "partial") {
4378
+ return createToolResultError({
4379
+ message: `Block update partially failed: ${classification.processedCount} of ${fieldNames.length} field(s) saved \u2014 ${classification.detail}`,
4380
+ savedFields: classification.savedFields,
4381
+ failedFields: classification.failedFields,
4382
+ ...classification.savedFields.length > 0 ? { note: "savedFields were written to the element and must not be retried." } : {},
4383
+ ...classification.warnings.length ? { warnings: classification.warnings } : {}
4384
+ });
4385
+ }
4386
+ const target = resolvedBlockType === "settings" ? "settings" : "content";
4387
+ const warnings = classification.warnings;
4388
+ return createToolResult({
4389
+ message: `Updated ${fieldNames.length} field(s) in block ${target} on element "${elementName}" (saved, not published)`,
4390
+ id,
4391
+ name: elementName,
4392
+ contentKey,
4393
+ updatedFields: fieldNames,
4394
+ ...warnings.length ? { warnings } : {}
4395
+ });
4396
+ }
4397
+ };
4398
+ var edit_element_block_default = withStandardDecorators(tool56);
4399
+ var inputSchema57 = {
4400
+ id: z.string().uuid().describe("The ID of the element to delete")
4401
+ };
4402
+ var outputSchema57 = z.object({
4403
+ message: z.string(),
4404
+ id: z.string(),
4405
+ name: z.string()
4406
+ });
4407
+ var tool57 = {
4408
+ name: "delete-element",
4409
+ description: "Move a Library element to the recycle bin. It can be restored later. You will be asked to confirm before deleting.",
4410
+ inputSchema: inputSchema57,
4411
+ outputSchema: outputSchema57,
4412
+ slices: ["delete"],
4413
+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
4414
+ handler: async ({ id }, extra) => {
4415
+ const elResult = await chainCms("get-element-by-id", { id });
4416
+ if (!elResult.ok) return elResult.errorResult;
4417
+ const elementName = elResult.data.variants?.[0]?.name ?? "Unknown";
4418
+ if (!await requestApproval(extra, `WARNING: Move element "${elementName}" to the recycle bin? This will remove it from the Library.`)) {
4419
+ return createToolResult({ message: "Delete cancelled", id, name: elementName });
4420
+ }
4421
+ const deleteResult = await chainCms("move-element-to-recycle-bin", { id });
4422
+ if (!deleteResult.ok) return deleteResult.errorResult;
4423
+ return createToolResult({ message: `Moved element "${elementName}" to the recycle bin`, id, name: elementName });
4424
+ }
4425
+ };
4426
+ var delete_element_default = withStandardDecorators(tool57);
4427
+
4428
+ // src/umbraco-api/tools/element/index.ts
4429
+ var collection6 = {
4430
+ metadata: {
4431
+ name: "element",
4432
+ displayName: "Library Elements",
4433
+ description: "Browse, view, edit (including blocks), publish, and organise reusable Library elements (Umbraco 18 Library section)"
4434
+ },
4435
+ tools: () => [
4436
+ get_element_default,
4437
+ list_element_children_default,
4438
+ search_elements_default,
4439
+ inspect_element_blocks_default,
4440
+ create_element_default,
4441
+ create_and_publish_element_default,
4442
+ create_element_folder_default,
4443
+ edit_element_default,
4444
+ edit_element_block_default,
4445
+ publish_element_default,
4446
+ unpublish_element_default,
4447
+ delete_element_default
4448
+ ]
4449
+ };
4450
+ var element_default = collection6;
4451
+ var inputSchema58 = {
4452
+ parentId: z.string().uuid().optional().describe("The ID of a blueprint folder to list children of. If omitted, lists root-level blueprints."),
4453
+ take: z.number().optional().default(50).describe("Number of results to return"),
4454
+ skip: z.number().optional().default(0).describe("Number of results to skip")
4455
+ };
4456
+ var outputSchema58 = z.object({
4457
+ items: z.array(z.object({
4458
+ id: z.string(),
4459
+ name: z.string(),
4460
+ documentType: z.string().optional().describe("The document type alias or name this blueprint is based on")
4461
+ })).describe("Available page blueprints"),
4462
+ total: z.number()
4463
+ });
4464
+ var tool58 = {
3932
4465
  name: "list-blueprints",
3933
4466
  description: "List available page blueprints (templates with pre-filled content). Use get-blueprint to view a blueprint's details and property values.",
3934
- inputSchema: inputSchema46,
3935
- outputSchema: outputSchema46,
4467
+ inputSchema: inputSchema58,
4468
+ outputSchema: outputSchema58,
3936
4469
  slices: ["list"],
3937
4470
  annotations: { readOnlyHint: true },
3938
4471
  handler: async ({ parentId, take, skip }) => {
@@ -3958,11 +4491,11 @@ var tool46 = {
3958
4491
  });
3959
4492
  }
3960
4493
  };
3961
- var list_blueprints_default = withStandardDecorators(tool46);
3962
- var inputSchema47 = {
4494
+ var list_blueprints_default = withStandardDecorators(tool58);
4495
+ var inputSchema59 = {
3963
4496
  id: z.string().uuid().describe("The ID of the blueprint to retrieve")
3964
4497
  };
3965
- var outputSchema47 = z.object({
4498
+ var outputSchema59 = z.object({
3966
4499
  id: z.string(),
3967
4500
  name: z.string(),
3968
4501
  documentType: z.object({
@@ -3982,11 +4515,11 @@ var outputSchema47 = z.object({
3982
4515
  segment: z.string().nullable().optional()
3983
4516
  })).optional().describe("Variant information")
3984
4517
  });
3985
- var tool47 = {
4518
+ var tool59 = {
3986
4519
  name: "get-blueprint",
3987
4520
  description: "Get the full details of a page blueprint including its pre-filled property values. Blueprints are page templates that provide default content when creating new pages.",
3988
- inputSchema: inputSchema47,
3989
- outputSchema: outputSchema47,
4521
+ inputSchema: inputSchema59,
4522
+ outputSchema: outputSchema59,
3990
4523
  slices: ["read"],
3991
4524
  annotations: { readOnlyHint: true },
3992
4525
  handler: async ({ id }) => {
@@ -4009,21 +4542,21 @@ var tool47 = {
4009
4542
  });
4010
4543
  }
4011
4544
  };
4012
- var get_blueprint_default = withStandardDecorators(tool47);
4013
- var inputSchema48 = {
4545
+ var get_blueprint_default = withStandardDecorators(tool59);
4546
+ var inputSchema60 = {
4014
4547
  pageId: z.string().uuid().describe("The ID of the source page to save as a blueprint"),
4015
4548
  name: z.string().describe("The name for the new blueprint")
4016
4549
  };
4017
- var outputSchema48 = z.object({
4550
+ var outputSchema60 = z.object({
4018
4551
  message: z.string(),
4019
4552
  id: z.string(),
4020
4553
  name: z.string()
4021
4554
  });
4022
- var tool48 = {
4555
+ var tool60 = {
4023
4556
  name: "create-blueprint",
4024
4557
  description: "Save an existing page as a reusable blueprint (template). The blueprint preserves the page's document type and property values.",
4025
- inputSchema: inputSchema48,
4026
- outputSchema: outputSchema48,
4558
+ inputSchema: inputSchema60,
4559
+ outputSchema: outputSchema60,
4027
4560
  slices: ["create"],
4028
4561
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
4029
4562
  handler: async ({ pageId, name }) => {
@@ -4055,10 +4588,10 @@ var tool48 = {
4055
4588
  });
4056
4589
  }
4057
4590
  };
4058
- var create_blueprint_default = withStandardDecorators(tool48);
4591
+ var create_blueprint_default = withStandardDecorators(tool60);
4059
4592
 
4060
4593
  // src/umbraco-api/tools/blueprint/index.ts
4061
- var collection6 = {
4594
+ var collection7 = {
4062
4595
  metadata: {
4063
4596
  name: "blueprint",
4064
4597
  displayName: "Blueprints",
@@ -4066,7 +4599,197 @@ var collection6 = {
4066
4599
  },
4067
4600
  tools: () => [list_blueprints_default, get_blueprint_default, create_blueprint_default]
4068
4601
  };
4069
- var blueprint_default = collection6;
4602
+ var blueprint_default = collection7;
4603
+ var inputSchema61 = {
4604
+ take: z.number().optional().default(50).describe("Number of results to return (default 50)"),
4605
+ skip: z.number().optional().default(0).describe("Number of results to skip for pagination")
4606
+ };
4607
+ var outputSchema61 = z.object({
4608
+ items: z.array(z.object({
4609
+ isoCode: z.string().describe("ISO language code (e.g. en-US)"),
4610
+ name: z.string().describe("Display name of the language"),
4611
+ isDefault: z.boolean().describe("Whether this is the default language"),
4612
+ isMandatory: z.boolean().describe("Whether this language is mandatory")
4613
+ })).describe("List of configured languages"),
4614
+ total: z.number().describe("Total number of languages")
4615
+ });
4616
+ var tool61 = {
4617
+ name: "list-languages",
4618
+ description: "List all languages configured on the Umbraco site. Shows the ISO code, name, and whether each language is the default or mandatory.",
4619
+ inputSchema: inputSchema61,
4620
+ outputSchema: outputSchema61,
4621
+ slices: ["list"],
4622
+ annotations: { readOnlyHint: true },
4623
+ handler: async ({ take, skip }) => {
4624
+ const result = await chainCms("get-language", { cursor: buildChainedCursor(skip, take) });
4625
+ if (!result.ok) return result.errorResult;
4626
+ const data = result.data;
4627
+ return createToolResult({
4628
+ items: (data.items ?? []).map((item) => ({
4629
+ isoCode: item.isoCode,
4630
+ name: item.name,
4631
+ isDefault: item.isDefault,
4632
+ isMandatory: item.isMandatory
4633
+ })),
4634
+ total: data.total ?? 0
4635
+ });
4636
+ }
4637
+ };
4638
+ var list_languages_default = withStandardDecorators(tool61);
4639
+ var inputSchema62 = {
4640
+ isoCode: z.string().describe("ISO language code (e.g. en-US)")
4641
+ };
4642
+ var outputSchema62 = z.object({
4643
+ isoCode: z.string().describe("ISO language code"),
4644
+ name: z.string().describe("Display name of the language"),
4645
+ isDefault: z.boolean().describe("Whether this is the default language"),
4646
+ isMandatory: z.boolean().describe("Whether this language is mandatory"),
4647
+ fallbackIsoCode: z.string().nullable().describe("ISO code of the fallback language, if set")
4648
+ });
4649
+ var tool62 = {
4650
+ name: "get-language",
4651
+ description: "Get details of a language by its ISO code. Shows default/mandatory status and fallback language. Use list-languages to see all available ISO codes.",
4652
+ inputSchema: inputSchema62,
4653
+ outputSchema: outputSchema62,
4654
+ slices: ["read"],
4655
+ annotations: { readOnlyHint: true },
4656
+ handler: async ({ isoCode }) => {
4657
+ const result = await chainCms("get-language-by-iso-code", { isoCode });
4658
+ if (!result.ok) return result.errorResult;
4659
+ const data = result.data;
4660
+ return createToolResult({
4661
+ isoCode: data.isoCode,
4662
+ name: data.name,
4663
+ isDefault: data.isDefault ?? false,
4664
+ isMandatory: data.isMandatory ?? false,
4665
+ fallbackIsoCode: data.fallbackIsoCode ?? null
4666
+ });
4667
+ }
4668
+ };
4669
+ var get_language_default = withStandardDecorators(tool62);
4670
+ var inputSchema63 = {
4671
+ isoCode: z.string().describe("ISO language code to add (e.g. fr-FR)"),
4672
+ name: z.string().optional().describe("Display name for the language (e.g. 'French'). Defaults to the ISO code if not provided."),
4673
+ isDefault: z.boolean().optional().describe("Whether this language should be the default"),
4674
+ isMandatory: z.boolean().optional().describe("Whether this language should be mandatory"),
4675
+ fallbackIsoCode: z.string().optional().describe("ISO code of the fallback language")
4676
+ };
4677
+ var outputSchema63 = z.object({
4678
+ message: z.string(),
4679
+ isoCode: z.string(),
4680
+ name: z.string()
4681
+ });
4682
+ var tool63 = {
4683
+ name: "create-language",
4684
+ description: "Add a new language to the site. Use this only for languages that do not yet exist \u2014 call list-languages first to avoid duplicates, and use update-language to change settings on an existing language.",
4685
+ inputSchema: inputSchema63,
4686
+ outputSchema: outputSchema63,
4687
+ slices: ["create"],
4688
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
4689
+ handler: async ({ isoCode, name: displayName, isDefault, isMandatory, fallbackIsoCode }) => {
4690
+ const langName = displayName || isoCode;
4691
+ const result = await chainCms("create-language", {
4692
+ name: langName,
4693
+ isoCode,
4694
+ isDefault: isDefault ?? false,
4695
+ isMandatory: isMandatory ?? false,
4696
+ fallbackIsoCode
4697
+ });
4698
+ if (!result.ok) return result.errorResult;
4699
+ return createToolResult({
4700
+ message: `Language "${langName}" (${isoCode}) added successfully`,
4701
+ isoCode: result.data.isoCode,
4702
+ name: langName
4703
+ });
4704
+ }
4705
+ };
4706
+ var create_language_default = withStandardDecorators(tool63);
4707
+ var inputSchema64 = {
4708
+ isoCode: z.string().describe("ISO language code of the language to update (e.g. en-US)"),
4709
+ isDefault: z.boolean().optional().describe("Whether this language should be the default"),
4710
+ isMandatory: z.boolean().optional().describe("Whether this language should be mandatory"),
4711
+ fallbackIsoCode: z.string().optional().describe("ISO code of the fallback language")
4712
+ };
4713
+ var outputSchema64 = z.object({
4714
+ message: z.string(),
4715
+ isoCode: z.string(),
4716
+ name: z.string()
4717
+ });
4718
+ var tool64 = {
4719
+ name: "update-language",
4720
+ description: "Update a language's settings (default, mandatory, fallback).",
4721
+ inputSchema: inputSchema64,
4722
+ outputSchema: outputSchema64,
4723
+ slices: ["update"],
4724
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
4725
+ handler: async ({ isoCode, isDefault, isMandatory, fallbackIsoCode }) => {
4726
+ const langResult = await chainCms("get-language-by-iso-code", { isoCode });
4727
+ if (!langResult.ok) return langResult.errorResult;
4728
+ const lang = langResult.data;
4729
+ const name = lang.name ?? isoCode;
4730
+ const result = await chainCms("update-language", {
4731
+ isoCode,
4732
+ data: {
4733
+ name,
4734
+ isDefault: isDefault ?? lang.isDefault ?? false,
4735
+ isMandatory: isMandatory ?? lang.isMandatory ?? false,
4736
+ fallbackIsoCode: fallbackIsoCode ?? lang.fallbackIsoCode ?? void 0
4737
+ }
4738
+ });
4739
+ if (!result.ok) return result.errorResult;
4740
+ return createToolResult({
4741
+ message: `Language "${name}" (${isoCode}) updated successfully`,
4742
+ isoCode,
4743
+ name
4744
+ });
4745
+ }
4746
+ };
4747
+ var update_language_default = withStandardDecorators(tool64);
4748
+ var inputSchema65 = {
4749
+ isoCode: z.string().describe("ISO language code of the language to delete (e.g. fr-FR)")
4750
+ };
4751
+ var outputSchema65 = z.object({
4752
+ message: z.string(),
4753
+ isoCode: z.string(),
4754
+ name: z.string()
4755
+ });
4756
+ var tool65 = {
4757
+ name: "delete-language",
4758
+ description: "Remove a language from the site. Content variants in this language will become inaccessible. You will be asked to confirm before deleting.",
4759
+ inputSchema: inputSchema65,
4760
+ outputSchema: outputSchema65,
4761
+ slices: ["delete"],
4762
+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
4763
+ handler: async ({ isoCode }, extra) => {
4764
+ const langResult = await chainCms("get-language-by-iso-code", { isoCode });
4765
+ if (!langResult.ok) return langResult.errorResult;
4766
+ const lang = langResult.data;
4767
+ const name = lang.name ?? isoCode;
4768
+ const confirmMessage = `Delete language "${name}" (${isoCode})? All content variants in this language will become inaccessible.`;
4769
+ if (!await requestApproval(extra, confirmMessage)) {
4770
+ return createToolResult({ message: "Delete cancelled", isoCode, name });
4771
+ }
4772
+ const deleteResult = await chainCms("delete-language", { isoCode });
4773
+ if (!deleteResult.ok) return deleteResult.errorResult;
4774
+ return createToolResult({
4775
+ message: `Language "${name}" (${isoCode}) deleted successfully`,
4776
+ isoCode,
4777
+ name
4778
+ });
4779
+ }
4780
+ };
4781
+ var delete_language_default = withStandardDecorators(tool65);
4782
+
4783
+ // src/umbraco-api/tools/language/index.ts
4784
+ var collection8 = {
4785
+ metadata: {
4786
+ name: "language",
4787
+ displayName: "Languages",
4788
+ description: "Manage languages configured on the Umbraco site"
4789
+ },
4790
+ tools: () => [list_languages_default, get_language_default, create_language_default, update_language_default, delete_language_default]
4791
+ };
4792
+ var language_default = collection8;
4070
4793
  async function checkVariesByCulture(documentId) {
4071
4794
  const docResult = await chainCms("get-document-by-id", { id: documentId });
4072
4795
  if (!docResult.ok) return docResult.errorResult;
@@ -4086,7 +4809,7 @@ async function checkVariesByCulture(documentId) {
4086
4809
  }
4087
4810
 
4088
4811
  // src/umbraco-api/tools/translation/post/create-variant.ts
4089
- var inputSchema49 = {
4812
+ var inputSchema66 = {
4090
4813
  id: z.string().uuid().describe("The ID of the page to add a language variant to"),
4091
4814
  culture: z.string().describe("The target language ISO code (e.g. 'da-DK', 'fr-FR'). Call list-languages to find available cultures."),
4092
4815
  values: z.array(z.object({
@@ -4096,7 +4819,7 @@ var inputSchema49 = {
4096
4819
  segment: z.string().nullable().optional().describe("The segment for segmented content")
4097
4820
  })).optional().describe("Optional property values to set on the new variant")
4098
4821
  };
4099
- var outputSchema49 = z.object({
4822
+ var outputSchema66 = z.object({
4100
4823
  message: z.string(),
4101
4824
  id: z.string(),
4102
4825
  name: z.string(),
@@ -4104,11 +4827,11 @@ var outputSchema49 = z.object({
4104
4827
  previewUrl: previewUrlSchema,
4105
4828
  validation: validationResultSchema
4106
4829
  });
4107
- var tool49 = {
4830
+ var tool66 = {
4108
4831
  name: "create-variant",
4109
4832
  description: "Create a new language variant for a content page. Call list-languages to find available cultures. Optionally provide property values for the new variant.",
4110
- inputSchema: inputSchema49,
4111
- outputSchema: outputSchema49,
4833
+ inputSchema: inputSchema66,
4834
+ outputSchema: outputSchema66,
4112
4835
  slices: ["create"],
4113
4836
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
4114
4837
  handler: async ({ id, culture, values }) => {
@@ -4152,13 +4875,13 @@ var tool49 = {
4152
4875
  });
4153
4876
  }
4154
4877
  };
4155
- var create_variant_default = withStandardDecorators(tool49);
4156
- var inputSchema50 = {
4878
+ var create_variant_default = withStandardDecorators(tool66);
4879
+ var inputSchema67 = {
4157
4880
  id: z.string().uuid().describe("The ID of the page to copy a variant on"),
4158
4881
  sourceCulture: z.string().describe("The source language ISO code to copy content from (e.g. 'en-US')"),
4159
4882
  targetCulture: z.string().describe("The target language ISO code to copy content to (e.g. 'da-DK')")
4160
4883
  };
4161
- var outputSchema50 = z.object({
4884
+ var outputSchema67 = z.object({
4162
4885
  message: z.string(),
4163
4886
  id: z.string(),
4164
4887
  name: z.string(),
@@ -4168,11 +4891,11 @@ var outputSchema50 = z.object({
4168
4891
  previewUrl: previewUrlSchema,
4169
4892
  validation: validationResultSchema
4170
4893
  });
4171
- var tool50 = {
4894
+ var tool67 = {
4172
4895
  name: "copy-variant",
4173
4896
  description: "Copy all content from one language variant to another as a starting point for translation. Overwrites the target variant's content and creates the variant if it does not exist \u2014 you will be asked to confirm. Note: Umbraco supports language fallback chains, so a property left unset on a variant can fall back to the default language automatically \u2014 copy-variant is for when you want explicit content per culture rather than relying on fallback.",
4174
- inputSchema: inputSchema50,
4175
- outputSchema: outputSchema50,
4897
+ inputSchema: inputSchema67,
4898
+ outputSchema: outputSchema67,
4176
4899
  slices: ["create"],
4177
4900
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
4178
4901
  handler: async ({ id, sourceCulture, targetCulture }, extra) => {
@@ -4226,14 +4949,14 @@ var tool50 = {
4226
4949
  });
4227
4950
  }
4228
4951
  };
4229
- var copy_variant_default = withStandardDecorators(tool50);
4230
- var inputSchema51 = {
4952
+ var copy_variant_default = withStandardDecorators(tool67);
4953
+ var inputSchema68 = {
4231
4954
  culture: z.string().describe("The language ISO code to check for (e.g. 'da-DK'). Pages missing this variant will be returned. Call list-languages to find valid culture codes."),
4232
4955
  parentId: z.string().uuid().optional().describe("Parent page ID to search under. Omit to search root-level pages."),
4233
4956
  take: z.number().optional().default(20).describe("Number of results to return"),
4234
4957
  skip: z.number().optional().default(0).describe("Number of results to skip for pagination")
4235
4958
  };
4236
- var outputSchema51 = z.object({
4959
+ var outputSchema68 = z.object({
4237
4960
  items: z.array(z.object({
4238
4961
  id: z.string(),
4239
4962
  name: z.string(),
@@ -4241,11 +4964,11 @@ var outputSchema51 = z.object({
4241
4964
  })).describe("Pages that are missing the specified language variant"),
4242
4965
  total: z.number().describe("Total number of pages missing the variant (before pagination)")
4243
4966
  });
4244
- var tool51 = {
4967
+ var tool68 = {
4245
4968
  name: "list-untranslated",
4246
4969
  description: "Find content pages that are missing a specific language variant. Searches up to 100 pages per call \u2014 use parentId to scope to a subtree for larger sites. Use copy-variant to seed translations for found pages. Call list-languages to find valid culture codes.",
4247
- inputSchema: inputSchema51,
4248
- outputSchema: outputSchema51,
4970
+ inputSchema: inputSchema68,
4971
+ outputSchema: outputSchema68,
4249
4972
  slices: ["search"],
4250
4973
  annotations: { readOnlyHint: true },
4251
4974
  handler: async ({ culture, parentId, take, skip }) => {
@@ -4278,10 +5001,10 @@ var tool51 = {
4278
5001
  return createToolResult({ items: paged, total });
4279
5002
  }
4280
5003
  };
4281
- var list_untranslated_default = withStandardDecorators(tool51);
5004
+ var list_untranslated_default = withStandardDecorators(tool68);
4282
5005
 
4283
5006
  // src/umbraco-api/tools/translation/index.ts
4284
- var collection7 = {
5007
+ var collection9 = {
4285
5008
  metadata: {
4286
5009
  name: "translation",
4287
5010
  displayName: "Translation",
@@ -4289,203 +5012,13 @@ var collection7 = {
4289
5012
  },
4290
5013
  tools: () => [create_variant_default, copy_variant_default, list_untranslated_default]
4291
5014
  };
4292
- var translation_default = collection7;
4293
- var inputSchema52 = {
4294
- take: z.number().optional().default(50).describe("Number of results to return (default 50)"),
4295
- skip: z.number().optional().default(0).describe("Number of results to skip for pagination")
4296
- };
4297
- var outputSchema52 = z.object({
4298
- items: z.array(z.object({
4299
- isoCode: z.string().describe("ISO language code (e.g. en-US)"),
4300
- name: z.string().describe("Display name of the language"),
4301
- isDefault: z.boolean().describe("Whether this is the default language"),
4302
- isMandatory: z.boolean().describe("Whether this language is mandatory")
4303
- })).describe("List of configured languages"),
4304
- total: z.number().describe("Total number of languages")
4305
- });
4306
- var tool52 = {
4307
- name: "list-languages",
4308
- description: "List all languages configured on the Umbraco site. Shows the ISO code, name, and whether each language is the default or mandatory.",
4309
- inputSchema: inputSchema52,
4310
- outputSchema: outputSchema52,
4311
- slices: ["list"],
4312
- annotations: { readOnlyHint: true },
4313
- handler: async ({ take, skip }) => {
4314
- const result = await chainCms("get-language", { cursor: buildChainedCursor(skip, take) });
4315
- if (!result.ok) return result.errorResult;
4316
- const data = result.data;
4317
- return createToolResult({
4318
- items: (data.items ?? []).map((item) => ({
4319
- isoCode: item.isoCode,
4320
- name: item.name,
4321
- isDefault: item.isDefault,
4322
- isMandatory: item.isMandatory
4323
- })),
4324
- total: data.total ?? 0
4325
- });
4326
- }
4327
- };
4328
- var list_languages_default = withStandardDecorators(tool52);
4329
- var inputSchema53 = {
4330
- isoCode: z.string().describe("ISO language code (e.g. en-US)")
4331
- };
4332
- var outputSchema53 = z.object({
4333
- isoCode: z.string().describe("ISO language code"),
4334
- name: z.string().describe("Display name of the language"),
4335
- isDefault: z.boolean().describe("Whether this is the default language"),
4336
- isMandatory: z.boolean().describe("Whether this language is mandatory"),
4337
- fallbackIsoCode: z.string().nullable().describe("ISO code of the fallback language, if set")
4338
- });
4339
- var tool53 = {
4340
- name: "get-language",
4341
- description: "Get details of a language by its ISO code. Shows default/mandatory status and fallback language. Use list-languages to see all available ISO codes.",
4342
- inputSchema: inputSchema53,
4343
- outputSchema: outputSchema53,
4344
- slices: ["read"],
4345
- annotations: { readOnlyHint: true },
4346
- handler: async ({ isoCode }) => {
4347
- const result = await chainCms("get-language-by-iso-code", { isoCode });
4348
- if (!result.ok) return result.errorResult;
4349
- const data = result.data;
4350
- return createToolResult({
4351
- isoCode: data.isoCode,
4352
- name: data.name,
4353
- isDefault: data.isDefault ?? false,
4354
- isMandatory: data.isMandatory ?? false,
4355
- fallbackIsoCode: data.fallbackIsoCode ?? null
4356
- });
4357
- }
4358
- };
4359
- var get_language_default = withStandardDecorators(tool53);
4360
- var inputSchema54 = {
4361
- isoCode: z.string().describe("ISO language code to add (e.g. fr-FR)"),
4362
- name: z.string().optional().describe("Display name for the language (e.g. 'French'). Defaults to the ISO code if not provided."),
4363
- isDefault: z.boolean().optional().describe("Whether this language should be the default"),
4364
- isMandatory: z.boolean().optional().describe("Whether this language should be mandatory"),
4365
- fallbackIsoCode: z.string().optional().describe("ISO code of the fallback language")
4366
- };
4367
- var outputSchema54 = z.object({
4368
- message: z.string(),
4369
- isoCode: z.string(),
4370
- name: z.string()
4371
- });
4372
- var tool54 = {
4373
- name: "create-language",
4374
- description: "Add a new language to the site. Use this only for languages that do not yet exist \u2014 call list-languages first to avoid duplicates, and use update-language to change settings on an existing language.",
4375
- inputSchema: inputSchema54,
4376
- outputSchema: outputSchema54,
4377
- slices: ["create"],
4378
- annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
4379
- handler: async ({ isoCode, name: displayName, isDefault, isMandatory, fallbackIsoCode }) => {
4380
- const langName = displayName || isoCode;
4381
- const result = await chainCms("create-language", {
4382
- name: langName,
4383
- isoCode,
4384
- isDefault: isDefault ?? false,
4385
- isMandatory: isMandatory ?? false,
4386
- fallbackIsoCode
4387
- });
4388
- if (!result.ok) return result.errorResult;
4389
- return createToolResult({
4390
- message: `Language "${langName}" (${isoCode}) added successfully`,
4391
- isoCode: result.data.isoCode,
4392
- name: langName
4393
- });
4394
- }
4395
- };
4396
- var create_language_default = withStandardDecorators(tool54);
4397
- var inputSchema55 = {
4398
- isoCode: z.string().describe("ISO language code of the language to update (e.g. en-US)"),
4399
- isDefault: z.boolean().optional().describe("Whether this language should be the default"),
4400
- isMandatory: z.boolean().optional().describe("Whether this language should be mandatory"),
4401
- fallbackIsoCode: z.string().optional().describe("ISO code of the fallback language")
4402
- };
4403
- var outputSchema55 = z.object({
4404
- message: z.string(),
4405
- isoCode: z.string(),
4406
- name: z.string()
4407
- });
4408
- var tool55 = {
4409
- name: "update-language",
4410
- description: "Update a language's settings (default, mandatory, fallback).",
4411
- inputSchema: inputSchema55,
4412
- outputSchema: outputSchema55,
4413
- slices: ["update"],
4414
- annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
4415
- handler: async ({ isoCode, isDefault, isMandatory, fallbackIsoCode }) => {
4416
- const langResult = await chainCms("get-language-by-iso-code", { isoCode });
4417
- if (!langResult.ok) return langResult.errorResult;
4418
- const lang = langResult.data;
4419
- const name = lang.name ?? isoCode;
4420
- const result = await chainCms("update-language", {
4421
- isoCode,
4422
- data: {
4423
- name,
4424
- isDefault: isDefault ?? lang.isDefault ?? false,
4425
- isMandatory: isMandatory ?? lang.isMandatory ?? false,
4426
- fallbackIsoCode: fallbackIsoCode ?? lang.fallbackIsoCode ?? void 0
4427
- }
4428
- });
4429
- if (!result.ok) return result.errorResult;
4430
- return createToolResult({
4431
- message: `Language "${name}" (${isoCode}) updated successfully`,
4432
- isoCode,
4433
- name
4434
- });
4435
- }
4436
- };
4437
- var update_language_default = withStandardDecorators(tool55);
4438
- var inputSchema56 = {
4439
- isoCode: z.string().describe("ISO language code of the language to delete (e.g. fr-FR)")
4440
- };
4441
- var outputSchema56 = z.object({
4442
- message: z.string(),
4443
- isoCode: z.string(),
4444
- name: z.string()
4445
- });
4446
- var tool56 = {
4447
- name: "delete-language",
4448
- description: "Remove a language from the site. Content variants in this language will become inaccessible. You will be asked to confirm before deleting.",
4449
- inputSchema: inputSchema56,
4450
- outputSchema: outputSchema56,
4451
- slices: ["delete"],
4452
- annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
4453
- handler: async ({ isoCode }, extra) => {
4454
- const langResult = await chainCms("get-language-by-iso-code", { isoCode });
4455
- if (!langResult.ok) return langResult.errorResult;
4456
- const lang = langResult.data;
4457
- const name = lang.name ?? isoCode;
4458
- const confirmMessage = `Delete language "${name}" (${isoCode})? All content variants in this language will become inaccessible.`;
4459
- if (!await requestApproval(extra, confirmMessage)) {
4460
- return createToolResult({ message: "Delete cancelled", isoCode, name });
4461
- }
4462
- const deleteResult = await chainCms("delete-language", { isoCode });
4463
- if (!deleteResult.ok) return deleteResult.errorResult;
4464
- return createToolResult({
4465
- message: `Language "${name}" (${isoCode}) deleted successfully`,
4466
- isoCode,
4467
- name
4468
- });
4469
- }
4470
- };
4471
- var delete_language_default = withStandardDecorators(tool56);
4472
-
4473
- // src/umbraco-api/tools/language/index.ts
4474
- var collection8 = {
4475
- metadata: {
4476
- name: "language",
4477
- displayName: "Languages",
4478
- description: "Manage languages configured on the Umbraco site"
4479
- },
4480
- tools: () => [list_languages_default, get_language_default, create_language_default, update_language_default, delete_language_default]
4481
- };
4482
- var language_default = collection8;
4483
- var inputSchema57 = {
5015
+ var translation_default = collection9;
5016
+ var inputSchema69 = {
4484
5017
  parentId: z.string().uuid().optional().describe("UUID of the parent dictionary item, or omit to list root-level entries"),
4485
5018
  take: z.number().optional().default(50).describe("Number of results to return (default 50)"),
4486
5019
  skip: z.number().optional().default(0).describe("Number of results to skip for pagination")
4487
5020
  };
4488
- var outputSchema57 = z.object({
5021
+ var outputSchema69 = z.object({
4489
5022
  items: z.array(
4490
5023
  z.object({
4491
5024
  id: z.string(),
@@ -4495,11 +5028,11 @@ var outputSchema57 = z.object({
4495
5028
  ).describe("Dictionary items"),
4496
5029
  total: z.number().describe("Total number of items")
4497
5030
  });
4498
- var tool57 = {
5031
+ var tool69 = {
4499
5032
  name: "list-dictionary",
4500
5033
  description: "Browse the dictionary tree. Shows root entries or children of a parent. Each item shows which languages have translations. Use get-dictionary to see the full translations.",
4501
- inputSchema: inputSchema57,
4502
- outputSchema: outputSchema57,
5034
+ inputSchema: inputSchema69,
5035
+ outputSchema: outputSchema69,
4503
5036
  slices: ["list", "tree"],
4504
5037
  annotations: { readOnlyHint: true },
4505
5038
  handler: async ({ parentId, take, skip }) => {
@@ -4525,11 +5058,11 @@ var tool57 = {
4525
5058
  });
4526
5059
  }
4527
5060
  };
4528
- var list_dictionary_default = withStandardDecorators(tool57);
4529
- var inputSchema58 = {
5061
+ var list_dictionary_default = withStandardDecorators(tool69);
5062
+ var inputSchema70 = {
4530
5063
  query: z.string().describe("Search term to match against dictionary item key names")
4531
5064
  };
4532
- var outputSchema58 = z.object({
5065
+ var outputSchema70 = z.object({
4533
5066
  items: z.array(
4534
5067
  z.object({
4535
5068
  id: z.string(),
@@ -4538,11 +5071,11 @@ var outputSchema58 = z.object({
4538
5071
  ).describe("Matching dictionary items"),
4539
5072
  total: z.number().describe("Total number of matching items")
4540
5073
  });
4541
- var tool58 = {
5074
+ var tool70 = {
4542
5075
  name: "search-dictionary",
4543
5076
  description: "Search for dictionary items by key name. Use get-dictionary to see all translations for a specific item.",
4544
- inputSchema: inputSchema58,
4545
- outputSchema: outputSchema58,
5077
+ inputSchema: inputSchema70,
5078
+ outputSchema: outputSchema70,
4546
5079
  slices: ["search"],
4547
5080
  annotations: { readOnlyHint: true },
4548
5081
  handler: async ({ query }) => {
@@ -4557,11 +5090,11 @@ var tool58 = {
4557
5090
  });
4558
5091
  }
4559
5092
  };
4560
- var search_dictionary_default = withStandardDecorators(tool58);
4561
- var inputSchema59 = {
5093
+ var search_dictionary_default = withStandardDecorators(tool70);
5094
+ var inputSchema71 = {
4562
5095
  id: z.string().uuid().describe("UUID of the dictionary item to retrieve")
4563
5096
  };
4564
- var outputSchema59 = z.object({
5097
+ var outputSchema71 = z.object({
4565
5098
  id: z.string(),
4566
5099
  name: z.string(),
4567
5100
  translations: z.array(
@@ -4572,11 +5105,11 @@ var outputSchema59 = z.object({
4572
5105
  })
4573
5106
  ).describe("All translations for this dictionary item")
4574
5107
  });
4575
- var tool59 = {
5108
+ var tool71 = {
4576
5109
  name: "get-dictionary",
4577
5110
  description: "Get a dictionary item with all its translations across languages. Shows the key name and each language's translation value.",
4578
- inputSchema: inputSchema59,
4579
- outputSchema: outputSchema59,
5111
+ inputSchema: inputSchema71,
5112
+ outputSchema: outputSchema71,
4580
5113
  slices: ["read"],
4581
5114
  annotations: { readOnlyHint: true },
4582
5115
  handler: async ({ id }) => {
@@ -4598,8 +5131,8 @@ var tool59 = {
4598
5131
  });
4599
5132
  }
4600
5133
  };
4601
- var get_dictionary_default = withStandardDecorators(tool59);
4602
- var inputSchema60 = {
5134
+ var get_dictionary_default = withStandardDecorators(tool71);
5135
+ var inputSchema72 = {
4603
5136
  name: z.string().describe("The dictionary key name"),
4604
5137
  translations: z.array(
4605
5138
  z.object({
@@ -4609,16 +5142,16 @@ var inputSchema60 = {
4609
5142
  ).describe("Translations to set for this dictionary item"),
4610
5143
  parentId: z.string().uuid().optional().describe("UUID of the parent dictionary item, or omit to create at the root")
4611
5144
  };
4612
- var outputSchema60 = z.object({
5145
+ var outputSchema72 = z.object({
4613
5146
  message: z.string(),
4614
5147
  id: z.string(),
4615
5148
  name: z.string()
4616
5149
  });
4617
- var tool60 = {
5150
+ var tool72 = {
4618
5151
  name: "create-dictionary",
4619
5152
  description: "Create a new dictionary item with translations. Dictionary keys typically use dot-notation (e.g. 'Header.Title', 'Buttons.ReadMore') \u2014 call list-dictionary first to avoid duplicate keys, and use update-dictionary to change translations on an existing item. Use list-languages to find valid ISO codes.",
4620
- inputSchema: inputSchema60,
4621
- outputSchema: outputSchema60,
5153
+ inputSchema: inputSchema72,
5154
+ outputSchema: outputSchema72,
4622
5155
  slices: ["create"],
4623
5156
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
4624
5157
  handler: async ({ name, translations, parentId }) => {
@@ -4635,8 +5168,8 @@ var tool60 = {
4635
5168
  });
4636
5169
  }
4637
5170
  };
4638
- var create_dictionary_default = withStandardDecorators(tool60);
4639
- var inputSchema61 = {
5171
+ var create_dictionary_default = withStandardDecorators(tool72);
5172
+ var inputSchema73 = {
4640
5173
  id: z.string().uuid().describe("UUID of the dictionary item to update"),
4641
5174
  translations: z.array(
4642
5175
  z.object({
@@ -4645,17 +5178,17 @@ var inputSchema61 = {
4645
5178
  })
4646
5179
  ).describe("Translations to update. Languages not listed here will keep their existing translations.")
4647
5180
  };
4648
- var outputSchema61 = z.object({
5181
+ var outputSchema73 = z.object({
4649
5182
  message: z.string(),
4650
5183
  id: z.string(),
4651
5184
  name: z.string(),
4652
5185
  updatedLanguages: z.array(z.string()).describe("ISO codes of languages that were updated")
4653
5186
  });
4654
- var tool61 = {
5187
+ var tool73 = {
4655
5188
  name: "update-dictionary",
4656
5189
  description: "Update translations for a dictionary item. Call get-dictionary first to see existing translations.",
4657
- inputSchema: inputSchema61,
4658
- outputSchema: outputSchema61,
5190
+ inputSchema: inputSchema73,
5191
+ outputSchema: outputSchema73,
4659
5192
  slices: ["update"],
4660
5193
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
4661
5194
  handler: async ({ id, translations }) => {
@@ -4687,21 +5220,21 @@ var tool61 = {
4687
5220
  });
4688
5221
  }
4689
5222
  };
4690
- var update_dictionary_default = withStandardDecorators(tool61);
4691
- var inputSchema62 = {
5223
+ var update_dictionary_default = withStandardDecorators(tool73);
5224
+ var inputSchema74 = {
4692
5225
  id: z.string().uuid().describe("UUID of the dictionary item to move"),
4693
5226
  targetParentId: z.string().uuid().optional().describe("UUID of the destination parent dictionary item, or omit to move to the root")
4694
5227
  };
4695
- var outputSchema62 = z.object({
5228
+ var outputSchema74 = z.object({
4696
5229
  message: z.string(),
4697
5230
  id: z.string(),
4698
5231
  name: z.string()
4699
5232
  });
4700
- var tool62 = {
5233
+ var tool74 = {
4701
5234
  name: "move-dictionary",
4702
5235
  description: "Move a dictionary item to a different parent in the dictionary tree, or to the root. You will be asked to confirm.",
4703
- inputSchema: inputSchema62,
4704
- outputSchema: outputSchema62,
5236
+ inputSchema: inputSchema74,
5237
+ outputSchema: outputSchema74,
4705
5238
  slices: ["move"],
4706
5239
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
4707
5240
  handler: async ({ id, targetParentId }, extra) => {
@@ -4732,10 +5265,10 @@ var tool62 = {
4732
5265
  });
4733
5266
  }
4734
5267
  };
4735
- var move_dictionary_default = withStandardDecorators(tool62);
5268
+ var move_dictionary_default = withStandardDecorators(tool74);
4736
5269
 
4737
5270
  // src/umbraco-api/tools/dictionary/index.ts
4738
- var collection9 = {
5271
+ var collection10 = {
4739
5272
  metadata: {
4740
5273
  name: "dictionary",
4741
5274
  displayName: "Dictionary",
@@ -4743,13 +5276,13 @@ var collection9 = {
4743
5276
  },
4744
5277
  tools: () => [list_dictionary_default, search_dictionary_default, get_dictionary_default, create_dictionary_default, update_dictionary_default, move_dictionary_default]
4745
5278
  };
4746
- var dictionary_default = collection9;
4747
- var inputSchema63 = {
5279
+ var dictionary_default = collection10;
5280
+ var inputSchema75 = {
4748
5281
  tagGroup: z.string().optional().describe("Filter tags by group name, or omit to list all tags"),
4749
5282
  take: z.number().optional().default(50).describe("Number of tags to return"),
4750
5283
  skip: z.number().optional().default(0).describe("Number of tags to skip for pagination")
4751
5284
  };
4752
- var outputSchema63 = z.object({
5285
+ var outputSchema75 = z.object({
4753
5286
  items: z.array(
4754
5287
  z.object({
4755
5288
  id: z.number(),
@@ -4760,11 +5293,11 @@ var outputSchema63 = z.object({
4760
5293
  ).describe("Tags in use across the site"),
4761
5294
  total: z.number().describe("Total number of tags")
4762
5295
  });
4763
- var tool63 = {
5296
+ var tool75 = {
4764
5297
  name: "list-tags",
4765
5298
  description: "List tags in use across the site. Optionally filter by tag group. Shows how many content items use each tag.",
4766
- inputSchema: inputSchema63,
4767
- outputSchema: outputSchema63,
5299
+ inputSchema: inputSchema75,
5300
+ outputSchema: outputSchema75,
4768
5301
  slices: ["list"],
4769
5302
  annotations: { readOnlyHint: true },
4770
5303
  handler: async ({ tagGroup, take, skip }) => {
@@ -4781,10 +5314,10 @@ var tool63 = {
4781
5314
  });
4782
5315
  }
4783
5316
  };
4784
- var list_tags_default = withStandardDecorators(tool63);
5317
+ var list_tags_default = withStandardDecorators(tool75);
4785
5318
 
4786
5319
  // src/umbraco-api/tools/tag/index.ts
4787
- var collection10 = {
5320
+ var collection11 = {
4788
5321
  metadata: {
4789
5322
  name: "tag",
4790
5323
  displayName: "Tags",
@@ -4792,13 +5325,13 @@ var collection10 = {
4792
5325
  },
4793
5326
  tools: () => [list_tags_default]
4794
5327
  };
4795
- var tag_default = collection10;
5328
+ var tag_default = collection11;
4796
5329
  var TITLE_ALIASES = ["pageTitle", "title", "metaTitle", "seoTitle"];
4797
5330
  var META_DESC_ALIASES = ["metaDescription", "seoMetaDescription", "description"];
4798
- var inputSchema64 = {
5331
+ var inputSchema76 = {
4799
5332
  id: z.string().uuid().describe("The ID of the content page to audit")
4800
5333
  };
4801
- var outputSchema64 = z.object({
5334
+ var outputSchema76 = z.object({
4802
5335
  id: z.string().describe("Page ID"),
4803
5336
  name: z.string().describe("Page name"),
4804
5337
  url: z.string().describe("Page URL"),
@@ -4815,11 +5348,11 @@ var outputSchema64 = z.object({
4815
5348
  headings: z.array(z.object({ level: z.number(), text: z.string() })).describe("Headings found in body content"),
4816
5349
  images: z.array(z.object({ src: z.string(), alt: z.string(), hasAlt: z.boolean() })).describe("Images found in body content with alt text status")
4817
5350
  });
4818
- var tool64 = {
5351
+ var tool76 = {
4819
5352
  name: "audit-page-seo",
4820
5353
  description: "Audit a page's SEO health. Returns title, meta description, headings, images with alt text status, and word count. Includes flags for quick scanning and raw data for detailed analysis. Use with analytics data to prioritise high-traffic pages.",
4821
- inputSchema: inputSchema64,
4822
- outputSchema: outputSchema64,
5354
+ inputSchema: inputSchema76,
5355
+ outputSchema: outputSchema76,
4823
5356
  slices: ["read"],
4824
5357
  annotations: { readOnlyHint: true },
4825
5358
  handler: async ({ id }) => {
@@ -4843,11 +5376,11 @@ var tool64 = {
4843
5376
  const headings = extractHeadings(allHtml);
4844
5377
  const images = extractImages(allHtml);
4845
5378
  const bodyWordCount = countWords(extractTextContent(values));
4846
- const extra = doc;
5379
+ const url = await fetchPrimaryPublishedUrl(id);
4847
5380
  return createToolResult({
4848
5381
  id: doc.id,
4849
5382
  name: variant?.name ?? "Unknown",
4850
- url: extra.urls?.[0]?.url ?? "",
5383
+ url,
4851
5384
  hasTitle: title.length > 0,
4852
5385
  hasMetaDescription: metaDescription.length > 0,
4853
5386
  titleLength: title.length,
@@ -4863,13 +5396,13 @@ var tool64 = {
4863
5396
  });
4864
5397
  }
4865
5398
  };
4866
- var audit_page_seo_default = withStandardDecorators(tool64);
5399
+ var audit_page_seo_default = withStandardDecorators(tool76);
4867
5400
  var META_DESC_ALIASES2 = ["metaDescription", "seoMetaDescription", "description"];
4868
5401
  var BODY_CONTENT_MAX = 2e3;
4869
- var inputSchema65 = {
5402
+ var inputSchema77 = {
4870
5403
  id: z.string().uuid().describe("The ID of the content page to audit")
4871
5404
  };
4872
- var outputSchema65 = z.object({
5405
+ var outputSchema77 = z.object({
4873
5406
  id: z.string().describe("Page ID"),
4874
5407
  name: z.string().describe("Page name"),
4875
5408
  url: z.string().describe("Page URL"),
@@ -4880,11 +5413,11 @@ var outputSchema65 = z.object({
4880
5413
  documentType: z.string().describe("The document type name"),
4881
5414
  lastModified: z.string().describe("ISO date string of last modification")
4882
5415
  });
4883
- var tool65 = {
5416
+ var tool77 = {
4884
5417
  name: "audit-page-content",
4885
5418
  description: "Retrieve a page's body text alongside its meta description for alignment analysis. Use to identify where the meta description does not reflect the actual content. Returns the first ~2000 characters of body text.",
4886
- inputSchema: inputSchema65,
4887
- outputSchema: outputSchema65,
5419
+ inputSchema: inputSchema77,
5420
+ outputSchema: outputSchema77,
4888
5421
  slices: ["read"],
4889
5422
  annotations: { readOnlyHint: true },
4890
5423
  handler: async ({ id }) => {
@@ -4906,12 +5439,12 @@ var tool65 = {
4906
5439
  const fullBodyText = extractTextContent(values);
4907
5440
  const bodyContent = fullBodyText.slice(0, BODY_CONTENT_MAX);
4908
5441
  const wordCount = fullBodyText ? fullBodyText.split(/\s+/).filter(Boolean).length : 0;
4909
- const extra = doc;
4910
5442
  const dt = doc.documentType;
5443
+ const url = await fetchPrimaryPublishedUrl(id);
4911
5444
  return createToolResult({
4912
5445
  id: doc.id,
4913
5446
  name: variant?.name ?? "Unknown",
4914
- url: extra.urls?.[0]?.url ?? "",
5447
+ url,
4915
5448
  hasMetaDescription: metaDescription.length > 0,
4916
5449
  bodyWordCount: wordCount,
4917
5450
  metaDescription,
@@ -4921,10 +5454,10 @@ var tool65 = {
4921
5454
  });
4922
5455
  }
4923
5456
  };
4924
- var audit_page_content_default = withStandardDecorators(tool65);
5457
+ var audit_page_content_default = withStandardDecorators(tool77);
4925
5458
 
4926
5459
  // src/umbraco-api/tools/content-health/index.ts
4927
- var collection11 = {
5460
+ var collection12 = {
4928
5461
  metadata: {
4929
5462
  name: "content-health",
4930
5463
  displayName: "Content Health",
@@ -4932,8 +5465,8 @@ var collection11 = {
4932
5465
  },
4933
5466
  tools: () => [audit_page_seo_default, audit_page_content_default]
4934
5467
  };
4935
- var content_health_default = collection11;
4936
- var inputSchema66 = {
5468
+ var content_health_default = collection12;
5469
+ var inputSchema78 = {
4937
5470
  parentId: z.string().uuid().optional().describe("Scope to a subtree by parent page ID. Omit to start from root."),
4938
5471
  maxDepth: z.number().optional().default(5).describe("How many levels deep to scan (default 5)")
4939
5472
  };
@@ -4948,7 +5481,7 @@ var treeNodeSchema = z.lazy(
4948
5481
  children: z.array(treeNodeSchema)
4949
5482
  })
4950
5483
  );
4951
- var outputSchema66 = z.object({
5484
+ var outputSchema78 = z.object({
4952
5485
  tree: z.array(treeNodeSchema).describe("Hierarchical site tree with children nested inside each node"),
4953
5486
  totalPages: z.number().describe("Total number of pages found across all levels"),
4954
5487
  maxDepthFound: z.number().describe("The deepest level actually found during the scan"),
@@ -4962,6 +5495,9 @@ async function fetchTreeLevel(parentId, depth) {
4962
5495
  }
4963
5496
  async function buildTreeNodes(parentId, depth, maxDepth, pagesPerLevel, totalRef, maxDepthRef) {
4964
5497
  const items = await fetchTreeLevel(parentId);
5498
+ const urlsById = await fetchPrimaryPublishedUrlsBatch(
5499
+ items.map((item) => item.id).filter((id) => typeof id === "string")
5500
+ );
4965
5501
  const nodes = [];
4966
5502
  for (const item of items) {
4967
5503
  totalRef.count++;
@@ -4977,7 +5513,7 @@ async function buildTreeNodes(parentId, depth, maxDepth, pagesPerLevel, totalRef
4977
5513
  nodes.push({
4978
5514
  id: item.id ?? "",
4979
5515
  name: item.name ?? item.variants?.[0]?.name ?? "Unknown",
4980
- url: item.url ?? item.urls?.[0]?.url ?? "",
5516
+ url: urlsById.get(item.id) ?? "",
4981
5517
  documentType: item.documentType?.name ?? item.contentTypeName ?? "",
4982
5518
  depth,
4983
5519
  childCount: children.length,
@@ -4986,11 +5522,11 @@ async function buildTreeNodes(parentId, depth, maxDepth, pagesPerLevel, totalRef
4986
5522
  }
4987
5523
  return nodes;
4988
5524
  }
4989
- var tool66 = {
5525
+ var tool78 = {
4990
5526
  name: "report-site-tree-summary",
4991
5527
  description: "Full site tree structure with page counts per level. Returns hierarchical data that maps to tree diagrams, sitemaps, and flowcharts. Use maxDepth to limit how deep to scan.",
4992
- inputSchema: inputSchema66,
4993
- outputSchema: outputSchema66,
5528
+ inputSchema: inputSchema78,
5529
+ outputSchema: outputSchema78,
4994
5530
  slices: ["read"],
4995
5531
  annotations: { readOnlyHint: true },
4996
5532
  handler: async ({ parentId, maxDepth }) => {
@@ -5007,14 +5543,14 @@ var tool66 = {
5007
5543
  });
5008
5544
  }
5009
5545
  };
5010
- var report_site_tree_summary_default = withStandardDecorators(tool66);
5011
- var inputSchema67 = {
5546
+ var report_site_tree_summary_default = withStandardDecorators(tool78);
5547
+ var inputSchema79 = {
5012
5548
  depthThreshold: z.number().optional().default(4).describe("Pages deeper than this level are reported (default 4)"),
5013
5549
  parentId: z.string().uuid().optional().describe("Scope to a subtree by parent page ID. Omit to start from root."),
5014
5550
  take: z.number().optional().default(50).describe("Number of results to return after filtering (default 50)"),
5015
5551
  skip: z.number().optional().default(0).describe("Number of results to skip for pagination (default 0)")
5016
5552
  };
5017
- var outputSchema67 = z.object({
5553
+ var outputSchema79 = z.object({
5018
5554
  items: z.array(
5019
5555
  z.object({
5020
5556
  id: z.string(),
@@ -5029,11 +5565,11 @@ var outputSchema67 = z.object({
5029
5565
  scannedPages: z.number().describe("Total number of pages scanned during the walk"),
5030
5566
  threshold: z.number().describe("The depth threshold used for this scan")
5031
5567
  });
5032
- var tool67 = {
5568
+ var tool79 = {
5033
5569
  name: "report-deep-pages",
5034
5570
  description: "Find pages buried more than N levels deep in the site tree. Deep pages are harder for users to find. Default threshold is 4 levels. Includes the full path to each deep page.",
5035
- inputSchema: inputSchema67,
5036
- outputSchema: outputSchema67,
5571
+ inputSchema: inputSchema79,
5572
+ outputSchema: outputSchema79,
5037
5573
  slices: ["read"],
5038
5574
  annotations: { readOnlyHint: true },
5039
5575
  handler: async ({ depthThreshold, parentId, take, skip }) => {
@@ -5045,6 +5581,9 @@ var tool67 = {
5045
5581
  if (!result.ok) return;
5046
5582
  const data = result.data;
5047
5583
  const items = data?.items ?? [];
5584
+ const urlsById = await fetchPrimaryPublishedUrlsBatch(
5585
+ items.map((item) => item.id).filter((id) => typeof id === "string")
5586
+ );
5048
5587
  for (const item of items) {
5049
5588
  if (scannedRef.count >= 500) break;
5050
5589
  scannedRef.count++;
@@ -5053,7 +5592,7 @@ var tool67 = {
5053
5592
  allPages.push({
5054
5593
  id: item.id ?? "",
5055
5594
  name,
5056
- url: item.url ?? item.urls?.[0]?.url ?? "",
5595
+ url: urlsById.get(item.id) ?? "",
5057
5596
  documentType: item.documentType?.name ?? item.contentTypeName ?? "",
5058
5597
  depth,
5059
5598
  rawDepth: depth,
@@ -5077,10 +5616,10 @@ var tool67 = {
5077
5616
  });
5078
5617
  }
5079
5618
  };
5080
- var report_deep_pages_default = withStandardDecorators(tool67);
5619
+ var report_deep_pages_default = withStandardDecorators(tool79);
5081
5620
 
5082
5621
  // src/umbraco-api/tools/site-structure/index.ts
5083
- var collection12 = {
5622
+ var collection13 = {
5084
5623
  metadata: {
5085
5624
  name: "site-structure",
5086
5625
  displayName: "Site Structure",
@@ -5088,12 +5627,12 @@ var collection12 = {
5088
5627
  },
5089
5628
  tools: () => [report_site_tree_summary_default, report_deep_pages_default]
5090
5629
  };
5091
- var site_structure_default = collection12;
5092
- var inputSchema68 = {
5630
+ var site_structure_default = collection13;
5631
+ var inputSchema80 = {
5093
5632
  ids: z.array(z.string().uuid()).min(1).max(10).describe("The IDs of the pages to publish (max 10)"),
5094
5633
  includeDescendants: z.boolean().optional().default(false).describe("Whether to also publish all child pages of each page")
5095
5634
  };
5096
- var outputSchema68 = z.object({
5635
+ var outputSchema80 = z.object({
5097
5636
  message: z.string(),
5098
5637
  results: z.array(z.object({
5099
5638
  id: z.string(),
@@ -5107,11 +5646,11 @@ var outputSchema68 = z.object({
5107
5646
  failureCount: z.number(),
5108
5647
  skippedCount: z.number()
5109
5648
  });
5110
- var tool68 = {
5649
+ var tool80 = {
5111
5650
  name: "bulk-publish",
5112
5651
  description: "Publish multiple pages at once (max 10). Lists all page names for confirmation. Each result includes a previousVersionId for rollback. Use search-content or list-children to find page IDs first.",
5113
- inputSchema: inputSchema68,
5114
- outputSchema: outputSchema68,
5652
+ inputSchema: inputSchema80,
5653
+ outputSchema: outputSchema80,
5115
5654
  slices: ["publish"],
5116
5655
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
5117
5656
  handler: async ({ ids, includeDescendants }, extra) => {
@@ -5163,11 +5702,11 @@ ${nameList}`;
5163
5702
  return createToolResult(buildBulkOutput("Published", results));
5164
5703
  }
5165
5704
  };
5166
- var bulk_publish_default = withStandardDecorators(tool68);
5167
- var inputSchema69 = {
5705
+ var bulk_publish_default = withStandardDecorators(tool80);
5706
+ var inputSchema81 = {
5168
5707
  ids: z.array(z.string().uuid()).min(1).max(10).describe("The IDs of the pages to unpublish (max 10)")
5169
5708
  };
5170
- var outputSchema69 = z.object({
5709
+ var outputSchema81 = z.object({
5171
5710
  message: z.string(),
5172
5711
  results: z.array(z.object({
5173
5712
  id: z.string(),
@@ -5181,11 +5720,11 @@ var outputSchema69 = z.object({
5181
5720
  failureCount: z.number(),
5182
5721
  skippedCount: z.number()
5183
5722
  });
5184
- var tool69 = {
5723
+ var tool81 = {
5185
5724
  name: "bulk-unpublish",
5186
5725
  description: "Take multiple pages offline at once (max 10). Pages will remain as drafts. Lists all page names for confirmation. Each result includes a previousVersionId for rollback.",
5187
- inputSchema: inputSchema69,
5188
- outputSchema: outputSchema69,
5726
+ inputSchema: inputSchema81,
5727
+ outputSchema: outputSchema81,
5189
5728
  slices: ["publish"],
5190
5729
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
5191
5730
  handler: async ({ ids }, extra) => {
@@ -5241,7 +5780,7 @@ ${nameList}`;
5241
5780
  return createToolResult(buildBulkOutput("Unpublished", results));
5242
5781
  }
5243
5782
  };
5244
- var bulk_unpublish_default = withStandardDecorators(tool69);
5783
+ var bulk_unpublish_default = withStandardDecorators(tool81);
5245
5784
 
5246
5785
  // src/umbraco-api/tools/helpers/format-date.ts
5247
5786
  function formatDate(iso) {
@@ -5255,11 +5794,11 @@ function formatDate(iso) {
5255
5794
  }
5256
5795
 
5257
5796
  // src/umbraco-api/tools/bulk-operations/post/bulk-schedule-publish.ts
5258
- var inputSchema70 = {
5797
+ var inputSchema82 = {
5259
5798
  ids: z.array(z.string().uuid()).min(1).max(10).describe("The IDs of the pages to schedule for publishing (max 10)"),
5260
5799
  publishDate: z.string().datetime().describe("The future date and time to publish the pages, in ISO 8601 format (e.g. 2026-06-01T09:00:00Z). Must be in the future.")
5261
5800
  };
5262
- var outputSchema70 = z.object({
5801
+ var outputSchema82 = z.object({
5263
5802
  message: z.string(),
5264
5803
  results: z.array(z.object({
5265
5804
  id: z.string(),
@@ -5273,11 +5812,11 @@ var outputSchema70 = z.object({
5273
5812
  failureCount: z.number(),
5274
5813
  skippedCount: z.number()
5275
5814
  });
5276
- var tool70 = {
5815
+ var tool82 = {
5277
5816
  name: "bulk-schedule-publish",
5278
5817
  description: "Schedule multiple pages to publish at a future date (max 10). Provide the date in ISO 8601 format. Lists all page names and the scheduled date for confirmation.",
5279
- inputSchema: inputSchema70,
5280
- outputSchema: outputSchema70,
5818
+ inputSchema: inputSchema82,
5819
+ outputSchema: outputSchema82,
5281
5820
  slices: ["publish"],
5282
5821
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
5283
5822
  handler: async ({ ids, publishDate }, extra) => {
@@ -5322,15 +5861,15 @@ ${nameList}`;
5322
5861
  return createToolResult(buildBulkOutput("Scheduled", results));
5323
5862
  }
5324
5863
  };
5325
- var bulk_schedule_publish_default = withStandardDecorators(tool70);
5326
- var inputSchema71 = {
5864
+ var bulk_schedule_publish_default = withStandardDecorators(tool82);
5865
+ var inputSchema83 = {
5327
5866
  ids: z.array(z.string().uuid()).min(1).max(10).describe("The IDs of the pages to update (max 10)"),
5328
5867
  alias: z.string().describe("The property alias to set (call get-page first to verify it exists on the document type)"),
5329
5868
  value: z.any().describe("The value to set on the property"),
5330
5869
  culture: z.string().optional().describe("The culture code for variant content (omit for invariant properties)"),
5331
5870
  segment: z.string().optional().describe("The segment for segmented content (omit if not using segments)")
5332
5871
  };
5333
- var outputSchema71 = z.object({
5872
+ var outputSchema83 = z.object({
5334
5873
  message: z.string(),
5335
5874
  results: z.array(z.object({
5336
5875
  id: z.string(),
@@ -5345,11 +5884,11 @@ var outputSchema71 = z.object({
5345
5884
  failureCount: z.number(),
5346
5885
  skippedCount: z.number()
5347
5886
  });
5348
- var tool71 = {
5887
+ var tool83 = {
5349
5888
  name: "bulk-set-property",
5350
5889
  description: "Set the same property value on multiple pages at once (max 10). Call get-page first to verify the property alias exists. For non-string non-block property values (media pickers, content/multi-node pickers, image cropper, slider, color, date, etc.) call get-property-value-template with the editor alias first to see the expected JSON shape. For block-shaped values use bulk-set-block-property (or the per-page block tools \u2014 add-blocklist-block / add-blockgrid-block / add-rte-block / edit-block) instead of hand-constructing the JSON here. Lists all page names and the property change for confirmation. Each successful result includes a previousVersionId for rollback, a previewUrl (draft preview after the change), and a `validation` outcome \u2014 if `valid` is false the changes were saved but the page cannot be published until the listed errors are resolved.",
5351
- inputSchema: inputSchema71,
5352
- outputSchema: outputSchema71,
5890
+ inputSchema: inputSchema83,
5891
+ outputSchema: outputSchema83,
5353
5892
  slices: ["update"],
5354
5893
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
5355
5894
  handler: async ({ ids, alias, value, culture, segment }, extra) => {
@@ -5396,12 +5935,12 @@ ${nameList}`;
5396
5935
  return createToolResult(buildBulkOutput("Updated", results));
5397
5936
  }
5398
5937
  };
5399
- var bulk_set_property_default = withStandardDecorators(tool71);
5400
- var inputSchema72 = {
5938
+ var bulk_set_property_default = withStandardDecorators(tool83);
5939
+ var inputSchema84 = {
5401
5940
  ids: z.array(z.string().uuid()).min(1).max(10).describe("The IDs of the pages to move (max 10)"),
5402
5941
  targetParentId: z.string().uuid().describe("The ID of the destination parent page to move the pages into")
5403
5942
  };
5404
- var outputSchema72 = z.object({
5943
+ var outputSchema84 = z.object({
5405
5944
  message: z.string(),
5406
5945
  results: z.array(z.object({
5407
5946
  id: z.string(),
@@ -5415,11 +5954,11 @@ var outputSchema72 = z.object({
5415
5954
  failureCount: z.number(),
5416
5955
  skippedCount: z.number()
5417
5956
  });
5418
- var tool72 = {
5957
+ var tool84 = {
5419
5958
  name: "bulk-move",
5420
5959
  description: "Move multiple pages to a new parent location (max 10). Shows each page name and target location for confirmation. Restructuring the site tree is hard to undo \u2014 review carefully. Note: previousVersionId in results is for content rollback only and cannot undo a move.",
5421
- inputSchema: inputSchema72,
5422
- outputSchema: outputSchema72,
5960
+ inputSchema: inputSchema84,
5961
+ outputSchema: outputSchema84,
5423
5962
  slices: ["move"],
5424
5963
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
5425
5964
  handler: async ({ ids, targetParentId }, extra) => {
@@ -5472,8 +6011,8 @@ ${nameList}`;
5472
6011
  return createToolResult(buildBulkOutput("Moved", results));
5473
6012
  }
5474
6013
  };
5475
- var bulk_move_default = withStandardDecorators(tool72);
5476
- var inputSchema73 = {
6014
+ var bulk_move_default = withStandardDecorators(tool84);
6015
+ var inputSchema85 = {
5477
6016
  ids: z.array(z.string().uuid()).min(1).max(10).describe("The IDs of the pages to update (max 10)"),
5478
6017
  contentTypeKey: z.string().uuid().describe("The block element type key to target. Use inspect-blocks to find this."),
5479
6018
  propertyAlias: z.string().describe("The document property alias containing the blocks (e.g. 'contentRows'). Use inspect-blocks to find this."),
@@ -5484,7 +6023,7 @@ var inputSchema73 = {
5484
6023
  culture: z.string().nullable().optional().describe("Culture code if the document property is variant"),
5485
6024
  segment: z.string().nullable().optional().describe("Segment if the document property is variant")
5486
6025
  };
5487
- var outputSchema73 = z.object({
6026
+ var outputSchema85 = z.object({
5488
6027
  message: z.string(),
5489
6028
  results: z.array(z.object({
5490
6029
  id: z.string(),
@@ -5502,10 +6041,10 @@ var outputSchema73 = z.object({
5502
6041
  skippedCount: z.number(),
5503
6042
  totalBlocksUpdated: z.number()
5504
6043
  });
5505
- function isBlockListOrGridValue3(value) {
6044
+ function isBlockListOrGridValue2(value) {
5506
6045
  return value !== null && typeof value === "object" && !Array.isArray(value) && Array.isArray(value.contentData);
5507
6046
  }
5508
- function isRteWithBlocks3(value) {
6047
+ function isRteWithBlocks2(value) {
5509
6048
  return value !== null && typeof value === "object" && !Array.isArray(value) && typeof value.markup === "string" && value.blocks !== null && typeof value.blocks === "object" && Array.isArray(value.blocks?.contentData);
5510
6049
  }
5511
6050
  function findMatchingBlocks(doc, propertyAlias, contentTypeKey) {
@@ -5513,18 +6052,18 @@ function findMatchingBlocks(doc, propertyAlias, contentTypeKey) {
5513
6052
  const prop = allValues.find((v) => v.alias === propertyAlias);
5514
6053
  if (!prop) return [];
5515
6054
  let contentData = [];
5516
- if (isBlockListOrGridValue3(prop.value)) {
6055
+ if (isBlockListOrGridValue2(prop.value)) {
5517
6056
  contentData = prop.value.contentData;
5518
- } else if (isRteWithBlocks3(prop.value)) {
6057
+ } else if (isRteWithBlocks2(prop.value)) {
5519
6058
  contentData = prop.value.blocks.contentData;
5520
6059
  }
5521
6060
  return contentData.filter((block) => block.contentTypeKey === contentTypeKey).map((block) => ({ contentKey: block.key ?? "" })).filter((b) => b.contentKey !== "");
5522
6061
  }
5523
- var tool73 = {
6062
+ var tool85 = {
5524
6063
  name: "bulk-set-block-property",
5525
6064
  description: "Update properties on blocks of a specific type across multiple pages (max 10). Targets all blocks matching the given element type within the specified property. Use inspect-blocks first on a sample page to find contentTypeKey and propertyAlias. For non-string property values inside the block (media pickers, content pickers, image cropper, slider, color, date, etc.) call get-property-value-template with the editor alias first to see the expected JSON shape. Changes are saved but NOT published. You will be asked to confirm before updating. Each successful per-page result includes a previewUrl (parent page draft preview) and a `validation` outcome \u2014 if `valid` is false the changes were saved but the page cannot be published until the listed errors are resolved.",
5526
- inputSchema: inputSchema73,
5527
- outputSchema: outputSchema73,
6065
+ inputSchema: inputSchema85,
6066
+ outputSchema: outputSchema85,
5528
6067
  slices: ["update"],
5529
6068
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
5530
6069
  handler: async ({ ids, contentTypeKey, propertyAlias, values, culture, segment }, extra) => {
@@ -5704,10 +6243,10 @@ Changes will be saved but not published.`;
5704
6243
  });
5705
6244
  }
5706
6245
  };
5707
- var bulk_set_block_property_default = withStandardDecorators(tool73);
6246
+ var bulk_set_block_property_default = withStandardDecorators(tool85);
5708
6247
 
5709
6248
  // src/umbraco-api/tools/bulk-operations/index.ts
5710
- var collection13 = {
6249
+ var collection14 = {
5711
6250
  metadata: {
5712
6251
  name: "bulk-operations",
5713
6252
  displayName: "Bulk Operations",
@@ -5715,7 +6254,7 @@ var collection13 = {
5715
6254
  },
5716
6255
  tools: () => [bulk_publish_default, bulk_unpublish_default, bulk_schedule_publish_default, bulk_set_property_default, bulk_move_default, bulk_set_block_property_default]
5717
6256
  };
5718
- var bulk_operations_default = collection13;
6257
+ var bulk_operations_default = collection14;
5719
6258
 
5720
6259
  // src/umbraco-api/tools/member-reporting/get/member-type-helper.ts
5721
6260
  function memberTypeToString(memberType) {
@@ -5729,12 +6268,12 @@ function memberTypeToString(memberType) {
5729
6268
  }
5730
6269
 
5731
6270
  // src/umbraco-api/tools/member/get/search-members.ts
5732
- var inputSchema74 = {
6271
+ var inputSchema86 = {
5733
6272
  query: z.string().describe("Search term to find members by name or email address"),
5734
6273
  take: z.number().optional().default(20).describe("Number of results to return (default 20)"),
5735
6274
  skip: z.number().optional().default(0).describe("Number of results to skip for pagination")
5736
6275
  };
5737
- var outputSchema74 = z.object({
6276
+ var outputSchema86 = z.object({
5738
6277
  items: z.array(z.object({
5739
6278
  id: z.string(),
5740
6279
  name: z.string(),
@@ -5745,11 +6284,11 @@ var outputSchema74 = z.object({
5745
6284
  })).describe("Matching members"),
5746
6285
  total: z.number().describe("Total number of matches")
5747
6286
  });
5748
- var tool74 = {
6287
+ var tool86 = {
5749
6288
  name: "search-members",
5750
6289
  description: "Search for members by name or email address. Returns matching members with their approval and lockout status. Use get-member for full profile details.",
5751
- inputSchema: inputSchema74,
5752
- outputSchema: outputSchema74,
6290
+ inputSchema: inputSchema86,
6291
+ outputSchema: outputSchema86,
5753
6292
  slices: ["search"],
5754
6293
  annotations: { readOnlyHint: true },
5755
6294
  handler: async ({ query, take, skip }) => {
@@ -5769,7 +6308,7 @@ var tool74 = {
5769
6308
  });
5770
6309
  }
5771
6310
  };
5772
- var search_members_default = withStandardDecorators(tool74);
6311
+ var search_members_default = withStandardDecorators(tool86);
5773
6312
 
5774
6313
  // src/umbraco-api/tools/member/sensitive-data-access.ts
5775
6314
  async function checkSensitiveDataAccess() {
@@ -5779,10 +6318,10 @@ async function checkSensitiveDataAccess() {
5779
6318
  }
5780
6319
 
5781
6320
  // src/umbraco-api/tools/member/get/get-member.ts
5782
- var inputSchema75 = {
6321
+ var inputSchema87 = {
5783
6322
  id: z.string().uuid().describe("The ID of the member to retrieve")
5784
6323
  };
5785
- var outputSchema75 = z.object({
6324
+ var outputSchema87 = z.object({
5786
6325
  id: z.string(),
5787
6326
  name: z.string(),
5788
6327
  email: z.string(),
@@ -5802,11 +6341,11 @@ var outputSchema75 = z.object({
5802
6341
  lastPasswordChangeDate: z.string().nullable(),
5803
6342
  sensitiveDataAccessible: z.boolean().describe("Whether the calling API user can see real values for isApproved / isLockedOut / isTwoFactorEnabled / lastLoginDate. False means those fields are null in this response \u2014 grant Sensitive Data group access to the API user to see them.")
5804
6343
  });
5805
- var tool75 = {
6344
+ var tool87 = {
5806
6345
  name: "get-member",
5807
6346
  description: "Get the full profile of a member including their groups, properties, approval status, and login history.",
5808
- inputSchema: inputSchema75,
5809
- outputSchema: outputSchema75,
6347
+ inputSchema: inputSchema87,
6348
+ outputSchema: outputSchema87,
5810
6349
  slices: ["read"],
5811
6350
  annotations: { readOnlyHint: true },
5812
6351
  handler: async ({ id }) => {
@@ -5832,12 +6371,12 @@ var tool75 = {
5832
6371
  });
5833
6372
  }
5834
6373
  };
5835
- var get_member_default = withStandardDecorators(tool75);
5836
- var inputSchema76 = {
6374
+ var get_member_default = withStandardDecorators(tool87);
6375
+ var inputSchema88 = {
5837
6376
  take: z.number().optional().default(50).describe("Number of results to return (default 50)"),
5838
6377
  skip: z.number().optional().default(0).describe("Number of results to skip for pagination")
5839
6378
  };
5840
- var outputSchema76 = z.object({
6379
+ var outputSchema88 = z.object({
5841
6380
  items: z.array(z.object({
5842
6381
  id: z.string(),
5843
6382
  alias: z.string(),
@@ -5845,11 +6384,11 @@ var outputSchema76 = z.object({
5845
6384
  })).describe("Available member types"),
5846
6385
  total: z.number().describe("Total number of member types")
5847
6386
  });
5848
- var tool76 = {
6387
+ var tool88 = {
5849
6388
  name: "list-member-types",
5850
6389
  description: "List available member types. Use this before create-member to find a valid member type ID.",
5851
- inputSchema: inputSchema76,
5852
- outputSchema: outputSchema76,
6390
+ inputSchema: inputSchema88,
6391
+ outputSchema: outputSchema88,
5853
6392
  slices: ["list"],
5854
6393
  annotations: { readOnlyHint: true },
5855
6394
  handler: async ({ take, skip }) => {
@@ -5865,8 +6404,8 @@ var tool76 = {
5865
6404
  });
5866
6405
  }
5867
6406
  };
5868
- var list_member_types_default = withStandardDecorators(tool76);
5869
- var inputSchema77 = {
6407
+ var list_member_types_default = withStandardDecorators(tool88);
6408
+ var inputSchema89 = {
5870
6409
  email: z.string().email().describe("The email address for the new member"),
5871
6410
  username: z.string().describe("The username for the new member"),
5872
6411
  name: z.string().describe("The display name for the new member"),
@@ -5879,17 +6418,17 @@ var inputSchema77 = {
5879
6418
  value: z.any().describe("The property value")
5880
6419
  })).optional().describe("Custom property values to set on the new member")
5881
6420
  };
5882
- var outputSchema77 = z.object({
6421
+ var outputSchema89 = z.object({
5883
6422
  message: z.string(),
5884
6423
  id: z.string(),
5885
6424
  name: z.string(),
5886
6425
  email: z.string()
5887
6426
  });
5888
- var tool77 = {
6427
+ var tool89 = {
5889
6428
  name: "create-member",
5890
6429
  description: "Create a new member account. Use update-member to change details on an existing member \u2014 search-members first if unsure whether the email or username is already taken. Call list-member-types to find a valid memberTypeId and list-member-groups for group IDs.",
5891
- inputSchema: inputSchema77,
5892
- outputSchema: outputSchema77,
6430
+ inputSchema: inputSchema89,
6431
+ outputSchema: outputSchema89,
5893
6432
  slices: ["create"],
5894
6433
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
5895
6434
  handler: async ({ email, username, name, password, memberTypeId, isApproved, groups, values }) => {
@@ -5943,8 +6482,8 @@ var tool77 = {
5943
6482
  });
5944
6483
  }
5945
6484
  };
5946
- var create_member_default = withStandardDecorators(tool77);
5947
- var inputSchema78 = {
6485
+ var create_member_default = withStandardDecorators(tool89);
6486
+ var inputSchema90 = {
5948
6487
  id: z.string().uuid().describe("The ID of the member to update"),
5949
6488
  name: z.string().optional().describe("The new display name for the member"),
5950
6489
  email: z.string().email().optional().describe("The new email address for the member"),
@@ -5959,17 +6498,17 @@ var inputSchema78 = {
5959
6498
  value: z.any().describe("The new property value")
5960
6499
  })).optional().describe("Custom property values to update")
5961
6500
  };
5962
- var outputSchema78 = z.object({
6501
+ var outputSchema90 = z.object({
5963
6502
  message: z.string(),
5964
6503
  id: z.string(),
5965
6504
  name: z.string(),
5966
6505
  email: z.string()
5967
6506
  });
5968
- var tool78 = {
6507
+ var tool90 = {
5969
6508
  name: "update-member",
5970
6509
  description: "Update a member's profile, credentials (username / password / 2FA toggle), approval status, groups, or custom properties. Call get-member first to see current values. Password resets require an extra confirmation.",
5971
- inputSchema: inputSchema78,
5972
- outputSchema: outputSchema78,
6510
+ inputSchema: inputSchema90,
6511
+ outputSchema: outputSchema90,
5973
6512
  slices: ["update"],
5974
6513
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
5975
6514
  handler: async ({ id, name, email, username, newPassword, isTwoFactorEnabled, isApproved, isLockedOut, groups, values }, extra) => {
@@ -6025,21 +6564,21 @@ var tool78 = {
6025
6564
  });
6026
6565
  }
6027
6566
  };
6028
- var update_member_default = withStandardDecorators(tool78);
6029
- var inputSchema79 = {
6567
+ var update_member_default = withStandardDecorators(tool90);
6568
+ var inputSchema91 = {
6030
6569
  id: z.string().uuid().describe("The ID of the member to permanently delete")
6031
6570
  };
6032
- var outputSchema79 = z.object({
6571
+ var outputSchema91 = z.object({
6033
6572
  message: z.string(),
6034
6573
  id: z.string(),
6035
6574
  name: z.string(),
6036
6575
  email: z.string()
6037
6576
  });
6038
- var tool79 = {
6577
+ var tool91 = {
6039
6578
  name: "delete-member",
6040
6579
  description: "Permanently delete a member. This cannot be undone \u2014 there is no recycle bin for members. You will be asked to confirm.",
6041
- inputSchema: inputSchema79,
6042
- outputSchema: outputSchema79,
6580
+ inputSchema: inputSchema91,
6581
+ outputSchema: outputSchema91,
6043
6582
  slices: ["delete"],
6044
6583
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
6045
6584
  handler: async ({ id }, extra) => {
@@ -6061,10 +6600,10 @@ var tool79 = {
6061
6600
  });
6062
6601
  }
6063
6602
  };
6064
- var delete_member_default = withStandardDecorators(tool79);
6603
+ var delete_member_default = withStandardDecorators(tool91);
6065
6604
 
6066
6605
  // src/umbraco-api/tools/member/index.ts
6067
- var collection14 = {
6606
+ var collection15 = {
6068
6607
  metadata: {
6069
6608
  name: "member",
6070
6609
  displayName: "Members",
@@ -6072,23 +6611,23 @@ var collection14 = {
6072
6611
  },
6073
6612
  tools: () => [search_members_default, get_member_default, list_member_types_default, create_member_default, update_member_default, delete_member_default]
6074
6613
  };
6075
- var member_default = collection14;
6076
- var inputSchema80 = {
6614
+ var member_default = collection15;
6615
+ var inputSchema92 = {
6077
6616
  take: z.number().optional().default(50).describe("Number of results to return (default 50)"),
6078
6617
  skip: z.number().optional().default(0).describe("Number of results to skip for pagination")
6079
6618
  };
6080
- var outputSchema80 = z.object({
6619
+ var outputSchema92 = z.object({
6081
6620
  items: z.array(z.object({
6082
6621
  id: z.string(),
6083
6622
  name: z.string()
6084
6623
  })).describe("Member groups"),
6085
6624
  total: z.number().describe("Total number of member groups")
6086
6625
  });
6087
- var tool80 = {
6626
+ var tool92 = {
6088
6627
  name: "list-member-groups",
6089
6628
  description: "List all member groups. Use group names when creating or updating members to assign them to groups.",
6090
- inputSchema: inputSchema80,
6091
- outputSchema: outputSchema80,
6629
+ inputSchema: inputSchema92,
6630
+ outputSchema: outputSchema92,
6092
6631
  slices: ["list"],
6093
6632
  annotations: { readOnlyHint: true },
6094
6633
  handler: async ({ take, skip }) => {
@@ -6104,20 +6643,20 @@ var tool80 = {
6104
6643
  });
6105
6644
  }
6106
6645
  };
6107
- var list_member_groups_default = withStandardDecorators(tool80);
6108
- var inputSchema81 = {
6646
+ var list_member_groups_default = withStandardDecorators(tool92);
6647
+ var inputSchema93 = {
6109
6648
  name: z.string().describe("The name of the new member group")
6110
6649
  };
6111
- var outputSchema81 = z.object({
6650
+ var outputSchema93 = z.object({
6112
6651
  message: z.string(),
6113
6652
  id: z.string(),
6114
6653
  name: z.string()
6115
6654
  });
6116
- var tool81 = {
6655
+ var tool93 = {
6117
6656
  name: "create-member-group",
6118
6657
  description: "Create a new member group. Groups are referenced by name when assigning members via create-member or update-member. Use list-member-groups to check existing groups first.",
6119
- inputSchema: inputSchema81,
6120
- outputSchema: outputSchema81,
6658
+ inputSchema: inputSchema93,
6659
+ outputSchema: outputSchema93,
6121
6660
  slices: ["create"],
6122
6661
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
6123
6662
  handler: async ({ name }) => {
@@ -6130,20 +6669,20 @@ var tool81 = {
6130
6669
  });
6131
6670
  }
6132
6671
  };
6133
- var create_member_group_default = withStandardDecorators(tool81);
6134
- var inputSchema82 = {
6672
+ var create_member_group_default = withStandardDecorators(tool93);
6673
+ var inputSchema94 = {
6135
6674
  id: z.string().uuid().describe("The ID of the member group to delete")
6136
6675
  };
6137
- var outputSchema82 = z.object({
6676
+ var outputSchema94 = z.object({
6138
6677
  message: z.string(),
6139
6678
  id: z.string(),
6140
6679
  name: z.string()
6141
6680
  });
6142
- var tool82 = {
6681
+ var tool94 = {
6143
6682
  name: "delete-member-group",
6144
6683
  description: "Delete a member group. Members in this group will lose the group assignment. You will be asked to confirm.",
6145
- inputSchema: inputSchema82,
6146
- outputSchema: outputSchema82,
6684
+ inputSchema: inputSchema94,
6685
+ outputSchema: outputSchema94,
6147
6686
  slices: ["delete"],
6148
6687
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
6149
6688
  handler: async ({ id }, extra) => {
@@ -6164,10 +6703,10 @@ var tool82 = {
6164
6703
  });
6165
6704
  }
6166
6705
  };
6167
- var delete_member_group_default = withStandardDecorators(tool82);
6706
+ var delete_member_group_default = withStandardDecorators(tool94);
6168
6707
 
6169
6708
  // src/umbraco-api/tools/member-group/index.ts
6170
- var collection15 = {
6709
+ var collection16 = {
6171
6710
  metadata: {
6172
6711
  name: "member-group",
6173
6712
  displayName: "Member Groups",
@@ -6175,74 +6714,82 @@ var collection15 = {
6175
6714
  },
6176
6715
  tools: () => [list_member_groups_default, create_member_group_default, delete_member_group_default]
6177
6716
  };
6178
- var member_group_default = collection15;
6179
- var inputSchema83 = {};
6180
- var outputSchema83 = z.object({
6181
- totalMembers: z.number().describe("Total number of members across all types and groups"),
6717
+ var member_group_default = collection16;
6718
+ var inputSchema95 = {};
6719
+ var outputSchema95 = z.object({
6720
+ totalMembers: z.number().describe("Total number of members across all types and groups (exact, server-reported \u2014 not capped by the sample)."),
6182
6721
  byType: z.array(z.object({
6183
6722
  memberType: z.string().describe("Member type alias or name"),
6184
6723
  count: z.number()
6185
- })).describe("Member counts grouped by member type. Maps naturally to a pie or bar chart."),
6724
+ })).describe("Member counts grouped by member type, computed from a sample of up to 500 members \u2014 may undercount byType on larger sites (byType counts can sum to less than totalMembers). Maps naturally to a pie or bar chart."),
6186
6725
  byGroup: z.array(z.object({
6187
6726
  group: z.string().describe("Member group name"),
6188
6727
  count: z.number()
6189
- })).describe("Member counts grouped by member group. Members with no group are excluded.")
6728
+ })).describe("Member counts grouped by member group \u2014 exact, server-reported per-group totals (uncapped). Members with no group are excluded.")
6190
6729
  });
6191
6730
  var PAGE_SIZE = 100;
6192
6731
  var MEMBER_CAP = 500;
6193
- var tool83 = {
6732
+ var tool95 = {
6194
6733
  name: "report-member-count",
6195
- description: "Returns a breakdown of member counts by type and group. Analyses up to 500 members \u2014 results may be incomplete on larger sites. Data maps naturally to pie or bar charts.",
6196
- inputSchema: inputSchema83,
6197
- outputSchema: outputSchema83,
6734
+ description: "Returns a breakdown of member counts by type and group. totalMembers and the byGroup counts are exact (server-reported, uncapped); the byType breakdown is computed from a sample of up to 500 members, so it may undercount on larger sites. Data maps naturally to pie or bar charts.",
6735
+ inputSchema: inputSchema95,
6736
+ outputSchema: outputSchema95,
6198
6737
  slices: ["read"],
6199
6738
  annotations: { readOnlyHint: true },
6200
6739
  handler: async () => {
6201
- const allMembers = [];
6740
+ const sampledMembers = [];
6741
+ let totalMembers = 0;
6202
6742
  let cursor = encodeCursor({ s: 0, t: PAGE_SIZE });
6203
- while (allMembers.length < MEMBER_CAP) {
6743
+ while (sampledMembers.length < MEMBER_CAP) {
6204
6744
  const result = await chainCms("find-member", { cursor, orderBy: "username" });
6205
6745
  if (!result.ok) return result.errorResult;
6206
6746
  const data = result.data;
6207
6747
  const items = data.items ?? [];
6208
- allMembers.push(...items);
6748
+ if (typeof data.total === "number") totalMembers = data.total;
6749
+ sampledMembers.push(...items);
6209
6750
  const nextCursor = data.nextCursor;
6210
6751
  if (!nextCursor || items.length === 0) break;
6211
6752
  cursor = nextCursor;
6212
6753
  }
6754
+ if (totalMembers === 0 && sampledMembers.length > 0) totalMembers = sampledMembers.length;
6213
6755
  const typeCounts = /* @__PURE__ */ new Map();
6214
- for (const member of allMembers) {
6756
+ for (const member of sampledMembers) {
6215
6757
  const memberType = memberTypeToString(member.memberType);
6216
6758
  typeCounts.set(memberType, (typeCounts.get(memberType) ?? 0) + 1);
6217
6759
  }
6218
6760
  const groupResult = await chainCms("get-all-member-groups", {});
6219
6761
  if (!groupResult.ok) return groupResult.errorResult;
6220
6762
  const allGroups = groupResult.data.items ?? [];
6763
+ const named = allGroups.filter((g) => typeof g.name === "string");
6764
+ const perGroupResults = await Promise.all(
6765
+ named.map(
6766
+ (g) => chainCms("find-member", {
6767
+ memberGroupName: g.name,
6768
+ cursor: encodeCursor({ s: 0, t: 1 }),
6769
+ orderBy: "username"
6770
+ })
6771
+ )
6772
+ );
6221
6773
  const byGroup = [];
6222
- for (const group of allGroups) {
6223
- if (!group.name) continue;
6224
- const countResult = await chainCms("find-member", {
6225
- memberGroupName: group.name,
6226
- cursor: encodeCursor({ s: 0, t: 1 }),
6227
- orderBy: "username"
6228
- });
6229
- if (!countResult.ok) return countResult.errorResult;
6230
- byGroup.push({ group: group.name, count: countResult.data.total ?? 0 });
6774
+ for (let i = 0; i < named.length; i++) {
6775
+ const r = perGroupResults[i];
6776
+ if (!r.ok) return r.errorResult;
6777
+ byGroup.push({ group: named[i].name, count: r.data.total ?? 0 });
6231
6778
  }
6232
6779
  return createToolResult({
6233
- totalMembers: allMembers.length,
6780
+ totalMembers,
6234
6781
  byType: Array.from(typeCounts.entries()).map(([memberType, count]) => ({ memberType, count })).sort((a, b) => b.count - a.count),
6235
6782
  byGroup: byGroup.sort((a, b) => b.count - a.count)
6236
6783
  });
6237
6784
  }
6238
6785
  };
6239
- var report_member_count_default = withStandardDecorators(tool83);
6240
- var inputSchema84 = {
6786
+ var report_member_count_default = withStandardDecorators(tool95);
6787
+ var inputSchema96 = {
6241
6788
  groupName: z.string().describe("The name of the member group to filter by. Use list-member-groups to find valid group names."),
6242
6789
  take: z.number().optional().default(50).describe("Number of results to return (default 50)"),
6243
6790
  skip: z.number().optional().default(0).describe("Number of results to skip for pagination (default 0)")
6244
6791
  };
6245
- var outputSchema84 = z.object({
6792
+ var outputSchema96 = z.object({
6246
6793
  groupName: z.string().describe("The group name used for this query"),
6247
6794
  items: z.array(z.object({
6248
6795
  id: z.string(),
@@ -6253,11 +6800,11 @@ var outputSchema84 = z.object({
6253
6800
  })).describe("Members belonging to the specified group"),
6254
6801
  total: z.number().describe("Total number of members in this group")
6255
6802
  });
6256
- var tool84 = {
6803
+ var tool96 = {
6257
6804
  name: "report-members-by-group",
6258
6805
  description: "List members belonging to a specific group. Use list-member-groups to find valid group names.",
6259
- inputSchema: inputSchema84,
6260
- outputSchema: outputSchema84,
6806
+ inputSchema: inputSchema96,
6807
+ outputSchema: outputSchema96,
6261
6808
  slices: ["read"],
6262
6809
  annotations: { readOnlyHint: true },
6263
6810
  handler: async ({ groupName, take, skip }) => {
@@ -6273,8 +6820,9 @@ var tool84 = {
6273
6820
  detail: `No member group named "${groupName}". Use list-member-groups to see existing group names.`
6274
6821
  });
6275
6822
  }
6823
+ const canonicalGroupName = groupMatch.name ?? groupName;
6276
6824
  const result = await chainCms("find-member", {
6277
- memberGroupName: groupMatch.name,
6825
+ memberGroupName: canonicalGroupName,
6278
6826
  cursor: buildChainedCursor(skip, take),
6279
6827
  orderBy: "username"
6280
6828
  });
@@ -6293,13 +6841,13 @@ var tool84 = {
6293
6841
  });
6294
6842
  }
6295
6843
  };
6296
- var report_members_by_group_default = withStandardDecorators(tool84);
6297
- var inputSchema85 = {
6844
+ var report_members_by_group_default = withStandardDecorators(tool96);
6845
+ var inputSchema97 = {
6298
6846
  inactiveDays: z.number().optional().default(90).describe("Number of days without a login before a member is considered inactive (default 90)"),
6299
6847
  take: z.number().optional().default(50).describe("Number of results to return after filtering (default 50)"),
6300
6848
  skip: z.number().optional().default(0).describe("Number of results to skip for pagination (default 0)")
6301
6849
  };
6302
- var outputSchema85 = z.object({
6850
+ var outputSchema97 = z.object({
6303
6851
  items: z.array(z.object({
6304
6852
  id: z.string(),
6305
6853
  name: z.string(),
@@ -6314,11 +6862,11 @@ var outputSchema85 = z.object({
6314
6862
  });
6315
6863
  var PAGE_SIZE2 = 100;
6316
6864
  var MEMBER_CAP2 = 500;
6317
- var tool85 = {
6865
+ var tool97 = {
6318
6866
  name: "report-member-activity",
6319
6867
  description: "Find members who haven't logged in within a given number of days. Default threshold is 90 days. Members who have never logged in are always included. Analyses up to 500 members. Useful for identifying inactive accounts.",
6320
- inputSchema: inputSchema85,
6321
- outputSchema: outputSchema85,
6868
+ inputSchema: inputSchema97,
6869
+ outputSchema: outputSchema97,
6322
6870
  slices: ["read"],
6323
6871
  annotations: { readOnlyHint: true },
6324
6872
  handler: async ({ inactiveDays, take, skip }) => {
@@ -6372,10 +6920,10 @@ var tool85 = {
6372
6920
  });
6373
6921
  }
6374
6922
  };
6375
- var report_member_activity_default = withStandardDecorators(tool85);
6923
+ var report_member_activity_default = withStandardDecorators(tool97);
6376
6924
 
6377
6925
  // src/umbraco-api/tools/member-reporting/index.ts
6378
- var collection16 = {
6926
+ var collection17 = {
6379
6927
  metadata: {
6380
6928
  name: "member-reporting",
6381
6929
  displayName: "Member Reporting",
@@ -6383,22 +6931,22 @@ var collection16 = {
6383
6931
  },
6384
6932
  tools: () => [report_member_count_default, report_members_by_group_default, report_member_activity_default]
6385
6933
  };
6386
- var member_reporting_default = collection16;
6387
- var inputSchema86 = {
6934
+ var member_reporting_default = collection17;
6935
+ var inputSchema98 = {
6388
6936
  id: z.string().uuid().describe("The ID of the page to check publish status for")
6389
6937
  };
6390
- var outputSchema86 = z.object({
6938
+ var outputSchema98 = z.object({
6391
6939
  id: z.string(),
6392
6940
  name: z.string(),
6393
6941
  isPublished: z.boolean(),
6394
6942
  state: z.string(),
6395
6943
  variants: z.array(publishStatusVariantSchema)
6396
6944
  });
6397
- var tool86 = {
6945
+ var tool98 = {
6398
6946
  name: "get-publish-status",
6399
6947
  description: "View a page's current publish state including any scheduled publish or unpublish dates. Shows per-variant status for multilingual sites. Returns empty variants for unpublished pages.",
6400
- inputSchema: inputSchema86,
6401
- outputSchema: outputSchema86,
6948
+ inputSchema: inputSchema98,
6949
+ outputSchema: outputSchema98,
6402
6950
  slices: ["read"],
6403
6951
  annotations: { readOnlyHint: true },
6404
6952
  handler: async ({ id }) => {
@@ -6414,24 +6962,24 @@ var tool86 = {
6414
6962
  });
6415
6963
  }
6416
6964
  };
6417
- var get_publish_status_default = withStandardDecorators(tool86);
6418
- var inputSchema87 = {
6965
+ var get_publish_status_default = withStandardDecorators(tool98);
6966
+ var inputSchema99 = {
6419
6967
  id: z.string().uuid().describe("The ID of the page to schedule for publish"),
6420
6968
  publishDate: z.string().datetime().describe("The date and time to publish the page (ISO 8601 format, must be in the future)"),
6421
6969
  culture: z.string().optional().describe("Culture code for variant-specific scheduling (e.g. 'en-US'). Omit for invariant content.")
6422
6970
  };
6423
- var outputSchema87 = z.object({
6971
+ var outputSchema99 = z.object({
6424
6972
  message: z.string(),
6425
6973
  id: z.string(),
6426
6974
  name: z.string(),
6427
6975
  scheduledDate: z.string(),
6428
6976
  previewUrl: previewUrlSchema
6429
6977
  });
6430
- var tool87 = {
6978
+ var tool99 = {
6431
6979
  name: "schedule-publish",
6432
6980
  description: "Schedule a page to publish at a future date. Provide the date in ISO 8601 format (must be in the future). Optionally specify a culture for variant-specific scheduling. You will be asked to confirm.",
6433
- inputSchema: inputSchema87,
6434
- outputSchema: outputSchema87,
6981
+ inputSchema: inputSchema99,
6982
+ outputSchema: outputSchema99,
6435
6983
  slices: ["publish"],
6436
6984
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
6437
6985
  handler: async ({ id, publishDate, culture }, extra) => {
@@ -6456,22 +7004,22 @@ var tool87 = {
6456
7004
  });
6457
7005
  }
6458
7006
  };
6459
- var schedule_publish_default = withStandardDecorators(tool87);
6460
- var inputSchema88 = {
7007
+ var schedule_publish_default = withStandardDecorators(tool99);
7008
+ var inputSchema100 = {
6461
7009
  id: z.string().uuid().describe("The ID of the page whose scheduled publish should be cancelled"),
6462
7010
  culture: z.string().optional().describe("Culture code to check for a scheduled variant (e.g. 'en-US'). Omit for invariant content.")
6463
7011
  };
6464
- var outputSchema88 = z.object({
7012
+ var outputSchema100 = z.object({
6465
7013
  message: z.string(),
6466
7014
  id: z.string(),
6467
7015
  name: z.string(),
6468
7016
  previewUrl: previewUrlSchema
6469
7017
  });
6470
- var tool88 = {
7018
+ var tool100 = {
6471
7019
  name: "cancel-schedule",
6472
7020
  description: "Cancel a pending scheduled publish for a page. Use get-publish-status to verify the page has a pending schedule. You will be asked to confirm.",
6473
- inputSchema: inputSchema88,
6474
- outputSchema: outputSchema88,
7021
+ inputSchema: inputSchema100,
7022
+ outputSchema: outputSchema100,
6475
7023
  slices: ["publish"],
6476
7024
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
6477
7025
  handler: async ({ id, culture }, extra) => {
@@ -6509,10 +7057,10 @@ var tool88 = {
6509
7057
  });
6510
7058
  }
6511
7059
  };
6512
- var cancel_schedule_default = withStandardDecorators(tool88);
7060
+ var cancel_schedule_default = withStandardDecorators(tool100);
6513
7061
 
6514
7062
  // src/umbraco-api/tools/scheduling/index.ts
6515
- var collection17 = {
7063
+ var collection18 = {
6516
7064
  metadata: {
6517
7065
  name: "scheduling",
6518
7066
  displayName: "Scheduling",
@@ -6520,13 +7068,13 @@ var collection17 = {
6520
7068
  },
6521
7069
  tools: () => [get_publish_status_default, schedule_publish_default, cancel_schedule_default]
6522
7070
  };
6523
- var scheduling_default = collection17;
6524
- var inputSchema89 = {
7071
+ var scheduling_default = collection18;
7072
+ var inputSchema101 = {
6525
7073
  take: z.number().optional().default(50).describe("Number of results to return (default 50)"),
6526
7074
  skip: z.number().optional().default(0).describe("Number of results to skip for pagination"),
6527
7075
  filter: z.string().optional().describe("Filter redirects by URL")
6528
7076
  };
6529
- var outputSchema89 = z.object({
7077
+ var outputSchema101 = z.object({
6530
7078
  items: z.array(
6531
7079
  z.object({
6532
7080
  id: z.string(),
@@ -6538,11 +7086,11 @@ var outputSchema89 = z.object({
6538
7086
  ).describe("URL redirects"),
6539
7087
  total: z.number().describe("Total number of redirects")
6540
7088
  });
6541
- var tool89 = {
7089
+ var tool101 = {
6542
7090
  name: "list-redirects",
6543
7091
  description: "List URL redirects configured on the site. Optionally filter by URL. Shows the original URL, destination, and whether the redirect was created automatically by Umbraco.",
6544
- inputSchema: inputSchema89,
6545
- outputSchema: outputSchema89,
7092
+ inputSchema: inputSchema101,
7093
+ outputSchema: outputSchema101,
6546
7094
  slices: ["list"],
6547
7095
  annotations: { readOnlyHint: true },
6548
7096
  handler: async ({ take, skip, filter }) => {
@@ -6564,11 +7112,11 @@ var tool89 = {
6564
7112
  });
6565
7113
  }
6566
7114
  };
6567
- var list_redirects_default = withStandardDecorators(tool89);
6568
- var inputSchema90 = {
7115
+ var list_redirects_default = withStandardDecorators(tool101);
7116
+ var inputSchema102 = {
6569
7117
  id: z.string().uuid().describe("The ID of the redirect to retrieve")
6570
7118
  };
6571
- var outputSchema90 = z.object({
7119
+ var outputSchema102 = z.object({
6572
7120
  id: z.string(),
6573
7121
  originalUrl: z.string(),
6574
7122
  destinationUrl: z.string(),
@@ -6576,11 +7124,11 @@ var outputSchema90 = z.object({
6576
7124
  isAutomatic: z.boolean(),
6577
7125
  createDate: z.string()
6578
7126
  });
6579
- var tool90 = {
7127
+ var tool102 = {
6580
7128
  name: "get-redirect",
6581
7129
  description: "View the full details of a URL redirect including when it was created and whether it was automatic. Use list-redirects to find redirect IDs.",
6582
- inputSchema: inputSchema90,
6583
- outputSchema: outputSchema90,
7130
+ inputSchema: inputSchema102,
7131
+ outputSchema: outputSchema102,
6584
7132
  slices: ["read"],
6585
7133
  annotations: { readOnlyHint: true },
6586
7134
  handler: async ({ id }) => {
@@ -6597,17 +7145,17 @@ var tool90 = {
6597
7145
  });
6598
7146
  }
6599
7147
  };
6600
- var get_redirect_default = withStandardDecorators(tool90);
6601
- var inputSchema91 = {};
6602
- var outputSchema91 = z.object({
7148
+ var get_redirect_default = withStandardDecorators(tool102);
7149
+ var inputSchema103 = {};
7150
+ var outputSchema103 = z.object({
6603
7151
  isEnabled: z.boolean(),
6604
7152
  message: z.string()
6605
7153
  });
6606
- var tool91 = {
7154
+ var tool103 = {
6607
7155
  name: "get-redirect-status",
6608
7156
  description: "Check whether automatic URL redirect tracking is enabled on the site. When enabled, Umbraco automatically creates redirects when pages are moved or renamed.",
6609
- inputSchema: inputSchema91,
6610
- outputSchema: outputSchema91,
7157
+ inputSchema: inputSchema103,
7158
+ outputSchema: outputSchema103,
6611
7159
  slices: ["read"],
6612
7160
  annotations: { readOnlyHint: true },
6613
7161
  handler: async () => {
@@ -6620,20 +7168,20 @@ var tool91 = {
6620
7168
  });
6621
7169
  }
6622
7170
  };
6623
- var get_redirect_status_default = withStandardDecorators(tool91);
6624
- var inputSchema92 = {
7171
+ var get_redirect_status_default = withStandardDecorators(tool103);
7172
+ var inputSchema104 = {
6625
7173
  id: z.string().uuid().describe("The ID of the redirect to delete")
6626
7174
  };
6627
- var outputSchema92 = z.object({
7175
+ var outputSchema104 = z.object({
6628
7176
  message: z.string(),
6629
7177
  id: z.string(),
6630
7178
  originalUrl: z.string()
6631
7179
  });
6632
- var tool92 = {
7180
+ var tool104 = {
6633
7181
  name: "delete-redirect",
6634
7182
  description: "Delete a URL redirect. Visitors following the original URL will get a 404 error. You will be asked to confirm.",
6635
- inputSchema: inputSchema92,
6636
- outputSchema: outputSchema92,
7183
+ inputSchema: inputSchema104,
7184
+ outputSchema: outputSchema104,
6637
7185
  slices: ["delete"],
6638
7186
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
6639
7187
  handler: async ({ id }, extra) => {
@@ -6664,10 +7212,10 @@ var tool92 = {
6664
7212
  });
6665
7213
  }
6666
7214
  };
6667
- var delete_redirect_default = withStandardDecorators(tool92);
7215
+ var delete_redirect_default = withStandardDecorators(tool104);
6668
7216
 
6669
7217
  // src/umbraco-api/tools/redirect/index.ts
6670
- var collection18 = {
7218
+ var collection19 = {
6671
7219
  metadata: {
6672
7220
  name: "redirect",
6673
7221
  displayName: "Redirects",
@@ -6675,12 +7223,12 @@ var collection18 = {
6675
7223
  },
6676
7224
  tools: () => [list_redirects_default, get_redirect_default, get_redirect_status_default, delete_redirect_default]
6677
7225
  };
6678
- var redirect_default = collection18;
6679
- var inputSchema93 = {
7226
+ var redirect_default = collection19;
7227
+ var inputSchema105 = {
6680
7228
  id: z.string().uuid().describe("The ID of the content page or media item to look up references for"),
6681
7229
  type: z.enum(["document", "media"]).describe("Whether the ID refers to a content document or a media item")
6682
7230
  };
6683
- var outputSchema93 = z.object({
7231
+ var outputSchema105 = z.object({
6684
7232
  id: z.string(),
6685
7233
  name: z.string(),
6686
7234
  url: z.string(),
@@ -6695,11 +7243,31 @@ var outputSchema93 = z.object({
6695
7243
  ).describe("Pages that reference this item"),
6696
7244
  referenceCount: z.number().describe("Total number of pages referencing this item")
6697
7245
  });
6698
- var tool93 = {
7246
+ async function buildReferencedBy(refItems) {
7247
+ const docRefIds = refItems.filter((ref) => ref.$type === "DocumentReferenceResponseModel").map((ref) => ref.id);
7248
+ const urlsById = await fetchPrimaryPublishedUrlsBatch(docRefIds);
7249
+ return refItems.map((ref) => {
7250
+ if (ref.$type === "DocumentReferenceResponseModel") {
7251
+ return {
7252
+ id: ref.id,
7253
+ name: ref.variants?.[0]?.name ?? ref.name ?? "(unnamed)",
7254
+ url: urlsById.get(ref.id) ?? "",
7255
+ documentType: ref.documentType?.alias ?? ""
7256
+ };
7257
+ }
7258
+ return {
7259
+ id: ref.id,
7260
+ name: ref.name ?? "(unnamed)",
7261
+ url: "",
7262
+ documentType: ""
7263
+ };
7264
+ });
7265
+ }
7266
+ var tool105 = {
6699
7267
  name: "report-content-references",
6700
7268
  description: "Find which pages reference a given content page or media item. Useful before deleting or restructuring content to understand the impact.",
6701
- inputSchema: inputSchema93,
6702
- outputSchema: outputSchema93,
7269
+ inputSchema: inputSchema105,
7270
+ outputSchema: outputSchema105,
6703
7271
  slices: ["read"],
6704
7272
  annotations: { readOnlyHint: true },
6705
7273
  handler: async ({ id, type }) => {
@@ -6709,32 +7277,11 @@ var tool93 = {
6709
7277
  chainCms("get-document-by-id-referenced-by", { id })
6710
7278
  ]);
6711
7279
  let name = "Unknown";
6712
- let url = "";
6713
7280
  if (docResult.ok) {
6714
- const doc = docResult.data;
6715
- name = doc.variants?.[0]?.name ?? "Unknown";
6716
- url = doc.urls?.[0]?.url ?? "";
6717
- }
6718
- const referencedBy = [];
6719
- if (refResult.ok) {
6720
- for (const ref of refResult.data.items ?? []) {
6721
- if (ref.$type === "DocumentReferenceResponseModel") {
6722
- referencedBy.push({
6723
- id: ref.id,
6724
- name: ref.variants?.[0]?.name ?? ref.name ?? "(unnamed)",
6725
- url: ref.urls?.[0]?.url ?? ref.url ?? "",
6726
- documentType: ref.documentType?.alias ?? ""
6727
- });
6728
- } else {
6729
- referencedBy.push({
6730
- id: ref.id,
6731
- name: ref.name ?? "(unnamed)",
6732
- url: "",
6733
- documentType: ""
6734
- });
6735
- }
6736
- }
7281
+ name = docResult.data.variants?.[0]?.name ?? "Unknown";
6737
7282
  }
7283
+ const url = await fetchPrimaryPublishedUrl(id);
7284
+ const referencedBy = refResult.ok ? await buildReferencedBy(refResult.data.items ?? []) : [];
6738
7285
  return createToolResult({
6739
7286
  id,
6740
7287
  name,
@@ -6758,26 +7305,7 @@ var tool93 = {
6758
7305
  const entry = urlResult.data.items?.find((u) => u.id === id);
6759
7306
  url = entry?.urlInfos?.[0]?.url ?? "";
6760
7307
  }
6761
- const referencedBy = [];
6762
- if (refResult.ok) {
6763
- for (const ref of refResult.data.items ?? []) {
6764
- if (ref.$type === "DocumentReferenceResponseModel") {
6765
- referencedBy.push({
6766
- id: ref.id,
6767
- name: ref.variants?.[0]?.name ?? ref.name ?? "(unnamed)",
6768
- url: ref.urls?.[0]?.url ?? ref.url ?? "",
6769
- documentType: ref.documentType?.alias ?? ""
6770
- });
6771
- } else {
6772
- referencedBy.push({
6773
- id: ref.id,
6774
- name: ref.name ?? "(unnamed)",
6775
- url: "",
6776
- documentType: ""
6777
- });
6778
- }
6779
- }
6780
- }
7308
+ const referencedBy = refResult.ok ? await buildReferencedBy(refResult.data.items ?? []) : [];
6781
7309
  return createToolResult({
6782
7310
  id,
6783
7311
  name,
@@ -6789,18 +7317,18 @@ var tool93 = {
6789
7317
  }
6790
7318
  }
6791
7319
  };
6792
- var report_content_references_default = withStandardDecorators(tool93);
7320
+ var report_content_references_default = withStandardDecorators(tool105);
6793
7321
 
6794
7322
  // src/umbraco-api/tools/helpers/link-extractor.ts
6795
7323
  var UUID_REGEX = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi;
6796
- function isBlockListOrGridValue4(value) {
7324
+ function isBlockListOrGridValue3(value) {
6797
7325
  return value !== null && typeof value === "object" && !Array.isArray(value) && Array.isArray(value.contentData);
6798
7326
  }
6799
- function isRteWithBlocks4(value) {
7327
+ function isRteWithBlocks3(value) {
6800
7328
  return value !== null && typeof value === "object" && !Array.isArray(value) && typeof value.markup === "string" && value.blocks !== null && typeof value.blocks === "object" && Array.isArray(value.blocks?.contentData);
6801
7329
  }
6802
7330
  function isPlainRteValue(value) {
6803
- return value !== null && typeof value === "object" && !Array.isArray(value) && typeof value.markup === "string" && !isRteWithBlocks4(value);
7331
+ return value !== null && typeof value === "object" && !Array.isArray(value) && typeof value.markup === "string" && !isRteWithBlocks3(value);
6804
7332
  }
6805
7333
  function extractHrefUrls(html) {
6806
7334
  const urls = [];
@@ -6910,7 +7438,7 @@ function extractLinksFromValues(values) {
6910
7438
  return;
6911
7439
  }
6912
7440
  if (typeof val === "object") {
6913
- if (isRteWithBlocks4(val)) {
7441
+ if (isRteWithBlocks3(val)) {
6914
7442
  processHtml(val.markup);
6915
7443
  const blockValues = extractBlockValues(val.blocks.contentData);
6916
7444
  for (const bv of blockValues) processValue(bv);
@@ -6920,7 +7448,7 @@ function extractLinksFromValues(values) {
6920
7448
  processHtml(val.markup);
6921
7449
  return;
6922
7450
  }
6923
- if (isBlockListOrGridValue4(val)) {
7451
+ if (isBlockListOrGridValue3(val)) {
6924
7452
  const blockValues = extractBlockValues(val.contentData);
6925
7453
  for (const bv of blockValues) processValue(bv);
6926
7454
  return;
@@ -6950,18 +7478,18 @@ async function resolveOutboundIds(candidateIds, excludeId) {
6950
7478
  const internalPages = [];
6951
7479
  const media = [];
6952
7480
  const filtered = excludeId ? candidateIds.filter((cid) => cid !== excludeId.toLowerCase()) : candidateIds;
7481
+ const urlsById = await fetchPrimaryPublishedUrlsBatch(filtered);
6953
7482
  await Promise.all(
6954
7483
  filtered.map(async (refId) => {
6955
7484
  try {
6956
7485
  const docResult = await chainCms("get-document-by-id", { id: refId });
6957
7486
  if (docResult.ok) {
6958
7487
  const refDoc = docResult.data;
6959
- const docExtra = refDoc;
6960
7488
  const docType = refDoc.documentType;
6961
7489
  internalPages.push({
6962
7490
  id: refId,
6963
7491
  name: refDoc.variants?.[0]?.name ?? "Unknown",
6964
- url: docExtra.urls?.[0]?.url ?? "",
7492
+ url: urlsById.get(refId) ?? "",
6965
7493
  documentType: docType?.alias ?? ""
6966
7494
  });
6967
7495
  return;
@@ -6987,10 +7515,10 @@ async function resolveOutboundIds(candidateIds, excludeId) {
6987
7515
  }
6988
7516
 
6989
7517
  // src/umbraco-api/tools/relationships/get/report-outbound-links.ts
6990
- var inputSchema94 = {
7518
+ var inputSchema106 = {
6991
7519
  id: z.string().uuid().describe("The ID of the page to analyze for outbound links")
6992
7520
  };
6993
- var outputSchema94 = z.object({
7521
+ var outputSchema106 = z.object({
6994
7522
  id: z.string(),
6995
7523
  name: z.string(),
6996
7524
  url: z.string(),
@@ -7022,11 +7550,11 @@ var outputSchema94 = z.object({
7022
7550
  totalLinks: z.number()
7023
7551
  })
7024
7552
  });
7025
- var tool94 = {
7553
+ var tool106 = {
7026
7554
  name: "report-outbound-links",
7027
7555
  description: "Show everything a page links to \u2014 internal content pages, media items, and external URLs. Extracts references from content pickers, media pickers, rich text links, and block content. Use this to understand a page's dependencies before restructuring.",
7028
- inputSchema: inputSchema94,
7029
- outputSchema: outputSchema94,
7556
+ inputSchema: inputSchema106,
7557
+ outputSchema: outputSchema106,
7030
7558
  slices: ["read"],
7031
7559
  annotations: { readOnlyHint: true },
7032
7560
  handler: async ({ id }) => {
@@ -7035,7 +7563,7 @@ var tool94 = {
7035
7563
  const doc = result.data;
7036
7564
  const variant = doc.variants?.[0];
7037
7565
  const name = variant?.name ?? "Unknown";
7038
- const url = doc.urls?.[0]?.url ?? "";
7566
+ const url = await fetchPrimaryPublishedUrl(id);
7039
7567
  const values = doc.values ?? [];
7040
7568
  const links = extractLinksFromValues(values);
7041
7569
  const { internalPages, media } = await resolveOutboundIds(links.allIds, id);
@@ -7055,10 +7583,10 @@ var tool94 = {
7055
7583
  });
7056
7584
  }
7057
7585
  };
7058
- var report_outbound_links_default = withStandardDecorators(tool94);
7586
+ var report_outbound_links_default = withStandardDecorators(tool106);
7059
7587
 
7060
7588
  // src/umbraco-api/tools/relationships/index.ts
7061
- var collection19 = {
7589
+ var collection20 = {
7062
7590
  metadata: {
7063
7591
  name: "relationships",
7064
7592
  displayName: "Content Relationships",
@@ -7066,11 +7594,11 @@ var collection19 = {
7066
7594
  },
7067
7595
  tools: () => [report_content_references_default, report_outbound_links_default]
7068
7596
  };
7069
- var relationships_default = collection19;
7070
- var inputSchema95 = {
7597
+ var relationships_default = collection20;
7598
+ var inputSchema107 = {
7071
7599
  id: z.string().uuid().describe("The ID of the content page to read public access settings for")
7072
7600
  };
7073
- var outputSchema95 = z.object({
7601
+ var outputSchema107 = z.object({
7074
7602
  hasRestrictions: z.boolean().describe("True if the page has public access rules configured"),
7075
7603
  memberGroups: z.array(z.object({
7076
7604
  id: z.string(),
@@ -7081,11 +7609,11 @@ var outputSchema95 = z.object({
7081
7609
  errorPageId: z.string().nullable().describe("The ID of the page shown when an authenticated visitor is denied access"),
7082
7610
  message: z.string().describe("Human-readable summary of the access rules")
7083
7611
  });
7084
- var tool95 = {
7612
+ var tool107 = {
7085
7613
  name: "get-public-access",
7086
7614
  description: "Read the public access (member-group restriction) settings for a content page. Returns the member groups, members, login page, and error page configured via the 'Public Access\u2026' entity action. If the page has no restrictions, returns hasRestrictions: false.",
7087
- inputSchema: inputSchema95,
7088
- outputSchema: outputSchema95,
7615
+ inputSchema: inputSchema107,
7616
+ outputSchema: outputSchema107,
7089
7617
  slices: ["read"],
7090
7618
  annotations: { readOnlyHint: true },
7091
7619
  handler: async ({ id }) => {
@@ -7118,15 +7646,15 @@ var tool95 = {
7118
7646
  });
7119
7647
  }
7120
7648
  };
7121
- var get_public_access_default = withStandardDecorators(tool95);
7122
- var inputSchema96 = {
7649
+ var get_public_access_default = withStandardDecorators(tool107);
7650
+ var inputSchema108 = {
7123
7651
  id: z.string().uuid().describe("The ID of the content page to restrict"),
7124
7652
  memberGroupNames: z.array(z.string()).describe("Names of member groups allowed to view the page. Use list-member-groups to look up existing groups."),
7125
7653
  loginPageId: z.string().uuid().describe("The ID of the page visitors are redirected to when login is required"),
7126
7654
  errorPageId: z.string().uuid().describe("The ID of the page shown when an authenticated visitor is denied access"),
7127
7655
  memberUserNames: z.array(z.string()).optional().describe("Optional: specific member usernames allowed to view the page (in addition to group members)")
7128
7656
  };
7129
- var outputSchema96 = z.object({
7657
+ var outputSchema108 = z.object({
7130
7658
  message: z.string(),
7131
7659
  id: z.string(),
7132
7660
  memberGroupNames: z.array(z.string()),
@@ -7134,11 +7662,11 @@ var outputSchema96 = z.object({
7134
7662
  loginPageId: z.string(),
7135
7663
  errorPageId: z.string()
7136
7664
  });
7137
- var tool96 = {
7665
+ var tool108 = {
7138
7666
  name: "set-public-access",
7139
7667
  description: "Restrict a content page to members of specific groups (or specific members), redirecting unauthenticated visitors to a login page. Equivalent to the 'Public Access\u2026' entity action in the Umbraco backoffice. Creates new rules on first call, updates them on subsequent calls. You will be asked to confirm.",
7140
- inputSchema: inputSchema96,
7141
- outputSchema: outputSchema96,
7668
+ inputSchema: inputSchema108,
7669
+ outputSchema: outputSchema108,
7142
7670
  slices: ["update"],
7143
7671
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
7144
7672
  handler: async ({ id, memberGroupNames, loginPageId, errorPageId, memberUserNames }, extra) => {
@@ -7176,19 +7704,19 @@ var tool96 = {
7176
7704
  });
7177
7705
  }
7178
7706
  };
7179
- var set_public_access_default = withStandardDecorators(tool96);
7180
- var inputSchema97 = {
7707
+ var set_public_access_default = withStandardDecorators(tool108);
7708
+ var inputSchema109 = {
7181
7709
  id: z.string().uuid().describe("The ID of the content page to remove public access restrictions from")
7182
7710
  };
7183
- var outputSchema97 = z.object({
7711
+ var outputSchema109 = z.object({
7184
7712
  message: z.string(),
7185
7713
  id: z.string()
7186
7714
  });
7187
- var tool97 = {
7715
+ var tool109 = {
7188
7716
  name: "remove-public-access",
7189
7717
  description: "Remove all public access restrictions from a content page, making it publicly viewable again. You will be asked to confirm.",
7190
- inputSchema: inputSchema97,
7191
- outputSchema: outputSchema97,
7718
+ inputSchema: inputSchema109,
7719
+ outputSchema: outputSchema109,
7192
7720
  slices: ["delete"],
7193
7721
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true },
7194
7722
  handler: async ({ id }, extra) => {
@@ -7203,10 +7731,10 @@ var tool97 = {
7203
7731
  });
7204
7732
  }
7205
7733
  };
7206
- var remove_public_access_default = withStandardDecorators(tool97);
7734
+ var remove_public_access_default = withStandardDecorators(tool109);
7207
7735
 
7208
7736
  // src/umbraco-api/tools/public-access/index.ts
7209
- var collection20 = {
7737
+ var collection21 = {
7210
7738
  metadata: {
7211
7739
  name: "public-access",
7212
7740
  displayName: "Public Access",
@@ -7214,7 +7742,7 @@ var collection20 = {
7214
7742
  },
7215
7743
  tools: () => [get_public_access_default, set_public_access_default, remove_public_access_default]
7216
7744
  };
7217
- var public_access_default = collection20;
7745
+ var public_access_default = collection21;
7218
7746
 
7219
7747
  // src/umbraco-api/tools/helpers/runtime.ts
7220
7748
  var isHostedRuntime = () => {
@@ -7224,7 +7752,7 @@ var isHostedRuntime = () => {
7224
7752
  };
7225
7753
 
7226
7754
  // src/umbraco-api/tools/notifications/get/get-content-notifications.ts
7227
- var inputSchema98 = {
7755
+ var inputSchema110 = {
7228
7756
  id: z.string().uuid().describe("UUID of the content page to read notification subscriptions for")
7229
7757
  };
7230
7758
  var subscriptionSchema = z.object({
@@ -7232,16 +7760,16 @@ var subscriptionSchema = z.object({
7232
7760
  alias: z.string().describe("Human-readable action alias (e.g. publish, unpublish, save, delete)"),
7233
7761
  subscribed: z.boolean().describe("True if the current user is subscribed to this action")
7234
7762
  });
7235
- var outputSchema98 = z.object({
7763
+ var outputSchema110 = z.object({
7236
7764
  id: z.string(),
7237
7765
  subscriptions: z.array(subscriptionSchema),
7238
7766
  subscribedActionIds: z.array(z.string()).describe("Convenience list of actionIds the current user is already subscribed to \u2014 pass back into set-content-notifications to preserve or modify")
7239
7767
  });
7240
- var tool98 = {
7768
+ var tool110 = {
7241
7769
  name: "get-content-notifications",
7242
7770
  description: "Get the current OAuth user's email notification subscriptions for a content page. Returns the full list of available actions (publish, unpublish, save, delete, etc.) with the user's subscribed/unsubscribed state for each. Hosted-only \u2014 not available in stdio mode because the static API user has no real inbox.",
7243
- inputSchema: inputSchema98,
7244
- outputSchema: outputSchema98,
7771
+ inputSchema: inputSchema110,
7772
+ outputSchema: outputSchema110,
7245
7773
  slices: ["read"],
7246
7774
  annotations: { readOnlyHint: true },
7247
7775
  enabled: isHostedRuntime,
@@ -7257,21 +7785,21 @@ var tool98 = {
7257
7785
  return createToolResult({ id, subscriptions, subscribedActionIds });
7258
7786
  }
7259
7787
  };
7260
- var get_content_notifications_default = withStandardDecorators(tool98);
7261
- var inputSchema99 = {
7788
+ var get_content_notifications_default = withStandardDecorators(tool110);
7789
+ var inputSchema111 = {
7262
7790
  id: z.string().uuid().describe("UUID of the content page to update notification subscriptions for"),
7263
7791
  subscribedActionIds: z.array(z.string()).describe("Complete list of action IDs the current user should be subscribed to. Replaces existing subscriptions \u2014 pass an empty array to unsubscribe from all. Call get-content-notifications first to see available actionIds and preserve any you don't want to change.")
7264
7792
  };
7265
- var outputSchema99 = z.object({
7793
+ var outputSchema111 = z.object({
7266
7794
  message: z.string(),
7267
7795
  id: z.string(),
7268
7796
  subscribedActionIds: z.array(z.string())
7269
7797
  });
7270
- var tool99 = {
7798
+ var tool111 = {
7271
7799
  name: "set-content-notifications",
7272
7800
  description: "Replace the current OAuth user's email notification subscriptions for a content page. Full overwrite \u2014 any action ID not in the list will be unsubscribed. Hosted-only \u2014 not available in stdio mode because the static API user has no real inbox.",
7273
- inputSchema: inputSchema99,
7274
- outputSchema: outputSchema99,
7801
+ inputSchema: inputSchema111,
7802
+ outputSchema: outputSchema111,
7275
7803
  slices: ["update"],
7276
7804
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
7277
7805
  enabled: isHostedRuntime,
@@ -7289,10 +7817,10 @@ var tool99 = {
7289
7817
  });
7290
7818
  }
7291
7819
  };
7292
- var set_content_notifications_default = withStandardDecorators(tool99);
7820
+ var set_content_notifications_default = withStandardDecorators(tool111);
7293
7821
 
7294
7822
  // src/umbraco-api/tools/notifications/index.ts
7295
- var collection21 = {
7823
+ var collection22 = {
7296
7824
  metadata: {
7297
7825
  name: "notifications",
7298
7826
  displayName: "Content Notifications",
@@ -7300,7 +7828,7 @@ var collection21 = {
7300
7828
  },
7301
7829
  tools: () => isHostedRuntime() ? [get_content_notifications_default, set_content_notifications_default] : []
7302
7830
  };
7303
- var notifications_default = collection21;
7831
+ var notifications_default = collection22;
7304
7832
  var mediaTools = {
7305
7833
  listRoot: "get-recycle-bin-media-root",
7306
7834
  listChildren: "get-recycle-bin-media-children",
@@ -7363,13 +7891,13 @@ function formatNamePreview(names, total) {
7363
7891
  }
7364
7892
 
7365
7893
  // src/umbraco-api/tools/recycle-bin/get/list-recycle-bin.ts
7366
- var inputSchema100 = {
7894
+ var inputSchema112 = {
7367
7895
  type: z.enum(["content", "media"]).describe("Which recycle bin to list: content (pages) or media."),
7368
7896
  parentId: z.string().uuid().optional().describe("When omitted, lists the bin root. When given, lists the children of that trashed folder \u2014 the recycle bin is a tree and this drills into nested trashed content."),
7369
7897
  take: z.number().optional().default(20).describe("Number of results to return (default 20)"),
7370
7898
  skip: z.number().optional().default(0).describe("Number of results to skip for pagination")
7371
7899
  };
7372
- var outputSchema100 = z.object({
7900
+ var outputSchema112 = z.object({
7373
7901
  items: z.array(z.object({
7374
7902
  id: z.string(),
7375
7903
  name: z.string(),
@@ -7378,11 +7906,11 @@ var outputSchema100 = z.object({
7378
7906
  })).describe("Trashed items at this level of the recycle bin"),
7379
7907
  total: z.number().describe("Total number of trashed items at this level (before pagination)")
7380
7908
  });
7381
- var tool100 = {
7909
+ var tool112 = {
7382
7910
  name: "list-recycle-bin",
7383
7911
  description: "List items in the content or media recycle bin. Returns one level at a time \u2014 when a trashed item has hasChildren=true it is a trashed folder; pass its id as parentId on a follow-up call to drill into its contents. Read-only.",
7384
- inputSchema: inputSchema100,
7385
- outputSchema: outputSchema100,
7912
+ inputSchema: inputSchema112,
7913
+ outputSchema: outputSchema112,
7386
7914
  slices: ["list", "tree"],
7387
7915
  annotations: { readOnlyHint: true },
7388
7916
  handler: async ({ type, parentId, take, skip }) => {
@@ -7405,22 +7933,22 @@ var tool100 = {
7405
7933
  });
7406
7934
  }
7407
7935
  };
7408
- var list_recycle_bin_default = withStandardDecorators(tool100);
7409
- var inputSchema101 = {
7936
+ var list_recycle_bin_default = withStandardDecorators(tool112);
7937
+ var inputSchema113 = {
7410
7938
  id: z.string().uuid().describe("ID of the trashed item to permanently delete."),
7411
7939
  type: z.enum(["content", "media"]).describe("Which recycle bin the item is in.")
7412
7940
  };
7413
- var outputSchema101 = z.object({
7941
+ var outputSchema113 = z.object({
7414
7942
  message: z.string(),
7415
7943
  id: z.string(),
7416
7944
  name: z.string(),
7417
7945
  descendantCount: z.number().optional().describe("Descendants also deleted when the item was a folder")
7418
7946
  });
7419
- var tool101 = {
7947
+ var tool113 = {
7420
7948
  name: "permanent-delete-recycle-bin-item",
7421
7949
  description: "Permanently delete a single item from the content or media recycle bin. Deleting a trashed folder deletes its entire subtree. This cannot be undone. Always elicits confirmation with an itemised preview before deleting.",
7422
- inputSchema: inputSchema101,
7423
- outputSchema: outputSchema101,
7950
+ inputSchema: inputSchema113,
7951
+ outputSchema: outputSchema113,
7424
7952
  slices: ["delete"],
7425
7953
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
7426
7954
  handler: async ({ id, type }, extra) => {
@@ -7467,20 +7995,20 @@ var tool101 = {
7467
7995
  });
7468
7996
  }
7469
7997
  };
7470
- var permanent_delete_recycle_bin_item_default = withStandardDecorators(tool101);
7471
- var inputSchema102 = {
7998
+ var permanent_delete_recycle_bin_item_default = withStandardDecorators(tool113);
7999
+ var inputSchema114 = {
7472
8000
  type: z.enum(["content", "media"]).describe("Which recycle bin to empty.")
7473
8001
  };
7474
- var outputSchema102 = z.object({
8002
+ var outputSchema114 = z.object({
7475
8003
  message: z.string(),
7476
8004
  type: z.enum(["content", "media"]),
7477
8005
  topLevelCount: z.number().describe("Number of top-level items that were in the bin before emptying (descendants are not counted).")
7478
8006
  });
7479
- var tool102 = {
8007
+ var tool114 = {
7480
8008
  name: "empty-recycle-bin",
7481
8009
  description: "Empty the entire content or media recycle bin \u2014 permanently deletes every trashed item including the contents of any trashed folders. This cannot be undone. Always elicits two successive confirmations before executing.",
7482
- inputSchema: inputSchema102,
7483
- outputSchema: outputSchema102,
8010
+ inputSchema: inputSchema114,
8011
+ outputSchema: outputSchema114,
7484
8012
  slices: ["delete"],
7485
8013
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
7486
8014
  handler: async ({ type }, extra) => {
@@ -7525,10 +8053,10 @@ var tool102 = {
7525
8053
  });
7526
8054
  }
7527
8055
  };
7528
- var empty_recycle_bin_default = withStandardDecorators(tool102);
8056
+ var empty_recycle_bin_default = withStandardDecorators(tool114);
7529
8057
 
7530
8058
  // src/umbraco-api/tools/recycle-bin/index.ts
7531
- var collection22 = {
8059
+ var collection23 = {
7532
8060
  metadata: {
7533
8061
  name: "recycle-bin",
7534
8062
  displayName: "Recycle Bin",
@@ -7536,9 +8064,9 @@ var collection22 = {
7536
8064
  },
7537
8065
  tools: () => [list_recycle_bin_default, permanent_delete_recycle_bin_item_default, empty_recycle_bin_default]
7538
8066
  };
7539
- var recycle_bin_default = collection22;
7540
- var inputSchema103 = {};
7541
- var outputSchema103 = z.object({
8067
+ var recycle_bin_default = collection23;
8068
+ var inputSchema115 = {};
8069
+ var outputSchema115 = z.object({
7542
8070
  id: z.string(),
7543
8071
  name: z.string(),
7544
8072
  userName: z.string(),
@@ -7560,11 +8088,11 @@ var outputSchema103 = z.object({
7560
8088
  documentStartNodeIds: z.array(z.string()).describe("Content node IDs the user is restricted to. Empty when hasDocumentRootAccess is true."),
7561
8089
  mediaStartNodeIds: z.array(z.string()).describe("Media node IDs the user is restricted to. Empty when hasMediaRootAccess is true.")
7562
8090
  });
7563
- var tool103 = {
8091
+ var tool115 = {
7564
8092
  name: "get-current-user",
7565
8093
  description: "Identify which Umbraco backoffice user the MCP server is authenticated as. Returns the user's name, email, admin flag, and resolved user-group names. Use this to confirm identity when permissions behave unexpectedly \u2014 e.g. an action fails or returns different data than expected, before assuming the API is broken.",
7566
- inputSchema: inputSchema103,
7567
- outputSchema: outputSchema103,
8094
+ inputSchema: inputSchema115,
8095
+ outputSchema: outputSchema115,
7568
8096
  slices: ["read"],
7569
8097
  annotations: { readOnlyHint: true },
7570
8098
  handler: async () => {
@@ -7603,10 +8131,10 @@ var tool103 = {
7603
8131
  });
7604
8132
  }
7605
8133
  };
7606
- var get_current_user_default = withStandardDecorators(tool103);
8134
+ var get_current_user_default = withStandardDecorators(tool115);
7607
8135
 
7608
8136
  // src/umbraco-api/tools/account/index.ts
7609
- var collection23 = {
8137
+ var collection24 = {
7610
8138
  metadata: {
7611
8139
  name: "account",
7612
8140
  displayName: "Account",
@@ -7614,22 +8142,7 @@ var collection23 = {
7614
8142
  },
7615
8143
  tools: () => [get_current_user_default]
7616
8144
  };
7617
- var account_default = collection23;
7618
- var toolSliceNames = [
7619
- // Base slices from toolkit (create, read, update, delete, list)
7620
- ...baseSliceNames,
7621
- // Query
7622
- "search",
7623
- // Navigation
7624
- "tree",
7625
- // Workflow
7626
- "publish",
7627
- // Versioning
7628
- "version",
7629
- // Movement
7630
- "move"
7631
- ];
7632
- var allSliceNames = [...toolSliceNames, "other"];
8145
+ var account_default = collection24;
7633
8146
 
7634
8147
  // src/config/mode-registry.ts
7635
8148
  var toolModes = [
@@ -7645,6 +8158,12 @@ var toolModes = [
7645
8158
  description: "Browse, search, upload, and manage media files and folders",
7646
8159
  collections: ["media", "media-management"]
7647
8160
  },
8161
+ {
8162
+ name: "library",
8163
+ displayName: "Library Elements",
8164
+ description: "Browse, view, and manage reusable Library elements (Umbraco 18 Library section)",
8165
+ collections: ["element"]
8166
+ },
7648
8167
  {
7649
8168
  name: "blueprints",
7650
8169
  displayName: "Blueprints",
@@ -7732,6 +8251,49 @@ var toolModes = [
7732
8251
  ];
7733
8252
  var allModes = [...toolModes];
7734
8253
  var allModeNames = toolModes.map((m) => m.name);
8254
+ var toolSliceNames = [
8255
+ // Base slices from toolkit (create, read, update, delete, list)
8256
+ ...baseSliceNames,
8257
+ // Query
8258
+ "search",
8259
+ // Navigation
8260
+ "tree",
8261
+ // Workflow
8262
+ "publish",
8263
+ // Versioning
8264
+ "version",
8265
+ // Movement
8266
+ "move"
8267
+ ];
8268
+ var allSliceNames = [...toolSliceNames, "other"];
8269
+
8270
+ // src/collections.ts
8271
+ var collections = [
8272
+ content_default,
8273
+ publishing_default,
8274
+ versioning_default,
8275
+ media_default,
8276
+ media_management_default,
8277
+ element_default,
8278
+ blueprint_default,
8279
+ language_default,
8280
+ translation_default,
8281
+ dictionary_default,
8282
+ tag_default,
8283
+ content_health_default,
8284
+ site_structure_default,
8285
+ bulk_operations_default,
8286
+ member_default,
8287
+ member_group_default,
8288
+ member_reporting_default,
8289
+ scheduling_default,
8290
+ redirect_default,
8291
+ relationships_default,
8292
+ public_access_default,
8293
+ notifications_default,
8294
+ recycle_bin_default,
8295
+ account_default
8296
+ ];
7735
8297
  var customFields = [
7736
8298
  {
7737
8299
  name: "disableMcpChaining",
@@ -7857,31 +8419,7 @@ initializeUmbracoFetch({
7857
8419
  clientSecret: serverConfig.umbraco.auth.clientSecret
7858
8420
  });
7859
8421
  var filterConfig = configLoader.loadFromConfig(serverConfig.umbraco);
7860
- var collections = [
7861
- content_default,
7862
- publishing_default,
7863
- versioning_default,
7864
- media_default,
7865
- media_management_default,
7866
- blueprint_default,
7867
- translation_default,
7868
- language_default,
7869
- dictionary_default,
7870
- tag_default,
7871
- content_health_default,
7872
- site_structure_default,
7873
- bulk_operations_default,
7874
- member_default,
7875
- member_group_default,
7876
- member_reporting_default,
7877
- scheduling_default,
7878
- redirect_default,
7879
- relationships_default,
7880
- public_access_default,
7881
- notifications_default,
7882
- recycle_bin_default,
7883
- account_default
7884
- ];
8422
+ var registeredCollections = collections;
7885
8423
  async function main() {
7886
8424
  const chainingEnabled = mcpServers.length > 0 && !serverConfig.custom.disableMcpChaining;
7887
8425
  let availableChainedTools;
@@ -7903,23 +8441,23 @@ async function main() {
7903
8441
  }
7904
8442
  let registeredToolCount = 0;
7905
8443
  let skippedByDeps = 0;
7906
- for (const collection24 of collections) {
7907
- const collectionName = collection24.metadata.name;
7908
- const tools = collection24.tools({});
7909
- for (const tool104 of tools) {
7910
- const toolWithDeps = CHAINED_DEPS[tool104.name] && !tool104.chainedDeps ? { ...tool104, chainedDeps: CHAINED_DEPS[tool104.name] } : tool104;
8444
+ for (const collection25 of registeredCollections) {
8445
+ const collectionName = collection25.metadata.name;
8446
+ const tools = collection25.tools({});
8447
+ for (const tool116 of tools) {
8448
+ const toolWithDeps = CHAINED_DEPS[tool116.name] && !tool116.chainedDeps ? { ...tool116, chainedDeps: CHAINED_DEPS[tool116.name] } : tool116;
7911
8449
  if (!shouldIncludeTool(toolWithDeps, { collectionName, config: filterConfig, availableChainedTools })) {
7912
- if (availableChainedTools && CHAINED_DEPS[tool104.name]) skippedByDeps++;
8450
+ if (availableChainedTools && CHAINED_DEPS[tool116.name]) skippedByDeps++;
7913
8451
  continue;
7914
8452
  }
7915
- const annotations = createToolAnnotations(tool104);
7916
- server.registerTool(tool104.name, {
7917
- description: tool104.description,
7918
- inputSchema: tool104.inputSchema,
7919
- outputSchema: tool104.outputSchema,
8453
+ const annotations = createToolAnnotations(tool116);
8454
+ server.registerTool(tool116.name, {
8455
+ description: tool116.description,
8456
+ inputSchema: tool116.inputSchema,
8457
+ outputSchema: tool116.outputSchema,
7920
8458
  annotations,
7921
- ...tool104._meta ? { _meta: tool104._meta } : {}
7922
- }, tool104.handler);
8459
+ ...tool116._meta ? { _meta: tool116._meta } : {}
8460
+ }, tool116.handler);
7923
8461
  registeredToolCount++;
7924
8462
  }
7925
8463
  }
@@ -7927,7 +8465,7 @@ async function main() {
7927
8465
  const transport = new StdioServerTransport();
7928
8466
  await server.connect(transport);
7929
8467
  console.error(
7930
- `MCP Server started with ${registeredToolCount} tool(s) from ${collections.length} collection(s)` + (skippedByDeps > 0 ? ` (${skippedByDeps} tool(s) hidden \u2014 chained deps not available for this user)` : "")
8468
+ `MCP Server started with ${registeredToolCount} tool(s) from ${registeredCollections.length} collection(s)` + (skippedByDeps > 0 ? ` (${skippedByDeps} tool(s) hidden \u2014 chained deps not available for this user)` : "")
7931
8469
  );
7932
8470
  }
7933
8471
  process.on("SIGINT", async () => {