@umbraco-cms/mcp-editor 17.6.0-beta.8 → 18.0.0-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,14 @@
1
1
  import { z } from 'zod';
2
- import { createMcpClientManager, withStandardDecorators, baseSliceNames, createToolResult, createToolResultError, extractChainedResult, requestApproval, UmbracoManagementClient, encodeCursor } from '@umbraco-cms/mcp-server-sdk';
2
+ import { createMcpClientManager, withStandardDecorators, baseSliceNames, createToolResult, createToolResultError, extractChainedResult, requestApproval, UmbracoManagementClient, encodeCursor, isLoopbackUrl } from '@umbraco-cms/mcp-server-sdk';
3
3
  import { statSync, readFileSync } from 'fs';
4
4
  import { resolve } from 'path';
5
5
 
6
6
  // src/umbraco-api/tools/content/get/search-content.ts
7
-
8
- // src/config/mcp-servers.ts
7
+ function chainedTlsEnv(baseUrl) {
8
+ return isLoopbackUrl(baseUrl) ? { NODE_TLS_REJECT_UNAUTHORIZED: "0" } : {};
9
+ }
9
10
  async function buildServers() {
10
- const isWorkersRuntime = typeof navigator !== "undefined" && navigator.userAgent === "Cloudflare-Workers";
11
- if (isWorkersRuntime || typeof process === "undefined" || !process.env) return [];
11
+ if (typeof process === "undefined" || !process.env) return [];
12
12
  const useMockChain = process.env.USE_MOCK_MCP_CHAIN === "true";
13
13
  if (useMockChain) {
14
14
  const path2 = await import('path');
@@ -30,13 +30,14 @@ async function buildServers() {
30
30
  const binEntry = typeof cmsDevPkg.bin === "string" ? cmsDevPkg.bin : cmsDevPkg.bin ? Object.values(cmsDevPkg.bin)[0] : void 0;
31
31
  if (!binEntry) throw new Error("@umbraco-cms/mcp-dev has no bin entry");
32
32
  const binAbs = path.resolve(path.dirname(pkgPath), binEntry);
33
+ const baseUrl = process.env.UMBRACO_BASE_URL || "http://localhost:44391";
33
34
  return [{
34
35
  name: "cms",
35
36
  command: process.execPath,
36
37
  args: [binAbs],
37
38
  env: {
38
- NODE_TLS_REJECT_UNAUTHORIZED: "0",
39
- UMBRACO_BASE_URL: process.env.UMBRACO_BASE_URL || "http://localhost:44391",
39
+ ...chainedTlsEnv(baseUrl),
40
+ UMBRACO_BASE_URL: baseUrl,
40
41
  UMBRACO_CLIENT_ID: process.env.UMBRACO_CLIENT_ID || "",
41
42
  UMBRACO_CLIENT_SECRET: process.env.UMBRACO_CLIENT_SECRET || "",
42
43
  // Clear tool filters so our editor tool names (search-content etc.) don't
@@ -110,14 +111,6 @@ function truncateAvailableTools(message) {
110
111
  }
111
112
  return message.slice(0, availableToolsIndex + 1);
112
113
  }
113
- async function isCmsToolAvailable(toolName) {
114
- try {
115
- const { tools } = await mcpClientManager.listTools("cms");
116
- return (tools ?? []).some((t) => t.name === toolName);
117
- } catch {
118
- return true;
119
- }
120
- }
121
114
  async function chainCms(toolName, args) {
122
115
  let result;
123
116
  try {
@@ -480,9 +473,9 @@ var tool2 = {
480
473
  })),
481
474
  variants: doc.variants ?? [],
482
475
  previewUrl: buildPreviewUrl(doc.id),
483
- // The get-document-by-id response doesn't carry `urls` — published
484
- // URLs come only from the separate get-document-urls endpoint via
485
- // fetchPublishedUrls.
476
+ // Umbraco 18's get-document-by-id response no longer carries `urls` —
477
+ // published URLs now come only from the separate get-document-urls
478
+ // endpoint via fetchPublishedUrls.
486
479
  publishedUrls: await fetchPublishedUrls(id)
487
480
  });
488
481
  }
@@ -649,10 +642,15 @@ var tool4 = {
649
642
  var list_document_types_default = withStandardDecorators(tool4);
650
643
 
651
644
  // src/umbraco-api/tools/content/helpers/resolve-document-type-properties.ts
652
- async function resolveDocumentTypeProperties(documentTypeId) {
653
- const docTypeResult = await chainCms("get-document-type-by-id", { id: documentTypeId });
654
- if (!docTypeResult.ok) return { ok: false, errorResult: docTypeResult.errorResult };
655
- const data = docTypeResult.data;
645
+ async function resolveDocumentTypeProperties(documentTypeId, documentType) {
646
+ let data;
647
+ if (documentType) {
648
+ data = documentType;
649
+ } else {
650
+ const docTypeResult = await chainCms("get-document-type-by-id", { id: documentTypeId });
651
+ if (!docTypeResult.ok) return { ok: false, errorResult: docTypeResult.errorResult };
652
+ data = docTypeResult.data;
653
+ }
656
654
  const collected = /* @__PURE__ */ new Map();
657
655
  function addProperties(props) {
658
656
  for (const p of props) {
@@ -807,13 +805,13 @@ async function validateDocumentState(id, doc) {
807
805
  culture: v.culture ?? null,
808
806
  segment: v.segment ?? null
809
807
  }));
810
- const ancestorsResult = await chainCms("get-document-ancestors", { descendantId: id });
811
- const parent = ancestorsResult.ok ? (ancestorsResult.data.items ?? []).find((item) => item.id === id)?.parent ?? null : null;
808
+ const itemResult = await chainCms("get-item-document", { id: [id] });
809
+ const parent = itemResult.ok ? itemResult.data.items[0]?.parent ?? null : null;
812
810
  const result = await chainCms("validate-document", {
813
811
  id,
814
812
  documentType: { id: target.documentType.id },
815
813
  template: target.template ? { id: target.template.id } : null,
816
- parent,
814
+ parent: parent ? { id: parent.id } : null,
817
815
  values,
818
816
  variants
819
817
  });
@@ -957,6 +955,30 @@ function isBlockListOrGridValue(value) {
957
955
  function isRteWithBlocks(value) {
958
956
  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);
959
957
  }
958
+
959
+ // src/umbraco-api/tools/helpers/block-inspector.ts
960
+ function blockPropertiesSchema(editTool) {
961
+ return z.array(z.object({
962
+ propertyAlias: z.string().describe("The property containing these blocks"),
963
+ editorAlias: z.string().optional(),
964
+ blocks: z.array(z.object({
965
+ contentKey: z.string().describe(`The block's unique key \u2014 use this with ${editTool}`),
966
+ contentTypeKey: z.string().describe("The block's element type ID"),
967
+ settingsKey: z.string().optional().describe("The key of the block's settings entry. Absent when the block has no settings."),
968
+ properties: z.array(z.object({
969
+ alias: z.string(),
970
+ value: z.any()
971
+ }))
972
+ }))
973
+ }));
974
+ }
975
+ function extractBlocks(contentData) {
976
+ return contentData.map((block) => ({
977
+ contentKey: block?.key ?? "",
978
+ contentTypeKey: block?.contentTypeKey ?? "",
979
+ properties: Array.isArray(block?.values) ? block.values.map((v) => ({ alias: v?.alias ?? "", value: v?.value })) : []
980
+ }));
981
+ }
960
982
  function findSettingsKey(container, contentKey) {
961
983
  const layout = container?.layout;
962
984
  if (!layout || typeof layout !== "object") return void 0;
@@ -983,6 +1005,94 @@ function searchLayout(entries, contentKey) {
983
1005
  }
984
1006
  return void 0;
985
1007
  }
1008
+ function collectBlockProperties(values, propertyAlias) {
1009
+ const filtered = propertyAlias ? values.filter((v) => v.alias === propertyAlias) : values;
1010
+ return filtered.filter((v) => isBlockListOrGridValue(v.value) || isRteWithBlocks(v.value)).map((v) => {
1011
+ const value = v.value;
1012
+ const container = isRteWithBlocks(value) ? value.blocks : value;
1013
+ return {
1014
+ propertyAlias: v.alias,
1015
+ editorAlias: isRteWithBlocks(value) ? "Umbraco.RichText" : v.editorAlias ?? void 0,
1016
+ blocks: withSettingsKeys(extractBlocks(container.contentData), container)
1017
+ };
1018
+ });
1019
+ }
1020
+ var MAX_ENRICHED_BLOCKS = 50;
1021
+ var MAX_BLOCK_WALK_DEPTH = 20;
1022
+ function enrichBlockNotFoundError(errorResult, values, options = {}) {
1023
+ const problem = extractInnerProblemDetails(errorResult);
1024
+ const availableBlocks = problem.availableBlocks;
1025
+ if (!Array.isArray(availableBlocks)) return errorResult;
1026
+ const { propertyAlias, note } = options;
1027
+ const filtered = propertyAlias ? values.filter((v) => v.alias === propertyAlias) : values;
1028
+ const typeByKey = /* @__PURE__ */ new Map();
1029
+ for (const v of filtered) {
1030
+ const container = isRteWithBlocks(v.value) ? v.value.blocks : v.value;
1031
+ if (isBlockListOrGridValue(container)) {
1032
+ collectBlockEntryTypes(container, typeByKey, 0);
1033
+ }
1034
+ }
1035
+ const truncated = availableBlocks.length > MAX_ENRICHED_BLOCKS;
1036
+ const limitedBlocks = truncated ? availableBlocks.slice(0, MAX_ENRICHED_BLOCKS) : availableBlocks;
1037
+ const enrichedBlocks = limitedBlocks.map(
1038
+ (b) => b && typeof b === "object" && typeof b.key === "string" ? { ...b, contentTypeKey: typeByKey.get(b.key) ?? null } : b
1039
+ );
1040
+ return createToolResultError({
1041
+ ...problem,
1042
+ availableBlocks: enrichedBlocks,
1043
+ ...truncated ? { availableBlocksNote: `Showing ${MAX_ENRICHED_BLOCKS} of ${availableBlocks.length} available blocks \u2014 use inspect-blocks for the full list.` } : {},
1044
+ ...note ? { note } : {}
1045
+ });
1046
+ }
1047
+ function collectBlockEntryTypes(container, into, depth) {
1048
+ if (depth > MAX_BLOCK_WALK_DEPTH) return;
1049
+ for (const list of [container.contentData, container.settingsData]) {
1050
+ if (!Array.isArray(list)) continue;
1051
+ for (const block of list) {
1052
+ if (!block || typeof block !== "object") continue;
1053
+ const key = block.key;
1054
+ const contentTypeKey = block.contentTypeKey;
1055
+ if (typeof key === "string" && typeof contentTypeKey === "string") into.set(key, contentTypeKey);
1056
+ const nestedValues = block.values;
1057
+ if (!Array.isArray(nestedValues)) continue;
1058
+ for (const nested of nestedValues) {
1059
+ const nestedRaw = nested?.value;
1060
+ const nestedContainer = isRteWithBlocks(nestedRaw) ? nestedRaw.blocks : nestedRaw;
1061
+ if (isBlockListOrGridValue(nestedContainer)) {
1062
+ collectBlockEntryTypes(nestedContainer, into, depth + 1);
1063
+ }
1064
+ }
1065
+ }
1066
+ }
1067
+ }
1068
+ function withSettingsKeys(blocks, container) {
1069
+ return blocks.map((block) => {
1070
+ const settingsKey = findSettingsKey(container, block.contentKey);
1071
+ return settingsKey ? { ...block, settingsKey } : block;
1072
+ });
1073
+ }
1074
+ var blockPropertyAliasSchema = z.string().regex(
1075
+ /^[A-Za-z_][A-Za-z0-9_]*$/,
1076
+ "Property alias must be a valid identifier (letters, digits, underscore; not starting with a digit)"
1077
+ );
1078
+ function classifyBlockUpdateResults(results, requestedCount, requestedAliases = [], expectedEntryCount = 1) {
1079
+ const list = results ?? [];
1080
+ const processedCount = list.reduce((sum, r) => sum + (r.updatedCount ?? 0) + (r.addedCount ?? 0), 0);
1081
+ const updatedEntryCount = list.filter((r) => (r.updatedCount ?? 0) + (r.addedCount ?? 0) > 0).length;
1082
+ const errors = list.flatMap((r) => r.errors ?? []);
1083
+ const warnings = list.flatMap((r) => r.warnings ?? []);
1084
+ const failureText = [...errors, ...warnings].join("; ");
1085
+ const unresolvedEntries = list.filter(
1086
+ (r) => (r.updatedCount ?? 0) + (r.addedCount ?? 0) === 0 && !r.errors?.length && !r.warnings?.length
1087
+ );
1088
+ const missingEntryCount = Math.max(0, expectedEntryCount - list.length);
1089
+ const unresolvedBlockCount = unresolvedEntries.length + missingEntryCount;
1090
+ const detail = [...errors, ...warnings, ...unresolvedEntries.map((r) => r.message).filter(Boolean)].join("; ") || list.map((r) => r.message).filter(Boolean).join("; ") || "no detail returned";
1091
+ const outcome = processedCount === 0 ? "failed" : processedCount < requestedCount ? "partial" : "clean";
1092
+ const failedFields = requestedAliases.filter((alias) => failureText.includes(`'${alias}'`));
1093
+ const savedFields = unresolvedBlockCount > 0 ? [] : requestedAliases.filter((alias) => !failedFields.includes(alias));
1094
+ return { outcome, processedCount, updatedEntryCount, detail, warnings, savedFields, failedFields, unresolvedBlockCount };
1095
+ }
986
1096
 
987
1097
  // src/umbraco-api/tools/content/get/inspect-blocks.ts
988
1098
  var inputSchema6 = {
@@ -993,41 +1103,11 @@ var outputSchema6 = z.object({
993
1103
  id: z.string(),
994
1104
  name: z.string(),
995
1105
  previewUrl: previewUrlSchema,
996
- blockProperties: z.array(z.object({
997
- propertyAlias: z.string().describe("The document property containing these blocks"),
998
- editorAlias: z.string().optional(),
999
- blocks: z.array(z.object({
1000
- contentKey: z.string().describe("The block's unique key \u2014 use this with edit-block"),
1001
- contentTypeKey: z.string().describe("The block's element type ID"),
1002
- settingsKey: z.string().optional().describe("The key of the block's settings entry. Absent when the block has no settings."),
1003
- properties: z.array(z.object({
1004
- alias: z.string(),
1005
- value: z.any()
1006
- }))
1007
- }))
1008
- }))
1106
+ blockProperties: blockPropertiesSchema("edit-block")
1009
1107
  });
1010
- function isBlockListOrGridValue2(value) {
1011
- return value !== null && typeof value === "object" && !Array.isArray(value) && Array.isArray(value.contentData);
1012
- }
1013
- function isRteWithBlocks2(value) {
1014
- 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);
1015
- }
1016
- function extractBlocks(contentData, container) {
1017
- return contentData.map((block) => {
1018
- const contentKey = block.key ?? "";
1019
- const settingsKey = findSettingsKey(container, contentKey);
1020
- return {
1021
- contentKey,
1022
- contentTypeKey: block.contentTypeKey ?? "",
1023
- ...settingsKey ? { settingsKey } : {},
1024
- properties: Array.isArray(block.values) ? block.values.map((v) => ({ alias: v.alias ?? "", value: v.value })) : []
1025
- };
1026
- });
1027
- }
1028
1108
  var tool6 = {
1029
1109
  name: "inspect-blocks",
1030
- 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.",
1110
+ 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.",
1031
1111
  inputSchema: inputSchema6,
1032
1112
  outputSchema: outputSchema6,
1033
1113
  slices: ["read"],
@@ -1036,28 +1116,11 @@ var tool6 = {
1036
1116
  const result = await chainCms("get-document-by-id", { id });
1037
1117
  if (!result.ok) return result.errorResult;
1038
1118
  const doc = result.data;
1039
- const allValues = doc.values ?? [];
1040
- const filtered = propertyAlias ? allValues.filter((v) => v.alias === propertyAlias) : allValues;
1041
- const blockProperties = filtered.filter((v) => isBlockListOrGridValue2(v.value) || isRteWithBlocks2(v.value)).map((v) => {
1042
- const value = v.value;
1043
- if (isRteWithBlocks2(value)) {
1044
- return {
1045
- propertyAlias: v.alias,
1046
- editorAlias: "Umbraco.RichText",
1047
- blocks: extractBlocks(value.blocks.contentData, value.blocks)
1048
- };
1049
- }
1050
- return {
1051
- propertyAlias: v.alias,
1052
- editorAlias: v.editorAlias ?? void 0,
1053
- blocks: extractBlocks(value.contentData, value)
1054
- };
1055
- });
1056
1119
  return createToolResult({
1057
1120
  id: doc.id,
1058
1121
  name: doc.variants?.[0]?.name ?? "Unknown",
1059
1122
  previewUrl: buildPreviewUrl(doc.id),
1060
- blockProperties
1123
+ blockProperties: collectBlockProperties(doc.values ?? [], propertyAlias)
1061
1124
  });
1062
1125
  }
1063
1126
  };
@@ -1385,17 +1448,18 @@ ${aliases.join("\n")}`
1385
1448
  const schemaResult = await chainCms("get-data-type-schema", { id: match.id });
1386
1449
  if (!schemaResult.ok) return schemaResult.errorResult;
1387
1450
  return createToolResult({
1388
- message: JSON.stringify(schemaResult.data, null, 2),
1451
+ message: `Value-shape template for ${editorAlias}:
1452
+ ${JSON.stringify(schemaResult.data, null, 2)}`,
1389
1453
  editorAlias
1390
1454
  });
1391
1455
  }
1392
1456
  };
1393
1457
  var get_property_value_template_default = withStandardDecorators(tool10);
1394
- async function resolveEditorAliases(documentTypeId, values) {
1458
+ async function resolveEditorAliases(documentTypeId, values, { defaultCulture = null, documentType, siteCultures } = {}) {
1395
1459
  if (!values || values.length === 0) {
1396
1460
  return { ok: true, values: [] };
1397
1461
  }
1398
- const docTypeResult = await resolveDocumentTypeProperties(documentTypeId);
1462
+ const docTypeResult = await resolveDocumentTypeProperties(documentTypeId, documentType);
1399
1463
  if (!docTypeResult.ok) return docTypeResult;
1400
1464
  const dataTypeIds = Array.from(
1401
1465
  new Set(
@@ -1414,22 +1478,32 @@ async function resolveEditorAliases(documentTypeId, values) {
1414
1478
  docTypeResult.properties.map((p) => p.alias).filter((alias) => typeof alias === "string")
1415
1479
  );
1416
1480
  const editorAliasByPropertyAlias = /* @__PURE__ */ new Map();
1481
+ const cultureVariantAliases = /* @__PURE__ */ new Set();
1417
1482
  for (const prop of docTypeResult.properties) {
1418
1483
  const editorAlias = prop.dataType?.id ? editorAliasByDataTypeId.get(prop.dataType.id) : void 0;
1419
1484
  if (prop.alias && editorAlias) editorAliasByPropertyAlias.set(prop.alias, editorAlias);
1485
+ if (prop.alias && prop.variesByCulture) cultureVariantAliases.add(prop.alias);
1420
1486
  }
1421
1487
  const notAProperty = /* @__PURE__ */ new Set();
1422
1488
  const missingEditorAlias = /* @__PURE__ */ new Set();
1489
+ const unknownCultures = /* @__PURE__ */ new Set();
1423
1490
  const resolved = values.map((v) => {
1424
1491
  const editorAlias = editorAliasByPropertyAlias.get(v.alias);
1425
1492
  if (!editorAlias) {
1426
1493
  if (propertyAliases.has(v.alias)) missingEditorAlias.add(v.alias);
1427
1494
  else notAProperty.add(v.alias);
1428
1495
  }
1496
+ let culture = v.culture ?? (cultureVariantAliases.has(v.alias) ? defaultCulture : null);
1497
+ if (v.culture && siteCultures) {
1498
+ const requested = v.culture.toLowerCase();
1499
+ const match = siteCultures.find((c) => c.toLowerCase() === requested);
1500
+ if (match) culture = match;
1501
+ else unknownCultures.add(v.culture);
1502
+ }
1429
1503
  return {
1430
1504
  alias: v.alias,
1431
1505
  value: v.value,
1432
- culture: v.culture ?? null,
1506
+ culture,
1433
1507
  segment: v.segment ?? null,
1434
1508
  editorAlias: editorAlias ?? ""
1435
1509
  };
@@ -1460,14 +1534,74 @@ async function resolveEditorAliases(documentTypeId, values) {
1460
1534
  )
1461
1535
  };
1462
1536
  }
1537
+ if (unknownCultures.size > 0 && siteCultures) {
1538
+ return {
1539
+ ok: false,
1540
+ errorResult: createToolResultError(
1541
+ `The following value culture(s) are not languages on this site: ${Array.from(unknownCultures).join(", ")}. Available cultures: ${siteCultures.join(", ")}.`
1542
+ )
1543
+ };
1544
+ }
1463
1545
  return { ok: true, values: resolved };
1464
1546
  }
1547
+ var LANGUAGE_PAGE_SIZE = 100;
1548
+ async function resolvePageCulture(documentTypeId, culture, { forPublish = false } = {}) {
1549
+ const docTypeResult = await chainCms("get-document-type-by-id", { id: documentTypeId });
1550
+ if (!docTypeResult.ok) return { ok: false, errorResult: docTypeResult.errorResult };
1551
+ const documentType = docTypeResult.data;
1552
+ if (!documentType.variesByCulture) {
1553
+ return { ok: true, culture: null, documentType };
1554
+ }
1555
+ const langResult = await chainCms("get-language", { cursor: encodeCursor({ s: 0, t: LANGUAGE_PAGE_SIZE }) });
1556
+ if (!langResult.ok) return { ok: false, errorResult: langResult.errorResult };
1557
+ const languages = langResult.data.items ?? [];
1558
+ const complete = (langResult.data.total ?? languages.length) <= languages.length;
1559
+ const siteCultures = languages.map((l) => l.isoCode);
1560
+ let pageCulture;
1561
+ if (culture) {
1562
+ const match = siteCultures.find((c) => c.toLowerCase() === culture.toLowerCase());
1563
+ if (!match && complete) {
1564
+ return {
1565
+ ok: false,
1566
+ errorResult: createToolResultError(
1567
+ `Culture "${culture}" is not a language on this site. Available cultures: ${siteCultures.join(", ")}.`
1568
+ )
1569
+ };
1570
+ }
1571
+ pageCulture = match ?? culture;
1572
+ } else {
1573
+ const defaultLanguage = languages.find((l) => l.isDefault);
1574
+ if (!defaultLanguage?.isoCode) {
1575
+ return {
1576
+ ok: false,
1577
+ errorResult: createToolResultError(
1578
+ "This document type varies by culture, but no default language could be determined. Call list-languages and pass `culture` explicitly."
1579
+ )
1580
+ };
1581
+ }
1582
+ pageCulture = defaultLanguage.isoCode;
1583
+ }
1584
+ if (forPublish) {
1585
+ const missingMandatory = languages.filter((l) => l.isMandatory && l.isoCode !== pageCulture).map((l) => l.isoCode);
1586
+ if (missingMandatory.length > 0) {
1587
+ const one = missingMandatory.length === 1;
1588
+ return {
1589
+ ok: false,
1590
+ errorResult: createToolResultError(
1591
+ `Cannot create and publish this page in ${pageCulture} alone: ${missingMandatory.join(", ")} ${one ? "is a mandatory language" : "are mandatory languages"} on this site, and a page can only be published once it exists in every mandatory language. Nothing was created. ${one ? `Either pass culture "${missingMandatory[0]}", or use` : "Use"} create-page, add the other language(s) with create-variant, then publish.`
1592
+ )
1593
+ };
1594
+ }
1595
+ }
1596
+ return { ok: true, culture: pageCulture, documentType, siteCultures: complete ? siteCultures : void 0 };
1597
+ }
1465
1598
 
1466
1599
  // src/umbraco-api/tools/content/post/create-page.ts
1467
1600
  var inputSchema11 = {
1468
1601
  name: z.string().describe("The name of the page to create"),
1469
1602
  documentTypeId: z.string().uuid().describe("The ID of the document type to use. Call list-document-types first to find available types."),
1470
1603
  parentId: z.string().uuid().optional().describe("The ID of the parent page. If omitted, the page is created at the root"),
1604
+ culture: z.string().optional().describe("Culture (ISO code, e.g. en-US) to create the page in. Only used when the document type varies by culture; defaults to the site's default language. Call list-languages for the available cultures. Add further languages afterwards with create-variant or copy-variant."),
1471
1605
  values: z.array(z.object({
1472
1606
  alias: z.string().describe("The property alias"),
1473
1607
  value: z.any().describe("The property value"),
@@ -1479,23 +1613,28 @@ var outputSchema11 = z.object({
1479
1613
  message: z.string(),
1480
1614
  id: z.string(),
1481
1615
  name: z.string(),
1616
+ culture: z.string().nullable().describe("The culture the page was created in \u2014 the requested `culture`, or the site's default language when none was given. Null when the document type does not vary by culture."),
1482
1617
  previewUrl: previewUrlSchema,
1483
1618
  validation: validationResultSchema
1484
1619
  });
1485
1620
  var tool11 = {
1486
1621
  name: "create-page",
1487
- description: "Create a new content page as a draft \u2014 the page will NOT be published automatically. 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 (strings, numbers, booleans). For everything else, follow up with the dedicated tools after creation \u2014 they're shorter, safer, and avoid the JSON-payload errors that come from cramming a full page into one call: edit-page for property updates, add-blocklist-block / add-blockgrid-block / add-rte-block for block content, edit-block for block-property edits, and get-property-value-template for the value shape of structured non-block editors (media pickers, image cropper, etc.).",
1622
+ description: "Create a new content page as a draft \u2014 the page will NOT be published automatically. 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 (strings, numbers, booleans). For everything else, follow up with the dedicated tools after creation \u2014 they're shorter, safer, and avoid the JSON-payload errors that come from cramming a full page into one call: edit-page for property updates, add-blocklist-block / add-blockgrid-block / add-rte-block for block content, edit-block for block-property edits, and get-property-value-template for the value shape of structured non-block editors (media pickers, image cropper, etc.). On a multilingual site, a document type that varies by culture is created in `culture` (default: the site's default language); values without a culture on culture-variant properties are stored in that culture too.",
1488
1623
  inputSchema: inputSchema11,
1489
1624
  outputSchema: outputSchema11,
1490
1625
  slices: ["create"],
1491
1626
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
1492
- handler: async ({ name, documentTypeId, parentId, values }) => {
1493
- const resolved = await resolveEditorAliases(documentTypeId, values);
1627
+ handler: async ({ name, documentTypeId, parentId, culture, values }) => {
1628
+ const cultureResult = await resolvePageCulture(documentTypeId, culture);
1629
+ if (!cultureResult.ok) return cultureResult.errorResult;
1630
+ const { culture: pageCulture, documentType, siteCultures } = cultureResult;
1631
+ const resolved = await resolveEditorAliases(documentTypeId, values, { defaultCulture: pageCulture, documentType, siteCultures });
1494
1632
  if (!resolved.ok) return resolved.errorResult;
1495
1633
  const createResult = await chainCms("create-document", {
1496
1634
  documentTypeId,
1497
1635
  name,
1498
1636
  values: resolved.values,
1637
+ ...pageCulture ? { cultures: [pageCulture] } : {},
1499
1638
  ...parentId ? { parentId } : {}
1500
1639
  });
1501
1640
  if (!createResult.ok) return createResult.errorResult;
@@ -1507,6 +1646,7 @@ var tool11 = {
1507
1646
  message,
1508
1647
  id: createdId,
1509
1648
  name,
1649
+ culture: pageCulture,
1510
1650
  previewUrl: createdId ? await fetchPreviewUrl(createdId) : null,
1511
1651
  validation
1512
1652
  });
@@ -1517,6 +1657,7 @@ var inputSchema12 = {
1517
1657
  name: z.string().describe("The name of the page to create"),
1518
1658
  documentTypeId: z.string().uuid().describe("The ID of the document type to use. Call list-document-types first to find available types."),
1519
1659
  parentId: z.string().uuid().optional().describe("The ID of the parent page. If omitted, the page is created at the root"),
1660
+ culture: z.string().optional().describe("Culture (ISO code, e.g. en-US) to create the page in. Only used when the document type varies by culture; defaults to the site's default language. Call list-languages for the available cultures. Add further languages afterwards with create-variant or copy-variant."),
1520
1661
  values: z.array(z.object({
1521
1662
  alias: z.string().describe("The property alias"),
1522
1663
  value: z.any().describe("The property value"),
@@ -1528,58 +1669,36 @@ var outputSchema12 = z.object({
1528
1669
  message: z.string(),
1529
1670
  id: z.string(),
1530
1671
  name: z.string(),
1672
+ culture: z.string().nullable().describe("The culture the page was created in \u2014 the requested `culture`, or the site's default language when none was given. Null when the document type does not vary by culture."),
1531
1673
  publishedUrls: publishedUrlsSchema
1532
1674
  });
1533
1675
  var tool12 = {
1534
1676
  name: "create-and-publish-page",
1535
- 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.",
1677
+ 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. On a multilingual site, a document type that varies by culture is created in `culture` (default: the site's default language); values without a culture on culture-variant properties are stored in that culture too. If the site has a mandatory language other than that culture, the page can't be published from a single call \u2014 the tool says so and creates nothing; use create-page, create-variant, then publish instead.",
1536
1678
  inputSchema: inputSchema12,
1537
1679
  outputSchema: outputSchema12,
1538
1680
  slices: ["create", "publish"],
1539
1681
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
1540
- handler: async ({ name, documentTypeId, parentId, values }) => {
1541
- const resolved = await resolveEditorAliases(documentTypeId, values);
1682
+ handler: async ({ name, documentTypeId, parentId, culture, values }) => {
1683
+ const cultureResult = await resolvePageCulture(documentTypeId, culture, { forPublish: true });
1684
+ if (!cultureResult.ok) return cultureResult.errorResult;
1685
+ const { culture: pageCulture, documentType, siteCultures } = cultureResult;
1686
+ const resolved = await resolveEditorAliases(documentTypeId, values, { defaultCulture: pageCulture, documentType, siteCultures });
1542
1687
  if (!resolved.ok) return resolved.errorResult;
1543
- if (await isCmsToolAvailable("create-and-publish-document")) {
1544
- const createResult = await chainCms("create-and-publish-document", {
1545
- documentTypeId,
1546
- name,
1547
- values: resolved.values,
1548
- ...parentId ? { parentId } : {}
1549
- });
1550
- if (!createResult.ok) return createResult.errorResult;
1551
- const createdId2 = createResult.data.id;
1552
- return createToolResult({
1553
- message: `Created and published "${name}"`,
1554
- id: createdId2,
1555
- name,
1556
- publishedUrls: createdId2 ? await fetchPublishedUrls(createdId2) : []
1557
- });
1558
- }
1559
- const createDocumentResult = await chainCms("create-document", {
1688
+ const createResult = await chainCms("create-and-publish-document", {
1560
1689
  documentTypeId,
1561
1690
  name,
1562
1691
  values: resolved.values,
1692
+ ...pageCulture ? { cultures: [pageCulture] } : {},
1563
1693
  ...parentId ? { parentId } : {}
1564
1694
  });
1565
- if (!createDocumentResult.ok) return createDocumentResult.errorResult;
1566
- const createdId = createDocumentResult.data.id;
1567
- const publishResult = await chainCms("publish-document", {
1568
- id: createdId,
1569
- data: { publishSchedules: [{ culture: null }] }
1570
- });
1571
- if (!publishResult.ok) {
1572
- return createToolResult({
1573
- message: `Created "${name}" as a draft but publish failed: ${publishResult.errorResult.content?.[0]?.text ?? "unknown error"}`,
1574
- id: createdId,
1575
- name,
1576
- publishedUrls: []
1577
- });
1578
- }
1695
+ if (!createResult.ok) return createResult.errorResult;
1696
+ const createdId = createResult.data.id;
1579
1697
  return createToolResult({
1580
1698
  message: `Created and published "${name}"`,
1581
1699
  id: createdId,
1582
1700
  name,
1701
+ culture: pageCulture,
1583
1702
  publishedUrls: createdId ? await fetchPublishedUrls(createdId) : []
1584
1703
  });
1585
1704
  }
@@ -1913,78 +2032,6 @@ var tool17 = {
1913
2032
  }
1914
2033
  };
1915
2034
  var edit_page_default = withStandardDecorators(tool17);
1916
- var MAX_ENRICHED_BLOCKS = 50;
1917
- var MAX_BLOCK_WALK_DEPTH = 20;
1918
- function enrichBlockNotFoundError(errorResult, values, options = {}) {
1919
- const problem = extractInnerProblemDetails(errorResult);
1920
- const availableBlocks = problem.availableBlocks;
1921
- if (!Array.isArray(availableBlocks)) return errorResult;
1922
- const { propertyAlias, note } = options;
1923
- const filtered = propertyAlias ? values.filter((v) => v.alias === propertyAlias) : values;
1924
- const typeByKey = /* @__PURE__ */ new Map();
1925
- for (const v of filtered) {
1926
- const container = isRteWithBlocks(v.value) ? v.value.blocks : v.value;
1927
- if (isBlockListOrGridValue(container)) {
1928
- collectBlockEntryTypes(container, typeByKey, 0);
1929
- }
1930
- }
1931
- const truncated = availableBlocks.length > MAX_ENRICHED_BLOCKS;
1932
- const limitedBlocks = truncated ? availableBlocks.slice(0, MAX_ENRICHED_BLOCKS) : availableBlocks;
1933
- const enrichedBlocks = limitedBlocks.map(
1934
- (b) => b && typeof b === "object" && typeof b.key === "string" ? { ...b, contentTypeKey: typeByKey.get(b.key) ?? null } : b
1935
- );
1936
- return createToolResultError({
1937
- ...problem,
1938
- availableBlocks: enrichedBlocks,
1939
- ...truncated ? { availableBlocksNote: `Showing ${MAX_ENRICHED_BLOCKS} of ${availableBlocks.length} available blocks \u2014 use inspect-blocks for the full list.` } : {},
1940
- ...note ? { note } : {}
1941
- });
1942
- }
1943
- function collectBlockEntryTypes(container, into, depth) {
1944
- if (depth > MAX_BLOCK_WALK_DEPTH) return;
1945
- for (const list of [container.contentData, container.settingsData]) {
1946
- if (!Array.isArray(list)) continue;
1947
- for (const block of list) {
1948
- if (!block || typeof block !== "object") continue;
1949
- const key = block.key;
1950
- const contentTypeKey = block.contentTypeKey;
1951
- if (typeof key === "string" && typeof contentTypeKey === "string") into.set(key, contentTypeKey);
1952
- const nestedValues = block.values;
1953
- if (!Array.isArray(nestedValues)) continue;
1954
- for (const nested of nestedValues) {
1955
- const nestedRaw = nested?.value;
1956
- const nestedContainer = isRteWithBlocks(nestedRaw) ? nestedRaw.blocks : nestedRaw;
1957
- if (isBlockListOrGridValue(nestedContainer)) {
1958
- collectBlockEntryTypes(nestedContainer, into, depth + 1);
1959
- }
1960
- }
1961
- }
1962
- }
1963
- }
1964
- var blockPropertyAliasSchema = z.string().regex(
1965
- /^[A-Za-z_][A-Za-z0-9_]*$/,
1966
- "Property alias must be a valid identifier (letters, digits, underscore; not starting with a digit)"
1967
- );
1968
- function classifyBlockUpdateResults(results, requestedCount, requestedAliases = [], expectedEntryCount = 1) {
1969
- const list = results ?? [];
1970
- const processedCount = list.reduce((sum, r) => sum + (r.updatedCount ?? 0) + (r.addedCount ?? 0), 0);
1971
- const updatedEntryCount = list.filter((r) => (r.updatedCount ?? 0) + (r.addedCount ?? 0) > 0).length;
1972
- const errors = list.flatMap((r) => r.errors ?? []);
1973
- const warnings = list.flatMap((r) => r.warnings ?? []);
1974
- const failureText = [...errors, ...warnings].join("; ");
1975
- const unresolvedEntries = list.filter(
1976
- (r) => (r.updatedCount ?? 0) + (r.addedCount ?? 0) === 0 && !r.errors?.length && !r.warnings?.length
1977
- );
1978
- const missingEntryCount = Math.max(0, expectedEntryCount - list.length);
1979
- const unresolvedBlockCount = unresolvedEntries.length + missingEntryCount;
1980
- const detail = [...errors, ...warnings, ...unresolvedEntries.map((r) => r.message).filter(Boolean)].join("; ") || list.map((r) => r.message).filter(Boolean).join("; ") || "no detail returned";
1981
- const outcome = processedCount === 0 ? "failed" : processedCount < requestedCount ? "partial" : "clean";
1982
- const failedFields = requestedAliases.filter((alias) => failureText.includes(`'${alias}'`));
1983
- const savedFields = unresolvedBlockCount > 0 ? [] : requestedAliases.filter((alias) => !failedFields.includes(alias));
1984
- return { outcome, processedCount, updatedEntryCount, detail, warnings, savedFields, failedFields, unresolvedBlockCount };
1985
- }
1986
-
1987
- // src/umbraco-api/tools/content/put/edit-block.ts
1988
2035
  var inputSchema18 = {
1989
2036
  id: z.string().uuid().describe("The ID of the page containing the block"),
1990
2037
  propertyAlias: z.string().describe("The document property alias containing the blocks (e.g. 'mainContent'). Use inspect-blocks to find this."),
@@ -2009,7 +2056,7 @@ var outputSchema18 = z.object({
2009
2056
  });
2010
2057
  var tool18 = {
2011
2058
  name: "edit-block",
2012
- 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.",
2059
+ 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.",
2013
2060
  inputSchema: inputSchema18,
2014
2061
  outputSchema: outputSchema18,
2015
2062
  slices: ["update"],
@@ -2121,7 +2168,8 @@ var tool19 = {
2121
2168
  const targetCulture = culture ?? null;
2122
2169
  const docResult = await chainCms("get-document-by-id", { id });
2123
2170
  if (!docResult.ok) return docResult.errorResult;
2124
- const variants = docResult.data.variants ?? [];
2171
+ const doc = docResult.data;
2172
+ const variants = doc.variants ?? [];
2125
2173
  const targetVariant = variants.find((v) => matchesCulture(v, targetCulture));
2126
2174
  if (!targetVariant) {
2127
2175
  if (targetCulture) {
@@ -2155,8 +2203,8 @@ var tool19 = {
2155
2203
  previewUrl: buildPreviewUrl(id)
2156
2204
  });
2157
2205
  }
2158
- const renameResult = await chainCms("update-document-name", { id, name, culture: targetCulture });
2159
- if (!renameResult.ok) return renameResult.errorResult;
2206
+ const updateResult = await chainCms("update-document-name", { id, name, culture: targetCulture });
2207
+ if (!updateResult.ok) return updateResult.errorResult;
2160
2208
  return createToolResult({
2161
2209
  message: `Renamed page${cultureLabel} from "${previousName}" to "${name}" (saved, not published)`,
2162
2210
  id,
@@ -2523,6 +2571,48 @@ async function verifyDocumentPublished(id, expectedCultures) {
2523
2571
  return `publish call returned success but ${failures.length === 1 ? "this culture is" : "these cultures are"} still in draft: ${failures.join(", ")}`;
2524
2572
  }
2525
2573
 
2574
+ // src/umbraco-api/tools/helpers/publish-with-descendants.ts
2575
+ var FOLLOWUP_MAX_ATTEMPTS = 30;
2576
+ var FOLLOWUP_POLL_INTERVAL_MS = 2e3;
2577
+ function parsePublishWithDescendantsStatus(data) {
2578
+ if (data !== null && typeof data === "object" && data.status === "in-progress" && typeof data.taskId === "string") {
2579
+ return { complete: false, taskId: data.taskId };
2580
+ }
2581
+ if (data !== "") {
2582
+ console.warn(
2583
+ `publish-document-with-descendants returned an unrecognized success payload (neither "" nor an in-progress marker) \u2014 treating as complete: ${JSON.stringify(data)}`
2584
+ );
2585
+ }
2586
+ return { complete: true };
2587
+ }
2588
+ function isRequestTimeout(error) {
2589
+ const detail = extractInnerProblemDetails(error.errorResult).detail;
2590
+ return typeof detail === "string" && detail.includes("Request timed out");
2591
+ }
2592
+ async function publishWithDescendants(id, data, options) {
2593
+ const initial = await chainCms("publish-document-with-descendants", { id, data });
2594
+ if (!initial.ok) {
2595
+ if (isRequestTimeout(initial)) return { ok: true, complete: false };
2596
+ return initial;
2597
+ }
2598
+ const status = parsePublishWithDescendantsStatus(initial.data);
2599
+ if (status.complete) return { ok: true, complete: true };
2600
+ if (options?.followUp === false) return { ok: true, complete: false };
2601
+ for (let attempt = 0; attempt < FOLLOWUP_MAX_ATTEMPTS; attempt++) {
2602
+ await new Promise((resolve2) => setTimeout(resolve2, FOLLOWUP_POLL_INTERVAL_MS));
2603
+ const poll = await chainCms("get-document-publish-with-descendants-result", {
2604
+ id,
2605
+ taskId: status.taskId
2606
+ });
2607
+ if (!poll.ok) {
2608
+ if (isRequestTimeout(poll)) return { ok: true, complete: false };
2609
+ return poll;
2610
+ }
2611
+ if (poll.data.isComplete) return { ok: true, complete: true };
2612
+ }
2613
+ return { ok: true, complete: false };
2614
+ }
2615
+
2526
2616
  // src/umbraco-api/tools/publishing/post/publish-page.ts
2527
2617
  var inputSchema25 = {
2528
2618
  id: z.string().uuid().describe("The ID of the page to publish"),
@@ -2540,7 +2630,12 @@ var tool25 = {
2540
2630
  inputSchema: inputSchema25,
2541
2631
  outputSchema: outputSchema25,
2542
2632
  slices: ["publish"],
2543
- annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
2633
+ // includeDescendants delegates to publish-document-with-descendants, which
2634
+ // the chained CMS tool annotates idempotentHint: false — a retry fires a
2635
+ // second concurrent recursive publish job rather than converging to the
2636
+ // same end state. That makes this tool non-idempotent as a whole, since
2637
+ // includeDescendants is a valid input, not a separate tool.
2638
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
2544
2639
  handler: async ({ id, includeDescendants }, extra) => {
2545
2640
  const docResult = await chainCms("get-document-by-id", { id });
2546
2641
  if (!docResult.ok) return docResult.errorResult;
@@ -2552,29 +2647,42 @@ var tool25 = {
2552
2647
  }
2553
2648
  }
2554
2649
  const variantCultures = (doc.variants ?? []).length ? doc.variants.map((v) => v.culture ?? null) : [null];
2555
- const publishResult = includeDescendants ? await chainCms("publish-document-with-descendants", {
2556
- id,
2557
- data: {
2650
+ if (includeDescendants) {
2651
+ const result = await publishWithDescendants(id, {
2558
2652
  includeUnpublishedDescendants: false,
2559
2653
  cultures: variantCultures.filter((c) => c !== null)
2560
- }
2561
- }) : await chainCms("publish-document", {
2654
+ });
2655
+ if (!result.ok) return result.errorResult;
2656
+ if (!result.complete) {
2657
+ return createToolResult({
2658
+ message: `"${pageName}" and its descendants are a large tree \u2014 publishing is still running in the background. Check again shortly.`,
2659
+ id,
2660
+ name: pageName,
2661
+ publishedUrls: []
2662
+ });
2663
+ }
2664
+ return createToolResult({
2665
+ message: `Published "${pageName}" and all child pages`,
2666
+ id,
2667
+ name: pageName,
2668
+ publishedUrls: await fetchPublishedUrls(id)
2669
+ });
2670
+ }
2671
+ const publishResult = await chainCms("publish-document", {
2562
2672
  id,
2563
2673
  data: { publishSchedules: variantCultures.map((c) => ({ culture: c })) }
2564
2674
  });
2565
2675
  if (!publishResult.ok) return publishResult.errorResult;
2566
- if (!includeDescendants) {
2567
- const verifyError = await verifyDocumentPublished(id, variantCultures);
2568
- if (verifyError) {
2569
- return createToolResultError({
2570
- status: 500,
2571
- title: "Publish did not take effect",
2572
- detail: `"${pageName}": ${verifyError}`
2573
- });
2574
- }
2676
+ const verifyError = await verifyDocumentPublished(id, variantCultures);
2677
+ if (verifyError) {
2678
+ return createToolResultError({
2679
+ status: 500,
2680
+ title: "Publish did not take effect",
2681
+ detail: `"${pageName}": ${verifyError}`
2682
+ });
2575
2683
  }
2576
2684
  return createToolResult({
2577
- message: includeDescendants ? `Published "${pageName}" and all child pages` : `Published "${pageName}"`,
2685
+ message: `Published "${pageName}"`,
2578
2686
  id,
2579
2687
  name: pageName,
2580
2688
  publishedUrls: await fetchPublishedUrls(id)
@@ -2636,17 +2744,36 @@ var outputSchema27 = z.object({
2636
2744
  updatedFields: z.array(z.string()),
2637
2745
  publishedUrls: publishedUrlsSchema
2638
2746
  });
2639
- function mergeValues(existing, updates) {
2640
- const key = (v) => `${v.alias}::${v.culture ?? ""}::${v.segment ?? ""}`;
2641
- const merged = new Map(existing.map((v) => [key(v), { alias: v.alias, value: v.value, culture: v.culture ?? null, segment: v.segment ?? null }]));
2642
- for (const u of updates) {
2643
- merged.set(key(u), { alias: u.alias, value: u.value, culture: u.culture ?? null, segment: u.segment ?? null });
2747
+ function valueKey2(value) {
2748
+ return `${value.alias}|${value.culture ?? ""}|${value.segment ?? ""}`;
2749
+ }
2750
+ function normaliseValue(value) {
2751
+ return {
2752
+ alias: value.alias,
2753
+ value: value.value,
2754
+ culture: value.culture ?? null,
2755
+ segment: value.segment ?? null
2756
+ };
2757
+ }
2758
+ function mergeValues(current, incoming) {
2759
+ const merged = current.map(normaliseValue);
2760
+ const indexByKey = new Map(merged.map((value, index) => [valueKey2(value), index]));
2761
+ for (const value of incoming) {
2762
+ const next = normaliseValue(value);
2763
+ const key = valueKey2(next);
2764
+ const existingIndex = indexByKey.get(key);
2765
+ if (existingIndex !== void 0) {
2766
+ merged[existingIndex] = next;
2767
+ } else {
2768
+ indexByKey.set(key, merged.length);
2769
+ merged.push(next);
2770
+ }
2644
2771
  }
2645
- return [...merged.values()];
2772
+ return merged;
2646
2773
  }
2647
2774
  var tool27 = {
2648
2775
  name: "save-and-publish",
2649
- 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.",
2776
+ 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.",
2650
2777
  inputSchema: inputSchema27,
2651
2778
  outputSchema: outputSchema27,
2652
2779
  slices: ["publish", "update"],
@@ -2657,6 +2784,7 @@ var tool27 = {
2657
2784
  const doc = docResult.data;
2658
2785
  const pageName = doc.variants?.[0]?.name ?? "Unknown";
2659
2786
  const fieldNames = (values ?? []).map((v) => v.alias);
2787
+ const hasValues = (values?.length ?? 0) > 0;
2660
2788
  if (includeDescendants) {
2661
2789
  if (!await requestApproval(extra, `Publish "${pageName}" and all its descendants?`)) {
2662
2790
  return createToolResult({
@@ -2671,9 +2799,9 @@ var tool27 = {
2671
2799
  }
2672
2800
  }
2673
2801
  const variantCultures = (doc.variants ?? []).length ? doc.variants.map((v) => v.culture ?? null) : [null];
2674
- const saved = !!(values && values.length > 0);
2675
2802
  if (includeDescendants) {
2676
- if (saved) {
2803
+ let saved = false;
2804
+ if (hasValues) {
2677
2805
  const properties = values.map((v) => ({
2678
2806
  alias: v.alias,
2679
2807
  value: v.value,
@@ -2682,13 +2810,11 @@ var tool27 = {
2682
2810
  }));
2683
2811
  const updateResult = await chainCms("update-document-properties", { id, properties });
2684
2812
  if (!updateResult.ok) return updateResult.errorResult;
2813
+ saved = true;
2685
2814
  }
2686
- const publishResult = await chainCms("publish-document-with-descendants", {
2687
- id,
2688
- data: {
2689
- includeUnpublishedDescendants: false,
2690
- cultures: variantCultures.filter((c) => c !== null)
2691
- }
2815
+ const publishResult = await publishWithDescendants(id, {
2816
+ includeUnpublishedDescendants: false,
2817
+ cultures: variantCultures.filter((c) => c !== null)
2692
2818
  });
2693
2819
  if (!publishResult.ok) {
2694
2820
  if (saved) {
@@ -2704,85 +2830,86 @@ var tool27 = {
2704
2830
  }
2705
2831
  return publishResult.errorResult;
2706
2832
  }
2707
- } else {
2708
- const mergedValues = mergeValues(doc.values ?? [], values ?? []);
2709
- const variants = (doc.variants ?? []).map((v) => ({
2710
- culture: v.culture ?? null,
2711
- segment: v.segment ?? null,
2712
- name: v.name
2713
- }));
2714
- if (await isCmsToolAvailable("update-and-publish-document")) {
2715
- const updateAndPublishResult = await chainCms("update-and-publish-document", {
2716
- id,
2717
- data: {
2718
- values: mergedValues,
2719
- variants,
2720
- template: doc.template ?? null,
2721
- culturesToPublish: variantCultures.filter((c) => c !== null)
2722
- }
2723
- });
2724
- if (!updateAndPublishResult.ok) return updateAndPublishResult.errorResult;
2725
- } else {
2726
- const updateResult = await chainCms("update-document", {
2727
- id,
2728
- data: {
2729
- values: mergedValues,
2730
- variants,
2731
- template: doc.template ?? null
2732
- }
2733
- });
2734
- if (!updateResult.ok) return updateResult.errorResult;
2735
- const publishResult = await chainCms("publish-document", {
2833
+ if (!publishResult.complete) {
2834
+ const savedPrefix = saved ? `Saved ${fieldNames.length} field(s) on "${pageName}". ` : "";
2835
+ return createToolResult({
2836
+ message: `${savedPrefix}"${pageName}" and its descendants are a large tree \u2014 publishing is still running in the background. Check again shortly.`,
2736
2837
  id,
2737
- data: {
2738
- publishSchedules: variantCultures.map((c) => ({ culture: c }))
2739
- }
2838
+ name: pageName,
2839
+ saved,
2840
+ published: false,
2841
+ updatedFields: fieldNames,
2842
+ publishedUrls: []
2740
2843
  });
2741
- if (!publishResult.ok) {
2742
- if (saved) {
2743
- return createToolResult({
2744
- message: `Saved ${fieldNames.length} field(s) on "${pageName}" but publish failed: ${publishResult.errorResult.content?.[0]?.text ?? "unknown error"}`,
2745
- id,
2746
- name: pageName,
2747
- saved: true,
2748
- published: false,
2749
- updatedFields: fieldNames,
2750
- publishedUrls: []
2751
- });
2752
- }
2753
- return publishResult.errorResult;
2754
- }
2755
2844
  }
2845
+ const savedPart2 = saved ? `Saved ${fieldNames.length} field(s) and ` : "";
2846
+ return createToolResult({
2847
+ message: `${savedPart2}published "${pageName}" and all descendants`,
2848
+ id,
2849
+ name: pageName,
2850
+ saved,
2851
+ published: true,
2852
+ updatedFields: fieldNames,
2853
+ publishedUrls: await fetchPublishedUrls(id)
2854
+ });
2756
2855
  }
2757
- if (!includeDescendants) {
2758
- const verifyError = await verifyDocumentPublished(id, variantCultures);
2759
- if (verifyError) {
2760
- if (saved) {
2761
- return createToolResult({
2762
- message: `Saved ${fieldNames.length} field(s) on "${pageName}" but publish did not take effect: ${verifyError}`,
2763
- id,
2764
- name: pageName,
2765
- saved: true,
2766
- published: false,
2767
- updatedFields: fieldNames,
2768
- publishedUrls: []
2769
- });
2856
+ if (hasValues) {
2857
+ const updateAndPublishResult = await chainCms("update-and-publish-document", {
2858
+ id,
2859
+ data: {
2860
+ culturesToPublish: [...new Set(variantCultures.filter((c) => c !== null))],
2861
+ template: doc.template ?? null,
2862
+ values: mergeValues(doc.values ?? [], values),
2863
+ variants: (doc.variants ?? []).map((v) => ({
2864
+ culture: v.culture ?? null,
2865
+ segment: v.segment ?? null,
2866
+ name: v.name
2867
+ }))
2770
2868
  }
2869
+ });
2870
+ if (!updateAndPublishResult.ok) {
2871
+ 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.`;
2872
+ const problem = extractInnerProblemDetails(updateAndPublishResult.errorResult);
2771
2873
  return createToolResultError({
2772
- status: 500,
2773
- title: "Publish did not take effect",
2774
- detail: `"${pageName}": ${verifyError}`
2874
+ ...problem,
2875
+ status: typeof problem?.status === "number" ? problem.status : 500,
2876
+ title: "Save and publish failed",
2877
+ detail: problem?.detail ? `${String(problem.detail)} ${rolledBack}` : rolledBack
2775
2878
  });
2776
2879
  }
2880
+ } else {
2881
+ const publishResult = await chainCms("publish-document", {
2882
+ id,
2883
+ data: { publishSchedules: variantCultures.map((c) => ({ culture: c })) }
2884
+ });
2885
+ if (!publishResult.ok) return publishResult.errorResult;
2886
+ }
2887
+ const verifyError = await verifyDocumentPublished(id, variantCultures);
2888
+ if (verifyError) {
2889
+ if (hasValues) {
2890
+ return createToolResult({
2891
+ message: `Saved ${fieldNames.length} field(s) on "${pageName}" but publish did not take effect: ${verifyError}`,
2892
+ id,
2893
+ name: pageName,
2894
+ saved: true,
2895
+ published: false,
2896
+ updatedFields: fieldNames,
2897
+ publishedUrls: []
2898
+ });
2899
+ }
2900
+ return createToolResultError({
2901
+ status: 500,
2902
+ title: "Publish did not take effect",
2903
+ detail: `"${pageName}": ${verifyError}`
2904
+ });
2777
2905
  }
2778
2906
  const publishedUrls = await fetchPublishedUrls(id);
2779
- const savedPart = saved ? `Saved ${fieldNames.length} field(s) and ` : "";
2780
- const descPart = includeDescendants ? " and all descendants" : "";
2907
+ const savedPart = hasValues ? `Saved ${fieldNames.length} field(s) and ` : "";
2781
2908
  return createToolResult({
2782
- message: `${savedPart}published "${pageName}"${descPart}`,
2909
+ message: `${savedPart}published "${pageName}"`,
2783
2910
  id,
2784
2911
  name: pageName,
2785
- saved,
2912
+ saved: hasValues,
2786
2913
  published: true,
2787
2914
  updatedFields: fieldNames,
2788
2915
  publishedUrls
@@ -3853,11 +3980,525 @@ var collection5 = {
3853
3980
  };
3854
3981
  var media_management_default = collection5;
3855
3982
  var inputSchema46 = {
3983
+ id: z.string().uuid().describe("The unique ID of the element to retrieve")
3984
+ };
3985
+ var outputSchema46 = z.object({
3986
+ id: z.string(),
3987
+ name: z.string(),
3988
+ elementType: z.object({ id: z.string() }).describe("The element type (document type) this element is based on"),
3989
+ values: z.array(z.object({ alias: z.string(), value: z.any() }).passthrough()).describe("Property field values"),
3990
+ variants: z.array(z.object({ name: z.string() }).passthrough()).describe("Language/culture variants")
3991
+ });
3992
+ var tool46 = {
3993
+ name: "get-element",
3994
+ 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.",
3995
+ inputSchema: inputSchema46,
3996
+ outputSchema: outputSchema46,
3997
+ slices: ["read"],
3998
+ annotations: { readOnlyHint: true },
3999
+ handler: async ({ id }) => {
4000
+ const result = await chainCms("get-element-by-id", { id });
4001
+ if (!result.ok) return result.errorResult;
4002
+ const el = result.data;
4003
+ return createToolResult({
4004
+ id: el.id,
4005
+ name: el.variants?.[0]?.name ?? "Unknown",
4006
+ elementType: { id: el.documentType?.id ?? el.elementType?.id ?? "" },
4007
+ values: el.values ?? [],
4008
+ variants: el.variants ?? []
4009
+ });
4010
+ }
4011
+ };
4012
+ var get_element_default = withStandardDecorators(tool46);
4013
+ var inputSchema47 = {
4014
+ 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)."),
4015
+ take: z.number().optional().default(20).describe("Number of results to return"),
4016
+ skip: z.number().optional().default(0).describe("Number of results to skip")
4017
+ };
4018
+ var outputSchema47 = z.object({
4019
+ items: z.array(z.object({
4020
+ id: z.string(),
4021
+ name: z.string(),
4022
+ isFolder: z.boolean().describe("True if this node is a folder that organises elements, false if it is an element item"),
4023
+ hasChildren: z.boolean()
4024
+ })).describe("Child folders and elements"),
4025
+ total: z.number().describe("Total number of children")
4026
+ });
4027
+ var tool47 = {
4028
+ name: "list-element-children",
4029
+ 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.",
4030
+ inputSchema: inputSchema47,
4031
+ outputSchema: outputSchema47,
4032
+ slices: ["tree"],
4033
+ annotations: { readOnlyHint: true },
4034
+ handler: async ({ parentId, take, skip }) => {
4035
+ const cursor = buildChainedCursor(skip, take);
4036
+ const result = parentId ? await chainCms("get-element-children", { parentId, cursor }) : await chainCms("get-element-root", { cursor });
4037
+ if (!result.ok) return result.errorResult;
4038
+ const data = result.data;
4039
+ const items = data.items ?? [];
4040
+ return createToolResult({
4041
+ items: items.map((item) => ({
4042
+ id: item.id,
4043
+ name: item.variants?.[0]?.name ?? item.name ?? "Unknown",
4044
+ isFolder: item.isFolder ?? false,
4045
+ hasChildren: item.hasChildren ?? false
4046
+ })),
4047
+ total: data.total ?? items.length
4048
+ });
4049
+ }
4050
+ };
4051
+ var list_element_children_default = withStandardDecorators(tool47);
4052
+ var inputSchema48 = {
4053
+ query: z.string().describe("Search term to find Library elements by name"),
4054
+ take: z.number().optional().default(10).describe("Number of results to return (default 10)"),
4055
+ skip: z.number().optional().default(0).describe("Number of results to skip for pagination")
4056
+ };
4057
+ var outputSchema48 = z.object({
4058
+ items: z.array(z.object({
4059
+ id: z.string(),
4060
+ name: z.string()
4061
+ })).describe("Matching Library elements"),
4062
+ total: z.number().describe("Total number of matches")
4063
+ });
4064
+ var tool48 = {
4065
+ name: "search-elements",
4066
+ 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).",
4067
+ inputSchema: inputSchema48,
4068
+ outputSchema: outputSchema48,
4069
+ slices: ["search"],
4070
+ annotations: { readOnlyHint: true },
4071
+ handler: async ({ query, take, skip }) => {
4072
+ const result = await chainCms("search-element", { query, cursor: buildChainedCursor(skip, take) });
4073
+ if (!result.ok) return result.errorResult;
4074
+ const data = result.data;
4075
+ const items = data.items ?? [];
4076
+ return createToolResult({
4077
+ items: items.map((item) => ({
4078
+ id: item.id,
4079
+ name: item.variants?.[0]?.name ?? item.name ?? "Unknown"
4080
+ })),
4081
+ total: data.total ?? items.length
4082
+ });
4083
+ }
4084
+ };
4085
+ var search_elements_default = withStandardDecorators(tool48);
4086
+ var inputSchema49 = {
4087
+ id: z.string().uuid().describe("The ID of the Library element to inspect"),
4088
+ propertyAlias: z.string().optional().describe("Specific property alias to inspect. If omitted, all block-based properties are shown.")
4089
+ };
4090
+ var outputSchema49 = z.object({
4091
+ id: z.string(),
4092
+ name: z.string(),
4093
+ blockProperties: blockPropertiesSchema("edit-element-block")
4094
+ });
4095
+ var tool49 = {
4096
+ name: "inspect-element-blocks",
4097
+ 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).",
4098
+ inputSchema: inputSchema49,
4099
+ outputSchema: outputSchema49,
4100
+ slices: ["read"],
4101
+ annotations: { readOnlyHint: true },
4102
+ handler: async ({ id, propertyAlias }) => {
4103
+ const result = await chainCms("get-element-by-id", { id });
4104
+ if (!result.ok) return result.errorResult;
4105
+ const element = result.data;
4106
+ return createToolResult({
4107
+ id: element.id,
4108
+ name: element.variants?.[0]?.name ?? "Unknown",
4109
+ blockProperties: collectBlockProperties(element.values ?? [], propertyAlias)
4110
+ });
4111
+ }
4112
+ };
4113
+ var inspect_element_blocks_default = withStandardDecorators(tool49);
4114
+ var inputSchema50 = {
4115
+ name: z.string().describe("The name of the element to create"),
4116
+ 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."),
4117
+ 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."),
4118
+ values: z.array(z.object({
4119
+ alias: z.string().describe("The property alias"),
4120
+ value: z.any().describe("The property value"),
4121
+ culture: z.string().nullable().optional().describe("The culture code for variant content"),
4122
+ segment: z.string().nullable().optional().describe("The segment for segmented content")
4123
+ })).optional().describe("Initial property values to set on the new element")
4124
+ };
4125
+ var outputSchema50 = z.object({
4126
+ message: z.string(),
4127
+ id: z.string(),
4128
+ name: z.string()
4129
+ });
4130
+ var tool50 = {
4131
+ name: "create-element",
4132
+ 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.",
4133
+ inputSchema: inputSchema50,
4134
+ outputSchema: outputSchema50,
4135
+ slices: ["create"],
4136
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
4137
+ handler: async ({ name, elementTypeId, parentId, values }) => {
4138
+ const resolved = await resolveEditorAliases(elementTypeId, values);
4139
+ if (!resolved.ok) return resolved.errorResult;
4140
+ const createResult = await chainCms("create-element", {
4141
+ documentTypeId: elementTypeId,
4142
+ name,
4143
+ values: resolved.values,
4144
+ ...parentId ? { parentId } : {}
4145
+ });
4146
+ if (!createResult.ok) return createResult.errorResult;
4147
+ return createToolResult({
4148
+ message: `Created draft element "${name}"`,
4149
+ id: createResult.data.id ?? "",
4150
+ name
4151
+ });
4152
+ }
4153
+ };
4154
+ var create_element_default = withStandardDecorators(tool50);
4155
+ var inputSchema51 = {
4156
+ name: z.string().describe("The name of the element to create"),
4157
+ 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."),
4158
+ 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."),
4159
+ values: z.array(z.object({
4160
+ alias: z.string().describe("The property alias"),
4161
+ value: z.any().describe("The property value"),
4162
+ culture: z.string().nullable().optional().describe("The culture code for variant content"),
4163
+ segment: z.string().nullable().optional().describe("The segment for segmented content")
4164
+ })).optional().describe("Initial property values to set on the new element")
4165
+ };
4166
+ var outputSchema51 = z.object({
4167
+ message: z.string(),
4168
+ id: z.string(),
4169
+ name: z.string()
4170
+ });
4171
+ var tool51 = {
4172
+ name: "create-and-publish-element",
4173
+ 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.",
4174
+ inputSchema: inputSchema51,
4175
+ outputSchema: outputSchema51,
4176
+ slices: ["create", "publish"],
4177
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
4178
+ handler: async ({ name, elementTypeId, parentId, values }) => {
4179
+ const createResult = await chainCms("create-and-publish-element", {
4180
+ documentTypeId: elementTypeId,
4181
+ name,
4182
+ values: (values ?? []).map((v) => ({
4183
+ alias: v.alias,
4184
+ value: v.value,
4185
+ culture: v.culture ?? null,
4186
+ segment: v.segment ?? null
4187
+ })),
4188
+ ...parentId ? { parentId } : {}
4189
+ });
4190
+ if (!createResult.ok) return createResult.errorResult;
4191
+ return createToolResult({
4192
+ message: `Created and published element "${name}"`,
4193
+ id: createResult.data.id ?? "",
4194
+ name
4195
+ });
4196
+ }
4197
+ };
4198
+ var create_and_publish_element_default = withStandardDecorators(tool51);
4199
+ var inputSchema52 = {
4200
+ name: z.string().describe("Name of the new folder"),
4201
+ parentId: z.string().uuid().optional().describe("ID of the parent folder in the Library (omit to create at the root)")
4202
+ };
4203
+ var outputSchema52 = z.object({
4204
+ message: z.string(),
4205
+ id: z.string(),
4206
+ name: z.string()
4207
+ });
4208
+ var tool52 = {
4209
+ name: "create-element-folder",
4210
+ 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.",
4211
+ inputSchema: inputSchema52,
4212
+ outputSchema: outputSchema52,
4213
+ slices: ["create"],
4214
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
4215
+ handler: async ({ name, parentId }) => {
4216
+ const createResult = await chainCms("create-element-folder", { name, parent: parentId ? { id: parentId } : null });
4217
+ if (!createResult.ok) return createResult.errorResult;
4218
+ let createdId = createResult.data?.id ?? "";
4219
+ let location = "at the root";
4220
+ if (!createdId) {
4221
+ const listResult = parentId ? await chainCms("get-element-children", { parentId }) : await chainCms("get-element-root", {});
4222
+ if (listResult.ok) {
4223
+ const match = (listResult.data.items ?? []).filter((i) => i.isFolder).find((i) => (i.variants?.[0]?.name ?? i.name) === name);
4224
+ if (match) createdId = match.id;
4225
+ }
4226
+ }
4227
+ if (parentId) {
4228
+ const folderResult = await chainCms("get-element-folder", { id: parentId });
4229
+ if (folderResult.ok) location = `under "${folderResult.data.name ?? "Unknown"}"`;
4230
+ }
4231
+ return createToolResult({
4232
+ message: `Created Library folder "${name}" ${location}`,
4233
+ id: createdId,
4234
+ name
4235
+ });
4236
+ }
4237
+ };
4238
+ var create_element_folder_default = withStandardDecorators(tool52);
4239
+ var inputSchema53 = {
4240
+ id: z.string().uuid().describe("The ID of the element to publish")
4241
+ };
4242
+ var outputSchema53 = z.object({
4243
+ message: z.string(),
4244
+ id: z.string(),
4245
+ name: z.string()
4246
+ });
4247
+ var tool53 = {
4248
+ name: "publish-element",
4249
+ 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.",
4250
+ inputSchema: inputSchema53,
4251
+ outputSchema: outputSchema53,
4252
+ slices: ["publish"],
4253
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
4254
+ handler: async ({ id }) => {
4255
+ const elResult = await chainCms("get-element-by-id", { id });
4256
+ if (!elResult.ok) return elResult.errorResult;
4257
+ const el = elResult.data;
4258
+ const elementName = el.variants?.[0]?.name ?? "Unknown";
4259
+ const variantCultures = (el.variants ?? []).length ? el.variants.map((v) => v.culture ?? null) : [null];
4260
+ const publishResult = await chainCms("publish-element", {
4261
+ id,
4262
+ data: { publishSchedules: variantCultures.map((c) => ({ culture: c })) }
4263
+ });
4264
+ if (!publishResult.ok) return publishResult.errorResult;
4265
+ return createToolResult({
4266
+ message: `Published element "${elementName}"`,
4267
+ id,
4268
+ name: elementName
4269
+ });
4270
+ }
4271
+ };
4272
+ var publish_element_default = withStandardDecorators(tool53);
4273
+ var inputSchema54 = {
4274
+ id: z.string().uuid().describe("The ID of the element to unpublish")
4275
+ };
4276
+ var outputSchema54 = z.object({
4277
+ message: z.string(),
4278
+ id: z.string(),
4279
+ name: z.string()
4280
+ });
4281
+ var tool54 = {
4282
+ name: "unpublish-element",
4283
+ description: "Unpublish a Library element, taking it offline. The element still exists as a draft. You will be asked to confirm before unpublishing.",
4284
+ inputSchema: inputSchema54,
4285
+ outputSchema: outputSchema54,
4286
+ slices: ["publish"],
4287
+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
4288
+ handler: async ({ id }, extra) => {
4289
+ const elResult = await chainCms("get-element-by-id", { id });
4290
+ if (!elResult.ok) return elResult.errorResult;
4291
+ const el = elResult.data;
4292
+ const elementName = el.variants?.[0]?.name ?? "Unknown";
4293
+ if (!await requestApproval(extra, `Unpublish element "${elementName}"? This will take it offline.`)) {
4294
+ return createToolResult({ message: "Unpublish cancelled", id, name: elementName });
4295
+ }
4296
+ const cultures = (el.variants ?? []).filter((v) => v.culture).map((v) => v.culture);
4297
+ const result = await chainCms("unpublish-element", {
4298
+ id,
4299
+ data: { cultures: cultures.length > 0 ? cultures : null }
4300
+ });
4301
+ if (!result.ok) return result.errorResult;
4302
+ return createToolResult({ message: `Unpublished element "${elementName}" \u2014 it is now a draft only`, id, name: elementName });
4303
+ }
4304
+ };
4305
+ var unpublish_element_default = withStandardDecorators(tool54);
4306
+ var inputSchema55 = {
4307
+ id: z.string().uuid().describe("The ID of the element to edit"),
4308
+ values: z.array(z.object({
4309
+ alias: z.string().describe("The property alias"),
4310
+ value: z.any().describe("The new property value"),
4311
+ culture: z.string().nullable().optional().describe("The culture code for variant content"),
4312
+ segment: z.string().nullable().optional().describe("The segment for segmented content")
4313
+ })).describe("Property values to update on the element")
4314
+ };
4315
+ var outputSchema55 = z.object({
4316
+ message: z.string(),
4317
+ id: z.string(),
4318
+ name: z.string(),
4319
+ updatedFields: z.array(z.string())
4320
+ });
4321
+ var tool55 = {
4322
+ name: "edit-element",
4323
+ 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).",
4324
+ inputSchema: inputSchema55,
4325
+ outputSchema: outputSchema55,
4326
+ slices: ["update"],
4327
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
4328
+ handler: async ({ id, values }) => {
4329
+ const elResult = await chainCms("get-element-by-id", { id });
4330
+ if (!elResult.ok) return elResult.errorResult;
4331
+ const elementName = elResult.data.variants?.[0]?.name ?? "Unknown";
4332
+ const fieldNames = values.map((v) => v.alias);
4333
+ const properties = values.map((v) => ({
4334
+ alias: v.alias,
4335
+ value: v.value,
4336
+ culture: v.culture ?? null,
4337
+ segment: v.segment ?? null
4338
+ }));
4339
+ const updateResult = await chainCms("update-element-properties", { id, properties });
4340
+ if (!updateResult.ok) return updateResult.errorResult;
4341
+ return createToolResult({
4342
+ message: `Updated ${fieldNames.length} field(s) on element "${elementName}" (saved, not published)`,
4343
+ id,
4344
+ name: elementName,
4345
+ updatedFields: fieldNames
4346
+ });
4347
+ }
4348
+ };
4349
+ var edit_element_default = withStandardDecorators(tool55);
4350
+ var inputSchema56 = {
4351
+ id: z.string().uuid().describe("The ID of the Library element containing the block"),
4352
+ propertyAlias: z.string().describe("The element property alias containing the blocks (e.g. 'mainContent'). Use inspect-element-blocks to find this."),
4353
+ 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'."),
4354
+ values: z.array(z.object({
4355
+ alias: blockPropertyAliasSchema.describe("The property alias within the block"),
4356
+ value: z.any().describe("The new value for the property")
4357
+ })).min(1).describe("Properties to update within the block"),
4358
+ blockType: z.enum(["content", "settings"]).optional().describe("Whether to update the block's content or its settings. Defaults to 'content'."),
4359
+ culture: z.string().nullable().optional().describe("Culture code if the element property is variant"),
4360
+ segment: z.string().nullable().optional().describe("Segment if the element property is variant")
4361
+ };
4362
+ var outputSchema56 = z.object({
4363
+ message: z.string(),
4364
+ id: z.string(),
4365
+ name: z.string(),
4366
+ contentKey: z.string(),
4367
+ updatedFields: z.array(z.string()),
4368
+ warnings: z.array(z.string()).optional()
4369
+ });
4370
+ var tool56 = {
4371
+ name: "edit-element-block",
4372
+ 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).",
4373
+ inputSchema: inputSchema56,
4374
+ outputSchema: outputSchema56,
4375
+ slices: ["update"],
4376
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
4377
+ handler: async ({ id, propertyAlias, contentKey, values, blockType, culture, segment }) => {
4378
+ const elResult = await chainCms("get-element-by-id", { id });
4379
+ if (!elResult.ok) return elResult.errorResult;
4380
+ const elementName = elResult.data.variants?.[0]?.name ?? "Unknown";
4381
+ const fieldNames = values.map((v) => v.alias);
4382
+ const resolvedBlockType = blockType ?? "content";
4383
+ let targetKey = contentKey;
4384
+ if (resolvedBlockType === "settings") {
4385
+ const rawValue = (elResult.data.values ?? []).find(
4386
+ (v) => v.alias === propertyAlias && (v.culture ?? null) === (culture ?? null) && (v.segment ?? null) === (segment ?? null)
4387
+ )?.value;
4388
+ const container = isRteWithBlocks(rawValue) ? rawValue.blocks : rawValue;
4389
+ const settingsKey = findSettingsKey(container, contentKey);
4390
+ if (!settingsKey) {
4391
+ return createToolResultError(
4392
+ `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.`
4393
+ );
4394
+ }
4395
+ targetKey = settingsKey;
4396
+ }
4397
+ const propsTuple = values.map((v) => ({ alias: v.alias, value: v.value }));
4398
+ const updateResult = await chainCms("update-element-block-property", {
4399
+ elementId: id,
4400
+ propertyAlias,
4401
+ culture: culture ?? null,
4402
+ segment: segment ?? null,
4403
+ updates: [{
4404
+ contentKey: targetKey,
4405
+ blockType: resolvedBlockType,
4406
+ properties: propsTuple
4407
+ }]
4408
+ });
4409
+ if (!updateResult.ok) return updateResult.errorResult;
4410
+ const results = updateResult.data.results;
4411
+ if (!results || results.length === 0) {
4412
+ return createToolResultError(
4413
+ "update-element-block-property returned no per-block result \u2014 cannot confirm the write succeeded."
4414
+ );
4415
+ }
4416
+ const classification = classifyBlockUpdateResults(results, fieldNames.length, fieldNames, 1);
4417
+ if (classification.outcome === "failed") {
4418
+ return createToolResultError(
4419
+ `Block update failed: ${classification.detail || updateResult.data.message || "no detail returned"}`
4420
+ );
4421
+ }
4422
+ if (classification.outcome === "partial") {
4423
+ return createToolResultError({
4424
+ message: `Block update partially failed: ${classification.processedCount} of ${fieldNames.length} field(s) saved \u2014 ${classification.detail}`,
4425
+ savedFields: classification.savedFields,
4426
+ failedFields: classification.failedFields,
4427
+ ...classification.savedFields.length > 0 ? { note: "savedFields were written to the element and must not be retried." } : {},
4428
+ ...classification.warnings.length ? { warnings: classification.warnings } : {}
4429
+ });
4430
+ }
4431
+ const target = resolvedBlockType === "settings" ? "settings" : "content";
4432
+ const warnings = classification.warnings;
4433
+ return createToolResult({
4434
+ message: `Updated ${fieldNames.length} field(s) in block ${target} on element "${elementName}" (saved, not published)`,
4435
+ id,
4436
+ name: elementName,
4437
+ contentKey,
4438
+ updatedFields: fieldNames,
4439
+ ...warnings.length ? { warnings } : {}
4440
+ });
4441
+ }
4442
+ };
4443
+ var edit_element_block_default = withStandardDecorators(tool56);
4444
+ var inputSchema57 = {
4445
+ id: z.string().uuid().describe("The ID of the element to delete")
4446
+ };
4447
+ var outputSchema57 = z.object({
4448
+ message: z.string(),
4449
+ id: z.string(),
4450
+ name: z.string()
4451
+ });
4452
+ var tool57 = {
4453
+ name: "delete-element",
4454
+ description: "Move a Library element to the recycle bin. It can be restored later. You will be asked to confirm before deleting.",
4455
+ inputSchema: inputSchema57,
4456
+ outputSchema: outputSchema57,
4457
+ slices: ["delete"],
4458
+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
4459
+ handler: async ({ id }, extra) => {
4460
+ const elResult = await chainCms("get-element-by-id", { id });
4461
+ if (!elResult.ok) return elResult.errorResult;
4462
+ const elementName = elResult.data.variants?.[0]?.name ?? "Unknown";
4463
+ if (!await requestApproval(extra, `WARNING: Move element "${elementName}" to the recycle bin? This will remove it from the Library.`)) {
4464
+ return createToolResult({ message: "Delete cancelled", id, name: elementName });
4465
+ }
4466
+ const deleteResult = await chainCms("move-element-to-recycle-bin", { id });
4467
+ if (!deleteResult.ok) return deleteResult.errorResult;
4468
+ return createToolResult({ message: `Moved element "${elementName}" to the recycle bin`, id, name: elementName });
4469
+ }
4470
+ };
4471
+ var delete_element_default = withStandardDecorators(tool57);
4472
+
4473
+ // src/umbraco-api/tools/element/index.ts
4474
+ var collection6 = {
4475
+ metadata: {
4476
+ name: "element",
4477
+ displayName: "Library Elements",
4478
+ description: "Browse, view, edit (including blocks), publish, and organise reusable Library elements (Umbraco 18 Library section)"
4479
+ },
4480
+ tools: () => [
4481
+ get_element_default,
4482
+ list_element_children_default,
4483
+ search_elements_default,
4484
+ inspect_element_blocks_default,
4485
+ create_element_default,
4486
+ create_and_publish_element_default,
4487
+ create_element_folder_default,
4488
+ edit_element_default,
4489
+ edit_element_block_default,
4490
+ publish_element_default,
4491
+ unpublish_element_default,
4492
+ delete_element_default
4493
+ ]
4494
+ };
4495
+ var element_default = collection6;
4496
+ var inputSchema58 = {
3856
4497
  parentId: z.string().uuid().optional().describe("The ID of a blueprint folder to list children of. If omitted, lists root-level blueprints."),
3857
4498
  take: z.number().optional().default(50).describe("Number of results to return"),
3858
4499
  skip: z.number().optional().default(0).describe("Number of results to skip")
3859
4500
  };
3860
- var outputSchema46 = z.object({
4501
+ var outputSchema58 = z.object({
3861
4502
  items: z.array(z.object({
3862
4503
  id: z.string(),
3863
4504
  name: z.string(),
@@ -3865,11 +4506,11 @@ var outputSchema46 = z.object({
3865
4506
  })).describe("Available page blueprints"),
3866
4507
  total: z.number()
3867
4508
  });
3868
- var tool46 = {
4509
+ var tool58 = {
3869
4510
  name: "list-blueprints",
3870
4511
  description: "List available page blueprints (templates with pre-filled content). Use get-blueprint to view a blueprint's details and property values.",
3871
- inputSchema: inputSchema46,
3872
- outputSchema: outputSchema46,
4512
+ inputSchema: inputSchema58,
4513
+ outputSchema: outputSchema58,
3873
4514
  slices: ["list"],
3874
4515
  annotations: { readOnlyHint: true },
3875
4516
  handler: async ({ parentId, take, skip }) => {
@@ -3895,11 +4536,11 @@ var tool46 = {
3895
4536
  });
3896
4537
  }
3897
4538
  };
3898
- var list_blueprints_default = withStandardDecorators(tool46);
3899
- var inputSchema47 = {
4539
+ var list_blueprints_default = withStandardDecorators(tool58);
4540
+ var inputSchema59 = {
3900
4541
  id: z.string().uuid().describe("The ID of the blueprint to retrieve")
3901
4542
  };
3902
- var outputSchema47 = z.object({
4543
+ var outputSchema59 = z.object({
3903
4544
  id: z.string(),
3904
4545
  name: z.string(),
3905
4546
  documentType: z.object({
@@ -3919,11 +4560,11 @@ var outputSchema47 = z.object({
3919
4560
  segment: z.string().nullable().optional()
3920
4561
  })).optional().describe("Variant information")
3921
4562
  });
3922
- var tool47 = {
4563
+ var tool59 = {
3923
4564
  name: "get-blueprint",
3924
4565
  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.",
3925
- inputSchema: inputSchema47,
3926
- outputSchema: outputSchema47,
4566
+ inputSchema: inputSchema59,
4567
+ outputSchema: outputSchema59,
3927
4568
  slices: ["read"],
3928
4569
  annotations: { readOnlyHint: true },
3929
4570
  handler: async ({ id }) => {
@@ -3946,21 +4587,21 @@ var tool47 = {
3946
4587
  });
3947
4588
  }
3948
4589
  };
3949
- var get_blueprint_default = withStandardDecorators(tool47);
3950
- var inputSchema48 = {
4590
+ var get_blueprint_default = withStandardDecorators(tool59);
4591
+ var inputSchema60 = {
3951
4592
  pageId: z.string().uuid().describe("The ID of the source page to save as a blueprint"),
3952
4593
  name: z.string().describe("The name for the new blueprint")
3953
4594
  };
3954
- var outputSchema48 = z.object({
4595
+ var outputSchema60 = z.object({
3955
4596
  message: z.string(),
3956
4597
  id: z.string(),
3957
4598
  name: z.string()
3958
4599
  });
3959
- var tool48 = {
4600
+ var tool60 = {
3960
4601
  name: "create-blueprint",
3961
4602
  description: "Save an existing page as a reusable blueprint (template). The blueprint preserves the page's document type and property values.",
3962
- inputSchema: inputSchema48,
3963
- outputSchema: outputSchema48,
4603
+ inputSchema: inputSchema60,
4604
+ outputSchema: outputSchema60,
3964
4605
  slices: ["create"],
3965
4606
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
3966
4607
  handler: async ({ pageId, name }) => {
@@ -3992,10 +4633,10 @@ var tool48 = {
3992
4633
  });
3993
4634
  }
3994
4635
  };
3995
- var create_blueprint_default = withStandardDecorators(tool48);
4636
+ var create_blueprint_default = withStandardDecorators(tool60);
3996
4637
 
3997
4638
  // src/umbraco-api/tools/blueprint/index.ts
3998
- var collection6 = {
4639
+ var collection7 = {
3999
4640
  metadata: {
4000
4641
  name: "blueprint",
4001
4642
  displayName: "Blueprints",
@@ -4003,12 +4644,12 @@ var collection6 = {
4003
4644
  },
4004
4645
  tools: () => [list_blueprints_default, get_blueprint_default, create_blueprint_default]
4005
4646
  };
4006
- var blueprint_default = collection6;
4007
- var inputSchema49 = {
4647
+ var blueprint_default = collection7;
4648
+ var inputSchema61 = {
4008
4649
  take: z.number().optional().default(50).describe("Number of results to return (default 50)"),
4009
4650
  skip: z.number().optional().default(0).describe("Number of results to skip for pagination")
4010
4651
  };
4011
- var outputSchema49 = z.object({
4652
+ var outputSchema61 = z.object({
4012
4653
  items: z.array(z.object({
4013
4654
  isoCode: z.string().describe("ISO language code (e.g. en-US)"),
4014
4655
  name: z.string().describe("Display name of the language"),
@@ -4017,11 +4658,11 @@ var outputSchema49 = z.object({
4017
4658
  })).describe("List of configured languages"),
4018
4659
  total: z.number().describe("Total number of languages")
4019
4660
  });
4020
- var tool49 = {
4661
+ var tool61 = {
4021
4662
  name: "list-languages",
4022
4663
  description: "List all languages configured on the Umbraco site. Shows the ISO code, name, and whether each language is the default or mandatory.",
4023
- inputSchema: inputSchema49,
4024
- outputSchema: outputSchema49,
4664
+ inputSchema: inputSchema61,
4665
+ outputSchema: outputSchema61,
4025
4666
  slices: ["list"],
4026
4667
  annotations: { readOnlyHint: true },
4027
4668
  handler: async ({ take, skip }) => {
@@ -4039,22 +4680,22 @@ var tool49 = {
4039
4680
  });
4040
4681
  }
4041
4682
  };
4042
- var list_languages_default = withStandardDecorators(tool49);
4043
- var inputSchema50 = {
4683
+ var list_languages_default = withStandardDecorators(tool61);
4684
+ var inputSchema62 = {
4044
4685
  isoCode: z.string().describe("ISO language code (e.g. en-US)")
4045
4686
  };
4046
- var outputSchema50 = z.object({
4687
+ var outputSchema62 = z.object({
4047
4688
  isoCode: z.string().describe("ISO language code"),
4048
4689
  name: z.string().describe("Display name of the language"),
4049
4690
  isDefault: z.boolean().describe("Whether this is the default language"),
4050
4691
  isMandatory: z.boolean().describe("Whether this language is mandatory"),
4051
4692
  fallbackIsoCode: z.string().nullable().describe("ISO code of the fallback language, if set")
4052
4693
  });
4053
- var tool50 = {
4694
+ var tool62 = {
4054
4695
  name: "get-language",
4055
4696
  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.",
4056
- inputSchema: inputSchema50,
4057
- outputSchema: outputSchema50,
4697
+ inputSchema: inputSchema62,
4698
+ outputSchema: outputSchema62,
4058
4699
  slices: ["read"],
4059
4700
  annotations: { readOnlyHint: true },
4060
4701
  handler: async ({ isoCode }) => {
@@ -4070,24 +4711,24 @@ var tool50 = {
4070
4711
  });
4071
4712
  }
4072
4713
  };
4073
- var get_language_default = withStandardDecorators(tool50);
4074
- var inputSchema51 = {
4714
+ var get_language_default = withStandardDecorators(tool62);
4715
+ var inputSchema63 = {
4075
4716
  isoCode: z.string().describe("ISO language code to add (e.g. fr-FR)"),
4076
4717
  name: z.string().optional().describe("Display name for the language (e.g. 'French'). Defaults to the ISO code if not provided."),
4077
4718
  isDefault: z.boolean().optional().describe("Whether this language should be the default"),
4078
4719
  isMandatory: z.boolean().optional().describe("Whether this language should be mandatory"),
4079
4720
  fallbackIsoCode: z.string().optional().describe("ISO code of the fallback language")
4080
4721
  };
4081
- var outputSchema51 = z.object({
4722
+ var outputSchema63 = z.object({
4082
4723
  message: z.string(),
4083
4724
  isoCode: z.string(),
4084
4725
  name: z.string()
4085
4726
  });
4086
- var tool51 = {
4727
+ var tool63 = {
4087
4728
  name: "create-language",
4088
4729
  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.",
4089
- inputSchema: inputSchema51,
4090
- outputSchema: outputSchema51,
4730
+ inputSchema: inputSchema63,
4731
+ outputSchema: outputSchema63,
4091
4732
  slices: ["create"],
4092
4733
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
4093
4734
  handler: async ({ isoCode, name: displayName, isDefault, isMandatory, fallbackIsoCode }) => {
@@ -4107,23 +4748,23 @@ var tool51 = {
4107
4748
  });
4108
4749
  }
4109
4750
  };
4110
- var create_language_default = withStandardDecorators(tool51);
4111
- var inputSchema52 = {
4751
+ var create_language_default = withStandardDecorators(tool63);
4752
+ var inputSchema64 = {
4112
4753
  isoCode: z.string().describe("ISO language code of the language to update (e.g. en-US)"),
4113
4754
  isDefault: z.boolean().optional().describe("Whether this language should be the default"),
4114
4755
  isMandatory: z.boolean().optional().describe("Whether this language should be mandatory"),
4115
4756
  fallbackIsoCode: z.string().optional().describe("ISO code of the fallback language")
4116
4757
  };
4117
- var outputSchema52 = z.object({
4758
+ var outputSchema64 = z.object({
4118
4759
  message: z.string(),
4119
4760
  isoCode: z.string(),
4120
4761
  name: z.string()
4121
4762
  });
4122
- var tool52 = {
4763
+ var tool64 = {
4123
4764
  name: "update-language",
4124
4765
  description: "Update a language's settings (default, mandatory, fallback).",
4125
- inputSchema: inputSchema52,
4126
- outputSchema: outputSchema52,
4766
+ inputSchema: inputSchema64,
4767
+ outputSchema: outputSchema64,
4127
4768
  slices: ["update"],
4128
4769
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
4129
4770
  handler: async ({ isoCode, isDefault, isMandatory, fallbackIsoCode }) => {
@@ -4148,20 +4789,20 @@ var tool52 = {
4148
4789
  });
4149
4790
  }
4150
4791
  };
4151
- var update_language_default = withStandardDecorators(tool52);
4152
- var inputSchema53 = {
4792
+ var update_language_default = withStandardDecorators(tool64);
4793
+ var inputSchema65 = {
4153
4794
  isoCode: z.string().describe("ISO language code of the language to delete (e.g. fr-FR)")
4154
4795
  };
4155
- var outputSchema53 = z.object({
4796
+ var outputSchema65 = z.object({
4156
4797
  message: z.string(),
4157
4798
  isoCode: z.string(),
4158
4799
  name: z.string()
4159
4800
  });
4160
- var tool53 = {
4801
+ var tool65 = {
4161
4802
  name: "delete-language",
4162
4803
  description: "Remove a language from the site. Content variants in this language will become inaccessible. You will be asked to confirm before deleting.",
4163
- inputSchema: inputSchema53,
4164
- outputSchema: outputSchema53,
4804
+ inputSchema: inputSchema65,
4805
+ outputSchema: outputSchema65,
4165
4806
  slices: ["delete"],
4166
4807
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
4167
4808
  handler: async ({ isoCode }, extra) => {
@@ -4182,10 +4823,10 @@ var tool53 = {
4182
4823
  });
4183
4824
  }
4184
4825
  };
4185
- var delete_language_default = withStandardDecorators(tool53);
4826
+ var delete_language_default = withStandardDecorators(tool65);
4186
4827
 
4187
4828
  // src/umbraco-api/tools/language/index.ts
4188
- var collection7 = {
4829
+ var collection8 = {
4189
4830
  metadata: {
4190
4831
  name: "language",
4191
4832
  displayName: "Languages",
@@ -4193,7 +4834,7 @@ var collection7 = {
4193
4834
  },
4194
4835
  tools: () => [list_languages_default, get_language_default, create_language_default, update_language_default, delete_language_default]
4195
4836
  };
4196
- var language_default = collection7;
4837
+ var language_default = collection8;
4197
4838
  async function checkVariesByCulture(documentId) {
4198
4839
  const docResult = await chainCms("get-document-by-id", { id: documentId });
4199
4840
  if (!docResult.ok) return docResult.errorResult;
@@ -4213,7 +4854,7 @@ async function checkVariesByCulture(documentId) {
4213
4854
  }
4214
4855
 
4215
4856
  // src/umbraco-api/tools/translation/post/create-variant.ts
4216
- var inputSchema54 = {
4857
+ var inputSchema66 = {
4217
4858
  id: z.string().uuid().describe("The ID of the page to add a language variant to"),
4218
4859
  culture: z.string().describe("The target language ISO code (e.g. 'da-DK', 'fr-FR'). Call list-languages to find available cultures."),
4219
4860
  values: z.array(z.object({
@@ -4223,7 +4864,7 @@ var inputSchema54 = {
4223
4864
  segment: z.string().nullable().optional().describe("The segment for segmented content")
4224
4865
  })).optional().describe("Optional property values to set on the new variant")
4225
4866
  };
4226
- var outputSchema54 = z.object({
4867
+ var outputSchema66 = z.object({
4227
4868
  message: z.string(),
4228
4869
  id: z.string(),
4229
4870
  name: z.string(),
@@ -4231,11 +4872,11 @@ var outputSchema54 = z.object({
4231
4872
  previewUrl: previewUrlSchema,
4232
4873
  validation: validationResultSchema
4233
4874
  });
4234
- var tool54 = {
4875
+ var tool66 = {
4235
4876
  name: "create-variant",
4236
4877
  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.",
4237
- inputSchema: inputSchema54,
4238
- outputSchema: outputSchema54,
4878
+ inputSchema: inputSchema66,
4879
+ outputSchema: outputSchema66,
4239
4880
  slices: ["create"],
4240
4881
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
4241
4882
  handler: async ({ id, culture, values }) => {
@@ -4279,13 +4920,13 @@ var tool54 = {
4279
4920
  });
4280
4921
  }
4281
4922
  };
4282
- var create_variant_default = withStandardDecorators(tool54);
4283
- var inputSchema55 = {
4923
+ var create_variant_default = withStandardDecorators(tool66);
4924
+ var inputSchema67 = {
4284
4925
  id: z.string().uuid().describe("The ID of the page to copy a variant on"),
4285
4926
  sourceCulture: z.string().describe("The source language ISO code to copy content from (e.g. 'en-US')"),
4286
4927
  targetCulture: z.string().describe("The target language ISO code to copy content to (e.g. 'da-DK')")
4287
4928
  };
4288
- var outputSchema55 = z.object({
4929
+ var outputSchema67 = z.object({
4289
4930
  message: z.string(),
4290
4931
  id: z.string(),
4291
4932
  name: z.string(),
@@ -4295,11 +4936,11 @@ var outputSchema55 = z.object({
4295
4936
  previewUrl: previewUrlSchema,
4296
4937
  validation: validationResultSchema
4297
4938
  });
4298
- var tool55 = {
4939
+ var tool67 = {
4299
4940
  name: "copy-variant",
4300
4941
  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.",
4301
- inputSchema: inputSchema55,
4302
- outputSchema: outputSchema55,
4942
+ inputSchema: inputSchema67,
4943
+ outputSchema: outputSchema67,
4303
4944
  slices: ["create"],
4304
4945
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
4305
4946
  handler: async ({ id, sourceCulture, targetCulture }, extra) => {
@@ -4353,14 +4994,14 @@ var tool55 = {
4353
4994
  });
4354
4995
  }
4355
4996
  };
4356
- var copy_variant_default = withStandardDecorators(tool55);
4357
- var inputSchema56 = {
4997
+ var copy_variant_default = withStandardDecorators(tool67);
4998
+ var inputSchema68 = {
4358
4999
  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."),
4359
5000
  parentId: z.string().uuid().optional().describe("Parent page ID to search under. Omit to search root-level pages."),
4360
5001
  take: z.number().optional().default(20).describe("Number of results to return"),
4361
5002
  skip: z.number().optional().default(0).describe("Number of results to skip for pagination")
4362
5003
  };
4363
- var outputSchema56 = z.object({
5004
+ var outputSchema68 = z.object({
4364
5005
  items: z.array(z.object({
4365
5006
  id: z.string(),
4366
5007
  name: z.string(),
@@ -4368,11 +5009,11 @@ var outputSchema56 = z.object({
4368
5009
  })).describe("Pages that are missing the specified language variant"),
4369
5010
  total: z.number().describe("Total number of pages missing the variant (before pagination)")
4370
5011
  });
4371
- var tool56 = {
5012
+ var tool68 = {
4372
5013
  name: "list-untranslated",
4373
5014
  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.",
4374
- inputSchema: inputSchema56,
4375
- outputSchema: outputSchema56,
5015
+ inputSchema: inputSchema68,
5016
+ outputSchema: outputSchema68,
4376
5017
  slices: ["search"],
4377
5018
  annotations: { readOnlyHint: true },
4378
5019
  handler: async ({ culture, parentId, take, skip }) => {
@@ -4405,10 +5046,10 @@ var tool56 = {
4405
5046
  return createToolResult({ items: paged, total });
4406
5047
  }
4407
5048
  };
4408
- var list_untranslated_default = withStandardDecorators(tool56);
5049
+ var list_untranslated_default = withStandardDecorators(tool68);
4409
5050
 
4410
5051
  // src/umbraco-api/tools/translation/index.ts
4411
- var collection8 = {
5052
+ var collection9 = {
4412
5053
  metadata: {
4413
5054
  name: "translation",
4414
5055
  displayName: "Translation",
@@ -4416,13 +5057,13 @@ var collection8 = {
4416
5057
  },
4417
5058
  tools: () => [create_variant_default, copy_variant_default, list_untranslated_default]
4418
5059
  };
4419
- var translation_default = collection8;
4420
- var inputSchema57 = {
5060
+ var translation_default = collection9;
5061
+ var inputSchema69 = {
4421
5062
  parentId: z.string().uuid().optional().describe("UUID of the parent dictionary item, or omit to list root-level entries"),
4422
5063
  take: z.number().optional().default(50).describe("Number of results to return (default 50)"),
4423
5064
  skip: z.number().optional().default(0).describe("Number of results to skip for pagination")
4424
5065
  };
4425
- var outputSchema57 = z.object({
5066
+ var outputSchema69 = z.object({
4426
5067
  items: z.array(
4427
5068
  z.object({
4428
5069
  id: z.string(),
@@ -4432,11 +5073,11 @@ var outputSchema57 = z.object({
4432
5073
  ).describe("Dictionary items"),
4433
5074
  total: z.number().describe("Total number of items")
4434
5075
  });
4435
- var tool57 = {
5076
+ var tool69 = {
4436
5077
  name: "list-dictionary",
4437
5078
  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.",
4438
- inputSchema: inputSchema57,
4439
- outputSchema: outputSchema57,
5079
+ inputSchema: inputSchema69,
5080
+ outputSchema: outputSchema69,
4440
5081
  slices: ["list", "tree"],
4441
5082
  annotations: { readOnlyHint: true },
4442
5083
  handler: async ({ parentId, take, skip }) => {
@@ -4462,11 +5103,11 @@ var tool57 = {
4462
5103
  });
4463
5104
  }
4464
5105
  };
4465
- var list_dictionary_default = withStandardDecorators(tool57);
4466
- var inputSchema58 = {
5106
+ var list_dictionary_default = withStandardDecorators(tool69);
5107
+ var inputSchema70 = {
4467
5108
  query: z.string().describe("Search term to match against dictionary item key names")
4468
5109
  };
4469
- var outputSchema58 = z.object({
5110
+ var outputSchema70 = z.object({
4470
5111
  items: z.array(
4471
5112
  z.object({
4472
5113
  id: z.string(),
@@ -4475,11 +5116,11 @@ var outputSchema58 = z.object({
4475
5116
  ).describe("Matching dictionary items"),
4476
5117
  total: z.number().describe("Total number of matching items")
4477
5118
  });
4478
- var tool58 = {
5119
+ var tool70 = {
4479
5120
  name: "search-dictionary",
4480
5121
  description: "Search for dictionary items by key name. Use get-dictionary to see all translations for a specific item.",
4481
- inputSchema: inputSchema58,
4482
- outputSchema: outputSchema58,
5122
+ inputSchema: inputSchema70,
5123
+ outputSchema: outputSchema70,
4483
5124
  slices: ["search"],
4484
5125
  annotations: { readOnlyHint: true },
4485
5126
  handler: async ({ query }) => {
@@ -4494,11 +5135,11 @@ var tool58 = {
4494
5135
  });
4495
5136
  }
4496
5137
  };
4497
- var search_dictionary_default = withStandardDecorators(tool58);
4498
- var inputSchema59 = {
5138
+ var search_dictionary_default = withStandardDecorators(tool70);
5139
+ var inputSchema71 = {
4499
5140
  id: z.string().uuid().describe("UUID of the dictionary item to retrieve")
4500
5141
  };
4501
- var outputSchema59 = z.object({
5142
+ var outputSchema71 = z.object({
4502
5143
  id: z.string(),
4503
5144
  name: z.string(),
4504
5145
  translations: z.array(
@@ -4509,11 +5150,11 @@ var outputSchema59 = z.object({
4509
5150
  })
4510
5151
  ).describe("All translations for this dictionary item")
4511
5152
  });
4512
- var tool59 = {
5153
+ var tool71 = {
4513
5154
  name: "get-dictionary",
4514
5155
  description: "Get a dictionary item with all its translations across languages. Shows the key name and each language's translation value.",
4515
- inputSchema: inputSchema59,
4516
- outputSchema: outputSchema59,
5156
+ inputSchema: inputSchema71,
5157
+ outputSchema: outputSchema71,
4517
5158
  slices: ["read"],
4518
5159
  annotations: { readOnlyHint: true },
4519
5160
  handler: async ({ id }) => {
@@ -4535,8 +5176,8 @@ var tool59 = {
4535
5176
  });
4536
5177
  }
4537
5178
  };
4538
- var get_dictionary_default = withStandardDecorators(tool59);
4539
- var inputSchema60 = {
5179
+ var get_dictionary_default = withStandardDecorators(tool71);
5180
+ var inputSchema72 = {
4540
5181
  name: z.string().describe("The dictionary key name"),
4541
5182
  translations: z.array(
4542
5183
  z.object({
@@ -4546,16 +5187,16 @@ var inputSchema60 = {
4546
5187
  ).describe("Translations to set for this dictionary item"),
4547
5188
  parentId: z.string().uuid().optional().describe("UUID of the parent dictionary item, or omit to create at the root")
4548
5189
  };
4549
- var outputSchema60 = z.object({
5190
+ var outputSchema72 = z.object({
4550
5191
  message: z.string(),
4551
5192
  id: z.string(),
4552
5193
  name: z.string()
4553
5194
  });
4554
- var tool60 = {
5195
+ var tool72 = {
4555
5196
  name: "create-dictionary",
4556
5197
  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.",
4557
- inputSchema: inputSchema60,
4558
- outputSchema: outputSchema60,
5198
+ inputSchema: inputSchema72,
5199
+ outputSchema: outputSchema72,
4559
5200
  slices: ["create"],
4560
5201
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
4561
5202
  handler: async ({ name, translations, parentId }) => {
@@ -4572,8 +5213,8 @@ var tool60 = {
4572
5213
  });
4573
5214
  }
4574
5215
  };
4575
- var create_dictionary_default = withStandardDecorators(tool60);
4576
- var inputSchema61 = {
5216
+ var create_dictionary_default = withStandardDecorators(tool72);
5217
+ var inputSchema73 = {
4577
5218
  id: z.string().uuid().describe("UUID of the dictionary item to update"),
4578
5219
  translations: z.array(
4579
5220
  z.object({
@@ -4582,17 +5223,17 @@ var inputSchema61 = {
4582
5223
  })
4583
5224
  ).describe("Translations to update. Languages not listed here will keep their existing translations.")
4584
5225
  };
4585
- var outputSchema61 = z.object({
5226
+ var outputSchema73 = z.object({
4586
5227
  message: z.string(),
4587
5228
  id: z.string(),
4588
5229
  name: z.string(),
4589
5230
  updatedLanguages: z.array(z.string()).describe("ISO codes of languages that were updated")
4590
5231
  });
4591
- var tool61 = {
5232
+ var tool73 = {
4592
5233
  name: "update-dictionary",
4593
5234
  description: "Update translations for a dictionary item. Call get-dictionary first to see existing translations.",
4594
- inputSchema: inputSchema61,
4595
- outputSchema: outputSchema61,
5235
+ inputSchema: inputSchema73,
5236
+ outputSchema: outputSchema73,
4596
5237
  slices: ["update"],
4597
5238
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
4598
5239
  handler: async ({ id, translations }) => {
@@ -4624,21 +5265,21 @@ var tool61 = {
4624
5265
  });
4625
5266
  }
4626
5267
  };
4627
- var update_dictionary_default = withStandardDecorators(tool61);
4628
- var inputSchema62 = {
5268
+ var update_dictionary_default = withStandardDecorators(tool73);
5269
+ var inputSchema74 = {
4629
5270
  id: z.string().uuid().describe("UUID of the dictionary item to move"),
4630
5271
  targetParentId: z.string().uuid().optional().describe("UUID of the destination parent dictionary item, or omit to move to the root")
4631
5272
  };
4632
- var outputSchema62 = z.object({
5273
+ var outputSchema74 = z.object({
4633
5274
  message: z.string(),
4634
5275
  id: z.string(),
4635
5276
  name: z.string()
4636
5277
  });
4637
- var tool62 = {
5278
+ var tool74 = {
4638
5279
  name: "move-dictionary",
4639
5280
  description: "Move a dictionary item to a different parent in the dictionary tree, or to the root. You will be asked to confirm.",
4640
- inputSchema: inputSchema62,
4641
- outputSchema: outputSchema62,
5281
+ inputSchema: inputSchema74,
5282
+ outputSchema: outputSchema74,
4642
5283
  slices: ["move"],
4643
5284
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
4644
5285
  handler: async ({ id, targetParentId }, extra) => {
@@ -4669,10 +5310,10 @@ var tool62 = {
4669
5310
  });
4670
5311
  }
4671
5312
  };
4672
- var move_dictionary_default = withStandardDecorators(tool62);
5313
+ var move_dictionary_default = withStandardDecorators(tool74);
4673
5314
 
4674
5315
  // src/umbraco-api/tools/dictionary/index.ts
4675
- var collection9 = {
5316
+ var collection10 = {
4676
5317
  metadata: {
4677
5318
  name: "dictionary",
4678
5319
  displayName: "Dictionary",
@@ -4680,13 +5321,13 @@ var collection9 = {
4680
5321
  },
4681
5322
  tools: () => [list_dictionary_default, search_dictionary_default, get_dictionary_default, create_dictionary_default, update_dictionary_default, move_dictionary_default]
4682
5323
  };
4683
- var dictionary_default = collection9;
4684
- var inputSchema63 = {
5324
+ var dictionary_default = collection10;
5325
+ var inputSchema75 = {
4685
5326
  tagGroup: z.string().optional().describe("Filter tags by group name, or omit to list all tags"),
4686
5327
  take: z.number().optional().default(50).describe("Number of tags to return"),
4687
5328
  skip: z.number().optional().default(0).describe("Number of tags to skip for pagination")
4688
5329
  };
4689
- var outputSchema63 = z.object({
5330
+ var outputSchema75 = z.object({
4690
5331
  items: z.array(
4691
5332
  z.object({
4692
5333
  id: z.number(),
@@ -4697,11 +5338,11 @@ var outputSchema63 = z.object({
4697
5338
  ).describe("Tags in use across the site"),
4698
5339
  total: z.number().describe("Total number of tags")
4699
5340
  });
4700
- var tool63 = {
5341
+ var tool75 = {
4701
5342
  name: "list-tags",
4702
5343
  description: "List tags in use across the site. Optionally filter by tag group. Shows how many content items use each tag.",
4703
- inputSchema: inputSchema63,
4704
- outputSchema: outputSchema63,
5344
+ inputSchema: inputSchema75,
5345
+ outputSchema: outputSchema75,
4705
5346
  slices: ["list"],
4706
5347
  annotations: { readOnlyHint: true },
4707
5348
  handler: async ({ tagGroup, take, skip }) => {
@@ -4718,10 +5359,10 @@ var tool63 = {
4718
5359
  });
4719
5360
  }
4720
5361
  };
4721
- var list_tags_default = withStandardDecorators(tool63);
5362
+ var list_tags_default = withStandardDecorators(tool75);
4722
5363
 
4723
5364
  // src/umbraco-api/tools/tag/index.ts
4724
- var collection10 = {
5365
+ var collection11 = {
4725
5366
  metadata: {
4726
5367
  name: "tag",
4727
5368
  displayName: "Tags",
@@ -4729,13 +5370,13 @@ var collection10 = {
4729
5370
  },
4730
5371
  tools: () => [list_tags_default]
4731
5372
  };
4732
- var tag_default = collection10;
5373
+ var tag_default = collection11;
4733
5374
  var TITLE_ALIASES = ["pageTitle", "title", "metaTitle", "seoTitle"];
4734
5375
  var META_DESC_ALIASES = ["metaDescription", "seoMetaDescription", "description"];
4735
- var inputSchema64 = {
5376
+ var inputSchema76 = {
4736
5377
  id: z.string().uuid().describe("The ID of the content page to audit")
4737
5378
  };
4738
- var outputSchema64 = z.object({
5379
+ var outputSchema76 = z.object({
4739
5380
  id: z.string().describe("Page ID"),
4740
5381
  name: z.string().describe("Page name"),
4741
5382
  url: z.string().describe("Page URL"),
@@ -4752,11 +5393,11 @@ var outputSchema64 = z.object({
4752
5393
  headings: z.array(z.object({ level: z.number(), text: z.string() })).describe("Headings found in body content"),
4753
5394
  images: z.array(z.object({ src: z.string(), alt: z.string(), hasAlt: z.boolean() })).describe("Images found in body content with alt text status")
4754
5395
  });
4755
- var tool64 = {
5396
+ var tool76 = {
4756
5397
  name: "audit-page-seo",
4757
5398
  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.",
4758
- inputSchema: inputSchema64,
4759
- outputSchema: outputSchema64,
5399
+ inputSchema: inputSchema76,
5400
+ outputSchema: outputSchema76,
4760
5401
  slices: ["read"],
4761
5402
  annotations: { readOnlyHint: true },
4762
5403
  handler: async ({ id }) => {
@@ -4800,13 +5441,13 @@ var tool64 = {
4800
5441
  });
4801
5442
  }
4802
5443
  };
4803
- var audit_page_seo_default = withStandardDecorators(tool64);
5444
+ var audit_page_seo_default = withStandardDecorators(tool76);
4804
5445
  var META_DESC_ALIASES2 = ["metaDescription", "seoMetaDescription", "description"];
4805
5446
  var BODY_CONTENT_MAX = 2e3;
4806
- var inputSchema65 = {
5447
+ var inputSchema77 = {
4807
5448
  id: z.string().uuid().describe("The ID of the content page to audit")
4808
5449
  };
4809
- var outputSchema65 = z.object({
5450
+ var outputSchema77 = z.object({
4810
5451
  id: z.string().describe("Page ID"),
4811
5452
  name: z.string().describe("Page name"),
4812
5453
  url: z.string().describe("Page URL"),
@@ -4817,11 +5458,11 @@ var outputSchema65 = z.object({
4817
5458
  documentType: z.string().describe("The document type name"),
4818
5459
  lastModified: z.string().describe("ISO date string of last modification")
4819
5460
  });
4820
- var tool65 = {
5461
+ var tool77 = {
4821
5462
  name: "audit-page-content",
4822
5463
  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.",
4823
- inputSchema: inputSchema65,
4824
- outputSchema: outputSchema65,
5464
+ inputSchema: inputSchema77,
5465
+ outputSchema: outputSchema77,
4825
5466
  slices: ["read"],
4826
5467
  annotations: { readOnlyHint: true },
4827
5468
  handler: async ({ id }) => {
@@ -4858,10 +5499,10 @@ var tool65 = {
4858
5499
  });
4859
5500
  }
4860
5501
  };
4861
- var audit_page_content_default = withStandardDecorators(tool65);
5502
+ var audit_page_content_default = withStandardDecorators(tool77);
4862
5503
 
4863
5504
  // src/umbraco-api/tools/content-health/index.ts
4864
- var collection11 = {
5505
+ var collection12 = {
4865
5506
  metadata: {
4866
5507
  name: "content-health",
4867
5508
  displayName: "Content Health",
@@ -4869,8 +5510,8 @@ var collection11 = {
4869
5510
  },
4870
5511
  tools: () => [audit_page_seo_default, audit_page_content_default]
4871
5512
  };
4872
- var content_health_default = collection11;
4873
- var inputSchema66 = {
5513
+ var content_health_default = collection12;
5514
+ var inputSchema78 = {
4874
5515
  parentId: z.string().uuid().optional().describe("Scope to a subtree by parent page ID. Omit to start from root."),
4875
5516
  maxDepth: z.number().optional().default(5).describe("How many levels deep to scan (default 5)")
4876
5517
  };
@@ -4885,7 +5526,7 @@ var treeNodeSchema = z.lazy(
4885
5526
  children: z.array(treeNodeSchema)
4886
5527
  })
4887
5528
  );
4888
- var outputSchema66 = z.object({
5529
+ var outputSchema78 = z.object({
4889
5530
  tree: z.array(treeNodeSchema).describe("Hierarchical site tree with children nested inside each node"),
4890
5531
  totalPages: z.number().describe("Total number of pages found across all levels"),
4891
5532
  maxDepthFound: z.number().describe("The deepest level actually found during the scan"),
@@ -4926,11 +5567,11 @@ async function buildTreeNodes(parentId, depth, maxDepth, pagesPerLevel, totalRef
4926
5567
  }
4927
5568
  return nodes;
4928
5569
  }
4929
- var tool66 = {
5570
+ var tool78 = {
4930
5571
  name: "report-site-tree-summary",
4931
5572
  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.",
4932
- inputSchema: inputSchema66,
4933
- outputSchema: outputSchema66,
5573
+ inputSchema: inputSchema78,
5574
+ outputSchema: outputSchema78,
4934
5575
  slices: ["read"],
4935
5576
  annotations: { readOnlyHint: true },
4936
5577
  handler: async ({ parentId, maxDepth }) => {
@@ -4947,14 +5588,14 @@ var tool66 = {
4947
5588
  });
4948
5589
  }
4949
5590
  };
4950
- var report_site_tree_summary_default = withStandardDecorators(tool66);
4951
- var inputSchema67 = {
5591
+ var report_site_tree_summary_default = withStandardDecorators(tool78);
5592
+ var inputSchema79 = {
4952
5593
  depthThreshold: z.number().optional().default(4).describe("Pages deeper than this level are reported (default 4)"),
4953
5594
  parentId: z.string().uuid().optional().describe("Scope to a subtree by parent page ID. Omit to start from root."),
4954
5595
  take: z.number().optional().default(50).describe("Number of results to return after filtering (default 50)"),
4955
5596
  skip: z.number().optional().default(0).describe("Number of results to skip for pagination (default 0)")
4956
5597
  };
4957
- var outputSchema67 = z.object({
5598
+ var outputSchema79 = z.object({
4958
5599
  items: z.array(
4959
5600
  z.object({
4960
5601
  id: z.string(),
@@ -4969,11 +5610,11 @@ var outputSchema67 = z.object({
4969
5610
  scannedPages: z.number().describe("Total number of pages scanned during the walk"),
4970
5611
  threshold: z.number().describe("The depth threshold used for this scan")
4971
5612
  });
4972
- var tool67 = {
5613
+ var tool79 = {
4973
5614
  name: "report-deep-pages",
4974
5615
  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.",
4975
- inputSchema: inputSchema67,
4976
- outputSchema: outputSchema67,
5616
+ inputSchema: inputSchema79,
5617
+ outputSchema: outputSchema79,
4977
5618
  slices: ["read"],
4978
5619
  annotations: { readOnlyHint: true },
4979
5620
  handler: async ({ depthThreshold, parentId, take, skip }) => {
@@ -5020,10 +5661,10 @@ var tool67 = {
5020
5661
  });
5021
5662
  }
5022
5663
  };
5023
- var report_deep_pages_default = withStandardDecorators(tool67);
5664
+ var report_deep_pages_default = withStandardDecorators(tool79);
5024
5665
 
5025
5666
  // src/umbraco-api/tools/site-structure/index.ts
5026
- var collection12 = {
5667
+ var collection13 = {
5027
5668
  metadata: {
5028
5669
  name: "site-structure",
5029
5670
  displayName: "Site Structure",
@@ -5031,12 +5672,12 @@ var collection12 = {
5031
5672
  },
5032
5673
  tools: () => [report_site_tree_summary_default, report_deep_pages_default]
5033
5674
  };
5034
- var site_structure_default = collection12;
5035
- var inputSchema68 = {
5675
+ var site_structure_default = collection13;
5676
+ var inputSchema80 = {
5036
5677
  ids: z.array(z.string().uuid()).min(1).max(10).describe("The IDs of the pages to publish (max 10)"),
5037
5678
  includeDescendants: z.boolean().optional().default(false).describe("Whether to also publish all child pages of each page")
5038
5679
  };
5039
- var outputSchema68 = z.object({
5680
+ var outputSchema80 = z.object({
5040
5681
  message: z.string(),
5041
5682
  results: z.array(z.object({
5042
5683
  id: z.string(),
@@ -5044,19 +5685,25 @@ var outputSchema68 = z.object({
5044
5685
  success: z.boolean(),
5045
5686
  previousVersionId: z.string().optional(),
5046
5687
  error: z.union([z.string(), z.record(z.string(), z.unknown())]).optional(),
5047
- publishedUrls: publishedUrlsSchema.optional()
5688
+ publishedUrls: publishedUrlsSchema.optional(),
5689
+ publishPending: z.boolean().optional().describe("True when includeDescendants was requested and the CMS couldn't confirm the tree finished publishing in time \u2014 the operation is still running, not failed.")
5048
5690
  })),
5049
5691
  successCount: z.number(),
5050
5692
  failureCount: z.number(),
5051
5693
  skippedCount: z.number()
5052
5694
  });
5053
- var tool68 = {
5695
+ var tool80 = {
5054
5696
  name: "bulk-publish",
5055
5697
  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.",
5056
- inputSchema: inputSchema68,
5057
- outputSchema: outputSchema68,
5698
+ inputSchema: inputSchema80,
5699
+ outputSchema: outputSchema80,
5058
5700
  slices: ["publish"],
5059
- annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
5701
+ // includeDescendants delegates to publish-document-with-descendants, which
5702
+ // the chained CMS tool annotates idempotentHint: false — a retry fires a
5703
+ // second concurrent recursive publish job rather than converging to the
5704
+ // same end state. That makes this tool non-idempotent as a whole, since
5705
+ // includeDescendants is a valid input, not a separate tool.
5706
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
5060
5707
  handler: async ({ ids, includeDescendants }, extra) => {
5061
5708
  const validationError = validateBulkIds(ids);
5062
5709
  if (validationError) return createToolResult(validationError);
@@ -5082,15 +5729,20 @@ ${nameList}`;
5082
5729
  skippedCount: 0
5083
5730
  });
5084
5731
  }
5732
+ const stillPublishing = /* @__PURE__ */ new Set();
5085
5733
  const results = await executeBulkSequentially(items, async (item) => {
5086
5734
  const cultures = item.cultures ?? [null];
5087
- const result = includeDescendants ? await chainCms("publish-document-with-descendants", {
5088
- id: item.id,
5089
- data: {
5090
- includeUnpublishedDescendants: false,
5091
- cultures: cultures.filter((c) => c !== null)
5092
- }
5093
- }) : await chainCms("publish-document", {
5735
+ if (includeDescendants) {
5736
+ const result2 = await publishWithDescendants(
5737
+ item.id,
5738
+ { includeUnpublishedDescendants: false, cultures: cultures.filter((c) => c !== null) },
5739
+ { followUp: false }
5740
+ );
5741
+ if (!result2.ok) return result2.errorResult;
5742
+ if (!result2.complete) stillPublishing.add(item.id);
5743
+ return null;
5744
+ }
5745
+ const result = await chainCms("publish-document", {
5094
5746
  id: item.id,
5095
5747
  data: { publishSchedules: cultures.map((c) => ({ culture: c })) }
5096
5748
  });
@@ -5101,16 +5753,25 @@ ${nameList}`;
5101
5753
  });
5102
5754
  for (const row of results) {
5103
5755
  if (!row.success) continue;
5756
+ if (stillPublishing.has(row.id)) {
5757
+ row.publishPending = true;
5758
+ continue;
5759
+ }
5104
5760
  row.publishedUrls = await fetchPublishedUrls(row.id);
5105
5761
  }
5106
- return createToolResult(buildBulkOutput("Published", results));
5762
+ const output = buildBulkOutput("Published", results);
5763
+ if (stillPublishing.size > 0) {
5764
+ const names = results.filter((r) => stillPublishing.has(r.id)).map((r) => r.name);
5765
+ output.message += ` (${names.join(", ")} ${names.length === 1 ? "is" : "are"} a large tree \u2014 descendants still publishing in the background; check again shortly)`;
5766
+ }
5767
+ return createToolResult(output);
5107
5768
  }
5108
5769
  };
5109
- var bulk_publish_default = withStandardDecorators(tool68);
5110
- var inputSchema69 = {
5770
+ var bulk_publish_default = withStandardDecorators(tool80);
5771
+ var inputSchema81 = {
5111
5772
  ids: z.array(z.string().uuid()).min(1).max(10).describe("The IDs of the pages to unpublish (max 10)")
5112
5773
  };
5113
- var outputSchema69 = z.object({
5774
+ var outputSchema81 = z.object({
5114
5775
  message: z.string(),
5115
5776
  results: z.array(z.object({
5116
5777
  id: z.string(),
@@ -5124,11 +5785,11 @@ var outputSchema69 = z.object({
5124
5785
  failureCount: z.number(),
5125
5786
  skippedCount: z.number()
5126
5787
  });
5127
- var tool69 = {
5788
+ var tool81 = {
5128
5789
  name: "bulk-unpublish",
5129
5790
  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.",
5130
- inputSchema: inputSchema69,
5131
- outputSchema: outputSchema69,
5791
+ inputSchema: inputSchema81,
5792
+ outputSchema: outputSchema81,
5132
5793
  slices: ["publish"],
5133
5794
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
5134
5795
  handler: async ({ ids }, extra) => {
@@ -5184,7 +5845,7 @@ ${nameList}`;
5184
5845
  return createToolResult(buildBulkOutput("Unpublished", results));
5185
5846
  }
5186
5847
  };
5187
- var bulk_unpublish_default = withStandardDecorators(tool69);
5848
+ var bulk_unpublish_default = withStandardDecorators(tool81);
5188
5849
 
5189
5850
  // src/umbraco-api/tools/helpers/format-date.ts
5190
5851
  function formatDate(iso) {
@@ -5198,11 +5859,11 @@ function formatDate(iso) {
5198
5859
  }
5199
5860
 
5200
5861
  // src/umbraco-api/tools/bulk-operations/post/bulk-schedule-publish.ts
5201
- var inputSchema70 = {
5862
+ var inputSchema82 = {
5202
5863
  ids: z.array(z.string().uuid()).min(1).max(10).describe("The IDs of the pages to schedule for publishing (max 10)"),
5203
5864
  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.")
5204
5865
  };
5205
- var outputSchema70 = z.object({
5866
+ var outputSchema82 = z.object({
5206
5867
  message: z.string(),
5207
5868
  results: z.array(z.object({
5208
5869
  id: z.string(),
@@ -5216,11 +5877,11 @@ var outputSchema70 = z.object({
5216
5877
  failureCount: z.number(),
5217
5878
  skippedCount: z.number()
5218
5879
  });
5219
- var tool70 = {
5880
+ var tool82 = {
5220
5881
  name: "bulk-schedule-publish",
5221
5882
  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.",
5222
- inputSchema: inputSchema70,
5223
- outputSchema: outputSchema70,
5883
+ inputSchema: inputSchema82,
5884
+ outputSchema: outputSchema82,
5224
5885
  slices: ["publish"],
5225
5886
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
5226
5887
  handler: async ({ ids, publishDate }, extra) => {
@@ -5265,15 +5926,15 @@ ${nameList}`;
5265
5926
  return createToolResult(buildBulkOutput("Scheduled", results));
5266
5927
  }
5267
5928
  };
5268
- var bulk_schedule_publish_default = withStandardDecorators(tool70);
5269
- var inputSchema71 = {
5929
+ var bulk_schedule_publish_default = withStandardDecorators(tool82);
5930
+ var inputSchema83 = {
5270
5931
  ids: z.array(z.string().uuid()).min(1).max(10).describe("The IDs of the pages to update (max 10)"),
5271
5932
  alias: z.string().describe("The property alias to set (call get-page first to verify it exists on the document type)"),
5272
5933
  value: z.any().describe("The value to set on the property"),
5273
5934
  culture: z.string().optional().describe("The culture code for variant content (omit for invariant properties)"),
5274
5935
  segment: z.string().optional().describe("The segment for segmented content (omit if not using segments)")
5275
5936
  };
5276
- var outputSchema71 = z.object({
5937
+ var outputSchema83 = z.object({
5277
5938
  message: z.string(),
5278
5939
  results: z.array(z.object({
5279
5940
  id: z.string(),
@@ -5288,11 +5949,11 @@ var outputSchema71 = z.object({
5288
5949
  failureCount: z.number(),
5289
5950
  skippedCount: z.number()
5290
5951
  });
5291
- var tool71 = {
5952
+ var tool83 = {
5292
5953
  name: "bulk-set-property",
5293
5954
  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.",
5294
- inputSchema: inputSchema71,
5295
- outputSchema: outputSchema71,
5955
+ inputSchema: inputSchema83,
5956
+ outputSchema: outputSchema83,
5296
5957
  slices: ["update"],
5297
5958
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
5298
5959
  handler: async ({ ids, alias, value, culture, segment }, extra) => {
@@ -5339,12 +6000,12 @@ ${nameList}`;
5339
6000
  return createToolResult(buildBulkOutput("Updated", results));
5340
6001
  }
5341
6002
  };
5342
- var bulk_set_property_default = withStandardDecorators(tool71);
5343
- var inputSchema72 = {
6003
+ var bulk_set_property_default = withStandardDecorators(tool83);
6004
+ var inputSchema84 = {
5344
6005
  ids: z.array(z.string().uuid()).min(1).max(10).describe("The IDs of the pages to move (max 10)"),
5345
6006
  targetParentId: z.string().uuid().describe("The ID of the destination parent page to move the pages into")
5346
6007
  };
5347
- var outputSchema72 = z.object({
6008
+ var outputSchema84 = z.object({
5348
6009
  message: z.string(),
5349
6010
  results: z.array(z.object({
5350
6011
  id: z.string(),
@@ -5358,11 +6019,11 @@ var outputSchema72 = z.object({
5358
6019
  failureCount: z.number(),
5359
6020
  skippedCount: z.number()
5360
6021
  });
5361
- var tool72 = {
6022
+ var tool84 = {
5362
6023
  name: "bulk-move",
5363
6024
  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.",
5364
- inputSchema: inputSchema72,
5365
- outputSchema: outputSchema72,
6025
+ inputSchema: inputSchema84,
6026
+ outputSchema: outputSchema84,
5366
6027
  slices: ["move"],
5367
6028
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
5368
6029
  handler: async ({ ids, targetParentId }, extra) => {
@@ -5415,8 +6076,8 @@ ${nameList}`;
5415
6076
  return createToolResult(buildBulkOutput("Moved", results));
5416
6077
  }
5417
6078
  };
5418
- var bulk_move_default = withStandardDecorators(tool72);
5419
- var inputSchema73 = {
6079
+ var bulk_move_default = withStandardDecorators(tool84);
6080
+ var inputSchema85 = {
5420
6081
  ids: z.array(z.string().uuid()).min(1).max(10).describe("The IDs of the pages to update (max 10)"),
5421
6082
  contentTypeKey: z.string().uuid().describe("The block element type key to target. Use inspect-blocks to find this."),
5422
6083
  propertyAlias: z.string().describe("The document property alias containing the blocks (e.g. 'contentRows'). Use inspect-blocks to find this."),
@@ -5427,7 +6088,7 @@ var inputSchema73 = {
5427
6088
  culture: z.string().nullable().optional().describe("Culture code if the document property is variant"),
5428
6089
  segment: z.string().nullable().optional().describe("Segment if the document property is variant")
5429
6090
  };
5430
- var outputSchema73 = z.object({
6091
+ var outputSchema85 = z.object({
5431
6092
  message: z.string(),
5432
6093
  results: z.array(z.object({
5433
6094
  id: z.string(),
@@ -5445,10 +6106,10 @@ var outputSchema73 = z.object({
5445
6106
  skippedCount: z.number(),
5446
6107
  totalBlocksUpdated: z.number()
5447
6108
  });
5448
- function isBlockListOrGridValue3(value) {
6109
+ function isBlockListOrGridValue2(value) {
5449
6110
  return value !== null && typeof value === "object" && !Array.isArray(value) && Array.isArray(value.contentData);
5450
6111
  }
5451
- function isRteWithBlocks3(value) {
6112
+ function isRteWithBlocks2(value) {
5452
6113
  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);
5453
6114
  }
5454
6115
  function findMatchingBlocks(doc, propertyAlias, contentTypeKey) {
@@ -5456,18 +6117,18 @@ function findMatchingBlocks(doc, propertyAlias, contentTypeKey) {
5456
6117
  const prop = allValues.find((v) => v.alias === propertyAlias);
5457
6118
  if (!prop) return [];
5458
6119
  let contentData = [];
5459
- if (isBlockListOrGridValue3(prop.value)) {
6120
+ if (isBlockListOrGridValue2(prop.value)) {
5460
6121
  contentData = prop.value.contentData;
5461
- } else if (isRteWithBlocks3(prop.value)) {
6122
+ } else if (isRteWithBlocks2(prop.value)) {
5462
6123
  contentData = prop.value.blocks.contentData;
5463
6124
  }
5464
6125
  return contentData.filter((block) => block.contentTypeKey === contentTypeKey).map((block) => ({ contentKey: block.key ?? "" })).filter((b) => b.contentKey !== "");
5465
6126
  }
5466
- var tool73 = {
6127
+ var tool85 = {
5467
6128
  name: "bulk-set-block-property",
5468
6129
  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.",
5469
- inputSchema: inputSchema73,
5470
- outputSchema: outputSchema73,
6130
+ inputSchema: inputSchema85,
6131
+ outputSchema: outputSchema85,
5471
6132
  slices: ["update"],
5472
6133
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
5473
6134
  handler: async ({ ids, contentTypeKey, propertyAlias, values, culture, segment }, extra) => {
@@ -5647,10 +6308,10 @@ Changes will be saved but not published.`;
5647
6308
  });
5648
6309
  }
5649
6310
  };
5650
- var bulk_set_block_property_default = withStandardDecorators(tool73);
6311
+ var bulk_set_block_property_default = withStandardDecorators(tool85);
5651
6312
 
5652
6313
  // src/umbraco-api/tools/bulk-operations/index.ts
5653
- var collection13 = {
6314
+ var collection14 = {
5654
6315
  metadata: {
5655
6316
  name: "bulk-operations",
5656
6317
  displayName: "Bulk Operations",
@@ -5658,7 +6319,7 @@ var collection13 = {
5658
6319
  },
5659
6320
  tools: () => [bulk_publish_default, bulk_unpublish_default, bulk_schedule_publish_default, bulk_set_property_default, bulk_move_default, bulk_set_block_property_default]
5660
6321
  };
5661
- var bulk_operations_default = collection13;
6322
+ var bulk_operations_default = collection14;
5662
6323
 
5663
6324
  // src/umbraco-api/tools/member-reporting/get/member-type-helper.ts
5664
6325
  function memberTypeToString(memberType) {
@@ -5672,12 +6333,12 @@ function memberTypeToString(memberType) {
5672
6333
  }
5673
6334
 
5674
6335
  // src/umbraco-api/tools/member/get/search-members.ts
5675
- var inputSchema74 = {
6336
+ var inputSchema86 = {
5676
6337
  query: z.string().describe("Search term to find members by name or email address"),
5677
6338
  take: z.number().optional().default(20).describe("Number of results to return (default 20)"),
5678
6339
  skip: z.number().optional().default(0).describe("Number of results to skip for pagination")
5679
6340
  };
5680
- var outputSchema74 = z.object({
6341
+ var outputSchema86 = z.object({
5681
6342
  items: z.array(z.object({
5682
6343
  id: z.string(),
5683
6344
  name: z.string(),
@@ -5688,11 +6349,11 @@ var outputSchema74 = z.object({
5688
6349
  })).describe("Matching members"),
5689
6350
  total: z.number().describe("Total number of matches")
5690
6351
  });
5691
- var tool74 = {
6352
+ var tool86 = {
5692
6353
  name: "search-members",
5693
6354
  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.",
5694
- inputSchema: inputSchema74,
5695
- outputSchema: outputSchema74,
6355
+ inputSchema: inputSchema86,
6356
+ outputSchema: outputSchema86,
5696
6357
  slices: ["search"],
5697
6358
  annotations: { readOnlyHint: true },
5698
6359
  handler: async ({ query, take, skip }) => {
@@ -5712,7 +6373,7 @@ var tool74 = {
5712
6373
  });
5713
6374
  }
5714
6375
  };
5715
- var search_members_default = withStandardDecorators(tool74);
6376
+ var search_members_default = withStandardDecorators(tool86);
5716
6377
 
5717
6378
  // src/umbraco-api/tools/member/sensitive-data-access.ts
5718
6379
  async function checkSensitiveDataAccess() {
@@ -5722,10 +6383,10 @@ async function checkSensitiveDataAccess() {
5722
6383
  }
5723
6384
 
5724
6385
  // src/umbraco-api/tools/member/get/get-member.ts
5725
- var inputSchema75 = {
6386
+ var inputSchema87 = {
5726
6387
  id: z.string().uuid().describe("The ID of the member to retrieve")
5727
6388
  };
5728
- var outputSchema75 = z.object({
6389
+ var outputSchema87 = z.object({
5729
6390
  id: z.string(),
5730
6391
  name: z.string(),
5731
6392
  email: z.string(),
@@ -5745,11 +6406,11 @@ var outputSchema75 = z.object({
5745
6406
  lastPasswordChangeDate: z.string().nullable(),
5746
6407
  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.")
5747
6408
  });
5748
- var tool75 = {
6409
+ var tool87 = {
5749
6410
  name: "get-member",
5750
6411
  description: "Get the full profile of a member including their groups, properties, approval status, and login history.",
5751
- inputSchema: inputSchema75,
5752
- outputSchema: outputSchema75,
6412
+ inputSchema: inputSchema87,
6413
+ outputSchema: outputSchema87,
5753
6414
  slices: ["read"],
5754
6415
  annotations: { readOnlyHint: true },
5755
6416
  handler: async ({ id }) => {
@@ -5775,12 +6436,12 @@ var tool75 = {
5775
6436
  });
5776
6437
  }
5777
6438
  };
5778
- var get_member_default = withStandardDecorators(tool75);
5779
- var inputSchema76 = {
6439
+ var get_member_default = withStandardDecorators(tool87);
6440
+ var inputSchema88 = {
5780
6441
  take: z.number().optional().default(50).describe("Number of results to return (default 50)"),
5781
6442
  skip: z.number().optional().default(0).describe("Number of results to skip for pagination")
5782
6443
  };
5783
- var outputSchema76 = z.object({
6444
+ var outputSchema88 = z.object({
5784
6445
  items: z.array(z.object({
5785
6446
  id: z.string(),
5786
6447
  alias: z.string(),
@@ -5788,11 +6449,11 @@ var outputSchema76 = z.object({
5788
6449
  })).describe("Available member types"),
5789
6450
  total: z.number().describe("Total number of member types")
5790
6451
  });
5791
- var tool76 = {
6452
+ var tool88 = {
5792
6453
  name: "list-member-types",
5793
6454
  description: "List available member types. Use this before create-member to find a valid member type ID.",
5794
- inputSchema: inputSchema76,
5795
- outputSchema: outputSchema76,
6455
+ inputSchema: inputSchema88,
6456
+ outputSchema: outputSchema88,
5796
6457
  slices: ["list"],
5797
6458
  annotations: { readOnlyHint: true },
5798
6459
  handler: async ({ take, skip }) => {
@@ -5808,8 +6469,8 @@ var tool76 = {
5808
6469
  });
5809
6470
  }
5810
6471
  };
5811
- var list_member_types_default = withStandardDecorators(tool76);
5812
- var inputSchema77 = {
6472
+ var list_member_types_default = withStandardDecorators(tool88);
6473
+ var inputSchema89 = {
5813
6474
  email: z.string().email().describe("The email address for the new member"),
5814
6475
  username: z.string().describe("The username for the new member"),
5815
6476
  name: z.string().describe("The display name for the new member"),
@@ -5822,17 +6483,17 @@ var inputSchema77 = {
5822
6483
  value: z.any().describe("The property value")
5823
6484
  })).optional().describe("Custom property values to set on the new member")
5824
6485
  };
5825
- var outputSchema77 = z.object({
6486
+ var outputSchema89 = z.object({
5826
6487
  message: z.string(),
5827
6488
  id: z.string(),
5828
6489
  name: z.string(),
5829
6490
  email: z.string()
5830
6491
  });
5831
- var tool77 = {
6492
+ var tool89 = {
5832
6493
  name: "create-member",
5833
6494
  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.",
5834
- inputSchema: inputSchema77,
5835
- outputSchema: outputSchema77,
6495
+ inputSchema: inputSchema89,
6496
+ outputSchema: outputSchema89,
5836
6497
  slices: ["create"],
5837
6498
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
5838
6499
  handler: async ({ email, username, name, password, memberTypeId, isApproved, groups, values }) => {
@@ -5886,8 +6547,8 @@ var tool77 = {
5886
6547
  });
5887
6548
  }
5888
6549
  };
5889
- var create_member_default = withStandardDecorators(tool77);
5890
- var inputSchema78 = {
6550
+ var create_member_default = withStandardDecorators(tool89);
6551
+ var inputSchema90 = {
5891
6552
  id: z.string().uuid().describe("The ID of the member to update"),
5892
6553
  name: z.string().optional().describe("The new display name for the member"),
5893
6554
  email: z.string().email().optional().describe("The new email address for the member"),
@@ -5902,17 +6563,17 @@ var inputSchema78 = {
5902
6563
  value: z.any().describe("The new property value")
5903
6564
  })).optional().describe("Custom property values to update")
5904
6565
  };
5905
- var outputSchema78 = z.object({
6566
+ var outputSchema90 = z.object({
5906
6567
  message: z.string(),
5907
6568
  id: z.string(),
5908
6569
  name: z.string(),
5909
6570
  email: z.string()
5910
6571
  });
5911
- var tool78 = {
6572
+ var tool90 = {
5912
6573
  name: "update-member",
5913
6574
  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.",
5914
- inputSchema: inputSchema78,
5915
- outputSchema: outputSchema78,
6575
+ inputSchema: inputSchema90,
6576
+ outputSchema: outputSchema90,
5916
6577
  slices: ["update"],
5917
6578
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
5918
6579
  handler: async ({ id, name, email, username, newPassword, isTwoFactorEnabled, isApproved, isLockedOut, groups, values }, extra) => {
@@ -5968,21 +6629,21 @@ var tool78 = {
5968
6629
  });
5969
6630
  }
5970
6631
  };
5971
- var update_member_default = withStandardDecorators(tool78);
5972
- var inputSchema79 = {
6632
+ var update_member_default = withStandardDecorators(tool90);
6633
+ var inputSchema91 = {
5973
6634
  id: z.string().uuid().describe("The ID of the member to permanently delete")
5974
6635
  };
5975
- var outputSchema79 = z.object({
6636
+ var outputSchema91 = z.object({
5976
6637
  message: z.string(),
5977
6638
  id: z.string(),
5978
6639
  name: z.string(),
5979
6640
  email: z.string()
5980
6641
  });
5981
- var tool79 = {
6642
+ var tool91 = {
5982
6643
  name: "delete-member",
5983
6644
  description: "Permanently delete a member. This cannot be undone \u2014 there is no recycle bin for members. You will be asked to confirm.",
5984
- inputSchema: inputSchema79,
5985
- outputSchema: outputSchema79,
6645
+ inputSchema: inputSchema91,
6646
+ outputSchema: outputSchema91,
5986
6647
  slices: ["delete"],
5987
6648
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
5988
6649
  handler: async ({ id }, extra) => {
@@ -6004,10 +6665,10 @@ var tool79 = {
6004
6665
  });
6005
6666
  }
6006
6667
  };
6007
- var delete_member_default = withStandardDecorators(tool79);
6668
+ var delete_member_default = withStandardDecorators(tool91);
6008
6669
 
6009
6670
  // src/umbraco-api/tools/member/index.ts
6010
- var collection14 = {
6671
+ var collection15 = {
6011
6672
  metadata: {
6012
6673
  name: "member",
6013
6674
  displayName: "Members",
@@ -6015,23 +6676,23 @@ var collection14 = {
6015
6676
  },
6016
6677
  tools: () => [search_members_default, get_member_default, list_member_types_default, create_member_default, update_member_default, delete_member_default]
6017
6678
  };
6018
- var member_default = collection14;
6019
- var inputSchema80 = {
6679
+ var member_default = collection15;
6680
+ var inputSchema92 = {
6020
6681
  take: z.number().optional().default(50).describe("Number of results to return (default 50)"),
6021
6682
  skip: z.number().optional().default(0).describe("Number of results to skip for pagination")
6022
6683
  };
6023
- var outputSchema80 = z.object({
6684
+ var outputSchema92 = z.object({
6024
6685
  items: z.array(z.object({
6025
6686
  id: z.string(),
6026
6687
  name: z.string()
6027
6688
  })).describe("Member groups"),
6028
6689
  total: z.number().describe("Total number of member groups")
6029
6690
  });
6030
- var tool80 = {
6691
+ var tool92 = {
6031
6692
  name: "list-member-groups",
6032
6693
  description: "List all member groups. Use group names when creating or updating members to assign them to groups.",
6033
- inputSchema: inputSchema80,
6034
- outputSchema: outputSchema80,
6694
+ inputSchema: inputSchema92,
6695
+ outputSchema: outputSchema92,
6035
6696
  slices: ["list"],
6036
6697
  annotations: { readOnlyHint: true },
6037
6698
  handler: async ({ take, skip }) => {
@@ -6047,20 +6708,20 @@ var tool80 = {
6047
6708
  });
6048
6709
  }
6049
6710
  };
6050
- var list_member_groups_default = withStandardDecorators(tool80);
6051
- var inputSchema81 = {
6711
+ var list_member_groups_default = withStandardDecorators(tool92);
6712
+ var inputSchema93 = {
6052
6713
  name: z.string().describe("The name of the new member group")
6053
6714
  };
6054
- var outputSchema81 = z.object({
6715
+ var outputSchema93 = z.object({
6055
6716
  message: z.string(),
6056
6717
  id: z.string(),
6057
6718
  name: z.string()
6058
6719
  });
6059
- var tool81 = {
6720
+ var tool93 = {
6060
6721
  name: "create-member-group",
6061
6722
  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.",
6062
- inputSchema: inputSchema81,
6063
- outputSchema: outputSchema81,
6723
+ inputSchema: inputSchema93,
6724
+ outputSchema: outputSchema93,
6064
6725
  slices: ["create"],
6065
6726
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
6066
6727
  handler: async ({ name }) => {
@@ -6073,20 +6734,20 @@ var tool81 = {
6073
6734
  });
6074
6735
  }
6075
6736
  };
6076
- var create_member_group_default = withStandardDecorators(tool81);
6077
- var inputSchema82 = {
6737
+ var create_member_group_default = withStandardDecorators(tool93);
6738
+ var inputSchema94 = {
6078
6739
  id: z.string().uuid().describe("The ID of the member group to delete")
6079
6740
  };
6080
- var outputSchema82 = z.object({
6741
+ var outputSchema94 = z.object({
6081
6742
  message: z.string(),
6082
6743
  id: z.string(),
6083
6744
  name: z.string()
6084
6745
  });
6085
- var tool82 = {
6746
+ var tool94 = {
6086
6747
  name: "delete-member-group",
6087
6748
  description: "Delete a member group. Members in this group will lose the group assignment. You will be asked to confirm.",
6088
- inputSchema: inputSchema82,
6089
- outputSchema: outputSchema82,
6749
+ inputSchema: inputSchema94,
6750
+ outputSchema: outputSchema94,
6090
6751
  slices: ["delete"],
6091
6752
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
6092
6753
  handler: async ({ id }, extra) => {
@@ -6107,10 +6768,10 @@ var tool82 = {
6107
6768
  });
6108
6769
  }
6109
6770
  };
6110
- var delete_member_group_default = withStandardDecorators(tool82);
6771
+ var delete_member_group_default = withStandardDecorators(tool94);
6111
6772
 
6112
6773
  // src/umbraco-api/tools/member-group/index.ts
6113
- var collection15 = {
6774
+ var collection16 = {
6114
6775
  metadata: {
6115
6776
  name: "member-group",
6116
6777
  displayName: "Member Groups",
@@ -6118,74 +6779,82 @@ var collection15 = {
6118
6779
  },
6119
6780
  tools: () => [list_member_groups_default, create_member_group_default, delete_member_group_default]
6120
6781
  };
6121
- var member_group_default = collection15;
6122
- var inputSchema83 = {};
6123
- var outputSchema83 = z.object({
6124
- totalMembers: z.number().describe("Total number of members across all types and groups"),
6782
+ var member_group_default = collection16;
6783
+ var inputSchema95 = {};
6784
+ var outputSchema95 = z.object({
6785
+ totalMembers: z.number().describe("Total number of members across all types and groups (exact, server-reported \u2014 not capped by the sample)."),
6125
6786
  byType: z.array(z.object({
6126
6787
  memberType: z.string().describe("Member type alias or name"),
6127
6788
  count: z.number()
6128
- })).describe("Member counts grouped by member type. Maps naturally to a pie or bar chart."),
6789
+ })).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."),
6129
6790
  byGroup: z.array(z.object({
6130
6791
  group: z.string().describe("Member group name"),
6131
6792
  count: z.number()
6132
- })).describe("Member counts grouped by member group. Members with no group are excluded.")
6793
+ })).describe("Member counts grouped by member group \u2014 exact, server-reported per-group totals (uncapped). Members with no group are excluded.")
6133
6794
  });
6134
6795
  var PAGE_SIZE = 100;
6135
6796
  var MEMBER_CAP = 500;
6136
- var tool83 = {
6797
+ var tool95 = {
6137
6798
  name: "report-member-count",
6138
- 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.",
6139
- inputSchema: inputSchema83,
6140
- outputSchema: outputSchema83,
6799
+ 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.",
6800
+ inputSchema: inputSchema95,
6801
+ outputSchema: outputSchema95,
6141
6802
  slices: ["read"],
6142
6803
  annotations: { readOnlyHint: true },
6143
6804
  handler: async () => {
6144
- const allMembers = [];
6805
+ const sampledMembers = [];
6806
+ let totalMembers = 0;
6145
6807
  let cursor = encodeCursor({ s: 0, t: PAGE_SIZE });
6146
- while (allMembers.length < MEMBER_CAP) {
6808
+ while (sampledMembers.length < MEMBER_CAP) {
6147
6809
  const result = await chainCms("find-member", { cursor, orderBy: "username" });
6148
6810
  if (!result.ok) return result.errorResult;
6149
6811
  const data = result.data;
6150
6812
  const items = data.items ?? [];
6151
- allMembers.push(...items);
6813
+ if (typeof data.total === "number") totalMembers = data.total;
6814
+ sampledMembers.push(...items);
6152
6815
  const nextCursor = data.nextCursor;
6153
6816
  if (!nextCursor || items.length === 0) break;
6154
6817
  cursor = nextCursor;
6155
6818
  }
6819
+ if (totalMembers === 0 && sampledMembers.length > 0) totalMembers = sampledMembers.length;
6156
6820
  const typeCounts = /* @__PURE__ */ new Map();
6157
- for (const member of allMembers) {
6821
+ for (const member of sampledMembers) {
6158
6822
  const memberType = memberTypeToString(member.memberType);
6159
6823
  typeCounts.set(memberType, (typeCounts.get(memberType) ?? 0) + 1);
6160
6824
  }
6161
6825
  const groupResult = await chainCms("get-all-member-groups", {});
6162
6826
  if (!groupResult.ok) return groupResult.errorResult;
6163
6827
  const allGroups = groupResult.data.items ?? [];
6828
+ const named = allGroups.filter((g) => typeof g.name === "string");
6829
+ const perGroupResults = await Promise.all(
6830
+ named.map(
6831
+ (g) => chainCms("find-member", {
6832
+ memberGroupName: g.name,
6833
+ cursor: encodeCursor({ s: 0, t: 1 }),
6834
+ orderBy: "username"
6835
+ })
6836
+ )
6837
+ );
6164
6838
  const byGroup = [];
6165
- for (const group of allGroups) {
6166
- if (!group.name) continue;
6167
- const countResult = await chainCms("find-member", {
6168
- memberGroupName: group.name,
6169
- cursor: encodeCursor({ s: 0, t: 1 }),
6170
- orderBy: "username"
6171
- });
6172
- if (!countResult.ok) return countResult.errorResult;
6173
- byGroup.push({ group: group.name, count: countResult.data.total ?? 0 });
6839
+ for (let i = 0; i < named.length; i++) {
6840
+ const r = perGroupResults[i];
6841
+ if (!r.ok) return r.errorResult;
6842
+ byGroup.push({ group: named[i].name, count: r.data.total ?? 0 });
6174
6843
  }
6175
6844
  return createToolResult({
6176
- totalMembers: allMembers.length,
6845
+ totalMembers,
6177
6846
  byType: Array.from(typeCounts.entries()).map(([memberType, count]) => ({ memberType, count })).sort((a, b) => b.count - a.count),
6178
6847
  byGroup: byGroup.sort((a, b) => b.count - a.count)
6179
6848
  });
6180
6849
  }
6181
6850
  };
6182
- var report_member_count_default = withStandardDecorators(tool83);
6183
- var inputSchema84 = {
6851
+ var report_member_count_default = withStandardDecorators(tool95);
6852
+ var inputSchema96 = {
6184
6853
  groupName: z.string().describe("The name of the member group to filter by. Use list-member-groups to find valid group names."),
6185
6854
  take: z.number().optional().default(50).describe("Number of results to return (default 50)"),
6186
6855
  skip: z.number().optional().default(0).describe("Number of results to skip for pagination (default 0)")
6187
6856
  };
6188
- var outputSchema84 = z.object({
6857
+ var outputSchema96 = z.object({
6189
6858
  groupName: z.string().describe("The group name used for this query"),
6190
6859
  items: z.array(z.object({
6191
6860
  id: z.string(),
@@ -6196,11 +6865,11 @@ var outputSchema84 = z.object({
6196
6865
  })).describe("Members belonging to the specified group"),
6197
6866
  total: z.number().describe("Total number of members in this group")
6198
6867
  });
6199
- var tool84 = {
6868
+ var tool96 = {
6200
6869
  name: "report-members-by-group",
6201
6870
  description: "List members belonging to a specific group. Use list-member-groups to find valid group names.",
6202
- inputSchema: inputSchema84,
6203
- outputSchema: outputSchema84,
6871
+ inputSchema: inputSchema96,
6872
+ outputSchema: outputSchema96,
6204
6873
  slices: ["read"],
6205
6874
  annotations: { readOnlyHint: true },
6206
6875
  handler: async ({ groupName, take, skip }) => {
@@ -6216,8 +6885,9 @@ var tool84 = {
6216
6885
  detail: `No member group named "${groupName}". Use list-member-groups to see existing group names.`
6217
6886
  });
6218
6887
  }
6888
+ const canonicalGroupName = groupMatch.name ?? groupName;
6219
6889
  const result = await chainCms("find-member", {
6220
- memberGroupName: groupMatch.name,
6890
+ memberGroupName: canonicalGroupName,
6221
6891
  cursor: buildChainedCursor(skip, take),
6222
6892
  orderBy: "username"
6223
6893
  });
@@ -6236,13 +6906,13 @@ var tool84 = {
6236
6906
  });
6237
6907
  }
6238
6908
  };
6239
- var report_members_by_group_default = withStandardDecorators(tool84);
6240
- var inputSchema85 = {
6909
+ var report_members_by_group_default = withStandardDecorators(tool96);
6910
+ var inputSchema97 = {
6241
6911
  inactiveDays: z.number().optional().default(90).describe("Number of days without a login before a member is considered inactive (default 90)"),
6242
6912
  take: z.number().optional().default(50).describe("Number of results to return after filtering (default 50)"),
6243
6913
  skip: z.number().optional().default(0).describe("Number of results to skip for pagination (default 0)")
6244
6914
  };
6245
- var outputSchema85 = z.object({
6915
+ var outputSchema97 = z.object({
6246
6916
  items: z.array(z.object({
6247
6917
  id: z.string(),
6248
6918
  name: z.string(),
@@ -6257,11 +6927,11 @@ var outputSchema85 = z.object({
6257
6927
  });
6258
6928
  var PAGE_SIZE2 = 100;
6259
6929
  var MEMBER_CAP2 = 500;
6260
- var tool85 = {
6930
+ var tool97 = {
6261
6931
  name: "report-member-activity",
6262
6932
  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.",
6263
- inputSchema: inputSchema85,
6264
- outputSchema: outputSchema85,
6933
+ inputSchema: inputSchema97,
6934
+ outputSchema: outputSchema97,
6265
6935
  slices: ["read"],
6266
6936
  annotations: { readOnlyHint: true },
6267
6937
  handler: async ({ inactiveDays, take, skip }) => {
@@ -6315,10 +6985,10 @@ var tool85 = {
6315
6985
  });
6316
6986
  }
6317
6987
  };
6318
- var report_member_activity_default = withStandardDecorators(tool85);
6988
+ var report_member_activity_default = withStandardDecorators(tool97);
6319
6989
 
6320
6990
  // src/umbraco-api/tools/member-reporting/index.ts
6321
- var collection16 = {
6991
+ var collection17 = {
6322
6992
  metadata: {
6323
6993
  name: "member-reporting",
6324
6994
  displayName: "Member Reporting",
@@ -6326,22 +6996,22 @@ var collection16 = {
6326
6996
  },
6327
6997
  tools: () => [report_member_count_default, report_members_by_group_default, report_member_activity_default]
6328
6998
  };
6329
- var member_reporting_default = collection16;
6330
- var inputSchema86 = {
6999
+ var member_reporting_default = collection17;
7000
+ var inputSchema98 = {
6331
7001
  id: z.string().uuid().describe("The ID of the page to check publish status for")
6332
7002
  };
6333
- var outputSchema86 = z.object({
7003
+ var outputSchema98 = z.object({
6334
7004
  id: z.string(),
6335
7005
  name: z.string(),
6336
7006
  isPublished: z.boolean(),
6337
7007
  state: z.string(),
6338
7008
  variants: z.array(publishStatusVariantSchema)
6339
7009
  });
6340
- var tool86 = {
7010
+ var tool98 = {
6341
7011
  name: "get-publish-status",
6342
7012
  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.",
6343
- inputSchema: inputSchema86,
6344
- outputSchema: outputSchema86,
7013
+ inputSchema: inputSchema98,
7014
+ outputSchema: outputSchema98,
6345
7015
  slices: ["read"],
6346
7016
  annotations: { readOnlyHint: true },
6347
7017
  handler: async ({ id }) => {
@@ -6357,24 +7027,24 @@ var tool86 = {
6357
7027
  });
6358
7028
  }
6359
7029
  };
6360
- var get_publish_status_default = withStandardDecorators(tool86);
6361
- var inputSchema87 = {
7030
+ var get_publish_status_default = withStandardDecorators(tool98);
7031
+ var inputSchema99 = {
6362
7032
  id: z.string().uuid().describe("The ID of the page to schedule for publish"),
6363
7033
  publishDate: z.string().datetime().describe("The date and time to publish the page (ISO 8601 format, must be in the future)"),
6364
7034
  culture: z.string().optional().describe("Culture code for variant-specific scheduling (e.g. 'en-US'). Omit for invariant content.")
6365
7035
  };
6366
- var outputSchema87 = z.object({
7036
+ var outputSchema99 = z.object({
6367
7037
  message: z.string(),
6368
7038
  id: z.string(),
6369
7039
  name: z.string(),
6370
7040
  scheduledDate: z.string(),
6371
7041
  previewUrl: previewUrlSchema
6372
7042
  });
6373
- var tool87 = {
7043
+ var tool99 = {
6374
7044
  name: "schedule-publish",
6375
7045
  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.",
6376
- inputSchema: inputSchema87,
6377
- outputSchema: outputSchema87,
7046
+ inputSchema: inputSchema99,
7047
+ outputSchema: outputSchema99,
6378
7048
  slices: ["publish"],
6379
7049
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
6380
7050
  handler: async ({ id, publishDate, culture }, extra) => {
@@ -6399,22 +7069,22 @@ var tool87 = {
6399
7069
  });
6400
7070
  }
6401
7071
  };
6402
- var schedule_publish_default = withStandardDecorators(tool87);
6403
- var inputSchema88 = {
7072
+ var schedule_publish_default = withStandardDecorators(tool99);
7073
+ var inputSchema100 = {
6404
7074
  id: z.string().uuid().describe("The ID of the page whose scheduled publish should be cancelled"),
6405
7075
  culture: z.string().optional().describe("Culture code to check for a scheduled variant (e.g. 'en-US'). Omit for invariant content.")
6406
7076
  };
6407
- var outputSchema88 = z.object({
7077
+ var outputSchema100 = z.object({
6408
7078
  message: z.string(),
6409
7079
  id: z.string(),
6410
7080
  name: z.string(),
6411
7081
  previewUrl: previewUrlSchema
6412
7082
  });
6413
- var tool88 = {
7083
+ var tool100 = {
6414
7084
  name: "cancel-schedule",
6415
7085
  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.",
6416
- inputSchema: inputSchema88,
6417
- outputSchema: outputSchema88,
7086
+ inputSchema: inputSchema100,
7087
+ outputSchema: outputSchema100,
6418
7088
  slices: ["publish"],
6419
7089
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
6420
7090
  handler: async ({ id, culture }, extra) => {
@@ -6452,10 +7122,10 @@ var tool88 = {
6452
7122
  });
6453
7123
  }
6454
7124
  };
6455
- var cancel_schedule_default = withStandardDecorators(tool88);
7125
+ var cancel_schedule_default = withStandardDecorators(tool100);
6456
7126
 
6457
7127
  // src/umbraco-api/tools/scheduling/index.ts
6458
- var collection17 = {
7128
+ var collection18 = {
6459
7129
  metadata: {
6460
7130
  name: "scheduling",
6461
7131
  displayName: "Scheduling",
@@ -6463,13 +7133,13 @@ var collection17 = {
6463
7133
  },
6464
7134
  tools: () => [get_publish_status_default, schedule_publish_default, cancel_schedule_default]
6465
7135
  };
6466
- var scheduling_default = collection17;
6467
- var inputSchema89 = {
7136
+ var scheduling_default = collection18;
7137
+ var inputSchema101 = {
6468
7138
  take: z.number().optional().default(50).describe("Number of results to return (default 50)"),
6469
7139
  skip: z.number().optional().default(0).describe("Number of results to skip for pagination"),
6470
7140
  filter: z.string().optional().describe("Filter redirects by URL")
6471
7141
  };
6472
- var outputSchema89 = z.object({
7142
+ var outputSchema101 = z.object({
6473
7143
  items: z.array(
6474
7144
  z.object({
6475
7145
  id: z.string(),
@@ -6481,11 +7151,11 @@ var outputSchema89 = z.object({
6481
7151
  ).describe("URL redirects"),
6482
7152
  total: z.number().describe("Total number of redirects")
6483
7153
  });
6484
- var tool89 = {
7154
+ var tool101 = {
6485
7155
  name: "list-redirects",
6486
7156
  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.",
6487
- inputSchema: inputSchema89,
6488
- outputSchema: outputSchema89,
7157
+ inputSchema: inputSchema101,
7158
+ outputSchema: outputSchema101,
6489
7159
  slices: ["list"],
6490
7160
  annotations: { readOnlyHint: true },
6491
7161
  handler: async ({ take, skip, filter }) => {
@@ -6507,11 +7177,11 @@ var tool89 = {
6507
7177
  });
6508
7178
  }
6509
7179
  };
6510
- var list_redirects_default = withStandardDecorators(tool89);
6511
- var inputSchema90 = {
7180
+ var list_redirects_default = withStandardDecorators(tool101);
7181
+ var inputSchema102 = {
6512
7182
  id: z.string().uuid().describe("The ID of the redirect to retrieve")
6513
7183
  };
6514
- var outputSchema90 = z.object({
7184
+ var outputSchema102 = z.object({
6515
7185
  id: z.string(),
6516
7186
  originalUrl: z.string(),
6517
7187
  destinationUrl: z.string(),
@@ -6519,11 +7189,11 @@ var outputSchema90 = z.object({
6519
7189
  isAutomatic: z.boolean(),
6520
7190
  createDate: z.string()
6521
7191
  });
6522
- var tool90 = {
7192
+ var tool102 = {
6523
7193
  name: "get-redirect",
6524
7194
  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.",
6525
- inputSchema: inputSchema90,
6526
- outputSchema: outputSchema90,
7195
+ inputSchema: inputSchema102,
7196
+ outputSchema: outputSchema102,
6527
7197
  slices: ["read"],
6528
7198
  annotations: { readOnlyHint: true },
6529
7199
  handler: async ({ id }) => {
@@ -6540,17 +7210,17 @@ var tool90 = {
6540
7210
  });
6541
7211
  }
6542
7212
  };
6543
- var get_redirect_default = withStandardDecorators(tool90);
6544
- var inputSchema91 = {};
6545
- var outputSchema91 = z.object({
7213
+ var get_redirect_default = withStandardDecorators(tool102);
7214
+ var inputSchema103 = {};
7215
+ var outputSchema103 = z.object({
6546
7216
  isEnabled: z.boolean(),
6547
7217
  message: z.string()
6548
7218
  });
6549
- var tool91 = {
7219
+ var tool103 = {
6550
7220
  name: "get-redirect-status",
6551
7221
  description: "Check whether automatic URL redirect tracking is enabled on the site. When enabled, Umbraco automatically creates redirects when pages are moved or renamed.",
6552
- inputSchema: inputSchema91,
6553
- outputSchema: outputSchema91,
7222
+ inputSchema: inputSchema103,
7223
+ outputSchema: outputSchema103,
6554
7224
  slices: ["read"],
6555
7225
  annotations: { readOnlyHint: true },
6556
7226
  handler: async () => {
@@ -6563,20 +7233,20 @@ var tool91 = {
6563
7233
  });
6564
7234
  }
6565
7235
  };
6566
- var get_redirect_status_default = withStandardDecorators(tool91);
6567
- var inputSchema92 = {
7236
+ var get_redirect_status_default = withStandardDecorators(tool103);
7237
+ var inputSchema104 = {
6568
7238
  id: z.string().uuid().describe("The ID of the redirect to delete")
6569
7239
  };
6570
- var outputSchema92 = z.object({
7240
+ var outputSchema104 = z.object({
6571
7241
  message: z.string(),
6572
7242
  id: z.string(),
6573
7243
  originalUrl: z.string()
6574
7244
  });
6575
- var tool92 = {
7245
+ var tool104 = {
6576
7246
  name: "delete-redirect",
6577
7247
  description: "Delete a URL redirect. Visitors following the original URL will get a 404 error. You will be asked to confirm.",
6578
- inputSchema: inputSchema92,
6579
- outputSchema: outputSchema92,
7248
+ inputSchema: inputSchema104,
7249
+ outputSchema: outputSchema104,
6580
7250
  slices: ["delete"],
6581
7251
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
6582
7252
  handler: async ({ id }, extra) => {
@@ -6607,10 +7277,10 @@ var tool92 = {
6607
7277
  });
6608
7278
  }
6609
7279
  };
6610
- var delete_redirect_default = withStandardDecorators(tool92);
7280
+ var delete_redirect_default = withStandardDecorators(tool104);
6611
7281
 
6612
7282
  // src/umbraco-api/tools/redirect/index.ts
6613
- var collection18 = {
7283
+ var collection19 = {
6614
7284
  metadata: {
6615
7285
  name: "redirect",
6616
7286
  displayName: "Redirects",
@@ -6618,12 +7288,12 @@ var collection18 = {
6618
7288
  },
6619
7289
  tools: () => [list_redirects_default, get_redirect_default, get_redirect_status_default, delete_redirect_default]
6620
7290
  };
6621
- var redirect_default = collection18;
6622
- var inputSchema93 = {
7291
+ var redirect_default = collection19;
7292
+ var inputSchema105 = {
6623
7293
  id: z.string().uuid().describe("The ID of the content page or media item to look up references for"),
6624
7294
  type: z.enum(["document", "media"]).describe("Whether the ID refers to a content document or a media item")
6625
7295
  };
6626
- var outputSchema93 = z.object({
7296
+ var outputSchema105 = z.object({
6627
7297
  id: z.string(),
6628
7298
  name: z.string(),
6629
7299
  url: z.string(),
@@ -6658,11 +7328,11 @@ async function buildReferencedBy(refItems) {
6658
7328
  };
6659
7329
  });
6660
7330
  }
6661
- var tool93 = {
7331
+ var tool105 = {
6662
7332
  name: "report-content-references",
6663
7333
  description: "Find which pages reference a given content page or media item. Useful before deleting or restructuring content to understand the impact.",
6664
- inputSchema: inputSchema93,
6665
- outputSchema: outputSchema93,
7334
+ inputSchema: inputSchema105,
7335
+ outputSchema: outputSchema105,
6666
7336
  slices: ["read"],
6667
7337
  annotations: { readOnlyHint: true },
6668
7338
  handler: async ({ id, type }) => {
@@ -6712,18 +7382,18 @@ var tool93 = {
6712
7382
  }
6713
7383
  }
6714
7384
  };
6715
- var report_content_references_default = withStandardDecorators(tool93);
7385
+ var report_content_references_default = withStandardDecorators(tool105);
6716
7386
 
6717
7387
  // src/umbraco-api/tools/helpers/link-extractor.ts
6718
7388
  var UUID_REGEX = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi;
6719
- function isBlockListOrGridValue4(value) {
7389
+ function isBlockListOrGridValue3(value) {
6720
7390
  return value !== null && typeof value === "object" && !Array.isArray(value) && Array.isArray(value.contentData);
6721
7391
  }
6722
- function isRteWithBlocks4(value) {
7392
+ function isRteWithBlocks3(value) {
6723
7393
  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);
6724
7394
  }
6725
7395
  function isPlainRteValue(value) {
6726
- return value !== null && typeof value === "object" && !Array.isArray(value) && typeof value.markup === "string" && !isRteWithBlocks4(value);
7396
+ return value !== null && typeof value === "object" && !Array.isArray(value) && typeof value.markup === "string" && !isRteWithBlocks3(value);
6727
7397
  }
6728
7398
  function extractHrefUrls(html) {
6729
7399
  const urls = [];
@@ -6833,7 +7503,7 @@ function extractLinksFromValues(values) {
6833
7503
  return;
6834
7504
  }
6835
7505
  if (typeof val === "object") {
6836
- if (isRteWithBlocks4(val)) {
7506
+ if (isRteWithBlocks3(val)) {
6837
7507
  processHtml(val.markup);
6838
7508
  const blockValues = extractBlockValues(val.blocks.contentData);
6839
7509
  for (const bv of blockValues) processValue(bv);
@@ -6843,7 +7513,7 @@ function extractLinksFromValues(values) {
6843
7513
  processHtml(val.markup);
6844
7514
  return;
6845
7515
  }
6846
- if (isBlockListOrGridValue4(val)) {
7516
+ if (isBlockListOrGridValue3(val)) {
6847
7517
  const blockValues = extractBlockValues(val.contentData);
6848
7518
  for (const bv of blockValues) processValue(bv);
6849
7519
  return;
@@ -6910,10 +7580,10 @@ async function resolveOutboundIds(candidateIds, excludeId) {
6910
7580
  }
6911
7581
 
6912
7582
  // src/umbraco-api/tools/relationships/get/report-outbound-links.ts
6913
- var inputSchema94 = {
7583
+ var inputSchema106 = {
6914
7584
  id: z.string().uuid().describe("The ID of the page to analyze for outbound links")
6915
7585
  };
6916
- var outputSchema94 = z.object({
7586
+ var outputSchema106 = z.object({
6917
7587
  id: z.string(),
6918
7588
  name: z.string(),
6919
7589
  url: z.string(),
@@ -6945,11 +7615,11 @@ var outputSchema94 = z.object({
6945
7615
  totalLinks: z.number()
6946
7616
  })
6947
7617
  });
6948
- var tool94 = {
7618
+ var tool106 = {
6949
7619
  name: "report-outbound-links",
6950
7620
  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.",
6951
- inputSchema: inputSchema94,
6952
- outputSchema: outputSchema94,
7621
+ inputSchema: inputSchema106,
7622
+ outputSchema: outputSchema106,
6953
7623
  slices: ["read"],
6954
7624
  annotations: { readOnlyHint: true },
6955
7625
  handler: async ({ id }) => {
@@ -6978,10 +7648,10 @@ var tool94 = {
6978
7648
  });
6979
7649
  }
6980
7650
  };
6981
- var report_outbound_links_default = withStandardDecorators(tool94);
7651
+ var report_outbound_links_default = withStandardDecorators(tool106);
6982
7652
 
6983
7653
  // src/umbraco-api/tools/relationships/index.ts
6984
- var collection19 = {
7654
+ var collection20 = {
6985
7655
  metadata: {
6986
7656
  name: "relationships",
6987
7657
  displayName: "Content Relationships",
@@ -6989,11 +7659,11 @@ var collection19 = {
6989
7659
  },
6990
7660
  tools: () => [report_content_references_default, report_outbound_links_default]
6991
7661
  };
6992
- var relationships_default = collection19;
6993
- var inputSchema95 = {
7662
+ var relationships_default = collection20;
7663
+ var inputSchema107 = {
6994
7664
  id: z.string().uuid().describe("The ID of the content page to read public access settings for")
6995
7665
  };
6996
- var outputSchema95 = z.object({
7666
+ var outputSchema107 = z.object({
6997
7667
  hasRestrictions: z.boolean().describe("True if the page has public access rules configured"),
6998
7668
  memberGroups: z.array(z.object({
6999
7669
  id: z.string(),
@@ -7004,11 +7674,11 @@ var outputSchema95 = z.object({
7004
7674
  errorPageId: z.string().nullable().describe("The ID of the page shown when an authenticated visitor is denied access"),
7005
7675
  message: z.string().describe("Human-readable summary of the access rules")
7006
7676
  });
7007
- var tool95 = {
7677
+ var tool107 = {
7008
7678
  name: "get-public-access",
7009
7679
  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.",
7010
- inputSchema: inputSchema95,
7011
- outputSchema: outputSchema95,
7680
+ inputSchema: inputSchema107,
7681
+ outputSchema: outputSchema107,
7012
7682
  slices: ["read"],
7013
7683
  annotations: { readOnlyHint: true },
7014
7684
  handler: async ({ id }) => {
@@ -7041,15 +7711,15 @@ var tool95 = {
7041
7711
  });
7042
7712
  }
7043
7713
  };
7044
- var get_public_access_default = withStandardDecorators(tool95);
7045
- var inputSchema96 = {
7714
+ var get_public_access_default = withStandardDecorators(tool107);
7715
+ var inputSchema108 = {
7046
7716
  id: z.string().uuid().describe("The ID of the content page to restrict"),
7047
7717
  memberGroupNames: z.array(z.string()).describe("Names of member groups allowed to view the page. Use list-member-groups to look up existing groups."),
7048
7718
  loginPageId: z.string().uuid().describe("The ID of the page visitors are redirected to when login is required"),
7049
7719
  errorPageId: z.string().uuid().describe("The ID of the page shown when an authenticated visitor is denied access"),
7050
7720
  memberUserNames: z.array(z.string()).optional().describe("Optional: specific member usernames allowed to view the page (in addition to group members)")
7051
7721
  };
7052
- var outputSchema96 = z.object({
7722
+ var outputSchema108 = z.object({
7053
7723
  message: z.string(),
7054
7724
  id: z.string(),
7055
7725
  memberGroupNames: z.array(z.string()),
@@ -7057,11 +7727,11 @@ var outputSchema96 = z.object({
7057
7727
  loginPageId: z.string(),
7058
7728
  errorPageId: z.string()
7059
7729
  });
7060
- var tool96 = {
7730
+ var tool108 = {
7061
7731
  name: "set-public-access",
7062
7732
  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.",
7063
- inputSchema: inputSchema96,
7064
- outputSchema: outputSchema96,
7733
+ inputSchema: inputSchema108,
7734
+ outputSchema: outputSchema108,
7065
7735
  slices: ["update"],
7066
7736
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
7067
7737
  handler: async ({ id, memberGroupNames, loginPageId, errorPageId, memberUserNames }, extra) => {
@@ -7099,19 +7769,19 @@ var tool96 = {
7099
7769
  });
7100
7770
  }
7101
7771
  };
7102
- var set_public_access_default = withStandardDecorators(tool96);
7103
- var inputSchema97 = {
7772
+ var set_public_access_default = withStandardDecorators(tool108);
7773
+ var inputSchema109 = {
7104
7774
  id: z.string().uuid().describe("The ID of the content page to remove public access restrictions from")
7105
7775
  };
7106
- var outputSchema97 = z.object({
7776
+ var outputSchema109 = z.object({
7107
7777
  message: z.string(),
7108
7778
  id: z.string()
7109
7779
  });
7110
- var tool97 = {
7780
+ var tool109 = {
7111
7781
  name: "remove-public-access",
7112
7782
  description: "Remove all public access restrictions from a content page, making it publicly viewable again. You will be asked to confirm.",
7113
- inputSchema: inputSchema97,
7114
- outputSchema: outputSchema97,
7783
+ inputSchema: inputSchema109,
7784
+ outputSchema: outputSchema109,
7115
7785
  slices: ["delete"],
7116
7786
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true },
7117
7787
  handler: async ({ id }, extra) => {
@@ -7126,10 +7796,10 @@ var tool97 = {
7126
7796
  });
7127
7797
  }
7128
7798
  };
7129
- var remove_public_access_default = withStandardDecorators(tool97);
7799
+ var remove_public_access_default = withStandardDecorators(tool109);
7130
7800
 
7131
7801
  // src/umbraco-api/tools/public-access/index.ts
7132
- var collection20 = {
7802
+ var collection21 = {
7133
7803
  metadata: {
7134
7804
  name: "public-access",
7135
7805
  displayName: "Public Access",
@@ -7137,7 +7807,7 @@ var collection20 = {
7137
7807
  },
7138
7808
  tools: () => [get_public_access_default, set_public_access_default, remove_public_access_default]
7139
7809
  };
7140
- var public_access_default = collection20;
7810
+ var public_access_default = collection21;
7141
7811
 
7142
7812
  // src/umbraco-api/tools/helpers/runtime.ts
7143
7813
  var isHostedRuntime = () => {
@@ -7147,7 +7817,7 @@ var isHostedRuntime = () => {
7147
7817
  };
7148
7818
 
7149
7819
  // src/umbraco-api/tools/notifications/get/get-content-notifications.ts
7150
- var inputSchema98 = {
7820
+ var inputSchema110 = {
7151
7821
  id: z.string().uuid().describe("UUID of the content page to read notification subscriptions for")
7152
7822
  };
7153
7823
  var subscriptionSchema = z.object({
@@ -7155,16 +7825,16 @@ var subscriptionSchema = z.object({
7155
7825
  alias: z.string().describe("Human-readable action alias (e.g. publish, unpublish, save, delete)"),
7156
7826
  subscribed: z.boolean().describe("True if the current user is subscribed to this action")
7157
7827
  });
7158
- var outputSchema98 = z.object({
7828
+ var outputSchema110 = z.object({
7159
7829
  id: z.string(),
7160
7830
  subscriptions: z.array(subscriptionSchema),
7161
7831
  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")
7162
7832
  });
7163
- var tool98 = {
7833
+ var tool110 = {
7164
7834
  name: "get-content-notifications",
7165
7835
  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.",
7166
- inputSchema: inputSchema98,
7167
- outputSchema: outputSchema98,
7836
+ inputSchema: inputSchema110,
7837
+ outputSchema: outputSchema110,
7168
7838
  slices: ["read"],
7169
7839
  annotations: { readOnlyHint: true },
7170
7840
  enabled: isHostedRuntime,
@@ -7180,21 +7850,21 @@ var tool98 = {
7180
7850
  return createToolResult({ id, subscriptions, subscribedActionIds });
7181
7851
  }
7182
7852
  };
7183
- var get_content_notifications_default = withStandardDecorators(tool98);
7184
- var inputSchema99 = {
7853
+ var get_content_notifications_default = withStandardDecorators(tool110);
7854
+ var inputSchema111 = {
7185
7855
  id: z.string().uuid().describe("UUID of the content page to update notification subscriptions for"),
7186
7856
  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.")
7187
7857
  };
7188
- var outputSchema99 = z.object({
7858
+ var outputSchema111 = z.object({
7189
7859
  message: z.string(),
7190
7860
  id: z.string(),
7191
7861
  subscribedActionIds: z.array(z.string())
7192
7862
  });
7193
- var tool99 = {
7863
+ var tool111 = {
7194
7864
  name: "set-content-notifications",
7195
7865
  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.",
7196
- inputSchema: inputSchema99,
7197
- outputSchema: outputSchema99,
7866
+ inputSchema: inputSchema111,
7867
+ outputSchema: outputSchema111,
7198
7868
  slices: ["update"],
7199
7869
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
7200
7870
  enabled: isHostedRuntime,
@@ -7212,10 +7882,10 @@ var tool99 = {
7212
7882
  });
7213
7883
  }
7214
7884
  };
7215
- var set_content_notifications_default = withStandardDecorators(tool99);
7885
+ var set_content_notifications_default = withStandardDecorators(tool111);
7216
7886
 
7217
7887
  // src/umbraco-api/tools/notifications/index.ts
7218
- var collection21 = {
7888
+ var collection22 = {
7219
7889
  metadata: {
7220
7890
  name: "notifications",
7221
7891
  displayName: "Content Notifications",
@@ -7223,7 +7893,7 @@ var collection21 = {
7223
7893
  },
7224
7894
  tools: () => isHostedRuntime() ? [get_content_notifications_default, set_content_notifications_default] : []
7225
7895
  };
7226
- var notifications_default = collection21;
7896
+ var notifications_default = collection22;
7227
7897
  var mediaTools = {
7228
7898
  listRoot: "get-recycle-bin-media-root",
7229
7899
  listChildren: "get-recycle-bin-media-children",
@@ -7286,13 +7956,13 @@ function formatNamePreview(names, total) {
7286
7956
  }
7287
7957
 
7288
7958
  // src/umbraco-api/tools/recycle-bin/get/list-recycle-bin.ts
7289
- var inputSchema100 = {
7959
+ var inputSchema112 = {
7290
7960
  type: z.enum(["content", "media"]).describe("Which recycle bin to list: content (pages) or media."),
7291
7961
  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."),
7292
7962
  take: z.number().optional().default(20).describe("Number of results to return (default 20)"),
7293
7963
  skip: z.number().optional().default(0).describe("Number of results to skip for pagination")
7294
7964
  };
7295
- var outputSchema100 = z.object({
7965
+ var outputSchema112 = z.object({
7296
7966
  items: z.array(z.object({
7297
7967
  id: z.string(),
7298
7968
  name: z.string(),
@@ -7301,11 +7971,11 @@ var outputSchema100 = z.object({
7301
7971
  })).describe("Trashed items at this level of the recycle bin"),
7302
7972
  total: z.number().describe("Total number of trashed items at this level (before pagination)")
7303
7973
  });
7304
- var tool100 = {
7974
+ var tool112 = {
7305
7975
  name: "list-recycle-bin",
7306
7976
  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.",
7307
- inputSchema: inputSchema100,
7308
- outputSchema: outputSchema100,
7977
+ inputSchema: inputSchema112,
7978
+ outputSchema: outputSchema112,
7309
7979
  slices: ["list", "tree"],
7310
7980
  annotations: { readOnlyHint: true },
7311
7981
  handler: async ({ type, parentId, take, skip }) => {
@@ -7328,22 +7998,22 @@ var tool100 = {
7328
7998
  });
7329
7999
  }
7330
8000
  };
7331
- var list_recycle_bin_default = withStandardDecorators(tool100);
7332
- var inputSchema101 = {
8001
+ var list_recycle_bin_default = withStandardDecorators(tool112);
8002
+ var inputSchema113 = {
7333
8003
  id: z.string().uuid().describe("ID of the trashed item to permanently delete."),
7334
8004
  type: z.enum(["content", "media"]).describe("Which recycle bin the item is in.")
7335
8005
  };
7336
- var outputSchema101 = z.object({
8006
+ var outputSchema113 = z.object({
7337
8007
  message: z.string(),
7338
8008
  id: z.string(),
7339
8009
  name: z.string(),
7340
8010
  descendantCount: z.number().optional().describe("Descendants also deleted when the item was a folder")
7341
8011
  });
7342
- var tool101 = {
8012
+ var tool113 = {
7343
8013
  name: "permanent-delete-recycle-bin-item",
7344
8014
  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.",
7345
- inputSchema: inputSchema101,
7346
- outputSchema: outputSchema101,
8015
+ inputSchema: inputSchema113,
8016
+ outputSchema: outputSchema113,
7347
8017
  slices: ["delete"],
7348
8018
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
7349
8019
  handler: async ({ id, type }, extra) => {
@@ -7390,20 +8060,20 @@ var tool101 = {
7390
8060
  });
7391
8061
  }
7392
8062
  };
7393
- var permanent_delete_recycle_bin_item_default = withStandardDecorators(tool101);
7394
- var inputSchema102 = {
8063
+ var permanent_delete_recycle_bin_item_default = withStandardDecorators(tool113);
8064
+ var inputSchema114 = {
7395
8065
  type: z.enum(["content", "media"]).describe("Which recycle bin to empty.")
7396
8066
  };
7397
- var outputSchema102 = z.object({
8067
+ var outputSchema114 = z.object({
7398
8068
  message: z.string(),
7399
8069
  type: z.enum(["content", "media"]),
7400
8070
  topLevelCount: z.number().describe("Number of top-level items that were in the bin before emptying (descendants are not counted).")
7401
8071
  });
7402
- var tool102 = {
8072
+ var tool114 = {
7403
8073
  name: "empty-recycle-bin",
7404
8074
  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.",
7405
- inputSchema: inputSchema102,
7406
- outputSchema: outputSchema102,
8075
+ inputSchema: inputSchema114,
8076
+ outputSchema: outputSchema114,
7407
8077
  slices: ["delete"],
7408
8078
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
7409
8079
  handler: async ({ type }, extra) => {
@@ -7448,10 +8118,10 @@ var tool102 = {
7448
8118
  });
7449
8119
  }
7450
8120
  };
7451
- var empty_recycle_bin_default = withStandardDecorators(tool102);
8121
+ var empty_recycle_bin_default = withStandardDecorators(tool114);
7452
8122
 
7453
8123
  // src/umbraco-api/tools/recycle-bin/index.ts
7454
- var collection22 = {
8124
+ var collection23 = {
7455
8125
  metadata: {
7456
8126
  name: "recycle-bin",
7457
8127
  displayName: "Recycle Bin",
@@ -7459,9 +8129,9 @@ var collection22 = {
7459
8129
  },
7460
8130
  tools: () => [list_recycle_bin_default, permanent_delete_recycle_bin_item_default, empty_recycle_bin_default]
7461
8131
  };
7462
- var recycle_bin_default = collection22;
7463
- var inputSchema103 = {};
7464
- var outputSchema103 = z.object({
8132
+ var recycle_bin_default = collection23;
8133
+ var inputSchema115 = {};
8134
+ var outputSchema115 = z.object({
7465
8135
  id: z.string(),
7466
8136
  name: z.string(),
7467
8137
  userName: z.string(),
@@ -7483,11 +8153,11 @@ var outputSchema103 = z.object({
7483
8153
  documentStartNodeIds: z.array(z.string()).describe("Content node IDs the user is restricted to. Empty when hasDocumentRootAccess is true."),
7484
8154
  mediaStartNodeIds: z.array(z.string()).describe("Media node IDs the user is restricted to. Empty when hasMediaRootAccess is true.")
7485
8155
  });
7486
- var tool103 = {
8156
+ var tool115 = {
7487
8157
  name: "get-current-user",
7488
8158
  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.",
7489
- inputSchema: inputSchema103,
7490
- outputSchema: outputSchema103,
8159
+ inputSchema: inputSchema115,
8160
+ outputSchema: outputSchema115,
7491
8161
  slices: ["read"],
7492
8162
  annotations: { readOnlyHint: true },
7493
8163
  handler: async () => {
@@ -7526,10 +8196,10 @@ var tool103 = {
7526
8196
  });
7527
8197
  }
7528
8198
  };
7529
- var get_current_user_default = withStandardDecorators(tool103);
8199
+ var get_current_user_default = withStandardDecorators(tool115);
7530
8200
 
7531
8201
  // src/umbraco-api/tools/account/index.ts
7532
- var collection23 = {
8202
+ var collection24 = {
7533
8203
  metadata: {
7534
8204
  name: "account",
7535
8205
  displayName: "Account",
@@ -7537,7 +8207,7 @@ var collection23 = {
7537
8207
  },
7538
8208
  tools: () => [get_current_user_default]
7539
8209
  };
7540
- var account_default = collection23;
8210
+ var account_default = collection24;
7541
8211
 
7542
8212
  // src/config/mode-registry.ts
7543
8213
  var toolModes = [
@@ -7553,6 +8223,12 @@ var toolModes = [
7553
8223
  description: "Browse, search, upload, and manage media files and folders",
7554
8224
  collections: ["media", "media-management"]
7555
8225
  },
8226
+ {
8227
+ name: "library",
8228
+ displayName: "Library Elements",
8229
+ description: "Browse, view, and manage reusable Library elements (Umbraco 18 Library section)",
8230
+ collections: ["element"]
8231
+ },
7556
8232
  {
7557
8233
  name: "blueprints",
7558
8234
  displayName: "Blueprints",
@@ -7663,6 +8339,7 @@ var collections = [
7663
8339
  versioning_default,
7664
8340
  media_default,
7665
8341
  media_management_default,
8342
+ element_default,
7666
8343
  blueprint_default,
7667
8344
  language_default,
7668
8345
  translation_default,