@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.
package/dist/index.js CHANGED
@@ -2,14 +2,14 @@
2
2
  import 'dotenv/config';
3
3
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
5
- import { createMcpClientManager, withStandardDecorators, baseSliceNames, setServerRef, createCollectionConfigLoader, initializeUmbracoFetch, createToolResult, createToolResultError, extractChainedResult, requestApproval, UmbracoManagementClient, encodeCursor, getServerConfig, gatherChainedTools, shouldIncludeTool, createToolAnnotations, useDraft202012ToolSchemas } from '@umbraco-cms/mcp-server-sdk';
5
+ import { createMcpClientManager, withStandardDecorators, baseSliceNames, setServerRef, createCollectionConfigLoader, initializeUmbracoFetch, createToolResult, createToolResultError, extractChainedResult, requestApproval, UmbracoManagementClient, encodeCursor, getServerConfig, gatherChainedTools, shouldIncludeTool, createToolAnnotations, useDraft202012ToolSchemas, isLoopbackUrl } from '@umbraco-cms/mcp-server-sdk';
6
6
  import { z } from 'zod';
7
7
  import { statSync, readFileSync } from 'fs';
8
8
  import { resolve } from 'path';
9
9
 
10
10
  // package.json
11
11
  var package_default = {
12
- version: "17.6.0-beta.8"};
12
+ version: "18.0.0-beta.11"};
13
13
 
14
14
  // src/auth/chained-deps.generated.ts
15
15
  var CHAINED_DEPS = {
@@ -20,20 +20,21 @@ var CHAINED_DEPS = {
20
20
  "audit-page-seo": ["get-document-by-id"],
21
21
  "bulk-move": ["get-document-by-id", "move-document"],
22
22
  "bulk-move-media": ["get-media-by-id", "move-media"],
23
- "bulk-publish": ["publish-document", "publish-document-with-descendants"],
23
+ "bulk-publish": ["get-document-publish-with-descendants-result", "publish-document", "publish-document-with-descendants"],
24
24
  "bulk-schedule-publish": ["publish-document"],
25
25
  "bulk-set-block-property": ["get-document-by-id", "get-document-version", "update-block-property"],
26
26
  "bulk-set-property": ["update-document-properties"],
27
27
  "bulk-unpublish": ["get-document-by-id", "unpublish-document"],
28
28
  "cancel-schedule": ["get-document-by-id", "publish-document"],
29
29
  "copy-variant": ["get-document-by-id", "update-document"],
30
+ "create-and-publish-page": ["create-and-publish-document", "get-data-types-by-id-array", "get-document-type-by-id", "get-language"],
30
31
  "create-blueprint": ["create-document-blueprint-from-document", "get-document-blueprint-root", "get-document-by-id"],
31
32
  "create-dictionary": ["create-dictionary"],
32
33
  "create-language": ["create-language"],
33
34
  "create-media-folder": ["create-media-folder", "get-media-by-id"],
34
35
  "create-member": ["create-member", "get-member", "update-member"],
35
36
  "create-member-group": ["create-member-group"],
36
- "create-page": ["create-document", "get-data-types-by-id-array", "get-document-type-by-id"],
37
+ "create-page": ["create-document", "get-data-types-by-id-array", "get-document-type-by-id", "get-language"],
37
38
  "create-variant": ["get-document-by-id", "update-document"],
38
39
  "delete-block": ["get-document-by-id", "update-document-properties"],
39
40
  "delete-language": ["delete-language", "get-language-by-iso-code"],
@@ -82,7 +83,7 @@ var CHAINED_DEPS = {
82
83
  "move-dictionary": ["get-dictionary", "move-dictionary-item"],
83
84
  "move-media": ["get-media-by-id", "move-media"],
84
85
  "permanent-delete-recycle-bin-item": ["get-document-by-id", "get-media-by-id"],
85
- "publish-page": ["get-document-by-id", "publish-document", "publish-document-with-descendants"],
86
+ "publish-page": ["get-document-by-id", "get-document-publish-with-descendants-result", "publish-document", "publish-document-with-descendants"],
86
87
  "remove-public-access": ["delete-document-public-access"],
87
88
  "report-content-references": ["get-document-by-id", "get-document-by-id-referenced-by", "get-media-by-id", "get-media-by-id-referenced-by", "get-media-urls"],
88
89
  "report-deep-pages": ["get-document-children", "get-document-root"],
@@ -100,7 +101,7 @@ var CHAINED_DEPS = {
100
101
  "restore-media": ["get-media-by-id", "restore-media-from-recycle-bin"],
101
102
  "restore-page": ["get-document-by-id"],
102
103
  "rollback-page": ["create-document-version-rollback", "get-document-by-id", "get-document-version", "get-user-by-id"],
103
- "save-and-publish": ["get-document-by-id", "publish-document", "publish-document-with-descendants", "update-document-properties"],
104
+ "save-and-publish": ["get-document-by-id", "get-document-publish-with-descendants-result", "publish-document", "publish-document-with-descendants", "update-and-publish-document", "update-document-properties"],
104
105
  "schedule-publish": ["get-document-by-id", "publish-document"],
105
106
  "search-content": ["search-document"],
106
107
  "search-dictionary": ["find-dictionary"],
@@ -117,11 +118,11 @@ var CHAINED_DEPS = {
117
118
  "update-member": ["get-member", "update-member"],
118
119
  "upload-media": ["create-media", "get-media-by-id"]
119
120
  };
120
-
121
- // src/config/mcp-servers.ts
121
+ function chainedTlsEnv(baseUrl) {
122
+ return isLoopbackUrl(baseUrl) ? { NODE_TLS_REJECT_UNAUTHORIZED: "0" } : {};
123
+ }
122
124
  async function buildServers() {
123
- const isWorkersRuntime = typeof navigator !== "undefined" && navigator.userAgent === "Cloudflare-Workers";
124
- if (isWorkersRuntime || typeof process === "undefined" || !process.env) return [];
125
+ if (typeof process === "undefined" || !process.env) return [];
125
126
  const useMockChain = process.env.USE_MOCK_MCP_CHAIN === "true";
126
127
  if (useMockChain) {
127
128
  const path2 = await import('path');
@@ -143,13 +144,14 @@ async function buildServers() {
143
144
  const binEntry = typeof cmsDevPkg.bin === "string" ? cmsDevPkg.bin : cmsDevPkg.bin ? Object.values(cmsDevPkg.bin)[0] : void 0;
144
145
  if (!binEntry) throw new Error("@umbraco-cms/mcp-dev has no bin entry");
145
146
  const binAbs = path.resolve(path.dirname(pkgPath), binEntry);
147
+ const baseUrl = process.env.UMBRACO_BASE_URL || "http://localhost:44391";
146
148
  return [{
147
149
  name: "cms",
148
150
  command: process.execPath,
149
151
  args: [binAbs],
150
152
  env: {
151
- NODE_TLS_REJECT_UNAUTHORIZED: "0",
152
- UMBRACO_BASE_URL: process.env.UMBRACO_BASE_URL || "http://localhost:44391",
153
+ ...chainedTlsEnv(baseUrl),
154
+ UMBRACO_BASE_URL: baseUrl,
153
155
  UMBRACO_CLIENT_ID: process.env.UMBRACO_CLIENT_ID || "",
154
156
  UMBRACO_CLIENT_SECRET: process.env.UMBRACO_CLIENT_SECRET || "",
155
157
  // Clear tool filters so our editor tool names (search-content etc.) don't
@@ -223,14 +225,6 @@ function truncateAvailableTools(message) {
223
225
  }
224
226
  return message.slice(0, availableToolsIndex + 1);
225
227
  }
226
- async function isCmsToolAvailable(toolName) {
227
- try {
228
- const { tools } = await mcpClientManager.listTools("cms");
229
- return (tools ?? []).some((t) => t.name === toolName);
230
- } catch {
231
- return true;
232
- }
233
- }
234
228
  async function chainCms(toolName, args) {
235
229
  let result;
236
230
  try {
@@ -593,9 +587,9 @@ var tool2 = {
593
587
  })),
594
588
  variants: doc.variants ?? [],
595
589
  previewUrl: buildPreviewUrl(doc.id),
596
- // The get-document-by-id response doesn't carry `urls` — published
597
- // URLs come only from the separate get-document-urls endpoint via
598
- // fetchPublishedUrls.
590
+ // Umbraco 18's get-document-by-id response no longer carries `urls` —
591
+ // published URLs now come only from the separate get-document-urls
592
+ // endpoint via fetchPublishedUrls.
599
593
  publishedUrls: await fetchPublishedUrls(id)
600
594
  });
601
595
  }
@@ -762,10 +756,15 @@ var tool4 = {
762
756
  var list_document_types_default = withStandardDecorators(tool4);
763
757
 
764
758
  // src/umbraco-api/tools/content/helpers/resolve-document-type-properties.ts
765
- async function resolveDocumentTypeProperties(documentTypeId) {
766
- const docTypeResult = await chainCms("get-document-type-by-id", { id: documentTypeId });
767
- if (!docTypeResult.ok) return { ok: false, errorResult: docTypeResult.errorResult };
768
- const data = docTypeResult.data;
759
+ async function resolveDocumentTypeProperties(documentTypeId, documentType) {
760
+ let data;
761
+ if (documentType) {
762
+ data = documentType;
763
+ } else {
764
+ const docTypeResult = await chainCms("get-document-type-by-id", { id: documentTypeId });
765
+ if (!docTypeResult.ok) return { ok: false, errorResult: docTypeResult.errorResult };
766
+ data = docTypeResult.data;
767
+ }
769
768
  const collected = /* @__PURE__ */ new Map();
770
769
  function addProperties(props) {
771
770
  for (const p of props) {
@@ -920,13 +919,13 @@ async function validateDocumentState(id, doc) {
920
919
  culture: v.culture ?? null,
921
920
  segment: v.segment ?? null
922
921
  }));
923
- const ancestorsResult = await chainCms("get-document-ancestors", { descendantId: id });
924
- const parent = ancestorsResult.ok ? (ancestorsResult.data.items ?? []).find((item) => item.id === id)?.parent ?? null : null;
922
+ const itemResult = await chainCms("get-item-document", { id: [id] });
923
+ const parent = itemResult.ok ? itemResult.data.items[0]?.parent ?? null : null;
925
924
  const result = await chainCms("validate-document", {
926
925
  id,
927
926
  documentType: { id: target.documentType.id },
928
927
  template: target.template ? { id: target.template.id } : null,
929
- parent,
928
+ parent: parent ? { id: parent.id } : null,
930
929
  values,
931
930
  variants
932
931
  });
@@ -1070,6 +1069,30 @@ function isBlockListOrGridValue(value) {
1070
1069
  function isRteWithBlocks(value) {
1071
1070
  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);
1072
1071
  }
1072
+
1073
+ // src/umbraco-api/tools/helpers/block-inspector.ts
1074
+ function blockPropertiesSchema(editTool) {
1075
+ return z.array(z.object({
1076
+ propertyAlias: z.string().describe("The property containing these blocks"),
1077
+ editorAlias: z.string().optional(),
1078
+ blocks: z.array(z.object({
1079
+ contentKey: z.string().describe(`The block's unique key \u2014 use this with ${editTool}`),
1080
+ contentTypeKey: z.string().describe("The block's element type ID"),
1081
+ settingsKey: z.string().optional().describe("The key of the block's settings entry. Absent when the block has no settings."),
1082
+ properties: z.array(z.object({
1083
+ alias: z.string(),
1084
+ value: z.any()
1085
+ }))
1086
+ }))
1087
+ }));
1088
+ }
1089
+ function extractBlocks(contentData) {
1090
+ return contentData.map((block) => ({
1091
+ contentKey: block?.key ?? "",
1092
+ contentTypeKey: block?.contentTypeKey ?? "",
1093
+ properties: Array.isArray(block?.values) ? block.values.map((v) => ({ alias: v?.alias ?? "", value: v?.value })) : []
1094
+ }));
1095
+ }
1073
1096
  function findSettingsKey(container, contentKey) {
1074
1097
  const layout = container?.layout;
1075
1098
  if (!layout || typeof layout !== "object") return void 0;
@@ -1096,6 +1119,94 @@ function searchLayout(entries, contentKey) {
1096
1119
  }
1097
1120
  return void 0;
1098
1121
  }
1122
+ function collectBlockProperties(values, propertyAlias) {
1123
+ const filtered = propertyAlias ? values.filter((v) => v.alias === propertyAlias) : values;
1124
+ return filtered.filter((v) => isBlockListOrGridValue(v.value) || isRteWithBlocks(v.value)).map((v) => {
1125
+ const value = v.value;
1126
+ const container = isRteWithBlocks(value) ? value.blocks : value;
1127
+ return {
1128
+ propertyAlias: v.alias,
1129
+ editorAlias: isRteWithBlocks(value) ? "Umbraco.RichText" : v.editorAlias ?? void 0,
1130
+ blocks: withSettingsKeys(extractBlocks(container.contentData), container)
1131
+ };
1132
+ });
1133
+ }
1134
+ var MAX_ENRICHED_BLOCKS = 50;
1135
+ var MAX_BLOCK_WALK_DEPTH = 20;
1136
+ function enrichBlockNotFoundError(errorResult, values, options = {}) {
1137
+ const problem = extractInnerProblemDetails(errorResult);
1138
+ const availableBlocks = problem.availableBlocks;
1139
+ if (!Array.isArray(availableBlocks)) return errorResult;
1140
+ const { propertyAlias, note } = options;
1141
+ const filtered = propertyAlias ? values.filter((v) => v.alias === propertyAlias) : values;
1142
+ const typeByKey = /* @__PURE__ */ new Map();
1143
+ for (const v of filtered) {
1144
+ const container = isRteWithBlocks(v.value) ? v.value.blocks : v.value;
1145
+ if (isBlockListOrGridValue(container)) {
1146
+ collectBlockEntryTypes(container, typeByKey, 0);
1147
+ }
1148
+ }
1149
+ const truncated = availableBlocks.length > MAX_ENRICHED_BLOCKS;
1150
+ const limitedBlocks = truncated ? availableBlocks.slice(0, MAX_ENRICHED_BLOCKS) : availableBlocks;
1151
+ const enrichedBlocks = limitedBlocks.map(
1152
+ (b) => b && typeof b === "object" && typeof b.key === "string" ? { ...b, contentTypeKey: typeByKey.get(b.key) ?? null } : b
1153
+ );
1154
+ return createToolResultError({
1155
+ ...problem,
1156
+ availableBlocks: enrichedBlocks,
1157
+ ...truncated ? { availableBlocksNote: `Showing ${MAX_ENRICHED_BLOCKS} of ${availableBlocks.length} available blocks \u2014 use inspect-blocks for the full list.` } : {},
1158
+ ...note ? { note } : {}
1159
+ });
1160
+ }
1161
+ function collectBlockEntryTypes(container, into, depth) {
1162
+ if (depth > MAX_BLOCK_WALK_DEPTH) return;
1163
+ for (const list of [container.contentData, container.settingsData]) {
1164
+ if (!Array.isArray(list)) continue;
1165
+ for (const block of list) {
1166
+ if (!block || typeof block !== "object") continue;
1167
+ const key = block.key;
1168
+ const contentTypeKey = block.contentTypeKey;
1169
+ if (typeof key === "string" && typeof contentTypeKey === "string") into.set(key, contentTypeKey);
1170
+ const nestedValues = block.values;
1171
+ if (!Array.isArray(nestedValues)) continue;
1172
+ for (const nested of nestedValues) {
1173
+ const nestedRaw = nested?.value;
1174
+ const nestedContainer = isRteWithBlocks(nestedRaw) ? nestedRaw.blocks : nestedRaw;
1175
+ if (isBlockListOrGridValue(nestedContainer)) {
1176
+ collectBlockEntryTypes(nestedContainer, into, depth + 1);
1177
+ }
1178
+ }
1179
+ }
1180
+ }
1181
+ }
1182
+ function withSettingsKeys(blocks, container) {
1183
+ return blocks.map((block) => {
1184
+ const settingsKey = findSettingsKey(container, block.contentKey);
1185
+ return settingsKey ? { ...block, settingsKey } : block;
1186
+ });
1187
+ }
1188
+ var blockPropertyAliasSchema = z.string().regex(
1189
+ /^[A-Za-z_][A-Za-z0-9_]*$/,
1190
+ "Property alias must be a valid identifier (letters, digits, underscore; not starting with a digit)"
1191
+ );
1192
+ function classifyBlockUpdateResults(results, requestedCount, requestedAliases = [], expectedEntryCount = 1) {
1193
+ const list = results ?? [];
1194
+ const processedCount = list.reduce((sum, r) => sum + (r.updatedCount ?? 0) + (r.addedCount ?? 0), 0);
1195
+ const updatedEntryCount = list.filter((r) => (r.updatedCount ?? 0) + (r.addedCount ?? 0) > 0).length;
1196
+ const errors = list.flatMap((r) => r.errors ?? []);
1197
+ const warnings = list.flatMap((r) => r.warnings ?? []);
1198
+ const failureText = [...errors, ...warnings].join("; ");
1199
+ const unresolvedEntries = list.filter(
1200
+ (r) => (r.updatedCount ?? 0) + (r.addedCount ?? 0) === 0 && !r.errors?.length && !r.warnings?.length
1201
+ );
1202
+ const missingEntryCount = Math.max(0, expectedEntryCount - list.length);
1203
+ const unresolvedBlockCount = unresolvedEntries.length + missingEntryCount;
1204
+ const detail = [...errors, ...warnings, ...unresolvedEntries.map((r) => r.message).filter(Boolean)].join("; ") || list.map((r) => r.message).filter(Boolean).join("; ") || "no detail returned";
1205
+ const outcome = processedCount === 0 ? "failed" : processedCount < requestedCount ? "partial" : "clean";
1206
+ const failedFields = requestedAliases.filter((alias) => failureText.includes(`'${alias}'`));
1207
+ const savedFields = unresolvedBlockCount > 0 ? [] : requestedAliases.filter((alias) => !failedFields.includes(alias));
1208
+ return { outcome, processedCount, updatedEntryCount, detail, warnings, savedFields, failedFields, unresolvedBlockCount };
1209
+ }
1099
1210
 
1100
1211
  // src/umbraco-api/tools/content/get/inspect-blocks.ts
1101
1212
  var inputSchema6 = {
@@ -1106,41 +1217,11 @@ var outputSchema6 = z.object({
1106
1217
  id: z.string(),
1107
1218
  name: z.string(),
1108
1219
  previewUrl: previewUrlSchema,
1109
- blockProperties: z.array(z.object({
1110
- propertyAlias: z.string().describe("The document property containing these blocks"),
1111
- editorAlias: z.string().optional(),
1112
- blocks: z.array(z.object({
1113
- contentKey: z.string().describe("The block's unique key \u2014 use this with edit-block"),
1114
- contentTypeKey: z.string().describe("The block's element type ID"),
1115
- settingsKey: z.string().optional().describe("The key of the block's settings entry. Absent when the block has no settings."),
1116
- properties: z.array(z.object({
1117
- alias: z.string(),
1118
- value: z.any()
1119
- }))
1120
- }))
1121
- }))
1220
+ blockProperties: blockPropertiesSchema("edit-block")
1122
1221
  });
1123
- function isBlockListOrGridValue2(value) {
1124
- return value !== null && typeof value === "object" && !Array.isArray(value) && Array.isArray(value.contentData);
1125
- }
1126
- function isRteWithBlocks2(value) {
1127
- 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);
1128
- }
1129
- function extractBlocks(contentData, container) {
1130
- return contentData.map((block) => {
1131
- const contentKey = block.key ?? "";
1132
- const settingsKey = findSettingsKey(container, contentKey);
1133
- return {
1134
- contentKey,
1135
- contentTypeKey: block.contentTypeKey ?? "",
1136
- ...settingsKey ? { settingsKey } : {},
1137
- properties: Array.isArray(block.values) ? block.values.map((v) => ({ alias: v.alias ?? "", value: v.value })) : []
1138
- };
1139
- });
1140
- }
1141
1222
  var tool6 = {
1142
1223
  name: "inspect-blocks",
1143
- 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.",
1224
+ 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.",
1144
1225
  inputSchema: inputSchema6,
1145
1226
  outputSchema: outputSchema6,
1146
1227
  slices: ["read"],
@@ -1149,28 +1230,11 @@ var tool6 = {
1149
1230
  const result = await chainCms("get-document-by-id", { id });
1150
1231
  if (!result.ok) return result.errorResult;
1151
1232
  const doc = result.data;
1152
- const allValues = doc.values ?? [];
1153
- const filtered = propertyAlias ? allValues.filter((v) => v.alias === propertyAlias) : allValues;
1154
- const blockProperties = filtered.filter((v) => isBlockListOrGridValue2(v.value) || isRteWithBlocks2(v.value)).map((v) => {
1155
- const value = v.value;
1156
- if (isRteWithBlocks2(value)) {
1157
- return {
1158
- propertyAlias: v.alias,
1159
- editorAlias: "Umbraco.RichText",
1160
- blocks: extractBlocks(value.blocks.contentData, value.blocks)
1161
- };
1162
- }
1163
- return {
1164
- propertyAlias: v.alias,
1165
- editorAlias: v.editorAlias ?? void 0,
1166
- blocks: extractBlocks(value.contentData, value)
1167
- };
1168
- });
1169
1233
  return createToolResult({
1170
1234
  id: doc.id,
1171
1235
  name: doc.variants?.[0]?.name ?? "Unknown",
1172
1236
  previewUrl: buildPreviewUrl(doc.id),
1173
- blockProperties
1237
+ blockProperties: collectBlockProperties(doc.values ?? [], propertyAlias)
1174
1238
  });
1175
1239
  }
1176
1240
  };
@@ -1498,17 +1562,18 @@ ${aliases.join("\n")}`
1498
1562
  const schemaResult = await chainCms("get-data-type-schema", { id: match.id });
1499
1563
  if (!schemaResult.ok) return schemaResult.errorResult;
1500
1564
  return createToolResult({
1501
- message: JSON.stringify(schemaResult.data, null, 2),
1565
+ message: `Value-shape template for ${editorAlias}:
1566
+ ${JSON.stringify(schemaResult.data, null, 2)}`,
1502
1567
  editorAlias
1503
1568
  });
1504
1569
  }
1505
1570
  };
1506
1571
  var get_property_value_template_default = withStandardDecorators(tool10);
1507
- async function resolveEditorAliases(documentTypeId, values) {
1572
+ async function resolveEditorAliases(documentTypeId, values, { defaultCulture = null, documentType, siteCultures } = {}) {
1508
1573
  if (!values || values.length === 0) {
1509
1574
  return { ok: true, values: [] };
1510
1575
  }
1511
- const docTypeResult = await resolveDocumentTypeProperties(documentTypeId);
1576
+ const docTypeResult = await resolveDocumentTypeProperties(documentTypeId, documentType);
1512
1577
  if (!docTypeResult.ok) return docTypeResult;
1513
1578
  const dataTypeIds = Array.from(
1514
1579
  new Set(
@@ -1527,22 +1592,32 @@ async function resolveEditorAliases(documentTypeId, values) {
1527
1592
  docTypeResult.properties.map((p) => p.alias).filter((alias) => typeof alias === "string")
1528
1593
  );
1529
1594
  const editorAliasByPropertyAlias = /* @__PURE__ */ new Map();
1595
+ const cultureVariantAliases = /* @__PURE__ */ new Set();
1530
1596
  for (const prop of docTypeResult.properties) {
1531
1597
  const editorAlias = prop.dataType?.id ? editorAliasByDataTypeId.get(prop.dataType.id) : void 0;
1532
1598
  if (prop.alias && editorAlias) editorAliasByPropertyAlias.set(prop.alias, editorAlias);
1599
+ if (prop.alias && prop.variesByCulture) cultureVariantAliases.add(prop.alias);
1533
1600
  }
1534
1601
  const notAProperty = /* @__PURE__ */ new Set();
1535
1602
  const missingEditorAlias = /* @__PURE__ */ new Set();
1603
+ const unknownCultures = /* @__PURE__ */ new Set();
1536
1604
  const resolved = values.map((v) => {
1537
1605
  const editorAlias = editorAliasByPropertyAlias.get(v.alias);
1538
1606
  if (!editorAlias) {
1539
1607
  if (propertyAliases.has(v.alias)) missingEditorAlias.add(v.alias);
1540
1608
  else notAProperty.add(v.alias);
1541
1609
  }
1610
+ let culture = v.culture ?? (cultureVariantAliases.has(v.alias) ? defaultCulture : null);
1611
+ if (v.culture && siteCultures) {
1612
+ const requested = v.culture.toLowerCase();
1613
+ const match = siteCultures.find((c) => c.toLowerCase() === requested);
1614
+ if (match) culture = match;
1615
+ else unknownCultures.add(v.culture);
1616
+ }
1542
1617
  return {
1543
1618
  alias: v.alias,
1544
1619
  value: v.value,
1545
- culture: v.culture ?? null,
1620
+ culture,
1546
1621
  segment: v.segment ?? null,
1547
1622
  editorAlias: editorAlias ?? ""
1548
1623
  };
@@ -1573,14 +1648,74 @@ async function resolveEditorAliases(documentTypeId, values) {
1573
1648
  )
1574
1649
  };
1575
1650
  }
1651
+ if (unknownCultures.size > 0 && siteCultures) {
1652
+ return {
1653
+ ok: false,
1654
+ errorResult: createToolResultError(
1655
+ `The following value culture(s) are not languages on this site: ${Array.from(unknownCultures).join(", ")}. Available cultures: ${siteCultures.join(", ")}.`
1656
+ )
1657
+ };
1658
+ }
1576
1659
  return { ok: true, values: resolved };
1577
1660
  }
1661
+ var LANGUAGE_PAGE_SIZE = 100;
1662
+ async function resolvePageCulture(documentTypeId, culture, { forPublish = false } = {}) {
1663
+ const docTypeResult = await chainCms("get-document-type-by-id", { id: documentTypeId });
1664
+ if (!docTypeResult.ok) return { ok: false, errorResult: docTypeResult.errorResult };
1665
+ const documentType = docTypeResult.data;
1666
+ if (!documentType.variesByCulture) {
1667
+ return { ok: true, culture: null, documentType };
1668
+ }
1669
+ const langResult = await chainCms("get-language", { cursor: encodeCursor({ s: 0, t: LANGUAGE_PAGE_SIZE }) });
1670
+ if (!langResult.ok) return { ok: false, errorResult: langResult.errorResult };
1671
+ const languages = langResult.data.items ?? [];
1672
+ const complete = (langResult.data.total ?? languages.length) <= languages.length;
1673
+ const siteCultures = languages.map((l) => l.isoCode);
1674
+ let pageCulture;
1675
+ if (culture) {
1676
+ const match = siteCultures.find((c) => c.toLowerCase() === culture.toLowerCase());
1677
+ if (!match && complete) {
1678
+ return {
1679
+ ok: false,
1680
+ errorResult: createToolResultError(
1681
+ `Culture "${culture}" is not a language on this site. Available cultures: ${siteCultures.join(", ")}.`
1682
+ )
1683
+ };
1684
+ }
1685
+ pageCulture = match ?? culture;
1686
+ } else {
1687
+ const defaultLanguage = languages.find((l) => l.isDefault);
1688
+ if (!defaultLanguage?.isoCode) {
1689
+ return {
1690
+ ok: false,
1691
+ errorResult: createToolResultError(
1692
+ "This document type varies by culture, but no default language could be determined. Call list-languages and pass `culture` explicitly."
1693
+ )
1694
+ };
1695
+ }
1696
+ pageCulture = defaultLanguage.isoCode;
1697
+ }
1698
+ if (forPublish) {
1699
+ const missingMandatory = languages.filter((l) => l.isMandatory && l.isoCode !== pageCulture).map((l) => l.isoCode);
1700
+ if (missingMandatory.length > 0) {
1701
+ const one = missingMandatory.length === 1;
1702
+ return {
1703
+ ok: false,
1704
+ errorResult: createToolResultError(
1705
+ `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.`
1706
+ )
1707
+ };
1708
+ }
1709
+ }
1710
+ return { ok: true, culture: pageCulture, documentType, siteCultures: complete ? siteCultures : void 0 };
1711
+ }
1578
1712
 
1579
1713
  // src/umbraco-api/tools/content/post/create-page.ts
1580
1714
  var inputSchema11 = {
1581
1715
  name: z.string().describe("The name of the page to create"),
1582
1716
  documentTypeId: z.string().uuid().describe("The ID of the document type to use. Call list-document-types first to find available types."),
1583
1717
  parentId: z.string().uuid().optional().describe("The ID of the parent page. If omitted, the page is created at the root"),
1718
+ 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."),
1584
1719
  values: z.array(z.object({
1585
1720
  alias: z.string().describe("The property alias"),
1586
1721
  value: z.any().describe("The property value"),
@@ -1592,23 +1727,28 @@ var outputSchema11 = z.object({
1592
1727
  message: z.string(),
1593
1728
  id: z.string(),
1594
1729
  name: z.string(),
1730
+ 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."),
1595
1731
  previewUrl: previewUrlSchema,
1596
1732
  validation: validationResultSchema
1597
1733
  });
1598
1734
  var tool11 = {
1599
1735
  name: "create-page",
1600
- 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.).",
1736
+ 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.",
1601
1737
  inputSchema: inputSchema11,
1602
1738
  outputSchema: outputSchema11,
1603
1739
  slices: ["create"],
1604
1740
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
1605
- handler: async ({ name, documentTypeId, parentId, values }) => {
1606
- const resolved = await resolveEditorAliases(documentTypeId, values);
1741
+ handler: async ({ name, documentTypeId, parentId, culture, values }) => {
1742
+ const cultureResult = await resolvePageCulture(documentTypeId, culture);
1743
+ if (!cultureResult.ok) return cultureResult.errorResult;
1744
+ const { culture: pageCulture, documentType, siteCultures } = cultureResult;
1745
+ const resolved = await resolveEditorAliases(documentTypeId, values, { defaultCulture: pageCulture, documentType, siteCultures });
1607
1746
  if (!resolved.ok) return resolved.errorResult;
1608
1747
  const createResult = await chainCms("create-document", {
1609
1748
  documentTypeId,
1610
1749
  name,
1611
1750
  values: resolved.values,
1751
+ ...pageCulture ? { cultures: [pageCulture] } : {},
1612
1752
  ...parentId ? { parentId } : {}
1613
1753
  });
1614
1754
  if (!createResult.ok) return createResult.errorResult;
@@ -1620,6 +1760,7 @@ var tool11 = {
1620
1760
  message,
1621
1761
  id: createdId,
1622
1762
  name,
1763
+ culture: pageCulture,
1623
1764
  previewUrl: createdId ? await fetchPreviewUrl(createdId) : null,
1624
1765
  validation
1625
1766
  });
@@ -1630,6 +1771,7 @@ var inputSchema12 = {
1630
1771
  name: z.string().describe("The name of the page to create"),
1631
1772
  documentTypeId: z.string().uuid().describe("The ID of the document type to use. Call list-document-types first to find available types."),
1632
1773
  parentId: z.string().uuid().optional().describe("The ID of the parent page. If omitted, the page is created at the root"),
1774
+ 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."),
1633
1775
  values: z.array(z.object({
1634
1776
  alias: z.string().describe("The property alias"),
1635
1777
  value: z.any().describe("The property value"),
@@ -1641,58 +1783,36 @@ var outputSchema12 = z.object({
1641
1783
  message: z.string(),
1642
1784
  id: z.string(),
1643
1785
  name: z.string(),
1786
+ 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."),
1644
1787
  publishedUrls: publishedUrlsSchema
1645
1788
  });
1646
1789
  var tool12 = {
1647
1790
  name: "create-and-publish-page",
1648
- 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.",
1791
+ 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.",
1649
1792
  inputSchema: inputSchema12,
1650
1793
  outputSchema: outputSchema12,
1651
1794
  slices: ["create", "publish"],
1652
1795
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
1653
- handler: async ({ name, documentTypeId, parentId, values }) => {
1654
- const resolved = await resolveEditorAliases(documentTypeId, values);
1796
+ handler: async ({ name, documentTypeId, parentId, culture, values }) => {
1797
+ const cultureResult = await resolvePageCulture(documentTypeId, culture, { forPublish: true });
1798
+ if (!cultureResult.ok) return cultureResult.errorResult;
1799
+ const { culture: pageCulture, documentType, siteCultures } = cultureResult;
1800
+ const resolved = await resolveEditorAliases(documentTypeId, values, { defaultCulture: pageCulture, documentType, siteCultures });
1655
1801
  if (!resolved.ok) return resolved.errorResult;
1656
- if (await isCmsToolAvailable("create-and-publish-document")) {
1657
- const createResult = await chainCms("create-and-publish-document", {
1658
- documentTypeId,
1659
- name,
1660
- values: resolved.values,
1661
- ...parentId ? { parentId } : {}
1662
- });
1663
- if (!createResult.ok) return createResult.errorResult;
1664
- const createdId2 = createResult.data.id;
1665
- return createToolResult({
1666
- message: `Created and published "${name}"`,
1667
- id: createdId2,
1668
- name,
1669
- publishedUrls: createdId2 ? await fetchPublishedUrls(createdId2) : []
1670
- });
1671
- }
1672
- const createDocumentResult = await chainCms("create-document", {
1802
+ const createResult = await chainCms("create-and-publish-document", {
1673
1803
  documentTypeId,
1674
1804
  name,
1675
1805
  values: resolved.values,
1806
+ ...pageCulture ? { cultures: [pageCulture] } : {},
1676
1807
  ...parentId ? { parentId } : {}
1677
1808
  });
1678
- if (!createDocumentResult.ok) return createDocumentResult.errorResult;
1679
- const createdId = createDocumentResult.data.id;
1680
- const publishResult = await chainCms("publish-document", {
1681
- id: createdId,
1682
- data: { publishSchedules: [{ culture: null }] }
1683
- });
1684
- if (!publishResult.ok) {
1685
- return createToolResult({
1686
- message: `Created "${name}" as a draft but publish failed: ${publishResult.errorResult.content?.[0]?.text ?? "unknown error"}`,
1687
- id: createdId,
1688
- name,
1689
- publishedUrls: []
1690
- });
1691
- }
1809
+ if (!createResult.ok) return createResult.errorResult;
1810
+ const createdId = createResult.data.id;
1692
1811
  return createToolResult({
1693
1812
  message: `Created and published "${name}"`,
1694
1813
  id: createdId,
1695
1814
  name,
1815
+ culture: pageCulture,
1696
1816
  publishedUrls: createdId ? await fetchPublishedUrls(createdId) : []
1697
1817
  });
1698
1818
  }
@@ -2026,78 +2146,6 @@ var tool17 = {
2026
2146
  }
2027
2147
  };
2028
2148
  var edit_page_default = withStandardDecorators(tool17);
2029
- var MAX_ENRICHED_BLOCKS = 50;
2030
- var MAX_BLOCK_WALK_DEPTH = 20;
2031
- function enrichBlockNotFoundError(errorResult, values, options = {}) {
2032
- const problem = extractInnerProblemDetails(errorResult);
2033
- const availableBlocks = problem.availableBlocks;
2034
- if (!Array.isArray(availableBlocks)) return errorResult;
2035
- const { propertyAlias, note } = options;
2036
- const filtered = propertyAlias ? values.filter((v) => v.alias === propertyAlias) : values;
2037
- const typeByKey = /* @__PURE__ */ new Map();
2038
- for (const v of filtered) {
2039
- const container = isRteWithBlocks(v.value) ? v.value.blocks : v.value;
2040
- if (isBlockListOrGridValue(container)) {
2041
- collectBlockEntryTypes(container, typeByKey, 0);
2042
- }
2043
- }
2044
- const truncated = availableBlocks.length > MAX_ENRICHED_BLOCKS;
2045
- const limitedBlocks = truncated ? availableBlocks.slice(0, MAX_ENRICHED_BLOCKS) : availableBlocks;
2046
- const enrichedBlocks = limitedBlocks.map(
2047
- (b) => b && typeof b === "object" && typeof b.key === "string" ? { ...b, contentTypeKey: typeByKey.get(b.key) ?? null } : b
2048
- );
2049
- return createToolResultError({
2050
- ...problem,
2051
- availableBlocks: enrichedBlocks,
2052
- ...truncated ? { availableBlocksNote: `Showing ${MAX_ENRICHED_BLOCKS} of ${availableBlocks.length} available blocks \u2014 use inspect-blocks for the full list.` } : {},
2053
- ...note ? { note } : {}
2054
- });
2055
- }
2056
- function collectBlockEntryTypes(container, into, depth) {
2057
- if (depth > MAX_BLOCK_WALK_DEPTH) return;
2058
- for (const list of [container.contentData, container.settingsData]) {
2059
- if (!Array.isArray(list)) continue;
2060
- for (const block of list) {
2061
- if (!block || typeof block !== "object") continue;
2062
- const key = block.key;
2063
- const contentTypeKey = block.contentTypeKey;
2064
- if (typeof key === "string" && typeof contentTypeKey === "string") into.set(key, contentTypeKey);
2065
- const nestedValues = block.values;
2066
- if (!Array.isArray(nestedValues)) continue;
2067
- for (const nested of nestedValues) {
2068
- const nestedRaw = nested?.value;
2069
- const nestedContainer = isRteWithBlocks(nestedRaw) ? nestedRaw.blocks : nestedRaw;
2070
- if (isBlockListOrGridValue(nestedContainer)) {
2071
- collectBlockEntryTypes(nestedContainer, into, depth + 1);
2072
- }
2073
- }
2074
- }
2075
- }
2076
- }
2077
- var blockPropertyAliasSchema = z.string().regex(
2078
- /^[A-Za-z_][A-Za-z0-9_]*$/,
2079
- "Property alias must be a valid identifier (letters, digits, underscore; not starting with a digit)"
2080
- );
2081
- function classifyBlockUpdateResults(results, requestedCount, requestedAliases = [], expectedEntryCount = 1) {
2082
- const list = results ?? [];
2083
- const processedCount = list.reduce((sum, r) => sum + (r.updatedCount ?? 0) + (r.addedCount ?? 0), 0);
2084
- const updatedEntryCount = list.filter((r) => (r.updatedCount ?? 0) + (r.addedCount ?? 0) > 0).length;
2085
- const errors = list.flatMap((r) => r.errors ?? []);
2086
- const warnings = list.flatMap((r) => r.warnings ?? []);
2087
- const failureText = [...errors, ...warnings].join("; ");
2088
- const unresolvedEntries = list.filter(
2089
- (r) => (r.updatedCount ?? 0) + (r.addedCount ?? 0) === 0 && !r.errors?.length && !r.warnings?.length
2090
- );
2091
- const missingEntryCount = Math.max(0, expectedEntryCount - list.length);
2092
- const unresolvedBlockCount = unresolvedEntries.length + missingEntryCount;
2093
- const detail = [...errors, ...warnings, ...unresolvedEntries.map((r) => r.message).filter(Boolean)].join("; ") || list.map((r) => r.message).filter(Boolean).join("; ") || "no detail returned";
2094
- const outcome = processedCount === 0 ? "failed" : processedCount < requestedCount ? "partial" : "clean";
2095
- const failedFields = requestedAliases.filter((alias) => failureText.includes(`'${alias}'`));
2096
- const savedFields = unresolvedBlockCount > 0 ? [] : requestedAliases.filter((alias) => !failedFields.includes(alias));
2097
- return { outcome, processedCount, updatedEntryCount, detail, warnings, savedFields, failedFields, unresolvedBlockCount };
2098
- }
2099
-
2100
- // src/umbraco-api/tools/content/put/edit-block.ts
2101
2149
  var inputSchema18 = {
2102
2150
  id: z.string().uuid().describe("The ID of the page containing the block"),
2103
2151
  propertyAlias: z.string().describe("The document property alias containing the blocks (e.g. 'mainContent'). Use inspect-blocks to find this."),
@@ -2122,7 +2170,7 @@ var outputSchema18 = z.object({
2122
2170
  });
2123
2171
  var tool18 = {
2124
2172
  name: "edit-block",
2125
- 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.",
2173
+ 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.",
2126
2174
  inputSchema: inputSchema18,
2127
2175
  outputSchema: outputSchema18,
2128
2176
  slices: ["update"],
@@ -2234,7 +2282,8 @@ var tool19 = {
2234
2282
  const targetCulture = culture ?? null;
2235
2283
  const docResult = await chainCms("get-document-by-id", { id });
2236
2284
  if (!docResult.ok) return docResult.errorResult;
2237
- const variants = docResult.data.variants ?? [];
2285
+ const doc = docResult.data;
2286
+ const variants = doc.variants ?? [];
2238
2287
  const targetVariant = variants.find((v) => matchesCulture(v, targetCulture));
2239
2288
  if (!targetVariant) {
2240
2289
  if (targetCulture) {
@@ -2268,8 +2317,8 @@ var tool19 = {
2268
2317
  previewUrl: buildPreviewUrl(id)
2269
2318
  });
2270
2319
  }
2271
- const renameResult = await chainCms("update-document-name", { id, name, culture: targetCulture });
2272
- if (!renameResult.ok) return renameResult.errorResult;
2320
+ const updateResult = await chainCms("update-document-name", { id, name, culture: targetCulture });
2321
+ if (!updateResult.ok) return updateResult.errorResult;
2273
2322
  return createToolResult({
2274
2323
  message: `Renamed page${cultureLabel} from "${previousName}" to "${name}" (saved, not published)`,
2275
2324
  id,
@@ -2636,6 +2685,48 @@ async function verifyDocumentPublished(id, expectedCultures) {
2636
2685
  return `publish call returned success but ${failures.length === 1 ? "this culture is" : "these cultures are"} still in draft: ${failures.join(", ")}`;
2637
2686
  }
2638
2687
 
2688
+ // src/umbraco-api/tools/helpers/publish-with-descendants.ts
2689
+ var FOLLOWUP_MAX_ATTEMPTS = 30;
2690
+ var FOLLOWUP_POLL_INTERVAL_MS = 2e3;
2691
+ function parsePublishWithDescendantsStatus(data) {
2692
+ if (data !== null && typeof data === "object" && data.status === "in-progress" && typeof data.taskId === "string") {
2693
+ return { complete: false, taskId: data.taskId };
2694
+ }
2695
+ if (data !== "") {
2696
+ console.warn(
2697
+ `publish-document-with-descendants returned an unrecognized success payload (neither "" nor an in-progress marker) \u2014 treating as complete: ${JSON.stringify(data)}`
2698
+ );
2699
+ }
2700
+ return { complete: true };
2701
+ }
2702
+ function isRequestTimeout(error) {
2703
+ const detail = extractInnerProblemDetails(error.errorResult).detail;
2704
+ return typeof detail === "string" && detail.includes("Request timed out");
2705
+ }
2706
+ async function publishWithDescendants(id, data, options) {
2707
+ const initial = await chainCms("publish-document-with-descendants", { id, data });
2708
+ if (!initial.ok) {
2709
+ if (isRequestTimeout(initial)) return { ok: true, complete: false };
2710
+ return initial;
2711
+ }
2712
+ const status = parsePublishWithDescendantsStatus(initial.data);
2713
+ if (status.complete) return { ok: true, complete: true };
2714
+ if (options?.followUp === false) return { ok: true, complete: false };
2715
+ for (let attempt = 0; attempt < FOLLOWUP_MAX_ATTEMPTS; attempt++) {
2716
+ await new Promise((resolve2) => setTimeout(resolve2, FOLLOWUP_POLL_INTERVAL_MS));
2717
+ const poll = await chainCms("get-document-publish-with-descendants-result", {
2718
+ id,
2719
+ taskId: status.taskId
2720
+ });
2721
+ if (!poll.ok) {
2722
+ if (isRequestTimeout(poll)) return { ok: true, complete: false };
2723
+ return poll;
2724
+ }
2725
+ if (poll.data.isComplete) return { ok: true, complete: true };
2726
+ }
2727
+ return { ok: true, complete: false };
2728
+ }
2729
+
2639
2730
  // src/umbraco-api/tools/publishing/post/publish-page.ts
2640
2731
  var inputSchema25 = {
2641
2732
  id: z.string().uuid().describe("The ID of the page to publish"),
@@ -2653,7 +2744,12 @@ var tool25 = {
2653
2744
  inputSchema: inputSchema25,
2654
2745
  outputSchema: outputSchema25,
2655
2746
  slices: ["publish"],
2656
- annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
2747
+ // includeDescendants delegates to publish-document-with-descendants, which
2748
+ // the chained CMS tool annotates idempotentHint: false — a retry fires a
2749
+ // second concurrent recursive publish job rather than converging to the
2750
+ // same end state. That makes this tool non-idempotent as a whole, since
2751
+ // includeDescendants is a valid input, not a separate tool.
2752
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
2657
2753
  handler: async ({ id, includeDescendants }, extra) => {
2658
2754
  const docResult = await chainCms("get-document-by-id", { id });
2659
2755
  if (!docResult.ok) return docResult.errorResult;
@@ -2665,29 +2761,42 @@ var tool25 = {
2665
2761
  }
2666
2762
  }
2667
2763
  const variantCultures = (doc.variants ?? []).length ? doc.variants.map((v) => v.culture ?? null) : [null];
2668
- const publishResult = includeDescendants ? await chainCms("publish-document-with-descendants", {
2669
- id,
2670
- data: {
2764
+ if (includeDescendants) {
2765
+ const result = await publishWithDescendants(id, {
2671
2766
  includeUnpublishedDescendants: false,
2672
2767
  cultures: variantCultures.filter((c) => c !== null)
2673
- }
2674
- }) : await chainCms("publish-document", {
2768
+ });
2769
+ if (!result.ok) return result.errorResult;
2770
+ if (!result.complete) {
2771
+ return createToolResult({
2772
+ message: `"${pageName}" and its descendants are a large tree \u2014 publishing is still running in the background. Check again shortly.`,
2773
+ id,
2774
+ name: pageName,
2775
+ publishedUrls: []
2776
+ });
2777
+ }
2778
+ return createToolResult({
2779
+ message: `Published "${pageName}" and all child pages`,
2780
+ id,
2781
+ name: pageName,
2782
+ publishedUrls: await fetchPublishedUrls(id)
2783
+ });
2784
+ }
2785
+ const publishResult = await chainCms("publish-document", {
2675
2786
  id,
2676
2787
  data: { publishSchedules: variantCultures.map((c) => ({ culture: c })) }
2677
2788
  });
2678
2789
  if (!publishResult.ok) return publishResult.errorResult;
2679
- if (!includeDescendants) {
2680
- const verifyError = await verifyDocumentPublished(id, variantCultures);
2681
- if (verifyError) {
2682
- return createToolResultError({
2683
- status: 500,
2684
- title: "Publish did not take effect",
2685
- detail: `"${pageName}": ${verifyError}`
2686
- });
2687
- }
2790
+ const verifyError = await verifyDocumentPublished(id, variantCultures);
2791
+ if (verifyError) {
2792
+ return createToolResultError({
2793
+ status: 500,
2794
+ title: "Publish did not take effect",
2795
+ detail: `"${pageName}": ${verifyError}`
2796
+ });
2688
2797
  }
2689
2798
  return createToolResult({
2690
- message: includeDescendants ? `Published "${pageName}" and all child pages` : `Published "${pageName}"`,
2799
+ message: `Published "${pageName}"`,
2691
2800
  id,
2692
2801
  name: pageName,
2693
2802
  publishedUrls: await fetchPublishedUrls(id)
@@ -2749,17 +2858,36 @@ var outputSchema27 = z.object({
2749
2858
  updatedFields: z.array(z.string()),
2750
2859
  publishedUrls: publishedUrlsSchema
2751
2860
  });
2752
- function mergeValues(existing, updates) {
2753
- const key = (v) => `${v.alias}::${v.culture ?? ""}::${v.segment ?? ""}`;
2754
- const merged = new Map(existing.map((v) => [key(v), { alias: v.alias, value: v.value, culture: v.culture ?? null, segment: v.segment ?? null }]));
2755
- for (const u of updates) {
2756
- merged.set(key(u), { alias: u.alias, value: u.value, culture: u.culture ?? null, segment: u.segment ?? null });
2861
+ function valueKey2(value) {
2862
+ return `${value.alias}|${value.culture ?? ""}|${value.segment ?? ""}`;
2863
+ }
2864
+ function normaliseValue(value) {
2865
+ return {
2866
+ alias: value.alias,
2867
+ value: value.value,
2868
+ culture: value.culture ?? null,
2869
+ segment: value.segment ?? null
2870
+ };
2871
+ }
2872
+ function mergeValues(current, incoming) {
2873
+ const merged = current.map(normaliseValue);
2874
+ const indexByKey = new Map(merged.map((value, index) => [valueKey2(value), index]));
2875
+ for (const value of incoming) {
2876
+ const next = normaliseValue(value);
2877
+ const key = valueKey2(next);
2878
+ const existingIndex = indexByKey.get(key);
2879
+ if (existingIndex !== void 0) {
2880
+ merged[existingIndex] = next;
2881
+ } else {
2882
+ indexByKey.set(key, merged.length);
2883
+ merged.push(next);
2884
+ }
2757
2885
  }
2758
- return [...merged.values()];
2886
+ return merged;
2759
2887
  }
2760
2888
  var tool27 = {
2761
2889
  name: "save-and-publish",
2762
- 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.",
2890
+ 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.",
2763
2891
  inputSchema: inputSchema27,
2764
2892
  outputSchema: outputSchema27,
2765
2893
  slices: ["publish", "update"],
@@ -2770,6 +2898,7 @@ var tool27 = {
2770
2898
  const doc = docResult.data;
2771
2899
  const pageName = doc.variants?.[0]?.name ?? "Unknown";
2772
2900
  const fieldNames = (values ?? []).map((v) => v.alias);
2901
+ const hasValues = (values?.length ?? 0) > 0;
2773
2902
  if (includeDescendants) {
2774
2903
  if (!await requestApproval(extra, `Publish "${pageName}" and all its descendants?`)) {
2775
2904
  return createToolResult({
@@ -2784,9 +2913,9 @@ var tool27 = {
2784
2913
  }
2785
2914
  }
2786
2915
  const variantCultures = (doc.variants ?? []).length ? doc.variants.map((v) => v.culture ?? null) : [null];
2787
- const saved = !!(values && values.length > 0);
2788
2916
  if (includeDescendants) {
2789
- if (saved) {
2917
+ let saved = false;
2918
+ if (hasValues) {
2790
2919
  const properties = values.map((v) => ({
2791
2920
  alias: v.alias,
2792
2921
  value: v.value,
@@ -2795,13 +2924,11 @@ var tool27 = {
2795
2924
  }));
2796
2925
  const updateResult = await chainCms("update-document-properties", { id, properties });
2797
2926
  if (!updateResult.ok) return updateResult.errorResult;
2927
+ saved = true;
2798
2928
  }
2799
- const publishResult = await chainCms("publish-document-with-descendants", {
2800
- id,
2801
- data: {
2802
- includeUnpublishedDescendants: false,
2803
- cultures: variantCultures.filter((c) => c !== null)
2804
- }
2929
+ const publishResult = await publishWithDescendants(id, {
2930
+ includeUnpublishedDescendants: false,
2931
+ cultures: variantCultures.filter((c) => c !== null)
2805
2932
  });
2806
2933
  if (!publishResult.ok) {
2807
2934
  if (saved) {
@@ -2817,85 +2944,86 @@ var tool27 = {
2817
2944
  }
2818
2945
  return publishResult.errorResult;
2819
2946
  }
2820
- } else {
2821
- const mergedValues = mergeValues(doc.values ?? [], values ?? []);
2822
- const variants = (doc.variants ?? []).map((v) => ({
2823
- culture: v.culture ?? null,
2824
- segment: v.segment ?? null,
2825
- name: v.name
2826
- }));
2827
- if (await isCmsToolAvailable("update-and-publish-document")) {
2828
- const updateAndPublishResult = await chainCms("update-and-publish-document", {
2829
- id,
2830
- data: {
2831
- values: mergedValues,
2832
- variants,
2833
- template: doc.template ?? null,
2834
- culturesToPublish: variantCultures.filter((c) => c !== null)
2835
- }
2836
- });
2837
- if (!updateAndPublishResult.ok) return updateAndPublishResult.errorResult;
2838
- } else {
2839
- const updateResult = await chainCms("update-document", {
2840
- id,
2841
- data: {
2842
- values: mergedValues,
2843
- variants,
2844
- template: doc.template ?? null
2845
- }
2846
- });
2847
- if (!updateResult.ok) return updateResult.errorResult;
2848
- const publishResult = await chainCms("publish-document", {
2947
+ if (!publishResult.complete) {
2948
+ const savedPrefix = saved ? `Saved ${fieldNames.length} field(s) on "${pageName}". ` : "";
2949
+ return createToolResult({
2950
+ message: `${savedPrefix}"${pageName}" and its descendants are a large tree \u2014 publishing is still running in the background. Check again shortly.`,
2849
2951
  id,
2850
- data: {
2851
- publishSchedules: variantCultures.map((c) => ({ culture: c }))
2852
- }
2952
+ name: pageName,
2953
+ saved,
2954
+ published: false,
2955
+ updatedFields: fieldNames,
2956
+ publishedUrls: []
2853
2957
  });
2854
- if (!publishResult.ok) {
2855
- if (saved) {
2856
- return createToolResult({
2857
- message: `Saved ${fieldNames.length} field(s) on "${pageName}" but publish failed: ${publishResult.errorResult.content?.[0]?.text ?? "unknown error"}`,
2858
- id,
2859
- name: pageName,
2860
- saved: true,
2861
- published: false,
2862
- updatedFields: fieldNames,
2863
- publishedUrls: []
2864
- });
2865
- }
2866
- return publishResult.errorResult;
2867
- }
2868
2958
  }
2959
+ const savedPart2 = saved ? `Saved ${fieldNames.length} field(s) and ` : "";
2960
+ return createToolResult({
2961
+ message: `${savedPart2}published "${pageName}" and all descendants`,
2962
+ id,
2963
+ name: pageName,
2964
+ saved,
2965
+ published: true,
2966
+ updatedFields: fieldNames,
2967
+ publishedUrls: await fetchPublishedUrls(id)
2968
+ });
2869
2969
  }
2870
- if (!includeDescendants) {
2871
- const verifyError = await verifyDocumentPublished(id, variantCultures);
2872
- if (verifyError) {
2873
- if (saved) {
2874
- return createToolResult({
2875
- message: `Saved ${fieldNames.length} field(s) on "${pageName}" but publish did not take effect: ${verifyError}`,
2876
- id,
2877
- name: pageName,
2878
- saved: true,
2879
- published: false,
2880
- updatedFields: fieldNames,
2881
- publishedUrls: []
2882
- });
2970
+ if (hasValues) {
2971
+ const updateAndPublishResult = await chainCms("update-and-publish-document", {
2972
+ id,
2973
+ data: {
2974
+ culturesToPublish: [...new Set(variantCultures.filter((c) => c !== null))],
2975
+ template: doc.template ?? null,
2976
+ values: mergeValues(doc.values ?? [], values),
2977
+ variants: (doc.variants ?? []).map((v) => ({
2978
+ culture: v.culture ?? null,
2979
+ segment: v.segment ?? null,
2980
+ name: v.name
2981
+ }))
2883
2982
  }
2983
+ });
2984
+ if (!updateAndPublishResult.ok) {
2985
+ 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.`;
2986
+ const problem = extractInnerProblemDetails(updateAndPublishResult.errorResult);
2884
2987
  return createToolResultError({
2885
- status: 500,
2886
- title: "Publish did not take effect",
2887
- detail: `"${pageName}": ${verifyError}`
2988
+ ...problem,
2989
+ status: typeof problem?.status === "number" ? problem.status : 500,
2990
+ title: "Save and publish failed",
2991
+ detail: problem?.detail ? `${String(problem.detail)} ${rolledBack}` : rolledBack
2992
+ });
2993
+ }
2994
+ } else {
2995
+ const publishResult = await chainCms("publish-document", {
2996
+ id,
2997
+ data: { publishSchedules: variantCultures.map((c) => ({ culture: c })) }
2998
+ });
2999
+ if (!publishResult.ok) return publishResult.errorResult;
3000
+ }
3001
+ const verifyError = await verifyDocumentPublished(id, variantCultures);
3002
+ if (verifyError) {
3003
+ if (hasValues) {
3004
+ return createToolResult({
3005
+ message: `Saved ${fieldNames.length} field(s) on "${pageName}" but publish did not take effect: ${verifyError}`,
3006
+ id,
3007
+ name: pageName,
3008
+ saved: true,
3009
+ published: false,
3010
+ updatedFields: fieldNames,
3011
+ publishedUrls: []
2888
3012
  });
2889
3013
  }
3014
+ return createToolResultError({
3015
+ status: 500,
3016
+ title: "Publish did not take effect",
3017
+ detail: `"${pageName}": ${verifyError}`
3018
+ });
2890
3019
  }
2891
3020
  const publishedUrls = await fetchPublishedUrls(id);
2892
- const savedPart = saved ? `Saved ${fieldNames.length} field(s) and ` : "";
2893
- const descPart = includeDescendants ? " and all descendants" : "";
3021
+ const savedPart = hasValues ? `Saved ${fieldNames.length} field(s) and ` : "";
2894
3022
  return createToolResult({
2895
- message: `${savedPart}published "${pageName}"${descPart}`,
3023
+ message: `${savedPart}published "${pageName}"`,
2896
3024
  id,
2897
3025
  name: pageName,
2898
- saved,
3026
+ saved: hasValues,
2899
3027
  published: true,
2900
3028
  updatedFields: fieldNames,
2901
3029
  publishedUrls
@@ -3966,157 +4094,861 @@ var collection5 = {
3966
4094
  };
3967
4095
  var media_management_default = collection5;
3968
4096
  var inputSchema46 = {
3969
- parentId: z.string().uuid().optional().describe("The ID of a blueprint folder to list children of. If omitted, lists root-level blueprints."),
3970
- take: z.number().optional().default(50).describe("Number of results to return"),
3971
- skip: z.number().optional().default(0).describe("Number of results to skip")
4097
+ id: z.string().uuid().describe("The unique ID of the element to retrieve")
3972
4098
  };
3973
4099
  var outputSchema46 = z.object({
3974
- items: z.array(z.object({
3975
- id: z.string(),
3976
- name: z.string(),
3977
- documentType: z.string().optional().describe("The document type alias or name this blueprint is based on")
3978
- })).describe("Available page blueprints"),
3979
- total: z.number()
4100
+ id: z.string(),
4101
+ name: z.string(),
4102
+ elementType: z.object({ id: z.string() }).describe("The element type (document type) this element is based on"),
4103
+ values: z.array(z.object({ alias: z.string(), value: z.any() }).passthrough()).describe("Property field values"),
4104
+ variants: z.array(z.object({ name: z.string() }).passthrough()).describe("Language/culture variants")
3980
4105
  });
3981
4106
  var tool46 = {
3982
- name: "list-blueprints",
3983
- description: "List available page blueprints (templates with pre-filled content). Use get-blueprint to view a blueprint's details and property values.",
4107
+ name: "get-element",
4108
+ 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.",
3984
4109
  inputSchema: inputSchema46,
3985
4110
  outputSchema: outputSchema46,
3986
- slices: ["list"],
4111
+ slices: ["read"],
3987
4112
  annotations: { readOnlyHint: true },
3988
- handler: async ({ parentId, take, skip }) => {
3989
- const accessCheck = await checkSettingsAccess();
3990
- if (!accessCheck.ok) return accessCheck.errorResult;
3991
- if (!accessCheck.hasAccess) {
3992
- return createToolResultError({
3993
- status: 403,
3994
- title: "Settings access required",
3995
- detail: "Listing blueprints requires the signed-in Umbraco user to have access to the Settings section. Grant Settings-section access to the user's group in the Umbraco backoffice (Users \u2192 [group] \u2192 Sections), then retry."
3996
- });
3997
- }
3998
- const cursor = buildChainedCursor(skip, take);
3999
- const result = parentId ? await chainCms("get-document-blueprint-children", { parentId, cursor }) : await chainCms("get-document-blueprint-root", { cursor });
4113
+ handler: async ({ id }) => {
4114
+ const result = await chainCms("get-element-by-id", { id });
4000
4115
  if (!result.ok) return result.errorResult;
4116
+ const el = result.data;
4001
4117
  return createToolResult({
4002
- items: (result.data.items ?? []).map((item) => ({
4003
- id: item.id,
4004
- name: item.name ?? "Unknown",
4005
- documentType: item.documentType?.id ?? void 0
4006
- })),
4007
- total: result.data.total ?? 0
4118
+ id: el.id,
4119
+ name: el.variants?.[0]?.name ?? "Unknown",
4120
+ elementType: { id: el.documentType?.id ?? el.elementType?.id ?? "" },
4121
+ values: el.values ?? [],
4122
+ variants: el.variants ?? []
4008
4123
  });
4009
4124
  }
4010
4125
  };
4011
- var list_blueprints_default = withStandardDecorators(tool46);
4126
+ var get_element_default = withStandardDecorators(tool46);
4012
4127
  var inputSchema47 = {
4013
- id: z.string().uuid().describe("The ID of the blueprint to retrieve")
4128
+ 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)."),
4129
+ take: z.number().optional().default(20).describe("Number of results to return"),
4130
+ skip: z.number().optional().default(0).describe("Number of results to skip")
4014
4131
  };
4015
4132
  var outputSchema47 = z.object({
4016
- id: z.string(),
4017
- name: z.string(),
4018
- documentType: z.object({
4019
- id: z.string().optional(),
4020
- alias: z.string().optional(),
4021
- name: z.string().optional()
4022
- }).optional().describe("The document type this blueprint is based on"),
4023
- values: z.array(z.object({
4024
- alias: z.string(),
4025
- value: z.any(),
4026
- culture: z.string().nullable().optional(),
4027
- segment: z.string().nullable().optional()
4028
- })).optional().describe("Pre-filled property values"),
4029
- variants: z.array(z.object({
4030
- name: z.string().optional(),
4031
- culture: z.string().nullable().optional(),
4032
- segment: z.string().nullable().optional()
4033
- })).optional().describe("Variant information")
4133
+ items: z.array(z.object({
4134
+ id: z.string(),
4135
+ name: z.string(),
4136
+ isFolder: z.boolean().describe("True if this node is a folder that organises elements, false if it is an element item"),
4137
+ hasChildren: z.boolean()
4138
+ })).describe("Child folders and elements"),
4139
+ total: z.number().describe("Total number of children")
4034
4140
  });
4035
4141
  var tool47 = {
4036
- name: "get-blueprint",
4037
- 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.",
4142
+ name: "list-element-children",
4143
+ 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.",
4038
4144
  inputSchema: inputSchema47,
4039
4145
  outputSchema: outputSchema47,
4040
- slices: ["read"],
4146
+ slices: ["tree"],
4041
4147
  annotations: { readOnlyHint: true },
4042
- handler: async ({ id }) => {
4043
- const result = await chainCms("get-document-blueprint", { id });
4148
+ handler: async ({ parentId, take, skip }) => {
4149
+ const cursor = buildChainedCursor(skip, take);
4150
+ const result = parentId ? await chainCms("get-element-children", { parentId, cursor }) : await chainCms("get-element-root", { cursor });
4044
4151
  if (!result.ok) return result.errorResult;
4045
4152
  const data = result.data;
4046
- const dt = data.documentType;
4047
- const documentType = dt ? { id: dt.id ?? void 0, alias: dt.alias ?? void 0, name: dt.name ?? void 0 } : void 0;
4048
- const name = data.variants?.[0]?.name ?? "Unknown";
4153
+ const items = data.items ?? [];
4049
4154
  return createToolResult({
4050
- id: data.id,
4051
- name,
4052
- documentType,
4053
- values: data.values ?? [],
4054
- variants: (data.variants ?? []).map((v) => ({
4055
- name: v.name ?? void 0,
4056
- culture: v.culture ?? null,
4057
- segment: v.segment ?? null
4058
- }))
4155
+ items: items.map((item) => ({
4156
+ id: item.id,
4157
+ name: item.variants?.[0]?.name ?? item.name ?? "Unknown",
4158
+ isFolder: item.isFolder ?? false,
4159
+ hasChildren: item.hasChildren ?? false
4160
+ })),
4161
+ total: data.total ?? items.length
4059
4162
  });
4060
4163
  }
4061
4164
  };
4062
- var get_blueprint_default = withStandardDecorators(tool47);
4165
+ var list_element_children_default = withStandardDecorators(tool47);
4063
4166
  var inputSchema48 = {
4064
- pageId: z.string().uuid().describe("The ID of the source page to save as a blueprint"),
4065
- name: z.string().describe("The name for the new blueprint")
4167
+ query: z.string().describe("Search term to find Library elements by name"),
4168
+ take: z.number().optional().default(10).describe("Number of results to return (default 10)"),
4169
+ skip: z.number().optional().default(0).describe("Number of results to skip for pagination")
4066
4170
  };
4067
4171
  var outputSchema48 = z.object({
4068
- message: z.string(),
4069
- id: z.string(),
4070
- name: z.string()
4172
+ items: z.array(z.object({
4173
+ id: z.string(),
4174
+ name: z.string()
4175
+ })).describe("Matching Library elements"),
4176
+ total: z.number().describe("Total number of matches")
4071
4177
  });
4072
4178
  var tool48 = {
4073
- name: "create-blueprint",
4074
- description: "Save an existing page as a reusable blueprint (template). The blueprint preserves the page's document type and property values.",
4179
+ name: "search-elements",
4180
+ 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).",
4075
4181
  inputSchema: inputSchema48,
4076
4182
  outputSchema: outputSchema48,
4183
+ slices: ["search"],
4184
+ annotations: { readOnlyHint: true },
4185
+ handler: async ({ query, take, skip }) => {
4186
+ const result = await chainCms("search-element", { query, cursor: buildChainedCursor(skip, take) });
4187
+ if (!result.ok) return result.errorResult;
4188
+ const data = result.data;
4189
+ const items = data.items ?? [];
4190
+ return createToolResult({
4191
+ items: items.map((item) => ({
4192
+ id: item.id,
4193
+ name: item.variants?.[0]?.name ?? item.name ?? "Unknown"
4194
+ })),
4195
+ total: data.total ?? items.length
4196
+ });
4197
+ }
4198
+ };
4199
+ var search_elements_default = withStandardDecorators(tool48);
4200
+ var inputSchema49 = {
4201
+ id: z.string().uuid().describe("The ID of the Library element to inspect"),
4202
+ propertyAlias: z.string().optional().describe("Specific property alias to inspect. If omitted, all block-based properties are shown.")
4203
+ };
4204
+ var outputSchema49 = z.object({
4205
+ id: z.string(),
4206
+ name: z.string(),
4207
+ blockProperties: blockPropertiesSchema("edit-element-block")
4208
+ });
4209
+ var tool49 = {
4210
+ name: "inspect-element-blocks",
4211
+ 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).",
4212
+ inputSchema: inputSchema49,
4213
+ outputSchema: outputSchema49,
4214
+ slices: ["read"],
4215
+ annotations: { readOnlyHint: true },
4216
+ handler: async ({ id, propertyAlias }) => {
4217
+ const result = await chainCms("get-element-by-id", { id });
4218
+ if (!result.ok) return result.errorResult;
4219
+ const element = result.data;
4220
+ return createToolResult({
4221
+ id: element.id,
4222
+ name: element.variants?.[0]?.name ?? "Unknown",
4223
+ blockProperties: collectBlockProperties(element.values ?? [], propertyAlias)
4224
+ });
4225
+ }
4226
+ };
4227
+ var inspect_element_blocks_default = withStandardDecorators(tool49);
4228
+ var inputSchema50 = {
4229
+ name: z.string().describe("The name of the element to create"),
4230
+ 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."),
4231
+ 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."),
4232
+ values: z.array(z.object({
4233
+ alias: z.string().describe("The property alias"),
4234
+ value: z.any().describe("The property value"),
4235
+ culture: z.string().nullable().optional().describe("The culture code for variant content"),
4236
+ segment: z.string().nullable().optional().describe("The segment for segmented content")
4237
+ })).optional().describe("Initial property values to set on the new element")
4238
+ };
4239
+ var outputSchema50 = z.object({
4240
+ message: z.string(),
4241
+ id: z.string(),
4242
+ name: z.string()
4243
+ });
4244
+ var tool50 = {
4245
+ name: "create-element",
4246
+ 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.",
4247
+ inputSchema: inputSchema50,
4248
+ outputSchema: outputSchema50,
4077
4249
  slices: ["create"],
4078
4250
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
4079
- handler: async ({ pageId, name }) => {
4080
- let pageName = pageId;
4081
- const pageResult = await chainCms("get-document-by-id", { id: pageId });
4082
- if (pageResult.ok) {
4083
- pageName = pageResult.data.variants?.[0]?.name ?? pageId;
4084
- }
4085
- const createResult = await chainCms("create-document-blueprint-from-document", {
4086
- document: { id: pageId },
4087
- name
4251
+ handler: async ({ name, elementTypeId, parentId, values }) => {
4252
+ const resolved = await resolveEditorAliases(elementTypeId, values);
4253
+ if (!resolved.ok) return resolved.errorResult;
4254
+ const createResult = await chainCms("create-element", {
4255
+ documentTypeId: elementTypeId,
4256
+ name,
4257
+ values: resolved.values,
4258
+ ...parentId ? { parentId } : {}
4088
4259
  });
4089
4260
  if (!createResult.ok) return createResult.errorResult;
4090
- const created = createResult.data;
4091
- let createdId = created?.id ?? "";
4092
- if (!createdId) {
4093
- const lookupResult = await chainCms("get-document-blueprint-root", {
4094
- cursor: encodeCursor({ s: 0, t: 100 })
4095
- });
4096
- if (lookupResult.ok) {
4097
- const match = (lookupResult.data.items ?? []).find((b) => b.name === name);
4098
- if (match?.id) createdId = match.id;
4099
- }
4100
- }
4101
4261
  return createToolResult({
4102
- message: `Created blueprint "${name}" from page "${pageName}"`,
4103
- id: createdId,
4262
+ message: `Created draft element "${name}"`,
4263
+ id: createResult.data.id ?? "",
4104
4264
  name
4105
4265
  });
4106
4266
  }
4107
4267
  };
4108
- var create_blueprint_default = withStandardDecorators(tool48);
4109
-
4268
+ var create_element_default = withStandardDecorators(tool50);
4269
+ var inputSchema51 = {
4270
+ name: z.string().describe("The name of the element to create"),
4271
+ 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."),
4272
+ 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."),
4273
+ values: z.array(z.object({
4274
+ alias: z.string().describe("The property alias"),
4275
+ value: z.any().describe("The property value"),
4276
+ culture: z.string().nullable().optional().describe("The culture code for variant content"),
4277
+ segment: z.string().nullable().optional().describe("The segment for segmented content")
4278
+ })).optional().describe("Initial property values to set on the new element")
4279
+ };
4280
+ var outputSchema51 = z.object({
4281
+ message: z.string(),
4282
+ id: z.string(),
4283
+ name: z.string()
4284
+ });
4285
+ var tool51 = {
4286
+ name: "create-and-publish-element",
4287
+ 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.",
4288
+ inputSchema: inputSchema51,
4289
+ outputSchema: outputSchema51,
4290
+ slices: ["create", "publish"],
4291
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
4292
+ handler: async ({ name, elementTypeId, parentId, values }) => {
4293
+ const createResult = await chainCms("create-and-publish-element", {
4294
+ documentTypeId: elementTypeId,
4295
+ name,
4296
+ values: (values ?? []).map((v) => ({
4297
+ alias: v.alias,
4298
+ value: v.value,
4299
+ culture: v.culture ?? null,
4300
+ segment: v.segment ?? null
4301
+ })),
4302
+ ...parentId ? { parentId } : {}
4303
+ });
4304
+ if (!createResult.ok) return createResult.errorResult;
4305
+ return createToolResult({
4306
+ message: `Created and published element "${name}"`,
4307
+ id: createResult.data.id ?? "",
4308
+ name
4309
+ });
4310
+ }
4311
+ };
4312
+ var create_and_publish_element_default = withStandardDecorators(tool51);
4313
+ var inputSchema52 = {
4314
+ name: z.string().describe("Name of the new folder"),
4315
+ parentId: z.string().uuid().optional().describe("ID of the parent folder in the Library (omit to create at the root)")
4316
+ };
4317
+ var outputSchema52 = z.object({
4318
+ message: z.string(),
4319
+ id: z.string(),
4320
+ name: z.string()
4321
+ });
4322
+ var tool52 = {
4323
+ name: "create-element-folder",
4324
+ 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.",
4325
+ inputSchema: inputSchema52,
4326
+ outputSchema: outputSchema52,
4327
+ slices: ["create"],
4328
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
4329
+ handler: async ({ name, parentId }) => {
4330
+ const createResult = await chainCms("create-element-folder", { name, parent: parentId ? { id: parentId } : null });
4331
+ if (!createResult.ok) return createResult.errorResult;
4332
+ let createdId = createResult.data?.id ?? "";
4333
+ let location = "at the root";
4334
+ if (!createdId) {
4335
+ const listResult = parentId ? await chainCms("get-element-children", { parentId }) : await chainCms("get-element-root", {});
4336
+ if (listResult.ok) {
4337
+ const match = (listResult.data.items ?? []).filter((i) => i.isFolder).find((i) => (i.variants?.[0]?.name ?? i.name) === name);
4338
+ if (match) createdId = match.id;
4339
+ }
4340
+ }
4341
+ if (parentId) {
4342
+ const folderResult = await chainCms("get-element-folder", { id: parentId });
4343
+ if (folderResult.ok) location = `under "${folderResult.data.name ?? "Unknown"}"`;
4344
+ }
4345
+ return createToolResult({
4346
+ message: `Created Library folder "${name}" ${location}`,
4347
+ id: createdId,
4348
+ name
4349
+ });
4350
+ }
4351
+ };
4352
+ var create_element_folder_default = withStandardDecorators(tool52);
4353
+ var inputSchema53 = {
4354
+ id: z.string().uuid().describe("The ID of the element to publish")
4355
+ };
4356
+ var outputSchema53 = z.object({
4357
+ message: z.string(),
4358
+ id: z.string(),
4359
+ name: z.string()
4360
+ });
4361
+ var tool53 = {
4362
+ name: "publish-element",
4363
+ 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.",
4364
+ inputSchema: inputSchema53,
4365
+ outputSchema: outputSchema53,
4366
+ slices: ["publish"],
4367
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
4368
+ handler: async ({ id }) => {
4369
+ const elResult = await chainCms("get-element-by-id", { id });
4370
+ if (!elResult.ok) return elResult.errorResult;
4371
+ const el = elResult.data;
4372
+ const elementName = el.variants?.[0]?.name ?? "Unknown";
4373
+ const variantCultures = (el.variants ?? []).length ? el.variants.map((v) => v.culture ?? null) : [null];
4374
+ const publishResult = await chainCms("publish-element", {
4375
+ id,
4376
+ data: { publishSchedules: variantCultures.map((c) => ({ culture: c })) }
4377
+ });
4378
+ if (!publishResult.ok) return publishResult.errorResult;
4379
+ return createToolResult({
4380
+ message: `Published element "${elementName}"`,
4381
+ id,
4382
+ name: elementName
4383
+ });
4384
+ }
4385
+ };
4386
+ var publish_element_default = withStandardDecorators(tool53);
4387
+ var inputSchema54 = {
4388
+ id: z.string().uuid().describe("The ID of the element to unpublish")
4389
+ };
4390
+ var outputSchema54 = z.object({
4391
+ message: z.string(),
4392
+ id: z.string(),
4393
+ name: z.string()
4394
+ });
4395
+ var tool54 = {
4396
+ name: "unpublish-element",
4397
+ description: "Unpublish a Library element, taking it offline. The element still exists as a draft. You will be asked to confirm before unpublishing.",
4398
+ inputSchema: inputSchema54,
4399
+ outputSchema: outputSchema54,
4400
+ slices: ["publish"],
4401
+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
4402
+ handler: async ({ id }, extra) => {
4403
+ const elResult = await chainCms("get-element-by-id", { id });
4404
+ if (!elResult.ok) return elResult.errorResult;
4405
+ const el = elResult.data;
4406
+ const elementName = el.variants?.[0]?.name ?? "Unknown";
4407
+ if (!await requestApproval(extra, `Unpublish element "${elementName}"? This will take it offline.`)) {
4408
+ return createToolResult({ message: "Unpublish cancelled", id, name: elementName });
4409
+ }
4410
+ const cultures = (el.variants ?? []).filter((v) => v.culture).map((v) => v.culture);
4411
+ const result = await chainCms("unpublish-element", {
4412
+ id,
4413
+ data: { cultures: cultures.length > 0 ? cultures : null }
4414
+ });
4415
+ if (!result.ok) return result.errorResult;
4416
+ return createToolResult({ message: `Unpublished element "${elementName}" \u2014 it is now a draft only`, id, name: elementName });
4417
+ }
4418
+ };
4419
+ var unpublish_element_default = withStandardDecorators(tool54);
4420
+ var inputSchema55 = {
4421
+ id: z.string().uuid().describe("The ID of the element to edit"),
4422
+ values: z.array(z.object({
4423
+ alias: z.string().describe("The property alias"),
4424
+ value: z.any().describe("The new property value"),
4425
+ culture: z.string().nullable().optional().describe("The culture code for variant content"),
4426
+ segment: z.string().nullable().optional().describe("The segment for segmented content")
4427
+ })).describe("Property values to update on the element")
4428
+ };
4429
+ var outputSchema55 = z.object({
4430
+ message: z.string(),
4431
+ id: z.string(),
4432
+ name: z.string(),
4433
+ updatedFields: z.array(z.string())
4434
+ });
4435
+ var tool55 = {
4436
+ name: "edit-element",
4437
+ 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).",
4438
+ inputSchema: inputSchema55,
4439
+ outputSchema: outputSchema55,
4440
+ slices: ["update"],
4441
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
4442
+ handler: async ({ id, values }) => {
4443
+ const elResult = await chainCms("get-element-by-id", { id });
4444
+ if (!elResult.ok) return elResult.errorResult;
4445
+ const elementName = elResult.data.variants?.[0]?.name ?? "Unknown";
4446
+ const fieldNames = values.map((v) => v.alias);
4447
+ const properties = values.map((v) => ({
4448
+ alias: v.alias,
4449
+ value: v.value,
4450
+ culture: v.culture ?? null,
4451
+ segment: v.segment ?? null
4452
+ }));
4453
+ const updateResult = await chainCms("update-element-properties", { id, properties });
4454
+ if (!updateResult.ok) return updateResult.errorResult;
4455
+ return createToolResult({
4456
+ message: `Updated ${fieldNames.length} field(s) on element "${elementName}" (saved, not published)`,
4457
+ id,
4458
+ name: elementName,
4459
+ updatedFields: fieldNames
4460
+ });
4461
+ }
4462
+ };
4463
+ var edit_element_default = withStandardDecorators(tool55);
4464
+ var inputSchema56 = {
4465
+ id: z.string().uuid().describe("The ID of the Library element containing the block"),
4466
+ propertyAlias: z.string().describe("The element property alias containing the blocks (e.g. 'mainContent'). Use inspect-element-blocks to find this."),
4467
+ 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'."),
4468
+ values: z.array(z.object({
4469
+ alias: blockPropertyAliasSchema.describe("The property alias within the block"),
4470
+ value: z.any().describe("The new value for the property")
4471
+ })).min(1).describe("Properties to update within the block"),
4472
+ blockType: z.enum(["content", "settings"]).optional().describe("Whether to update the block's content or its settings. Defaults to 'content'."),
4473
+ culture: z.string().nullable().optional().describe("Culture code if the element property is variant"),
4474
+ segment: z.string().nullable().optional().describe("Segment if the element property is variant")
4475
+ };
4476
+ var outputSchema56 = z.object({
4477
+ message: z.string(),
4478
+ id: z.string(),
4479
+ name: z.string(),
4480
+ contentKey: z.string(),
4481
+ updatedFields: z.array(z.string()),
4482
+ warnings: z.array(z.string()).optional()
4483
+ });
4484
+ var tool56 = {
4485
+ name: "edit-element-block",
4486
+ 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).",
4487
+ inputSchema: inputSchema56,
4488
+ outputSchema: outputSchema56,
4489
+ slices: ["update"],
4490
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
4491
+ handler: async ({ id, propertyAlias, contentKey, values, blockType, culture, segment }) => {
4492
+ const elResult = await chainCms("get-element-by-id", { id });
4493
+ if (!elResult.ok) return elResult.errorResult;
4494
+ const elementName = elResult.data.variants?.[0]?.name ?? "Unknown";
4495
+ const fieldNames = values.map((v) => v.alias);
4496
+ const resolvedBlockType = blockType ?? "content";
4497
+ let targetKey = contentKey;
4498
+ if (resolvedBlockType === "settings") {
4499
+ const rawValue = (elResult.data.values ?? []).find(
4500
+ (v) => v.alias === propertyAlias && (v.culture ?? null) === (culture ?? null) && (v.segment ?? null) === (segment ?? null)
4501
+ )?.value;
4502
+ const container = isRteWithBlocks(rawValue) ? rawValue.blocks : rawValue;
4503
+ const settingsKey = findSettingsKey(container, contentKey);
4504
+ if (!settingsKey) {
4505
+ return createToolResultError(
4506
+ `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.`
4507
+ );
4508
+ }
4509
+ targetKey = settingsKey;
4510
+ }
4511
+ const propsTuple = values.map((v) => ({ alias: v.alias, value: v.value }));
4512
+ const updateResult = await chainCms("update-element-block-property", {
4513
+ elementId: id,
4514
+ propertyAlias,
4515
+ culture: culture ?? null,
4516
+ segment: segment ?? null,
4517
+ updates: [{
4518
+ contentKey: targetKey,
4519
+ blockType: resolvedBlockType,
4520
+ properties: propsTuple
4521
+ }]
4522
+ });
4523
+ if (!updateResult.ok) return updateResult.errorResult;
4524
+ const results = updateResult.data.results;
4525
+ if (!results || results.length === 0) {
4526
+ return createToolResultError(
4527
+ "update-element-block-property returned no per-block result \u2014 cannot confirm the write succeeded."
4528
+ );
4529
+ }
4530
+ const classification = classifyBlockUpdateResults(results, fieldNames.length, fieldNames, 1);
4531
+ if (classification.outcome === "failed") {
4532
+ return createToolResultError(
4533
+ `Block update failed: ${classification.detail || updateResult.data.message || "no detail returned"}`
4534
+ );
4535
+ }
4536
+ if (classification.outcome === "partial") {
4537
+ return createToolResultError({
4538
+ message: `Block update partially failed: ${classification.processedCount} of ${fieldNames.length} field(s) saved \u2014 ${classification.detail}`,
4539
+ savedFields: classification.savedFields,
4540
+ failedFields: classification.failedFields,
4541
+ ...classification.savedFields.length > 0 ? { note: "savedFields were written to the element and must not be retried." } : {},
4542
+ ...classification.warnings.length ? { warnings: classification.warnings } : {}
4543
+ });
4544
+ }
4545
+ const target = resolvedBlockType === "settings" ? "settings" : "content";
4546
+ const warnings = classification.warnings;
4547
+ return createToolResult({
4548
+ message: `Updated ${fieldNames.length} field(s) in block ${target} on element "${elementName}" (saved, not published)`,
4549
+ id,
4550
+ name: elementName,
4551
+ contentKey,
4552
+ updatedFields: fieldNames,
4553
+ ...warnings.length ? { warnings } : {}
4554
+ });
4555
+ }
4556
+ };
4557
+ var edit_element_block_default = withStandardDecorators(tool56);
4558
+ var inputSchema57 = {
4559
+ id: z.string().uuid().describe("The ID of the element to delete")
4560
+ };
4561
+ var outputSchema57 = z.object({
4562
+ message: z.string(),
4563
+ id: z.string(),
4564
+ name: z.string()
4565
+ });
4566
+ var tool57 = {
4567
+ name: "delete-element",
4568
+ description: "Move a Library element to the recycle bin. It can be restored later. You will be asked to confirm before deleting.",
4569
+ inputSchema: inputSchema57,
4570
+ outputSchema: outputSchema57,
4571
+ slices: ["delete"],
4572
+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
4573
+ handler: async ({ id }, extra) => {
4574
+ const elResult = await chainCms("get-element-by-id", { id });
4575
+ if (!elResult.ok) return elResult.errorResult;
4576
+ const elementName = elResult.data.variants?.[0]?.name ?? "Unknown";
4577
+ if (!await requestApproval(extra, `WARNING: Move element "${elementName}" to the recycle bin? This will remove it from the Library.`)) {
4578
+ return createToolResult({ message: "Delete cancelled", id, name: elementName });
4579
+ }
4580
+ const deleteResult = await chainCms("move-element-to-recycle-bin", { id });
4581
+ if (!deleteResult.ok) return deleteResult.errorResult;
4582
+ return createToolResult({ message: `Moved element "${elementName}" to the recycle bin`, id, name: elementName });
4583
+ }
4584
+ };
4585
+ var delete_element_default = withStandardDecorators(tool57);
4586
+
4587
+ // src/umbraco-api/tools/element/index.ts
4588
+ var collection6 = {
4589
+ metadata: {
4590
+ name: "element",
4591
+ displayName: "Library Elements",
4592
+ description: "Browse, view, edit (including blocks), publish, and organise reusable Library elements (Umbraco 18 Library section)"
4593
+ },
4594
+ tools: () => [
4595
+ get_element_default,
4596
+ list_element_children_default,
4597
+ search_elements_default,
4598
+ inspect_element_blocks_default,
4599
+ create_element_default,
4600
+ create_and_publish_element_default,
4601
+ create_element_folder_default,
4602
+ edit_element_default,
4603
+ edit_element_block_default,
4604
+ publish_element_default,
4605
+ unpublish_element_default,
4606
+ delete_element_default
4607
+ ]
4608
+ };
4609
+ var element_default = collection6;
4610
+ var inputSchema58 = {
4611
+ parentId: z.string().uuid().optional().describe("The ID of a blueprint folder to list children of. If omitted, lists root-level blueprints."),
4612
+ take: z.number().optional().default(50).describe("Number of results to return"),
4613
+ skip: z.number().optional().default(0).describe("Number of results to skip")
4614
+ };
4615
+ var outputSchema58 = z.object({
4616
+ items: z.array(z.object({
4617
+ id: z.string(),
4618
+ name: z.string(),
4619
+ documentType: z.string().optional().describe("The document type alias or name this blueprint is based on")
4620
+ })).describe("Available page blueprints"),
4621
+ total: z.number()
4622
+ });
4623
+ var tool58 = {
4624
+ name: "list-blueprints",
4625
+ description: "List available page blueprints (templates with pre-filled content). Use get-blueprint to view a blueprint's details and property values.",
4626
+ inputSchema: inputSchema58,
4627
+ outputSchema: outputSchema58,
4628
+ slices: ["list"],
4629
+ annotations: { readOnlyHint: true },
4630
+ handler: async ({ parentId, take, skip }) => {
4631
+ const accessCheck = await checkSettingsAccess();
4632
+ if (!accessCheck.ok) return accessCheck.errorResult;
4633
+ if (!accessCheck.hasAccess) {
4634
+ return createToolResultError({
4635
+ status: 403,
4636
+ title: "Settings access required",
4637
+ detail: "Listing blueprints requires the signed-in Umbraco user to have access to the Settings section. Grant Settings-section access to the user's group in the Umbraco backoffice (Users \u2192 [group] \u2192 Sections), then retry."
4638
+ });
4639
+ }
4640
+ const cursor = buildChainedCursor(skip, take);
4641
+ const result = parentId ? await chainCms("get-document-blueprint-children", { parentId, cursor }) : await chainCms("get-document-blueprint-root", { cursor });
4642
+ if (!result.ok) return result.errorResult;
4643
+ return createToolResult({
4644
+ items: (result.data.items ?? []).map((item) => ({
4645
+ id: item.id,
4646
+ name: item.name ?? "Unknown",
4647
+ documentType: item.documentType?.id ?? void 0
4648
+ })),
4649
+ total: result.data.total ?? 0
4650
+ });
4651
+ }
4652
+ };
4653
+ var list_blueprints_default = withStandardDecorators(tool58);
4654
+ var inputSchema59 = {
4655
+ id: z.string().uuid().describe("The ID of the blueprint to retrieve")
4656
+ };
4657
+ var outputSchema59 = z.object({
4658
+ id: z.string(),
4659
+ name: z.string(),
4660
+ documentType: z.object({
4661
+ id: z.string().optional(),
4662
+ alias: z.string().optional(),
4663
+ name: z.string().optional()
4664
+ }).optional().describe("The document type this blueprint is based on"),
4665
+ values: z.array(z.object({
4666
+ alias: z.string(),
4667
+ value: z.any(),
4668
+ culture: z.string().nullable().optional(),
4669
+ segment: z.string().nullable().optional()
4670
+ })).optional().describe("Pre-filled property values"),
4671
+ variants: z.array(z.object({
4672
+ name: z.string().optional(),
4673
+ culture: z.string().nullable().optional(),
4674
+ segment: z.string().nullable().optional()
4675
+ })).optional().describe("Variant information")
4676
+ });
4677
+ var tool59 = {
4678
+ name: "get-blueprint",
4679
+ 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.",
4680
+ inputSchema: inputSchema59,
4681
+ outputSchema: outputSchema59,
4682
+ slices: ["read"],
4683
+ annotations: { readOnlyHint: true },
4684
+ handler: async ({ id }) => {
4685
+ const result = await chainCms("get-document-blueprint", { id });
4686
+ if (!result.ok) return result.errorResult;
4687
+ const data = result.data;
4688
+ const dt = data.documentType;
4689
+ const documentType = dt ? { id: dt.id ?? void 0, alias: dt.alias ?? void 0, name: dt.name ?? void 0 } : void 0;
4690
+ const name = data.variants?.[0]?.name ?? "Unknown";
4691
+ return createToolResult({
4692
+ id: data.id,
4693
+ name,
4694
+ documentType,
4695
+ values: data.values ?? [],
4696
+ variants: (data.variants ?? []).map((v) => ({
4697
+ name: v.name ?? void 0,
4698
+ culture: v.culture ?? null,
4699
+ segment: v.segment ?? null
4700
+ }))
4701
+ });
4702
+ }
4703
+ };
4704
+ var get_blueprint_default = withStandardDecorators(tool59);
4705
+ var inputSchema60 = {
4706
+ pageId: z.string().uuid().describe("The ID of the source page to save as a blueprint"),
4707
+ name: z.string().describe("The name for the new blueprint")
4708
+ };
4709
+ var outputSchema60 = z.object({
4710
+ message: z.string(),
4711
+ id: z.string(),
4712
+ name: z.string()
4713
+ });
4714
+ var tool60 = {
4715
+ name: "create-blueprint",
4716
+ description: "Save an existing page as a reusable blueprint (template). The blueprint preserves the page's document type and property values.",
4717
+ inputSchema: inputSchema60,
4718
+ outputSchema: outputSchema60,
4719
+ slices: ["create"],
4720
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
4721
+ handler: async ({ pageId, name }) => {
4722
+ let pageName = pageId;
4723
+ const pageResult = await chainCms("get-document-by-id", { id: pageId });
4724
+ if (pageResult.ok) {
4725
+ pageName = pageResult.data.variants?.[0]?.name ?? pageId;
4726
+ }
4727
+ const createResult = await chainCms("create-document-blueprint-from-document", {
4728
+ document: { id: pageId },
4729
+ name
4730
+ });
4731
+ if (!createResult.ok) return createResult.errorResult;
4732
+ const created = createResult.data;
4733
+ let createdId = created?.id ?? "";
4734
+ if (!createdId) {
4735
+ const lookupResult = await chainCms("get-document-blueprint-root", {
4736
+ cursor: encodeCursor({ s: 0, t: 100 })
4737
+ });
4738
+ if (lookupResult.ok) {
4739
+ const match = (lookupResult.data.items ?? []).find((b) => b.name === name);
4740
+ if (match?.id) createdId = match.id;
4741
+ }
4742
+ }
4743
+ return createToolResult({
4744
+ message: `Created blueprint "${name}" from page "${pageName}"`,
4745
+ id: createdId,
4746
+ name
4747
+ });
4748
+ }
4749
+ };
4750
+ var create_blueprint_default = withStandardDecorators(tool60);
4751
+
4110
4752
  // src/umbraco-api/tools/blueprint/index.ts
4111
- var collection6 = {
4753
+ var collection7 = {
4754
+ metadata: {
4755
+ name: "blueprint",
4756
+ displayName: "Blueprints",
4757
+ description: "List, view, and create page blueprints"
4758
+ },
4759
+ tools: () => [list_blueprints_default, get_blueprint_default, create_blueprint_default]
4760
+ };
4761
+ var blueprint_default = collection7;
4762
+ var inputSchema61 = {
4763
+ take: z.number().optional().default(50).describe("Number of results to return (default 50)"),
4764
+ skip: z.number().optional().default(0).describe("Number of results to skip for pagination")
4765
+ };
4766
+ var outputSchema61 = z.object({
4767
+ items: z.array(z.object({
4768
+ isoCode: z.string().describe("ISO language code (e.g. en-US)"),
4769
+ name: z.string().describe("Display name of the language"),
4770
+ isDefault: z.boolean().describe("Whether this is the default language"),
4771
+ isMandatory: z.boolean().describe("Whether this language is mandatory")
4772
+ })).describe("List of configured languages"),
4773
+ total: z.number().describe("Total number of languages")
4774
+ });
4775
+ var tool61 = {
4776
+ name: "list-languages",
4777
+ description: "List all languages configured on the Umbraco site. Shows the ISO code, name, and whether each language is the default or mandatory.",
4778
+ inputSchema: inputSchema61,
4779
+ outputSchema: outputSchema61,
4780
+ slices: ["list"],
4781
+ annotations: { readOnlyHint: true },
4782
+ handler: async ({ take, skip }) => {
4783
+ const result = await chainCms("get-language", { cursor: buildChainedCursor(skip, take) });
4784
+ if (!result.ok) return result.errorResult;
4785
+ const data = result.data;
4786
+ return createToolResult({
4787
+ items: (data.items ?? []).map((item) => ({
4788
+ isoCode: item.isoCode,
4789
+ name: item.name,
4790
+ isDefault: item.isDefault,
4791
+ isMandatory: item.isMandatory
4792
+ })),
4793
+ total: data.total ?? 0
4794
+ });
4795
+ }
4796
+ };
4797
+ var list_languages_default = withStandardDecorators(tool61);
4798
+ var inputSchema62 = {
4799
+ isoCode: z.string().describe("ISO language code (e.g. en-US)")
4800
+ };
4801
+ var outputSchema62 = z.object({
4802
+ isoCode: z.string().describe("ISO language code"),
4803
+ name: z.string().describe("Display name of the language"),
4804
+ isDefault: z.boolean().describe("Whether this is the default language"),
4805
+ isMandatory: z.boolean().describe("Whether this language is mandatory"),
4806
+ fallbackIsoCode: z.string().nullable().describe("ISO code of the fallback language, if set")
4807
+ });
4808
+ var tool62 = {
4809
+ name: "get-language",
4810
+ 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.",
4811
+ inputSchema: inputSchema62,
4812
+ outputSchema: outputSchema62,
4813
+ slices: ["read"],
4814
+ annotations: { readOnlyHint: true },
4815
+ handler: async ({ isoCode }) => {
4816
+ const result = await chainCms("get-language-by-iso-code", { isoCode });
4817
+ if (!result.ok) return result.errorResult;
4818
+ const data = result.data;
4819
+ return createToolResult({
4820
+ isoCode: data.isoCode,
4821
+ name: data.name,
4822
+ isDefault: data.isDefault ?? false,
4823
+ isMandatory: data.isMandatory ?? false,
4824
+ fallbackIsoCode: data.fallbackIsoCode ?? null
4825
+ });
4826
+ }
4827
+ };
4828
+ var get_language_default = withStandardDecorators(tool62);
4829
+ var inputSchema63 = {
4830
+ isoCode: z.string().describe("ISO language code to add (e.g. fr-FR)"),
4831
+ name: z.string().optional().describe("Display name for the language (e.g. 'French'). Defaults to the ISO code if not provided."),
4832
+ isDefault: z.boolean().optional().describe("Whether this language should be the default"),
4833
+ isMandatory: z.boolean().optional().describe("Whether this language should be mandatory"),
4834
+ fallbackIsoCode: z.string().optional().describe("ISO code of the fallback language")
4835
+ };
4836
+ var outputSchema63 = z.object({
4837
+ message: z.string(),
4838
+ isoCode: z.string(),
4839
+ name: z.string()
4840
+ });
4841
+ var tool63 = {
4842
+ name: "create-language",
4843
+ 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.",
4844
+ inputSchema: inputSchema63,
4845
+ outputSchema: outputSchema63,
4846
+ slices: ["create"],
4847
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
4848
+ handler: async ({ isoCode, name: displayName, isDefault, isMandatory, fallbackIsoCode }) => {
4849
+ const langName = displayName || isoCode;
4850
+ const result = await chainCms("create-language", {
4851
+ name: langName,
4852
+ isoCode,
4853
+ isDefault: isDefault ?? false,
4854
+ isMandatory: isMandatory ?? false,
4855
+ fallbackIsoCode
4856
+ });
4857
+ if (!result.ok) return result.errorResult;
4858
+ return createToolResult({
4859
+ message: `Language "${langName}" (${isoCode}) added successfully`,
4860
+ isoCode: result.data.isoCode,
4861
+ name: langName
4862
+ });
4863
+ }
4864
+ };
4865
+ var create_language_default = withStandardDecorators(tool63);
4866
+ var inputSchema64 = {
4867
+ isoCode: z.string().describe("ISO language code of the language to update (e.g. en-US)"),
4868
+ isDefault: z.boolean().optional().describe("Whether this language should be the default"),
4869
+ isMandatory: z.boolean().optional().describe("Whether this language should be mandatory"),
4870
+ fallbackIsoCode: z.string().optional().describe("ISO code of the fallback language")
4871
+ };
4872
+ var outputSchema64 = z.object({
4873
+ message: z.string(),
4874
+ isoCode: z.string(),
4875
+ name: z.string()
4876
+ });
4877
+ var tool64 = {
4878
+ name: "update-language",
4879
+ description: "Update a language's settings (default, mandatory, fallback).",
4880
+ inputSchema: inputSchema64,
4881
+ outputSchema: outputSchema64,
4882
+ slices: ["update"],
4883
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
4884
+ handler: async ({ isoCode, isDefault, isMandatory, fallbackIsoCode }) => {
4885
+ const langResult = await chainCms("get-language-by-iso-code", { isoCode });
4886
+ if (!langResult.ok) return langResult.errorResult;
4887
+ const lang = langResult.data;
4888
+ const name = lang.name ?? isoCode;
4889
+ const result = await chainCms("update-language", {
4890
+ isoCode,
4891
+ data: {
4892
+ name,
4893
+ isDefault: isDefault ?? lang.isDefault ?? false,
4894
+ isMandatory: isMandatory ?? lang.isMandatory ?? false,
4895
+ fallbackIsoCode: fallbackIsoCode ?? lang.fallbackIsoCode ?? void 0
4896
+ }
4897
+ });
4898
+ if (!result.ok) return result.errorResult;
4899
+ return createToolResult({
4900
+ message: `Language "${name}" (${isoCode}) updated successfully`,
4901
+ isoCode,
4902
+ name
4903
+ });
4904
+ }
4905
+ };
4906
+ var update_language_default = withStandardDecorators(tool64);
4907
+ var inputSchema65 = {
4908
+ isoCode: z.string().describe("ISO language code of the language to delete (e.g. fr-FR)")
4909
+ };
4910
+ var outputSchema65 = z.object({
4911
+ message: z.string(),
4912
+ isoCode: z.string(),
4913
+ name: z.string()
4914
+ });
4915
+ var tool65 = {
4916
+ name: "delete-language",
4917
+ description: "Remove a language from the site. Content variants in this language will become inaccessible. You will be asked to confirm before deleting.",
4918
+ inputSchema: inputSchema65,
4919
+ outputSchema: outputSchema65,
4920
+ slices: ["delete"],
4921
+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
4922
+ handler: async ({ isoCode }, extra) => {
4923
+ const langResult = await chainCms("get-language-by-iso-code", { isoCode });
4924
+ if (!langResult.ok) return langResult.errorResult;
4925
+ const lang = langResult.data;
4926
+ const name = lang.name ?? isoCode;
4927
+ const confirmMessage = `Delete language "${name}" (${isoCode})? All content variants in this language will become inaccessible.`;
4928
+ if (!await requestApproval(extra, confirmMessage)) {
4929
+ return createToolResult({ message: "Delete cancelled", isoCode, name });
4930
+ }
4931
+ const deleteResult = await chainCms("delete-language", { isoCode });
4932
+ if (!deleteResult.ok) return deleteResult.errorResult;
4933
+ return createToolResult({
4934
+ message: `Language "${name}" (${isoCode}) deleted successfully`,
4935
+ isoCode,
4936
+ name
4937
+ });
4938
+ }
4939
+ };
4940
+ var delete_language_default = withStandardDecorators(tool65);
4941
+
4942
+ // src/umbraco-api/tools/language/index.ts
4943
+ var collection8 = {
4112
4944
  metadata: {
4113
- name: "blueprint",
4114
- displayName: "Blueprints",
4115
- description: "List, view, and create page blueprints"
4945
+ name: "language",
4946
+ displayName: "Languages",
4947
+ description: "Manage languages configured on the Umbraco site"
4116
4948
  },
4117
- tools: () => [list_blueprints_default, get_blueprint_default, create_blueprint_default]
4949
+ tools: () => [list_languages_default, get_language_default, create_language_default, update_language_default, delete_language_default]
4118
4950
  };
4119
- var blueprint_default = collection6;
4951
+ var language_default = collection8;
4120
4952
  async function checkVariesByCulture(documentId) {
4121
4953
  const docResult = await chainCms("get-document-by-id", { id: documentId });
4122
4954
  if (!docResult.ok) return docResult.errorResult;
@@ -4136,7 +4968,7 @@ async function checkVariesByCulture(documentId) {
4136
4968
  }
4137
4969
 
4138
4970
  // src/umbraco-api/tools/translation/post/create-variant.ts
4139
- var inputSchema49 = {
4971
+ var inputSchema66 = {
4140
4972
  id: z.string().uuid().describe("The ID of the page to add a language variant to"),
4141
4973
  culture: z.string().describe("The target language ISO code (e.g. 'da-DK', 'fr-FR'). Call list-languages to find available cultures."),
4142
4974
  values: z.array(z.object({
@@ -4146,7 +4978,7 @@ var inputSchema49 = {
4146
4978
  segment: z.string().nullable().optional().describe("The segment for segmented content")
4147
4979
  })).optional().describe("Optional property values to set on the new variant")
4148
4980
  };
4149
- var outputSchema49 = z.object({
4981
+ var outputSchema66 = z.object({
4150
4982
  message: z.string(),
4151
4983
  id: z.string(),
4152
4984
  name: z.string(),
@@ -4154,11 +4986,11 @@ var outputSchema49 = z.object({
4154
4986
  previewUrl: previewUrlSchema,
4155
4987
  validation: validationResultSchema
4156
4988
  });
4157
- var tool49 = {
4989
+ var tool66 = {
4158
4990
  name: "create-variant",
4159
4991
  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.",
4160
- inputSchema: inputSchema49,
4161
- outputSchema: outputSchema49,
4992
+ inputSchema: inputSchema66,
4993
+ outputSchema: outputSchema66,
4162
4994
  slices: ["create"],
4163
4995
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
4164
4996
  handler: async ({ id, culture, values }) => {
@@ -4202,13 +5034,13 @@ var tool49 = {
4202
5034
  });
4203
5035
  }
4204
5036
  };
4205
- var create_variant_default = withStandardDecorators(tool49);
4206
- var inputSchema50 = {
5037
+ var create_variant_default = withStandardDecorators(tool66);
5038
+ var inputSchema67 = {
4207
5039
  id: z.string().uuid().describe("The ID of the page to copy a variant on"),
4208
5040
  sourceCulture: z.string().describe("The source language ISO code to copy content from (e.g. 'en-US')"),
4209
5041
  targetCulture: z.string().describe("The target language ISO code to copy content to (e.g. 'da-DK')")
4210
5042
  };
4211
- var outputSchema50 = z.object({
5043
+ var outputSchema67 = z.object({
4212
5044
  message: z.string(),
4213
5045
  id: z.string(),
4214
5046
  name: z.string(),
@@ -4218,11 +5050,11 @@ var outputSchema50 = z.object({
4218
5050
  previewUrl: previewUrlSchema,
4219
5051
  validation: validationResultSchema
4220
5052
  });
4221
- var tool50 = {
5053
+ var tool67 = {
4222
5054
  name: "copy-variant",
4223
5055
  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.",
4224
- inputSchema: inputSchema50,
4225
- outputSchema: outputSchema50,
5056
+ inputSchema: inputSchema67,
5057
+ outputSchema: outputSchema67,
4226
5058
  slices: ["create"],
4227
5059
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
4228
5060
  handler: async ({ id, sourceCulture, targetCulture }, extra) => {
@@ -4276,14 +5108,14 @@ var tool50 = {
4276
5108
  });
4277
5109
  }
4278
5110
  };
4279
- var copy_variant_default = withStandardDecorators(tool50);
4280
- var inputSchema51 = {
5111
+ var copy_variant_default = withStandardDecorators(tool67);
5112
+ var inputSchema68 = {
4281
5113
  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."),
4282
5114
  parentId: z.string().uuid().optional().describe("Parent page ID to search under. Omit to search root-level pages."),
4283
5115
  take: z.number().optional().default(20).describe("Number of results to return"),
4284
5116
  skip: z.number().optional().default(0).describe("Number of results to skip for pagination")
4285
5117
  };
4286
- var outputSchema51 = z.object({
5118
+ var outputSchema68 = z.object({
4287
5119
  items: z.array(z.object({
4288
5120
  id: z.string(),
4289
5121
  name: z.string(),
@@ -4291,11 +5123,11 @@ var outputSchema51 = z.object({
4291
5123
  })).describe("Pages that are missing the specified language variant"),
4292
5124
  total: z.number().describe("Total number of pages missing the variant (before pagination)")
4293
5125
  });
4294
- var tool51 = {
5126
+ var tool68 = {
4295
5127
  name: "list-untranslated",
4296
5128
  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.",
4297
- inputSchema: inputSchema51,
4298
- outputSchema: outputSchema51,
5129
+ inputSchema: inputSchema68,
5130
+ outputSchema: outputSchema68,
4299
5131
  slices: ["search"],
4300
5132
  annotations: { readOnlyHint: true },
4301
5133
  handler: async ({ culture, parentId, take, skip }) => {
@@ -4328,10 +5160,10 @@ var tool51 = {
4328
5160
  return createToolResult({ items: paged, total });
4329
5161
  }
4330
5162
  };
4331
- var list_untranslated_default = withStandardDecorators(tool51);
5163
+ var list_untranslated_default = withStandardDecorators(tool68);
4332
5164
 
4333
5165
  // src/umbraco-api/tools/translation/index.ts
4334
- var collection7 = {
5166
+ var collection9 = {
4335
5167
  metadata: {
4336
5168
  name: "translation",
4337
5169
  displayName: "Translation",
@@ -4339,203 +5171,13 @@ var collection7 = {
4339
5171
  },
4340
5172
  tools: () => [create_variant_default, copy_variant_default, list_untranslated_default]
4341
5173
  };
4342
- var translation_default = collection7;
4343
- var inputSchema52 = {
4344
- take: z.number().optional().default(50).describe("Number of results to return (default 50)"),
4345
- skip: z.number().optional().default(0).describe("Number of results to skip for pagination")
4346
- };
4347
- var outputSchema52 = z.object({
4348
- items: z.array(z.object({
4349
- isoCode: z.string().describe("ISO language code (e.g. en-US)"),
4350
- name: z.string().describe("Display name of the language"),
4351
- isDefault: z.boolean().describe("Whether this is the default language"),
4352
- isMandatory: z.boolean().describe("Whether this language is mandatory")
4353
- })).describe("List of configured languages"),
4354
- total: z.number().describe("Total number of languages")
4355
- });
4356
- var tool52 = {
4357
- name: "list-languages",
4358
- description: "List all languages configured on the Umbraco site. Shows the ISO code, name, and whether each language is the default or mandatory.",
4359
- inputSchema: inputSchema52,
4360
- outputSchema: outputSchema52,
4361
- slices: ["list"],
4362
- annotations: { readOnlyHint: true },
4363
- handler: async ({ take, skip }) => {
4364
- const result = await chainCms("get-language", { cursor: buildChainedCursor(skip, take) });
4365
- if (!result.ok) return result.errorResult;
4366
- const data = result.data;
4367
- return createToolResult({
4368
- items: (data.items ?? []).map((item) => ({
4369
- isoCode: item.isoCode,
4370
- name: item.name,
4371
- isDefault: item.isDefault,
4372
- isMandatory: item.isMandatory
4373
- })),
4374
- total: data.total ?? 0
4375
- });
4376
- }
4377
- };
4378
- var list_languages_default = withStandardDecorators(tool52);
4379
- var inputSchema53 = {
4380
- isoCode: z.string().describe("ISO language code (e.g. en-US)")
4381
- };
4382
- var outputSchema53 = z.object({
4383
- isoCode: z.string().describe("ISO language code"),
4384
- name: z.string().describe("Display name of the language"),
4385
- isDefault: z.boolean().describe("Whether this is the default language"),
4386
- isMandatory: z.boolean().describe("Whether this language is mandatory"),
4387
- fallbackIsoCode: z.string().nullable().describe("ISO code of the fallback language, if set")
4388
- });
4389
- var tool53 = {
4390
- name: "get-language",
4391
- 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.",
4392
- inputSchema: inputSchema53,
4393
- outputSchema: outputSchema53,
4394
- slices: ["read"],
4395
- annotations: { readOnlyHint: true },
4396
- handler: async ({ isoCode }) => {
4397
- const result = await chainCms("get-language-by-iso-code", { isoCode });
4398
- if (!result.ok) return result.errorResult;
4399
- const data = result.data;
4400
- return createToolResult({
4401
- isoCode: data.isoCode,
4402
- name: data.name,
4403
- isDefault: data.isDefault ?? false,
4404
- isMandatory: data.isMandatory ?? false,
4405
- fallbackIsoCode: data.fallbackIsoCode ?? null
4406
- });
4407
- }
4408
- };
4409
- var get_language_default = withStandardDecorators(tool53);
4410
- var inputSchema54 = {
4411
- isoCode: z.string().describe("ISO language code to add (e.g. fr-FR)"),
4412
- name: z.string().optional().describe("Display name for the language (e.g. 'French'). Defaults to the ISO code if not provided."),
4413
- isDefault: z.boolean().optional().describe("Whether this language should be the default"),
4414
- isMandatory: z.boolean().optional().describe("Whether this language should be mandatory"),
4415
- fallbackIsoCode: z.string().optional().describe("ISO code of the fallback language")
4416
- };
4417
- var outputSchema54 = z.object({
4418
- message: z.string(),
4419
- isoCode: z.string(),
4420
- name: z.string()
4421
- });
4422
- var tool54 = {
4423
- name: "create-language",
4424
- 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.",
4425
- inputSchema: inputSchema54,
4426
- outputSchema: outputSchema54,
4427
- slices: ["create"],
4428
- annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
4429
- handler: async ({ isoCode, name: displayName, isDefault, isMandatory, fallbackIsoCode }) => {
4430
- const langName = displayName || isoCode;
4431
- const result = await chainCms("create-language", {
4432
- name: langName,
4433
- isoCode,
4434
- isDefault: isDefault ?? false,
4435
- isMandatory: isMandatory ?? false,
4436
- fallbackIsoCode
4437
- });
4438
- if (!result.ok) return result.errorResult;
4439
- return createToolResult({
4440
- message: `Language "${langName}" (${isoCode}) added successfully`,
4441
- isoCode: result.data.isoCode,
4442
- name: langName
4443
- });
4444
- }
4445
- };
4446
- var create_language_default = withStandardDecorators(tool54);
4447
- var inputSchema55 = {
4448
- isoCode: z.string().describe("ISO language code of the language to update (e.g. en-US)"),
4449
- isDefault: z.boolean().optional().describe("Whether this language should be the default"),
4450
- isMandatory: z.boolean().optional().describe("Whether this language should be mandatory"),
4451
- fallbackIsoCode: z.string().optional().describe("ISO code of the fallback language")
4452
- };
4453
- var outputSchema55 = z.object({
4454
- message: z.string(),
4455
- isoCode: z.string(),
4456
- name: z.string()
4457
- });
4458
- var tool55 = {
4459
- name: "update-language",
4460
- description: "Update a language's settings (default, mandatory, fallback).",
4461
- inputSchema: inputSchema55,
4462
- outputSchema: outputSchema55,
4463
- slices: ["update"],
4464
- annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
4465
- handler: async ({ isoCode, isDefault, isMandatory, fallbackIsoCode }) => {
4466
- const langResult = await chainCms("get-language-by-iso-code", { isoCode });
4467
- if (!langResult.ok) return langResult.errorResult;
4468
- const lang = langResult.data;
4469
- const name = lang.name ?? isoCode;
4470
- const result = await chainCms("update-language", {
4471
- isoCode,
4472
- data: {
4473
- name,
4474
- isDefault: isDefault ?? lang.isDefault ?? false,
4475
- isMandatory: isMandatory ?? lang.isMandatory ?? false,
4476
- fallbackIsoCode: fallbackIsoCode ?? lang.fallbackIsoCode ?? void 0
4477
- }
4478
- });
4479
- if (!result.ok) return result.errorResult;
4480
- return createToolResult({
4481
- message: `Language "${name}" (${isoCode}) updated successfully`,
4482
- isoCode,
4483
- name
4484
- });
4485
- }
4486
- };
4487
- var update_language_default = withStandardDecorators(tool55);
4488
- var inputSchema56 = {
4489
- isoCode: z.string().describe("ISO language code of the language to delete (e.g. fr-FR)")
4490
- };
4491
- var outputSchema56 = z.object({
4492
- message: z.string(),
4493
- isoCode: z.string(),
4494
- name: z.string()
4495
- });
4496
- var tool56 = {
4497
- name: "delete-language",
4498
- description: "Remove a language from the site. Content variants in this language will become inaccessible. You will be asked to confirm before deleting.",
4499
- inputSchema: inputSchema56,
4500
- outputSchema: outputSchema56,
4501
- slices: ["delete"],
4502
- annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
4503
- handler: async ({ isoCode }, extra) => {
4504
- const langResult = await chainCms("get-language-by-iso-code", { isoCode });
4505
- if (!langResult.ok) return langResult.errorResult;
4506
- const lang = langResult.data;
4507
- const name = lang.name ?? isoCode;
4508
- const confirmMessage = `Delete language "${name}" (${isoCode})? All content variants in this language will become inaccessible.`;
4509
- if (!await requestApproval(extra, confirmMessage)) {
4510
- return createToolResult({ message: "Delete cancelled", isoCode, name });
4511
- }
4512
- const deleteResult = await chainCms("delete-language", { isoCode });
4513
- if (!deleteResult.ok) return deleteResult.errorResult;
4514
- return createToolResult({
4515
- message: `Language "${name}" (${isoCode}) deleted successfully`,
4516
- isoCode,
4517
- name
4518
- });
4519
- }
4520
- };
4521
- var delete_language_default = withStandardDecorators(tool56);
4522
-
4523
- // src/umbraco-api/tools/language/index.ts
4524
- var collection8 = {
4525
- metadata: {
4526
- name: "language",
4527
- displayName: "Languages",
4528
- description: "Manage languages configured on the Umbraco site"
4529
- },
4530
- tools: () => [list_languages_default, get_language_default, create_language_default, update_language_default, delete_language_default]
4531
- };
4532
- var language_default = collection8;
4533
- var inputSchema57 = {
5174
+ var translation_default = collection9;
5175
+ var inputSchema69 = {
4534
5176
  parentId: z.string().uuid().optional().describe("UUID of the parent dictionary item, or omit to list root-level entries"),
4535
5177
  take: z.number().optional().default(50).describe("Number of results to return (default 50)"),
4536
5178
  skip: z.number().optional().default(0).describe("Number of results to skip for pagination")
4537
5179
  };
4538
- var outputSchema57 = z.object({
5180
+ var outputSchema69 = z.object({
4539
5181
  items: z.array(
4540
5182
  z.object({
4541
5183
  id: z.string(),
@@ -4545,11 +5187,11 @@ var outputSchema57 = z.object({
4545
5187
  ).describe("Dictionary items"),
4546
5188
  total: z.number().describe("Total number of items")
4547
5189
  });
4548
- var tool57 = {
5190
+ var tool69 = {
4549
5191
  name: "list-dictionary",
4550
5192
  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.",
4551
- inputSchema: inputSchema57,
4552
- outputSchema: outputSchema57,
5193
+ inputSchema: inputSchema69,
5194
+ outputSchema: outputSchema69,
4553
5195
  slices: ["list", "tree"],
4554
5196
  annotations: { readOnlyHint: true },
4555
5197
  handler: async ({ parentId, take, skip }) => {
@@ -4575,11 +5217,11 @@ var tool57 = {
4575
5217
  });
4576
5218
  }
4577
5219
  };
4578
- var list_dictionary_default = withStandardDecorators(tool57);
4579
- var inputSchema58 = {
5220
+ var list_dictionary_default = withStandardDecorators(tool69);
5221
+ var inputSchema70 = {
4580
5222
  query: z.string().describe("Search term to match against dictionary item key names")
4581
5223
  };
4582
- var outputSchema58 = z.object({
5224
+ var outputSchema70 = z.object({
4583
5225
  items: z.array(
4584
5226
  z.object({
4585
5227
  id: z.string(),
@@ -4588,11 +5230,11 @@ var outputSchema58 = z.object({
4588
5230
  ).describe("Matching dictionary items"),
4589
5231
  total: z.number().describe("Total number of matching items")
4590
5232
  });
4591
- var tool58 = {
5233
+ var tool70 = {
4592
5234
  name: "search-dictionary",
4593
5235
  description: "Search for dictionary items by key name. Use get-dictionary to see all translations for a specific item.",
4594
- inputSchema: inputSchema58,
4595
- outputSchema: outputSchema58,
5236
+ inputSchema: inputSchema70,
5237
+ outputSchema: outputSchema70,
4596
5238
  slices: ["search"],
4597
5239
  annotations: { readOnlyHint: true },
4598
5240
  handler: async ({ query }) => {
@@ -4607,11 +5249,11 @@ var tool58 = {
4607
5249
  });
4608
5250
  }
4609
5251
  };
4610
- var search_dictionary_default = withStandardDecorators(tool58);
4611
- var inputSchema59 = {
5252
+ var search_dictionary_default = withStandardDecorators(tool70);
5253
+ var inputSchema71 = {
4612
5254
  id: z.string().uuid().describe("UUID of the dictionary item to retrieve")
4613
5255
  };
4614
- var outputSchema59 = z.object({
5256
+ var outputSchema71 = z.object({
4615
5257
  id: z.string(),
4616
5258
  name: z.string(),
4617
5259
  translations: z.array(
@@ -4622,11 +5264,11 @@ var outputSchema59 = z.object({
4622
5264
  })
4623
5265
  ).describe("All translations for this dictionary item")
4624
5266
  });
4625
- var tool59 = {
5267
+ var tool71 = {
4626
5268
  name: "get-dictionary",
4627
5269
  description: "Get a dictionary item with all its translations across languages. Shows the key name and each language's translation value.",
4628
- inputSchema: inputSchema59,
4629
- outputSchema: outputSchema59,
5270
+ inputSchema: inputSchema71,
5271
+ outputSchema: outputSchema71,
4630
5272
  slices: ["read"],
4631
5273
  annotations: { readOnlyHint: true },
4632
5274
  handler: async ({ id }) => {
@@ -4648,8 +5290,8 @@ var tool59 = {
4648
5290
  });
4649
5291
  }
4650
5292
  };
4651
- var get_dictionary_default = withStandardDecorators(tool59);
4652
- var inputSchema60 = {
5293
+ var get_dictionary_default = withStandardDecorators(tool71);
5294
+ var inputSchema72 = {
4653
5295
  name: z.string().describe("The dictionary key name"),
4654
5296
  translations: z.array(
4655
5297
  z.object({
@@ -4659,16 +5301,16 @@ var inputSchema60 = {
4659
5301
  ).describe("Translations to set for this dictionary item"),
4660
5302
  parentId: z.string().uuid().optional().describe("UUID of the parent dictionary item, or omit to create at the root")
4661
5303
  };
4662
- var outputSchema60 = z.object({
5304
+ var outputSchema72 = z.object({
4663
5305
  message: z.string(),
4664
5306
  id: z.string(),
4665
5307
  name: z.string()
4666
5308
  });
4667
- var tool60 = {
5309
+ var tool72 = {
4668
5310
  name: "create-dictionary",
4669
5311
  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.",
4670
- inputSchema: inputSchema60,
4671
- outputSchema: outputSchema60,
5312
+ inputSchema: inputSchema72,
5313
+ outputSchema: outputSchema72,
4672
5314
  slices: ["create"],
4673
5315
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
4674
5316
  handler: async ({ name, translations, parentId }) => {
@@ -4685,8 +5327,8 @@ var tool60 = {
4685
5327
  });
4686
5328
  }
4687
5329
  };
4688
- var create_dictionary_default = withStandardDecorators(tool60);
4689
- var inputSchema61 = {
5330
+ var create_dictionary_default = withStandardDecorators(tool72);
5331
+ var inputSchema73 = {
4690
5332
  id: z.string().uuid().describe("UUID of the dictionary item to update"),
4691
5333
  translations: z.array(
4692
5334
  z.object({
@@ -4695,17 +5337,17 @@ var inputSchema61 = {
4695
5337
  })
4696
5338
  ).describe("Translations to update. Languages not listed here will keep their existing translations.")
4697
5339
  };
4698
- var outputSchema61 = z.object({
5340
+ var outputSchema73 = z.object({
4699
5341
  message: z.string(),
4700
5342
  id: z.string(),
4701
5343
  name: z.string(),
4702
5344
  updatedLanguages: z.array(z.string()).describe("ISO codes of languages that were updated")
4703
5345
  });
4704
- var tool61 = {
5346
+ var tool73 = {
4705
5347
  name: "update-dictionary",
4706
5348
  description: "Update translations for a dictionary item. Call get-dictionary first to see existing translations.",
4707
- inputSchema: inputSchema61,
4708
- outputSchema: outputSchema61,
5349
+ inputSchema: inputSchema73,
5350
+ outputSchema: outputSchema73,
4709
5351
  slices: ["update"],
4710
5352
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
4711
5353
  handler: async ({ id, translations }) => {
@@ -4737,21 +5379,21 @@ var tool61 = {
4737
5379
  });
4738
5380
  }
4739
5381
  };
4740
- var update_dictionary_default = withStandardDecorators(tool61);
4741
- var inputSchema62 = {
5382
+ var update_dictionary_default = withStandardDecorators(tool73);
5383
+ var inputSchema74 = {
4742
5384
  id: z.string().uuid().describe("UUID of the dictionary item to move"),
4743
5385
  targetParentId: z.string().uuid().optional().describe("UUID of the destination parent dictionary item, or omit to move to the root")
4744
5386
  };
4745
- var outputSchema62 = z.object({
5387
+ var outputSchema74 = z.object({
4746
5388
  message: z.string(),
4747
5389
  id: z.string(),
4748
5390
  name: z.string()
4749
5391
  });
4750
- var tool62 = {
5392
+ var tool74 = {
4751
5393
  name: "move-dictionary",
4752
5394
  description: "Move a dictionary item to a different parent in the dictionary tree, or to the root. You will be asked to confirm.",
4753
- inputSchema: inputSchema62,
4754
- outputSchema: outputSchema62,
5395
+ inputSchema: inputSchema74,
5396
+ outputSchema: outputSchema74,
4755
5397
  slices: ["move"],
4756
5398
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
4757
5399
  handler: async ({ id, targetParentId }, extra) => {
@@ -4782,10 +5424,10 @@ var tool62 = {
4782
5424
  });
4783
5425
  }
4784
5426
  };
4785
- var move_dictionary_default = withStandardDecorators(tool62);
5427
+ var move_dictionary_default = withStandardDecorators(tool74);
4786
5428
 
4787
5429
  // src/umbraco-api/tools/dictionary/index.ts
4788
- var collection9 = {
5430
+ var collection10 = {
4789
5431
  metadata: {
4790
5432
  name: "dictionary",
4791
5433
  displayName: "Dictionary",
@@ -4793,13 +5435,13 @@ var collection9 = {
4793
5435
  },
4794
5436
  tools: () => [list_dictionary_default, search_dictionary_default, get_dictionary_default, create_dictionary_default, update_dictionary_default, move_dictionary_default]
4795
5437
  };
4796
- var dictionary_default = collection9;
4797
- var inputSchema63 = {
5438
+ var dictionary_default = collection10;
5439
+ var inputSchema75 = {
4798
5440
  tagGroup: z.string().optional().describe("Filter tags by group name, or omit to list all tags"),
4799
5441
  take: z.number().optional().default(50).describe("Number of tags to return"),
4800
5442
  skip: z.number().optional().default(0).describe("Number of tags to skip for pagination")
4801
5443
  };
4802
- var outputSchema63 = z.object({
5444
+ var outputSchema75 = z.object({
4803
5445
  items: z.array(
4804
5446
  z.object({
4805
5447
  id: z.number(),
@@ -4810,11 +5452,11 @@ var outputSchema63 = z.object({
4810
5452
  ).describe("Tags in use across the site"),
4811
5453
  total: z.number().describe("Total number of tags")
4812
5454
  });
4813
- var tool63 = {
5455
+ var tool75 = {
4814
5456
  name: "list-tags",
4815
5457
  description: "List tags in use across the site. Optionally filter by tag group. Shows how many content items use each tag.",
4816
- inputSchema: inputSchema63,
4817
- outputSchema: outputSchema63,
5458
+ inputSchema: inputSchema75,
5459
+ outputSchema: outputSchema75,
4818
5460
  slices: ["list"],
4819
5461
  annotations: { readOnlyHint: true },
4820
5462
  handler: async ({ tagGroup, take, skip }) => {
@@ -4831,10 +5473,10 @@ var tool63 = {
4831
5473
  });
4832
5474
  }
4833
5475
  };
4834
- var list_tags_default = withStandardDecorators(tool63);
5476
+ var list_tags_default = withStandardDecorators(tool75);
4835
5477
 
4836
5478
  // src/umbraco-api/tools/tag/index.ts
4837
- var collection10 = {
5479
+ var collection11 = {
4838
5480
  metadata: {
4839
5481
  name: "tag",
4840
5482
  displayName: "Tags",
@@ -4842,13 +5484,13 @@ var collection10 = {
4842
5484
  },
4843
5485
  tools: () => [list_tags_default]
4844
5486
  };
4845
- var tag_default = collection10;
5487
+ var tag_default = collection11;
4846
5488
  var TITLE_ALIASES = ["pageTitle", "title", "metaTitle", "seoTitle"];
4847
5489
  var META_DESC_ALIASES = ["metaDescription", "seoMetaDescription", "description"];
4848
- var inputSchema64 = {
5490
+ var inputSchema76 = {
4849
5491
  id: z.string().uuid().describe("The ID of the content page to audit")
4850
5492
  };
4851
- var outputSchema64 = z.object({
5493
+ var outputSchema76 = z.object({
4852
5494
  id: z.string().describe("Page ID"),
4853
5495
  name: z.string().describe("Page name"),
4854
5496
  url: z.string().describe("Page URL"),
@@ -4865,11 +5507,11 @@ var outputSchema64 = z.object({
4865
5507
  headings: z.array(z.object({ level: z.number(), text: z.string() })).describe("Headings found in body content"),
4866
5508
  images: z.array(z.object({ src: z.string(), alt: z.string(), hasAlt: z.boolean() })).describe("Images found in body content with alt text status")
4867
5509
  });
4868
- var tool64 = {
5510
+ var tool76 = {
4869
5511
  name: "audit-page-seo",
4870
5512
  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.",
4871
- inputSchema: inputSchema64,
4872
- outputSchema: outputSchema64,
5513
+ inputSchema: inputSchema76,
5514
+ outputSchema: outputSchema76,
4873
5515
  slices: ["read"],
4874
5516
  annotations: { readOnlyHint: true },
4875
5517
  handler: async ({ id }) => {
@@ -4913,13 +5555,13 @@ var tool64 = {
4913
5555
  });
4914
5556
  }
4915
5557
  };
4916
- var audit_page_seo_default = withStandardDecorators(tool64);
5558
+ var audit_page_seo_default = withStandardDecorators(tool76);
4917
5559
  var META_DESC_ALIASES2 = ["metaDescription", "seoMetaDescription", "description"];
4918
5560
  var BODY_CONTENT_MAX = 2e3;
4919
- var inputSchema65 = {
5561
+ var inputSchema77 = {
4920
5562
  id: z.string().uuid().describe("The ID of the content page to audit")
4921
5563
  };
4922
- var outputSchema65 = z.object({
5564
+ var outputSchema77 = z.object({
4923
5565
  id: z.string().describe("Page ID"),
4924
5566
  name: z.string().describe("Page name"),
4925
5567
  url: z.string().describe("Page URL"),
@@ -4930,11 +5572,11 @@ var outputSchema65 = z.object({
4930
5572
  documentType: z.string().describe("The document type name"),
4931
5573
  lastModified: z.string().describe("ISO date string of last modification")
4932
5574
  });
4933
- var tool65 = {
5575
+ var tool77 = {
4934
5576
  name: "audit-page-content",
4935
5577
  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.",
4936
- inputSchema: inputSchema65,
4937
- outputSchema: outputSchema65,
5578
+ inputSchema: inputSchema77,
5579
+ outputSchema: outputSchema77,
4938
5580
  slices: ["read"],
4939
5581
  annotations: { readOnlyHint: true },
4940
5582
  handler: async ({ id }) => {
@@ -4971,10 +5613,10 @@ var tool65 = {
4971
5613
  });
4972
5614
  }
4973
5615
  };
4974
- var audit_page_content_default = withStandardDecorators(tool65);
5616
+ var audit_page_content_default = withStandardDecorators(tool77);
4975
5617
 
4976
5618
  // src/umbraco-api/tools/content-health/index.ts
4977
- var collection11 = {
5619
+ var collection12 = {
4978
5620
  metadata: {
4979
5621
  name: "content-health",
4980
5622
  displayName: "Content Health",
@@ -4982,8 +5624,8 @@ var collection11 = {
4982
5624
  },
4983
5625
  tools: () => [audit_page_seo_default, audit_page_content_default]
4984
5626
  };
4985
- var content_health_default = collection11;
4986
- var inputSchema66 = {
5627
+ var content_health_default = collection12;
5628
+ var inputSchema78 = {
4987
5629
  parentId: z.string().uuid().optional().describe("Scope to a subtree by parent page ID. Omit to start from root."),
4988
5630
  maxDepth: z.number().optional().default(5).describe("How many levels deep to scan (default 5)")
4989
5631
  };
@@ -4998,7 +5640,7 @@ var treeNodeSchema = z.lazy(
4998
5640
  children: z.array(treeNodeSchema)
4999
5641
  })
5000
5642
  );
5001
- var outputSchema66 = z.object({
5643
+ var outputSchema78 = z.object({
5002
5644
  tree: z.array(treeNodeSchema).describe("Hierarchical site tree with children nested inside each node"),
5003
5645
  totalPages: z.number().describe("Total number of pages found across all levels"),
5004
5646
  maxDepthFound: z.number().describe("The deepest level actually found during the scan"),
@@ -5039,11 +5681,11 @@ async function buildTreeNodes(parentId, depth, maxDepth, pagesPerLevel, totalRef
5039
5681
  }
5040
5682
  return nodes;
5041
5683
  }
5042
- var tool66 = {
5684
+ var tool78 = {
5043
5685
  name: "report-site-tree-summary",
5044
5686
  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.",
5045
- inputSchema: inputSchema66,
5046
- outputSchema: outputSchema66,
5687
+ inputSchema: inputSchema78,
5688
+ outputSchema: outputSchema78,
5047
5689
  slices: ["read"],
5048
5690
  annotations: { readOnlyHint: true },
5049
5691
  handler: async ({ parentId, maxDepth }) => {
@@ -5060,14 +5702,14 @@ var tool66 = {
5060
5702
  });
5061
5703
  }
5062
5704
  };
5063
- var report_site_tree_summary_default = withStandardDecorators(tool66);
5064
- var inputSchema67 = {
5705
+ var report_site_tree_summary_default = withStandardDecorators(tool78);
5706
+ var inputSchema79 = {
5065
5707
  depthThreshold: z.number().optional().default(4).describe("Pages deeper than this level are reported (default 4)"),
5066
5708
  parentId: z.string().uuid().optional().describe("Scope to a subtree by parent page ID. Omit to start from root."),
5067
5709
  take: z.number().optional().default(50).describe("Number of results to return after filtering (default 50)"),
5068
5710
  skip: z.number().optional().default(0).describe("Number of results to skip for pagination (default 0)")
5069
5711
  };
5070
- var outputSchema67 = z.object({
5712
+ var outputSchema79 = z.object({
5071
5713
  items: z.array(
5072
5714
  z.object({
5073
5715
  id: z.string(),
@@ -5082,11 +5724,11 @@ var outputSchema67 = z.object({
5082
5724
  scannedPages: z.number().describe("Total number of pages scanned during the walk"),
5083
5725
  threshold: z.number().describe("The depth threshold used for this scan")
5084
5726
  });
5085
- var tool67 = {
5727
+ var tool79 = {
5086
5728
  name: "report-deep-pages",
5087
5729
  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.",
5088
- inputSchema: inputSchema67,
5089
- outputSchema: outputSchema67,
5730
+ inputSchema: inputSchema79,
5731
+ outputSchema: outputSchema79,
5090
5732
  slices: ["read"],
5091
5733
  annotations: { readOnlyHint: true },
5092
5734
  handler: async ({ depthThreshold, parentId, take, skip }) => {
@@ -5133,10 +5775,10 @@ var tool67 = {
5133
5775
  });
5134
5776
  }
5135
5777
  };
5136
- var report_deep_pages_default = withStandardDecorators(tool67);
5778
+ var report_deep_pages_default = withStandardDecorators(tool79);
5137
5779
 
5138
5780
  // src/umbraco-api/tools/site-structure/index.ts
5139
- var collection12 = {
5781
+ var collection13 = {
5140
5782
  metadata: {
5141
5783
  name: "site-structure",
5142
5784
  displayName: "Site Structure",
@@ -5144,12 +5786,12 @@ var collection12 = {
5144
5786
  },
5145
5787
  tools: () => [report_site_tree_summary_default, report_deep_pages_default]
5146
5788
  };
5147
- var site_structure_default = collection12;
5148
- var inputSchema68 = {
5789
+ var site_structure_default = collection13;
5790
+ var inputSchema80 = {
5149
5791
  ids: z.array(z.string().uuid()).min(1).max(10).describe("The IDs of the pages to publish (max 10)"),
5150
5792
  includeDescendants: z.boolean().optional().default(false).describe("Whether to also publish all child pages of each page")
5151
5793
  };
5152
- var outputSchema68 = z.object({
5794
+ var outputSchema80 = z.object({
5153
5795
  message: z.string(),
5154
5796
  results: z.array(z.object({
5155
5797
  id: z.string(),
@@ -5157,19 +5799,25 @@ var outputSchema68 = z.object({
5157
5799
  success: z.boolean(),
5158
5800
  previousVersionId: z.string().optional(),
5159
5801
  error: z.union([z.string(), z.record(z.string(), z.unknown())]).optional(),
5160
- publishedUrls: publishedUrlsSchema.optional()
5802
+ publishedUrls: publishedUrlsSchema.optional(),
5803
+ 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.")
5161
5804
  })),
5162
5805
  successCount: z.number(),
5163
5806
  failureCount: z.number(),
5164
5807
  skippedCount: z.number()
5165
5808
  });
5166
- var tool68 = {
5809
+ var tool80 = {
5167
5810
  name: "bulk-publish",
5168
5811
  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.",
5169
- inputSchema: inputSchema68,
5170
- outputSchema: outputSchema68,
5812
+ inputSchema: inputSchema80,
5813
+ outputSchema: outputSchema80,
5171
5814
  slices: ["publish"],
5172
- annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
5815
+ // includeDescendants delegates to publish-document-with-descendants, which
5816
+ // the chained CMS tool annotates idempotentHint: false — a retry fires a
5817
+ // second concurrent recursive publish job rather than converging to the
5818
+ // same end state. That makes this tool non-idempotent as a whole, since
5819
+ // includeDescendants is a valid input, not a separate tool.
5820
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
5173
5821
  handler: async ({ ids, includeDescendants }, extra) => {
5174
5822
  const validationError = validateBulkIds(ids);
5175
5823
  if (validationError) return createToolResult(validationError);
@@ -5195,15 +5843,20 @@ ${nameList}`;
5195
5843
  skippedCount: 0
5196
5844
  });
5197
5845
  }
5846
+ const stillPublishing = /* @__PURE__ */ new Set();
5198
5847
  const results = await executeBulkSequentially(items, async (item) => {
5199
5848
  const cultures = item.cultures ?? [null];
5200
- const result = includeDescendants ? await chainCms("publish-document-with-descendants", {
5201
- id: item.id,
5202
- data: {
5203
- includeUnpublishedDescendants: false,
5204
- cultures: cultures.filter((c) => c !== null)
5205
- }
5206
- }) : await chainCms("publish-document", {
5849
+ if (includeDescendants) {
5850
+ const result2 = await publishWithDescendants(
5851
+ item.id,
5852
+ { includeUnpublishedDescendants: false, cultures: cultures.filter((c) => c !== null) },
5853
+ { followUp: false }
5854
+ );
5855
+ if (!result2.ok) return result2.errorResult;
5856
+ if (!result2.complete) stillPublishing.add(item.id);
5857
+ return null;
5858
+ }
5859
+ const result = await chainCms("publish-document", {
5207
5860
  id: item.id,
5208
5861
  data: { publishSchedules: cultures.map((c) => ({ culture: c })) }
5209
5862
  });
@@ -5214,16 +5867,25 @@ ${nameList}`;
5214
5867
  });
5215
5868
  for (const row of results) {
5216
5869
  if (!row.success) continue;
5870
+ if (stillPublishing.has(row.id)) {
5871
+ row.publishPending = true;
5872
+ continue;
5873
+ }
5217
5874
  row.publishedUrls = await fetchPublishedUrls(row.id);
5218
5875
  }
5219
- return createToolResult(buildBulkOutput("Published", results));
5876
+ const output = buildBulkOutput("Published", results);
5877
+ if (stillPublishing.size > 0) {
5878
+ const names = results.filter((r) => stillPublishing.has(r.id)).map((r) => r.name);
5879
+ output.message += ` (${names.join(", ")} ${names.length === 1 ? "is" : "are"} a large tree \u2014 descendants still publishing in the background; check again shortly)`;
5880
+ }
5881
+ return createToolResult(output);
5220
5882
  }
5221
5883
  };
5222
- var bulk_publish_default = withStandardDecorators(tool68);
5223
- var inputSchema69 = {
5884
+ var bulk_publish_default = withStandardDecorators(tool80);
5885
+ var inputSchema81 = {
5224
5886
  ids: z.array(z.string().uuid()).min(1).max(10).describe("The IDs of the pages to unpublish (max 10)")
5225
5887
  };
5226
- var outputSchema69 = z.object({
5888
+ var outputSchema81 = z.object({
5227
5889
  message: z.string(),
5228
5890
  results: z.array(z.object({
5229
5891
  id: z.string(),
@@ -5237,11 +5899,11 @@ var outputSchema69 = z.object({
5237
5899
  failureCount: z.number(),
5238
5900
  skippedCount: z.number()
5239
5901
  });
5240
- var tool69 = {
5902
+ var tool81 = {
5241
5903
  name: "bulk-unpublish",
5242
5904
  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.",
5243
- inputSchema: inputSchema69,
5244
- outputSchema: outputSchema69,
5905
+ inputSchema: inputSchema81,
5906
+ outputSchema: outputSchema81,
5245
5907
  slices: ["publish"],
5246
5908
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
5247
5909
  handler: async ({ ids }, extra) => {
@@ -5297,7 +5959,7 @@ ${nameList}`;
5297
5959
  return createToolResult(buildBulkOutput("Unpublished", results));
5298
5960
  }
5299
5961
  };
5300
- var bulk_unpublish_default = withStandardDecorators(tool69);
5962
+ var bulk_unpublish_default = withStandardDecorators(tool81);
5301
5963
 
5302
5964
  // src/umbraco-api/tools/helpers/format-date.ts
5303
5965
  function formatDate(iso) {
@@ -5311,11 +5973,11 @@ function formatDate(iso) {
5311
5973
  }
5312
5974
 
5313
5975
  // src/umbraco-api/tools/bulk-operations/post/bulk-schedule-publish.ts
5314
- var inputSchema70 = {
5976
+ var inputSchema82 = {
5315
5977
  ids: z.array(z.string().uuid()).min(1).max(10).describe("The IDs of the pages to schedule for publishing (max 10)"),
5316
5978
  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.")
5317
5979
  };
5318
- var outputSchema70 = z.object({
5980
+ var outputSchema82 = z.object({
5319
5981
  message: z.string(),
5320
5982
  results: z.array(z.object({
5321
5983
  id: z.string(),
@@ -5329,11 +5991,11 @@ var outputSchema70 = z.object({
5329
5991
  failureCount: z.number(),
5330
5992
  skippedCount: z.number()
5331
5993
  });
5332
- var tool70 = {
5994
+ var tool82 = {
5333
5995
  name: "bulk-schedule-publish",
5334
5996
  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.",
5335
- inputSchema: inputSchema70,
5336
- outputSchema: outputSchema70,
5997
+ inputSchema: inputSchema82,
5998
+ outputSchema: outputSchema82,
5337
5999
  slices: ["publish"],
5338
6000
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
5339
6001
  handler: async ({ ids, publishDate }, extra) => {
@@ -5378,15 +6040,15 @@ ${nameList}`;
5378
6040
  return createToolResult(buildBulkOutput("Scheduled", results));
5379
6041
  }
5380
6042
  };
5381
- var bulk_schedule_publish_default = withStandardDecorators(tool70);
5382
- var inputSchema71 = {
6043
+ var bulk_schedule_publish_default = withStandardDecorators(tool82);
6044
+ var inputSchema83 = {
5383
6045
  ids: z.array(z.string().uuid()).min(1).max(10).describe("The IDs of the pages to update (max 10)"),
5384
6046
  alias: z.string().describe("The property alias to set (call get-page first to verify it exists on the document type)"),
5385
6047
  value: z.any().describe("The value to set on the property"),
5386
6048
  culture: z.string().optional().describe("The culture code for variant content (omit for invariant properties)"),
5387
6049
  segment: z.string().optional().describe("The segment for segmented content (omit if not using segments)")
5388
6050
  };
5389
- var outputSchema71 = z.object({
6051
+ var outputSchema83 = z.object({
5390
6052
  message: z.string(),
5391
6053
  results: z.array(z.object({
5392
6054
  id: z.string(),
@@ -5401,11 +6063,11 @@ var outputSchema71 = z.object({
5401
6063
  failureCount: z.number(),
5402
6064
  skippedCount: z.number()
5403
6065
  });
5404
- var tool71 = {
6066
+ var tool83 = {
5405
6067
  name: "bulk-set-property",
5406
6068
  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.",
5407
- inputSchema: inputSchema71,
5408
- outputSchema: outputSchema71,
6069
+ inputSchema: inputSchema83,
6070
+ outputSchema: outputSchema83,
5409
6071
  slices: ["update"],
5410
6072
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
5411
6073
  handler: async ({ ids, alias, value, culture, segment }, extra) => {
@@ -5452,12 +6114,12 @@ ${nameList}`;
5452
6114
  return createToolResult(buildBulkOutput("Updated", results));
5453
6115
  }
5454
6116
  };
5455
- var bulk_set_property_default = withStandardDecorators(tool71);
5456
- var inputSchema72 = {
6117
+ var bulk_set_property_default = withStandardDecorators(tool83);
6118
+ var inputSchema84 = {
5457
6119
  ids: z.array(z.string().uuid()).min(1).max(10).describe("The IDs of the pages to move (max 10)"),
5458
6120
  targetParentId: z.string().uuid().describe("The ID of the destination parent page to move the pages into")
5459
6121
  };
5460
- var outputSchema72 = z.object({
6122
+ var outputSchema84 = z.object({
5461
6123
  message: z.string(),
5462
6124
  results: z.array(z.object({
5463
6125
  id: z.string(),
@@ -5471,11 +6133,11 @@ var outputSchema72 = z.object({
5471
6133
  failureCount: z.number(),
5472
6134
  skippedCount: z.number()
5473
6135
  });
5474
- var tool72 = {
6136
+ var tool84 = {
5475
6137
  name: "bulk-move",
5476
6138
  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.",
5477
- inputSchema: inputSchema72,
5478
- outputSchema: outputSchema72,
6139
+ inputSchema: inputSchema84,
6140
+ outputSchema: outputSchema84,
5479
6141
  slices: ["move"],
5480
6142
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
5481
6143
  handler: async ({ ids, targetParentId }, extra) => {
@@ -5528,8 +6190,8 @@ ${nameList}`;
5528
6190
  return createToolResult(buildBulkOutput("Moved", results));
5529
6191
  }
5530
6192
  };
5531
- var bulk_move_default = withStandardDecorators(tool72);
5532
- var inputSchema73 = {
6193
+ var bulk_move_default = withStandardDecorators(tool84);
6194
+ var inputSchema85 = {
5533
6195
  ids: z.array(z.string().uuid()).min(1).max(10).describe("The IDs of the pages to update (max 10)"),
5534
6196
  contentTypeKey: z.string().uuid().describe("The block element type key to target. Use inspect-blocks to find this."),
5535
6197
  propertyAlias: z.string().describe("The document property alias containing the blocks (e.g. 'contentRows'). Use inspect-blocks to find this."),
@@ -5540,7 +6202,7 @@ var inputSchema73 = {
5540
6202
  culture: z.string().nullable().optional().describe("Culture code if the document property is variant"),
5541
6203
  segment: z.string().nullable().optional().describe("Segment if the document property is variant")
5542
6204
  };
5543
- var outputSchema73 = z.object({
6205
+ var outputSchema85 = z.object({
5544
6206
  message: z.string(),
5545
6207
  results: z.array(z.object({
5546
6208
  id: z.string(),
@@ -5558,10 +6220,10 @@ var outputSchema73 = z.object({
5558
6220
  skippedCount: z.number(),
5559
6221
  totalBlocksUpdated: z.number()
5560
6222
  });
5561
- function isBlockListOrGridValue3(value) {
6223
+ function isBlockListOrGridValue2(value) {
5562
6224
  return value !== null && typeof value === "object" && !Array.isArray(value) && Array.isArray(value.contentData);
5563
6225
  }
5564
- function isRteWithBlocks3(value) {
6226
+ function isRteWithBlocks2(value) {
5565
6227
  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);
5566
6228
  }
5567
6229
  function findMatchingBlocks(doc, propertyAlias, contentTypeKey) {
@@ -5569,18 +6231,18 @@ function findMatchingBlocks(doc, propertyAlias, contentTypeKey) {
5569
6231
  const prop = allValues.find((v) => v.alias === propertyAlias);
5570
6232
  if (!prop) return [];
5571
6233
  let contentData = [];
5572
- if (isBlockListOrGridValue3(prop.value)) {
6234
+ if (isBlockListOrGridValue2(prop.value)) {
5573
6235
  contentData = prop.value.contentData;
5574
- } else if (isRteWithBlocks3(prop.value)) {
6236
+ } else if (isRteWithBlocks2(prop.value)) {
5575
6237
  contentData = prop.value.blocks.contentData;
5576
6238
  }
5577
6239
  return contentData.filter((block) => block.contentTypeKey === contentTypeKey).map((block) => ({ contentKey: block.key ?? "" })).filter((b) => b.contentKey !== "");
5578
6240
  }
5579
- var tool73 = {
6241
+ var tool85 = {
5580
6242
  name: "bulk-set-block-property",
5581
6243
  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.",
5582
- inputSchema: inputSchema73,
5583
- outputSchema: outputSchema73,
6244
+ inputSchema: inputSchema85,
6245
+ outputSchema: outputSchema85,
5584
6246
  slices: ["update"],
5585
6247
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
5586
6248
  handler: async ({ ids, contentTypeKey, propertyAlias, values, culture, segment }, extra) => {
@@ -5760,10 +6422,10 @@ Changes will be saved but not published.`;
5760
6422
  });
5761
6423
  }
5762
6424
  };
5763
- var bulk_set_block_property_default = withStandardDecorators(tool73);
6425
+ var bulk_set_block_property_default = withStandardDecorators(tool85);
5764
6426
 
5765
6427
  // src/umbraco-api/tools/bulk-operations/index.ts
5766
- var collection13 = {
6428
+ var collection14 = {
5767
6429
  metadata: {
5768
6430
  name: "bulk-operations",
5769
6431
  displayName: "Bulk Operations",
@@ -5771,7 +6433,7 @@ var collection13 = {
5771
6433
  },
5772
6434
  tools: () => [bulk_publish_default, bulk_unpublish_default, bulk_schedule_publish_default, bulk_set_property_default, bulk_move_default, bulk_set_block_property_default]
5773
6435
  };
5774
- var bulk_operations_default = collection13;
6436
+ var bulk_operations_default = collection14;
5775
6437
 
5776
6438
  // src/umbraco-api/tools/member-reporting/get/member-type-helper.ts
5777
6439
  function memberTypeToString(memberType) {
@@ -5785,12 +6447,12 @@ function memberTypeToString(memberType) {
5785
6447
  }
5786
6448
 
5787
6449
  // src/umbraco-api/tools/member/get/search-members.ts
5788
- var inputSchema74 = {
6450
+ var inputSchema86 = {
5789
6451
  query: z.string().describe("Search term to find members by name or email address"),
5790
6452
  take: z.number().optional().default(20).describe("Number of results to return (default 20)"),
5791
6453
  skip: z.number().optional().default(0).describe("Number of results to skip for pagination")
5792
6454
  };
5793
- var outputSchema74 = z.object({
6455
+ var outputSchema86 = z.object({
5794
6456
  items: z.array(z.object({
5795
6457
  id: z.string(),
5796
6458
  name: z.string(),
@@ -5801,11 +6463,11 @@ var outputSchema74 = z.object({
5801
6463
  })).describe("Matching members"),
5802
6464
  total: z.number().describe("Total number of matches")
5803
6465
  });
5804
- var tool74 = {
6466
+ var tool86 = {
5805
6467
  name: "search-members",
5806
6468
  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.",
5807
- inputSchema: inputSchema74,
5808
- outputSchema: outputSchema74,
6469
+ inputSchema: inputSchema86,
6470
+ outputSchema: outputSchema86,
5809
6471
  slices: ["search"],
5810
6472
  annotations: { readOnlyHint: true },
5811
6473
  handler: async ({ query, take, skip }) => {
@@ -5825,7 +6487,7 @@ var tool74 = {
5825
6487
  });
5826
6488
  }
5827
6489
  };
5828
- var search_members_default = withStandardDecorators(tool74);
6490
+ var search_members_default = withStandardDecorators(tool86);
5829
6491
 
5830
6492
  // src/umbraco-api/tools/member/sensitive-data-access.ts
5831
6493
  async function checkSensitiveDataAccess() {
@@ -5835,10 +6497,10 @@ async function checkSensitiveDataAccess() {
5835
6497
  }
5836
6498
 
5837
6499
  // src/umbraco-api/tools/member/get/get-member.ts
5838
- var inputSchema75 = {
6500
+ var inputSchema87 = {
5839
6501
  id: z.string().uuid().describe("The ID of the member to retrieve")
5840
6502
  };
5841
- var outputSchema75 = z.object({
6503
+ var outputSchema87 = z.object({
5842
6504
  id: z.string(),
5843
6505
  name: z.string(),
5844
6506
  email: z.string(),
@@ -5858,11 +6520,11 @@ var outputSchema75 = z.object({
5858
6520
  lastPasswordChangeDate: z.string().nullable(),
5859
6521
  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.")
5860
6522
  });
5861
- var tool75 = {
6523
+ var tool87 = {
5862
6524
  name: "get-member",
5863
6525
  description: "Get the full profile of a member including their groups, properties, approval status, and login history.",
5864
- inputSchema: inputSchema75,
5865
- outputSchema: outputSchema75,
6526
+ inputSchema: inputSchema87,
6527
+ outputSchema: outputSchema87,
5866
6528
  slices: ["read"],
5867
6529
  annotations: { readOnlyHint: true },
5868
6530
  handler: async ({ id }) => {
@@ -5888,12 +6550,12 @@ var tool75 = {
5888
6550
  });
5889
6551
  }
5890
6552
  };
5891
- var get_member_default = withStandardDecorators(tool75);
5892
- var inputSchema76 = {
6553
+ var get_member_default = withStandardDecorators(tool87);
6554
+ var inputSchema88 = {
5893
6555
  take: z.number().optional().default(50).describe("Number of results to return (default 50)"),
5894
6556
  skip: z.number().optional().default(0).describe("Number of results to skip for pagination")
5895
6557
  };
5896
- var outputSchema76 = z.object({
6558
+ var outputSchema88 = z.object({
5897
6559
  items: z.array(z.object({
5898
6560
  id: z.string(),
5899
6561
  alias: z.string(),
@@ -5901,11 +6563,11 @@ var outputSchema76 = z.object({
5901
6563
  })).describe("Available member types"),
5902
6564
  total: z.number().describe("Total number of member types")
5903
6565
  });
5904
- var tool76 = {
6566
+ var tool88 = {
5905
6567
  name: "list-member-types",
5906
6568
  description: "List available member types. Use this before create-member to find a valid member type ID.",
5907
- inputSchema: inputSchema76,
5908
- outputSchema: outputSchema76,
6569
+ inputSchema: inputSchema88,
6570
+ outputSchema: outputSchema88,
5909
6571
  slices: ["list"],
5910
6572
  annotations: { readOnlyHint: true },
5911
6573
  handler: async ({ take, skip }) => {
@@ -5921,8 +6583,8 @@ var tool76 = {
5921
6583
  });
5922
6584
  }
5923
6585
  };
5924
- var list_member_types_default = withStandardDecorators(tool76);
5925
- var inputSchema77 = {
6586
+ var list_member_types_default = withStandardDecorators(tool88);
6587
+ var inputSchema89 = {
5926
6588
  email: z.string().email().describe("The email address for the new member"),
5927
6589
  username: z.string().describe("The username for the new member"),
5928
6590
  name: z.string().describe("The display name for the new member"),
@@ -5935,17 +6597,17 @@ var inputSchema77 = {
5935
6597
  value: z.any().describe("The property value")
5936
6598
  })).optional().describe("Custom property values to set on the new member")
5937
6599
  };
5938
- var outputSchema77 = z.object({
6600
+ var outputSchema89 = z.object({
5939
6601
  message: z.string(),
5940
6602
  id: z.string(),
5941
6603
  name: z.string(),
5942
6604
  email: z.string()
5943
6605
  });
5944
- var tool77 = {
6606
+ var tool89 = {
5945
6607
  name: "create-member",
5946
6608
  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.",
5947
- inputSchema: inputSchema77,
5948
- outputSchema: outputSchema77,
6609
+ inputSchema: inputSchema89,
6610
+ outputSchema: outputSchema89,
5949
6611
  slices: ["create"],
5950
6612
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
5951
6613
  handler: async ({ email, username, name, password, memberTypeId, isApproved, groups, values }) => {
@@ -5999,8 +6661,8 @@ var tool77 = {
5999
6661
  });
6000
6662
  }
6001
6663
  };
6002
- var create_member_default = withStandardDecorators(tool77);
6003
- var inputSchema78 = {
6664
+ var create_member_default = withStandardDecorators(tool89);
6665
+ var inputSchema90 = {
6004
6666
  id: z.string().uuid().describe("The ID of the member to update"),
6005
6667
  name: z.string().optional().describe("The new display name for the member"),
6006
6668
  email: z.string().email().optional().describe("The new email address for the member"),
@@ -6015,17 +6677,17 @@ var inputSchema78 = {
6015
6677
  value: z.any().describe("The new property value")
6016
6678
  })).optional().describe("Custom property values to update")
6017
6679
  };
6018
- var outputSchema78 = z.object({
6680
+ var outputSchema90 = z.object({
6019
6681
  message: z.string(),
6020
6682
  id: z.string(),
6021
6683
  name: z.string(),
6022
6684
  email: z.string()
6023
6685
  });
6024
- var tool78 = {
6686
+ var tool90 = {
6025
6687
  name: "update-member",
6026
6688
  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.",
6027
- inputSchema: inputSchema78,
6028
- outputSchema: outputSchema78,
6689
+ inputSchema: inputSchema90,
6690
+ outputSchema: outputSchema90,
6029
6691
  slices: ["update"],
6030
6692
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
6031
6693
  handler: async ({ id, name, email, username, newPassword, isTwoFactorEnabled, isApproved, isLockedOut, groups, values }, extra) => {
@@ -6081,21 +6743,21 @@ var tool78 = {
6081
6743
  });
6082
6744
  }
6083
6745
  };
6084
- var update_member_default = withStandardDecorators(tool78);
6085
- var inputSchema79 = {
6746
+ var update_member_default = withStandardDecorators(tool90);
6747
+ var inputSchema91 = {
6086
6748
  id: z.string().uuid().describe("The ID of the member to permanently delete")
6087
6749
  };
6088
- var outputSchema79 = z.object({
6750
+ var outputSchema91 = z.object({
6089
6751
  message: z.string(),
6090
6752
  id: z.string(),
6091
6753
  name: z.string(),
6092
6754
  email: z.string()
6093
6755
  });
6094
- var tool79 = {
6756
+ var tool91 = {
6095
6757
  name: "delete-member",
6096
6758
  description: "Permanently delete a member. This cannot be undone \u2014 there is no recycle bin for members. You will be asked to confirm.",
6097
- inputSchema: inputSchema79,
6098
- outputSchema: outputSchema79,
6759
+ inputSchema: inputSchema91,
6760
+ outputSchema: outputSchema91,
6099
6761
  slices: ["delete"],
6100
6762
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
6101
6763
  handler: async ({ id }, extra) => {
@@ -6117,10 +6779,10 @@ var tool79 = {
6117
6779
  });
6118
6780
  }
6119
6781
  };
6120
- var delete_member_default = withStandardDecorators(tool79);
6782
+ var delete_member_default = withStandardDecorators(tool91);
6121
6783
 
6122
6784
  // src/umbraco-api/tools/member/index.ts
6123
- var collection14 = {
6785
+ var collection15 = {
6124
6786
  metadata: {
6125
6787
  name: "member",
6126
6788
  displayName: "Members",
@@ -6128,23 +6790,23 @@ var collection14 = {
6128
6790
  },
6129
6791
  tools: () => [search_members_default, get_member_default, list_member_types_default, create_member_default, update_member_default, delete_member_default]
6130
6792
  };
6131
- var member_default = collection14;
6132
- var inputSchema80 = {
6793
+ var member_default = collection15;
6794
+ var inputSchema92 = {
6133
6795
  take: z.number().optional().default(50).describe("Number of results to return (default 50)"),
6134
6796
  skip: z.number().optional().default(0).describe("Number of results to skip for pagination")
6135
6797
  };
6136
- var outputSchema80 = z.object({
6798
+ var outputSchema92 = z.object({
6137
6799
  items: z.array(z.object({
6138
6800
  id: z.string(),
6139
6801
  name: z.string()
6140
6802
  })).describe("Member groups"),
6141
6803
  total: z.number().describe("Total number of member groups")
6142
6804
  });
6143
- var tool80 = {
6805
+ var tool92 = {
6144
6806
  name: "list-member-groups",
6145
6807
  description: "List all member groups. Use group names when creating or updating members to assign them to groups.",
6146
- inputSchema: inputSchema80,
6147
- outputSchema: outputSchema80,
6808
+ inputSchema: inputSchema92,
6809
+ outputSchema: outputSchema92,
6148
6810
  slices: ["list"],
6149
6811
  annotations: { readOnlyHint: true },
6150
6812
  handler: async ({ take, skip }) => {
@@ -6160,20 +6822,20 @@ var tool80 = {
6160
6822
  });
6161
6823
  }
6162
6824
  };
6163
- var list_member_groups_default = withStandardDecorators(tool80);
6164
- var inputSchema81 = {
6825
+ var list_member_groups_default = withStandardDecorators(tool92);
6826
+ var inputSchema93 = {
6165
6827
  name: z.string().describe("The name of the new member group")
6166
6828
  };
6167
- var outputSchema81 = z.object({
6829
+ var outputSchema93 = z.object({
6168
6830
  message: z.string(),
6169
6831
  id: z.string(),
6170
6832
  name: z.string()
6171
6833
  });
6172
- var tool81 = {
6834
+ var tool93 = {
6173
6835
  name: "create-member-group",
6174
6836
  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.",
6175
- inputSchema: inputSchema81,
6176
- outputSchema: outputSchema81,
6837
+ inputSchema: inputSchema93,
6838
+ outputSchema: outputSchema93,
6177
6839
  slices: ["create"],
6178
6840
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
6179
6841
  handler: async ({ name }) => {
@@ -6186,20 +6848,20 @@ var tool81 = {
6186
6848
  });
6187
6849
  }
6188
6850
  };
6189
- var create_member_group_default = withStandardDecorators(tool81);
6190
- var inputSchema82 = {
6851
+ var create_member_group_default = withStandardDecorators(tool93);
6852
+ var inputSchema94 = {
6191
6853
  id: z.string().uuid().describe("The ID of the member group to delete")
6192
6854
  };
6193
- var outputSchema82 = z.object({
6855
+ var outputSchema94 = z.object({
6194
6856
  message: z.string(),
6195
6857
  id: z.string(),
6196
6858
  name: z.string()
6197
6859
  });
6198
- var tool82 = {
6860
+ var tool94 = {
6199
6861
  name: "delete-member-group",
6200
6862
  description: "Delete a member group. Members in this group will lose the group assignment. You will be asked to confirm.",
6201
- inputSchema: inputSchema82,
6202
- outputSchema: outputSchema82,
6863
+ inputSchema: inputSchema94,
6864
+ outputSchema: outputSchema94,
6203
6865
  slices: ["delete"],
6204
6866
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
6205
6867
  handler: async ({ id }, extra) => {
@@ -6220,10 +6882,10 @@ var tool82 = {
6220
6882
  });
6221
6883
  }
6222
6884
  };
6223
- var delete_member_group_default = withStandardDecorators(tool82);
6885
+ var delete_member_group_default = withStandardDecorators(tool94);
6224
6886
 
6225
6887
  // src/umbraco-api/tools/member-group/index.ts
6226
- var collection15 = {
6888
+ var collection16 = {
6227
6889
  metadata: {
6228
6890
  name: "member-group",
6229
6891
  displayName: "Member Groups",
@@ -6231,74 +6893,82 @@ var collection15 = {
6231
6893
  },
6232
6894
  tools: () => [list_member_groups_default, create_member_group_default, delete_member_group_default]
6233
6895
  };
6234
- var member_group_default = collection15;
6235
- var inputSchema83 = {};
6236
- var outputSchema83 = z.object({
6237
- totalMembers: z.number().describe("Total number of members across all types and groups"),
6896
+ var member_group_default = collection16;
6897
+ var inputSchema95 = {};
6898
+ var outputSchema95 = z.object({
6899
+ totalMembers: z.number().describe("Total number of members across all types and groups (exact, server-reported \u2014 not capped by the sample)."),
6238
6900
  byType: z.array(z.object({
6239
6901
  memberType: z.string().describe("Member type alias or name"),
6240
6902
  count: z.number()
6241
- })).describe("Member counts grouped by member type. Maps naturally to a pie or bar chart."),
6903
+ })).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."),
6242
6904
  byGroup: z.array(z.object({
6243
6905
  group: z.string().describe("Member group name"),
6244
6906
  count: z.number()
6245
- })).describe("Member counts grouped by member group. Members with no group are excluded.")
6907
+ })).describe("Member counts grouped by member group \u2014 exact, server-reported per-group totals (uncapped). Members with no group are excluded.")
6246
6908
  });
6247
6909
  var PAGE_SIZE = 100;
6248
6910
  var MEMBER_CAP = 500;
6249
- var tool83 = {
6911
+ var tool95 = {
6250
6912
  name: "report-member-count",
6251
- 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.",
6252
- inputSchema: inputSchema83,
6253
- outputSchema: outputSchema83,
6913
+ 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.",
6914
+ inputSchema: inputSchema95,
6915
+ outputSchema: outputSchema95,
6254
6916
  slices: ["read"],
6255
6917
  annotations: { readOnlyHint: true },
6256
6918
  handler: async () => {
6257
- const allMembers = [];
6919
+ const sampledMembers = [];
6920
+ let totalMembers = 0;
6258
6921
  let cursor = encodeCursor({ s: 0, t: PAGE_SIZE });
6259
- while (allMembers.length < MEMBER_CAP) {
6922
+ while (sampledMembers.length < MEMBER_CAP) {
6260
6923
  const result = await chainCms("find-member", { cursor, orderBy: "username" });
6261
6924
  if (!result.ok) return result.errorResult;
6262
6925
  const data = result.data;
6263
6926
  const items = data.items ?? [];
6264
- allMembers.push(...items);
6927
+ if (typeof data.total === "number") totalMembers = data.total;
6928
+ sampledMembers.push(...items);
6265
6929
  const nextCursor = data.nextCursor;
6266
6930
  if (!nextCursor || items.length === 0) break;
6267
6931
  cursor = nextCursor;
6268
6932
  }
6933
+ if (totalMembers === 0 && sampledMembers.length > 0) totalMembers = sampledMembers.length;
6269
6934
  const typeCounts = /* @__PURE__ */ new Map();
6270
- for (const member of allMembers) {
6935
+ for (const member of sampledMembers) {
6271
6936
  const memberType = memberTypeToString(member.memberType);
6272
6937
  typeCounts.set(memberType, (typeCounts.get(memberType) ?? 0) + 1);
6273
6938
  }
6274
6939
  const groupResult = await chainCms("get-all-member-groups", {});
6275
6940
  if (!groupResult.ok) return groupResult.errorResult;
6276
6941
  const allGroups = groupResult.data.items ?? [];
6942
+ const named = allGroups.filter((g) => typeof g.name === "string");
6943
+ const perGroupResults = await Promise.all(
6944
+ named.map(
6945
+ (g) => chainCms("find-member", {
6946
+ memberGroupName: g.name,
6947
+ cursor: encodeCursor({ s: 0, t: 1 }),
6948
+ orderBy: "username"
6949
+ })
6950
+ )
6951
+ );
6277
6952
  const byGroup = [];
6278
- for (const group of allGroups) {
6279
- if (!group.name) continue;
6280
- const countResult = await chainCms("find-member", {
6281
- memberGroupName: group.name,
6282
- cursor: encodeCursor({ s: 0, t: 1 }),
6283
- orderBy: "username"
6284
- });
6285
- if (!countResult.ok) return countResult.errorResult;
6286
- byGroup.push({ group: group.name, count: countResult.data.total ?? 0 });
6953
+ for (let i = 0; i < named.length; i++) {
6954
+ const r = perGroupResults[i];
6955
+ if (!r.ok) return r.errorResult;
6956
+ byGroup.push({ group: named[i].name, count: r.data.total ?? 0 });
6287
6957
  }
6288
6958
  return createToolResult({
6289
- totalMembers: allMembers.length,
6959
+ totalMembers,
6290
6960
  byType: Array.from(typeCounts.entries()).map(([memberType, count]) => ({ memberType, count })).sort((a, b) => b.count - a.count),
6291
6961
  byGroup: byGroup.sort((a, b) => b.count - a.count)
6292
6962
  });
6293
6963
  }
6294
6964
  };
6295
- var report_member_count_default = withStandardDecorators(tool83);
6296
- var inputSchema84 = {
6965
+ var report_member_count_default = withStandardDecorators(tool95);
6966
+ var inputSchema96 = {
6297
6967
  groupName: z.string().describe("The name of the member group to filter by. Use list-member-groups to find valid group names."),
6298
6968
  take: z.number().optional().default(50).describe("Number of results to return (default 50)"),
6299
6969
  skip: z.number().optional().default(0).describe("Number of results to skip for pagination (default 0)")
6300
6970
  };
6301
- var outputSchema84 = z.object({
6971
+ var outputSchema96 = z.object({
6302
6972
  groupName: z.string().describe("The group name used for this query"),
6303
6973
  items: z.array(z.object({
6304
6974
  id: z.string(),
@@ -6309,11 +6979,11 @@ var outputSchema84 = z.object({
6309
6979
  })).describe("Members belonging to the specified group"),
6310
6980
  total: z.number().describe("Total number of members in this group")
6311
6981
  });
6312
- var tool84 = {
6982
+ var tool96 = {
6313
6983
  name: "report-members-by-group",
6314
6984
  description: "List members belonging to a specific group. Use list-member-groups to find valid group names.",
6315
- inputSchema: inputSchema84,
6316
- outputSchema: outputSchema84,
6985
+ inputSchema: inputSchema96,
6986
+ outputSchema: outputSchema96,
6317
6987
  slices: ["read"],
6318
6988
  annotations: { readOnlyHint: true },
6319
6989
  handler: async ({ groupName, take, skip }) => {
@@ -6329,8 +6999,9 @@ var tool84 = {
6329
6999
  detail: `No member group named "${groupName}". Use list-member-groups to see existing group names.`
6330
7000
  });
6331
7001
  }
7002
+ const canonicalGroupName = groupMatch.name ?? groupName;
6332
7003
  const result = await chainCms("find-member", {
6333
- memberGroupName: groupMatch.name,
7004
+ memberGroupName: canonicalGroupName,
6334
7005
  cursor: buildChainedCursor(skip, take),
6335
7006
  orderBy: "username"
6336
7007
  });
@@ -6349,13 +7020,13 @@ var tool84 = {
6349
7020
  });
6350
7021
  }
6351
7022
  };
6352
- var report_members_by_group_default = withStandardDecorators(tool84);
6353
- var inputSchema85 = {
7023
+ var report_members_by_group_default = withStandardDecorators(tool96);
7024
+ var inputSchema97 = {
6354
7025
  inactiveDays: z.number().optional().default(90).describe("Number of days without a login before a member is considered inactive (default 90)"),
6355
7026
  take: z.number().optional().default(50).describe("Number of results to return after filtering (default 50)"),
6356
7027
  skip: z.number().optional().default(0).describe("Number of results to skip for pagination (default 0)")
6357
7028
  };
6358
- var outputSchema85 = z.object({
7029
+ var outputSchema97 = z.object({
6359
7030
  items: z.array(z.object({
6360
7031
  id: z.string(),
6361
7032
  name: z.string(),
@@ -6370,11 +7041,11 @@ var outputSchema85 = z.object({
6370
7041
  });
6371
7042
  var PAGE_SIZE2 = 100;
6372
7043
  var MEMBER_CAP2 = 500;
6373
- var tool85 = {
7044
+ var tool97 = {
6374
7045
  name: "report-member-activity",
6375
7046
  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.",
6376
- inputSchema: inputSchema85,
6377
- outputSchema: outputSchema85,
7047
+ inputSchema: inputSchema97,
7048
+ outputSchema: outputSchema97,
6378
7049
  slices: ["read"],
6379
7050
  annotations: { readOnlyHint: true },
6380
7051
  handler: async ({ inactiveDays, take, skip }) => {
@@ -6428,10 +7099,10 @@ var tool85 = {
6428
7099
  });
6429
7100
  }
6430
7101
  };
6431
- var report_member_activity_default = withStandardDecorators(tool85);
7102
+ var report_member_activity_default = withStandardDecorators(tool97);
6432
7103
 
6433
7104
  // src/umbraco-api/tools/member-reporting/index.ts
6434
- var collection16 = {
7105
+ var collection17 = {
6435
7106
  metadata: {
6436
7107
  name: "member-reporting",
6437
7108
  displayName: "Member Reporting",
@@ -6439,22 +7110,22 @@ var collection16 = {
6439
7110
  },
6440
7111
  tools: () => [report_member_count_default, report_members_by_group_default, report_member_activity_default]
6441
7112
  };
6442
- var member_reporting_default = collection16;
6443
- var inputSchema86 = {
7113
+ var member_reporting_default = collection17;
7114
+ var inputSchema98 = {
6444
7115
  id: z.string().uuid().describe("The ID of the page to check publish status for")
6445
7116
  };
6446
- var outputSchema86 = z.object({
7117
+ var outputSchema98 = z.object({
6447
7118
  id: z.string(),
6448
7119
  name: z.string(),
6449
7120
  isPublished: z.boolean(),
6450
7121
  state: z.string(),
6451
7122
  variants: z.array(publishStatusVariantSchema)
6452
7123
  });
6453
- var tool86 = {
7124
+ var tool98 = {
6454
7125
  name: "get-publish-status",
6455
7126
  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.",
6456
- inputSchema: inputSchema86,
6457
- outputSchema: outputSchema86,
7127
+ inputSchema: inputSchema98,
7128
+ outputSchema: outputSchema98,
6458
7129
  slices: ["read"],
6459
7130
  annotations: { readOnlyHint: true },
6460
7131
  handler: async ({ id }) => {
@@ -6470,24 +7141,24 @@ var tool86 = {
6470
7141
  });
6471
7142
  }
6472
7143
  };
6473
- var get_publish_status_default = withStandardDecorators(tool86);
6474
- var inputSchema87 = {
7144
+ var get_publish_status_default = withStandardDecorators(tool98);
7145
+ var inputSchema99 = {
6475
7146
  id: z.string().uuid().describe("The ID of the page to schedule for publish"),
6476
7147
  publishDate: z.string().datetime().describe("The date and time to publish the page (ISO 8601 format, must be in the future)"),
6477
7148
  culture: z.string().optional().describe("Culture code for variant-specific scheduling (e.g. 'en-US'). Omit for invariant content.")
6478
7149
  };
6479
- var outputSchema87 = z.object({
7150
+ var outputSchema99 = z.object({
6480
7151
  message: z.string(),
6481
7152
  id: z.string(),
6482
7153
  name: z.string(),
6483
7154
  scheduledDate: z.string(),
6484
7155
  previewUrl: previewUrlSchema
6485
7156
  });
6486
- var tool87 = {
7157
+ var tool99 = {
6487
7158
  name: "schedule-publish",
6488
7159
  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.",
6489
- inputSchema: inputSchema87,
6490
- outputSchema: outputSchema87,
7160
+ inputSchema: inputSchema99,
7161
+ outputSchema: outputSchema99,
6491
7162
  slices: ["publish"],
6492
7163
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
6493
7164
  handler: async ({ id, publishDate, culture }, extra) => {
@@ -6512,22 +7183,22 @@ var tool87 = {
6512
7183
  });
6513
7184
  }
6514
7185
  };
6515
- var schedule_publish_default = withStandardDecorators(tool87);
6516
- var inputSchema88 = {
7186
+ var schedule_publish_default = withStandardDecorators(tool99);
7187
+ var inputSchema100 = {
6517
7188
  id: z.string().uuid().describe("The ID of the page whose scheduled publish should be cancelled"),
6518
7189
  culture: z.string().optional().describe("Culture code to check for a scheduled variant (e.g. 'en-US'). Omit for invariant content.")
6519
7190
  };
6520
- var outputSchema88 = z.object({
7191
+ var outputSchema100 = z.object({
6521
7192
  message: z.string(),
6522
7193
  id: z.string(),
6523
7194
  name: z.string(),
6524
7195
  previewUrl: previewUrlSchema
6525
7196
  });
6526
- var tool88 = {
7197
+ var tool100 = {
6527
7198
  name: "cancel-schedule",
6528
7199
  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.",
6529
- inputSchema: inputSchema88,
6530
- outputSchema: outputSchema88,
7200
+ inputSchema: inputSchema100,
7201
+ outputSchema: outputSchema100,
6531
7202
  slices: ["publish"],
6532
7203
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
6533
7204
  handler: async ({ id, culture }, extra) => {
@@ -6565,10 +7236,10 @@ var tool88 = {
6565
7236
  });
6566
7237
  }
6567
7238
  };
6568
- var cancel_schedule_default = withStandardDecorators(tool88);
7239
+ var cancel_schedule_default = withStandardDecorators(tool100);
6569
7240
 
6570
7241
  // src/umbraco-api/tools/scheduling/index.ts
6571
- var collection17 = {
7242
+ var collection18 = {
6572
7243
  metadata: {
6573
7244
  name: "scheduling",
6574
7245
  displayName: "Scheduling",
@@ -6576,13 +7247,13 @@ var collection17 = {
6576
7247
  },
6577
7248
  tools: () => [get_publish_status_default, schedule_publish_default, cancel_schedule_default]
6578
7249
  };
6579
- var scheduling_default = collection17;
6580
- var inputSchema89 = {
7250
+ var scheduling_default = collection18;
7251
+ var inputSchema101 = {
6581
7252
  take: z.number().optional().default(50).describe("Number of results to return (default 50)"),
6582
7253
  skip: z.number().optional().default(0).describe("Number of results to skip for pagination"),
6583
7254
  filter: z.string().optional().describe("Filter redirects by URL")
6584
7255
  };
6585
- var outputSchema89 = z.object({
7256
+ var outputSchema101 = z.object({
6586
7257
  items: z.array(
6587
7258
  z.object({
6588
7259
  id: z.string(),
@@ -6594,11 +7265,11 @@ var outputSchema89 = z.object({
6594
7265
  ).describe("URL redirects"),
6595
7266
  total: z.number().describe("Total number of redirects")
6596
7267
  });
6597
- var tool89 = {
7268
+ var tool101 = {
6598
7269
  name: "list-redirects",
6599
7270
  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.",
6600
- inputSchema: inputSchema89,
6601
- outputSchema: outputSchema89,
7271
+ inputSchema: inputSchema101,
7272
+ outputSchema: outputSchema101,
6602
7273
  slices: ["list"],
6603
7274
  annotations: { readOnlyHint: true },
6604
7275
  handler: async ({ take, skip, filter }) => {
@@ -6620,11 +7291,11 @@ var tool89 = {
6620
7291
  });
6621
7292
  }
6622
7293
  };
6623
- var list_redirects_default = withStandardDecorators(tool89);
6624
- var inputSchema90 = {
7294
+ var list_redirects_default = withStandardDecorators(tool101);
7295
+ var inputSchema102 = {
6625
7296
  id: z.string().uuid().describe("The ID of the redirect to retrieve")
6626
7297
  };
6627
- var outputSchema90 = z.object({
7298
+ var outputSchema102 = z.object({
6628
7299
  id: z.string(),
6629
7300
  originalUrl: z.string(),
6630
7301
  destinationUrl: z.string(),
@@ -6632,11 +7303,11 @@ var outputSchema90 = z.object({
6632
7303
  isAutomatic: z.boolean(),
6633
7304
  createDate: z.string()
6634
7305
  });
6635
- var tool90 = {
7306
+ var tool102 = {
6636
7307
  name: "get-redirect",
6637
7308
  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.",
6638
- inputSchema: inputSchema90,
6639
- outputSchema: outputSchema90,
7309
+ inputSchema: inputSchema102,
7310
+ outputSchema: outputSchema102,
6640
7311
  slices: ["read"],
6641
7312
  annotations: { readOnlyHint: true },
6642
7313
  handler: async ({ id }) => {
@@ -6653,17 +7324,17 @@ var tool90 = {
6653
7324
  });
6654
7325
  }
6655
7326
  };
6656
- var get_redirect_default = withStandardDecorators(tool90);
6657
- var inputSchema91 = {};
6658
- var outputSchema91 = z.object({
7327
+ var get_redirect_default = withStandardDecorators(tool102);
7328
+ var inputSchema103 = {};
7329
+ var outputSchema103 = z.object({
6659
7330
  isEnabled: z.boolean(),
6660
7331
  message: z.string()
6661
7332
  });
6662
- var tool91 = {
7333
+ var tool103 = {
6663
7334
  name: "get-redirect-status",
6664
7335
  description: "Check whether automatic URL redirect tracking is enabled on the site. When enabled, Umbraco automatically creates redirects when pages are moved or renamed.",
6665
- inputSchema: inputSchema91,
6666
- outputSchema: outputSchema91,
7336
+ inputSchema: inputSchema103,
7337
+ outputSchema: outputSchema103,
6667
7338
  slices: ["read"],
6668
7339
  annotations: { readOnlyHint: true },
6669
7340
  handler: async () => {
@@ -6676,20 +7347,20 @@ var tool91 = {
6676
7347
  });
6677
7348
  }
6678
7349
  };
6679
- var get_redirect_status_default = withStandardDecorators(tool91);
6680
- var inputSchema92 = {
7350
+ var get_redirect_status_default = withStandardDecorators(tool103);
7351
+ var inputSchema104 = {
6681
7352
  id: z.string().uuid().describe("The ID of the redirect to delete")
6682
7353
  };
6683
- var outputSchema92 = z.object({
7354
+ var outputSchema104 = z.object({
6684
7355
  message: z.string(),
6685
7356
  id: z.string(),
6686
7357
  originalUrl: z.string()
6687
7358
  });
6688
- var tool92 = {
7359
+ var tool104 = {
6689
7360
  name: "delete-redirect",
6690
7361
  description: "Delete a URL redirect. Visitors following the original URL will get a 404 error. You will be asked to confirm.",
6691
- inputSchema: inputSchema92,
6692
- outputSchema: outputSchema92,
7362
+ inputSchema: inputSchema104,
7363
+ outputSchema: outputSchema104,
6693
7364
  slices: ["delete"],
6694
7365
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
6695
7366
  handler: async ({ id }, extra) => {
@@ -6720,10 +7391,10 @@ var tool92 = {
6720
7391
  });
6721
7392
  }
6722
7393
  };
6723
- var delete_redirect_default = withStandardDecorators(tool92);
7394
+ var delete_redirect_default = withStandardDecorators(tool104);
6724
7395
 
6725
7396
  // src/umbraco-api/tools/redirect/index.ts
6726
- var collection18 = {
7397
+ var collection19 = {
6727
7398
  metadata: {
6728
7399
  name: "redirect",
6729
7400
  displayName: "Redirects",
@@ -6731,12 +7402,12 @@ var collection18 = {
6731
7402
  },
6732
7403
  tools: () => [list_redirects_default, get_redirect_default, get_redirect_status_default, delete_redirect_default]
6733
7404
  };
6734
- var redirect_default = collection18;
6735
- var inputSchema93 = {
7405
+ var redirect_default = collection19;
7406
+ var inputSchema105 = {
6736
7407
  id: z.string().uuid().describe("The ID of the content page or media item to look up references for"),
6737
7408
  type: z.enum(["document", "media"]).describe("Whether the ID refers to a content document or a media item")
6738
7409
  };
6739
- var outputSchema93 = z.object({
7410
+ var outputSchema105 = z.object({
6740
7411
  id: z.string(),
6741
7412
  name: z.string(),
6742
7413
  url: z.string(),
@@ -6771,11 +7442,11 @@ async function buildReferencedBy(refItems) {
6771
7442
  };
6772
7443
  });
6773
7444
  }
6774
- var tool93 = {
7445
+ var tool105 = {
6775
7446
  name: "report-content-references",
6776
7447
  description: "Find which pages reference a given content page or media item. Useful before deleting or restructuring content to understand the impact.",
6777
- inputSchema: inputSchema93,
6778
- outputSchema: outputSchema93,
7448
+ inputSchema: inputSchema105,
7449
+ outputSchema: outputSchema105,
6779
7450
  slices: ["read"],
6780
7451
  annotations: { readOnlyHint: true },
6781
7452
  handler: async ({ id, type }) => {
@@ -6825,18 +7496,18 @@ var tool93 = {
6825
7496
  }
6826
7497
  }
6827
7498
  };
6828
- var report_content_references_default = withStandardDecorators(tool93);
7499
+ var report_content_references_default = withStandardDecorators(tool105);
6829
7500
 
6830
7501
  // src/umbraco-api/tools/helpers/link-extractor.ts
6831
7502
  var UUID_REGEX = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi;
6832
- function isBlockListOrGridValue4(value) {
7503
+ function isBlockListOrGridValue3(value) {
6833
7504
  return value !== null && typeof value === "object" && !Array.isArray(value) && Array.isArray(value.contentData);
6834
7505
  }
6835
- function isRteWithBlocks4(value) {
7506
+ function isRteWithBlocks3(value) {
6836
7507
  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);
6837
7508
  }
6838
7509
  function isPlainRteValue(value) {
6839
- return value !== null && typeof value === "object" && !Array.isArray(value) && typeof value.markup === "string" && !isRteWithBlocks4(value);
7510
+ return value !== null && typeof value === "object" && !Array.isArray(value) && typeof value.markup === "string" && !isRteWithBlocks3(value);
6840
7511
  }
6841
7512
  function extractHrefUrls(html) {
6842
7513
  const urls = [];
@@ -6946,7 +7617,7 @@ function extractLinksFromValues(values) {
6946
7617
  return;
6947
7618
  }
6948
7619
  if (typeof val === "object") {
6949
- if (isRteWithBlocks4(val)) {
7620
+ if (isRteWithBlocks3(val)) {
6950
7621
  processHtml(val.markup);
6951
7622
  const blockValues = extractBlockValues(val.blocks.contentData);
6952
7623
  for (const bv of blockValues) processValue(bv);
@@ -6956,7 +7627,7 @@ function extractLinksFromValues(values) {
6956
7627
  processHtml(val.markup);
6957
7628
  return;
6958
7629
  }
6959
- if (isBlockListOrGridValue4(val)) {
7630
+ if (isBlockListOrGridValue3(val)) {
6960
7631
  const blockValues = extractBlockValues(val.contentData);
6961
7632
  for (const bv of blockValues) processValue(bv);
6962
7633
  return;
@@ -7023,10 +7694,10 @@ async function resolveOutboundIds(candidateIds, excludeId) {
7023
7694
  }
7024
7695
 
7025
7696
  // src/umbraco-api/tools/relationships/get/report-outbound-links.ts
7026
- var inputSchema94 = {
7697
+ var inputSchema106 = {
7027
7698
  id: z.string().uuid().describe("The ID of the page to analyze for outbound links")
7028
7699
  };
7029
- var outputSchema94 = z.object({
7700
+ var outputSchema106 = z.object({
7030
7701
  id: z.string(),
7031
7702
  name: z.string(),
7032
7703
  url: z.string(),
@@ -7058,11 +7729,11 @@ var outputSchema94 = z.object({
7058
7729
  totalLinks: z.number()
7059
7730
  })
7060
7731
  });
7061
- var tool94 = {
7732
+ var tool106 = {
7062
7733
  name: "report-outbound-links",
7063
7734
  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.",
7064
- inputSchema: inputSchema94,
7065
- outputSchema: outputSchema94,
7735
+ inputSchema: inputSchema106,
7736
+ outputSchema: outputSchema106,
7066
7737
  slices: ["read"],
7067
7738
  annotations: { readOnlyHint: true },
7068
7739
  handler: async ({ id }) => {
@@ -7091,10 +7762,10 @@ var tool94 = {
7091
7762
  });
7092
7763
  }
7093
7764
  };
7094
- var report_outbound_links_default = withStandardDecorators(tool94);
7765
+ var report_outbound_links_default = withStandardDecorators(tool106);
7095
7766
 
7096
7767
  // src/umbraco-api/tools/relationships/index.ts
7097
- var collection19 = {
7768
+ var collection20 = {
7098
7769
  metadata: {
7099
7770
  name: "relationships",
7100
7771
  displayName: "Content Relationships",
@@ -7102,11 +7773,11 @@ var collection19 = {
7102
7773
  },
7103
7774
  tools: () => [report_content_references_default, report_outbound_links_default]
7104
7775
  };
7105
- var relationships_default = collection19;
7106
- var inputSchema95 = {
7776
+ var relationships_default = collection20;
7777
+ var inputSchema107 = {
7107
7778
  id: z.string().uuid().describe("The ID of the content page to read public access settings for")
7108
7779
  };
7109
- var outputSchema95 = z.object({
7780
+ var outputSchema107 = z.object({
7110
7781
  hasRestrictions: z.boolean().describe("True if the page has public access rules configured"),
7111
7782
  memberGroups: z.array(z.object({
7112
7783
  id: z.string(),
@@ -7117,11 +7788,11 @@ var outputSchema95 = z.object({
7117
7788
  errorPageId: z.string().nullable().describe("The ID of the page shown when an authenticated visitor is denied access"),
7118
7789
  message: z.string().describe("Human-readable summary of the access rules")
7119
7790
  });
7120
- var tool95 = {
7791
+ var tool107 = {
7121
7792
  name: "get-public-access",
7122
7793
  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.",
7123
- inputSchema: inputSchema95,
7124
- outputSchema: outputSchema95,
7794
+ inputSchema: inputSchema107,
7795
+ outputSchema: outputSchema107,
7125
7796
  slices: ["read"],
7126
7797
  annotations: { readOnlyHint: true },
7127
7798
  handler: async ({ id }) => {
@@ -7154,15 +7825,15 @@ var tool95 = {
7154
7825
  });
7155
7826
  }
7156
7827
  };
7157
- var get_public_access_default = withStandardDecorators(tool95);
7158
- var inputSchema96 = {
7828
+ var get_public_access_default = withStandardDecorators(tool107);
7829
+ var inputSchema108 = {
7159
7830
  id: z.string().uuid().describe("The ID of the content page to restrict"),
7160
7831
  memberGroupNames: z.array(z.string()).describe("Names of member groups allowed to view the page. Use list-member-groups to look up existing groups."),
7161
7832
  loginPageId: z.string().uuid().describe("The ID of the page visitors are redirected to when login is required"),
7162
7833
  errorPageId: z.string().uuid().describe("The ID of the page shown when an authenticated visitor is denied access"),
7163
7834
  memberUserNames: z.array(z.string()).optional().describe("Optional: specific member usernames allowed to view the page (in addition to group members)")
7164
7835
  };
7165
- var outputSchema96 = z.object({
7836
+ var outputSchema108 = z.object({
7166
7837
  message: z.string(),
7167
7838
  id: z.string(),
7168
7839
  memberGroupNames: z.array(z.string()),
@@ -7170,11 +7841,11 @@ var outputSchema96 = z.object({
7170
7841
  loginPageId: z.string(),
7171
7842
  errorPageId: z.string()
7172
7843
  });
7173
- var tool96 = {
7844
+ var tool108 = {
7174
7845
  name: "set-public-access",
7175
7846
  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.",
7176
- inputSchema: inputSchema96,
7177
- outputSchema: outputSchema96,
7847
+ inputSchema: inputSchema108,
7848
+ outputSchema: outputSchema108,
7178
7849
  slices: ["update"],
7179
7850
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
7180
7851
  handler: async ({ id, memberGroupNames, loginPageId, errorPageId, memberUserNames }, extra) => {
@@ -7212,19 +7883,19 @@ var tool96 = {
7212
7883
  });
7213
7884
  }
7214
7885
  };
7215
- var set_public_access_default = withStandardDecorators(tool96);
7216
- var inputSchema97 = {
7886
+ var set_public_access_default = withStandardDecorators(tool108);
7887
+ var inputSchema109 = {
7217
7888
  id: z.string().uuid().describe("The ID of the content page to remove public access restrictions from")
7218
7889
  };
7219
- var outputSchema97 = z.object({
7890
+ var outputSchema109 = z.object({
7220
7891
  message: z.string(),
7221
7892
  id: z.string()
7222
7893
  });
7223
- var tool97 = {
7894
+ var tool109 = {
7224
7895
  name: "remove-public-access",
7225
7896
  description: "Remove all public access restrictions from a content page, making it publicly viewable again. You will be asked to confirm.",
7226
- inputSchema: inputSchema97,
7227
- outputSchema: outputSchema97,
7897
+ inputSchema: inputSchema109,
7898
+ outputSchema: outputSchema109,
7228
7899
  slices: ["delete"],
7229
7900
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true },
7230
7901
  handler: async ({ id }, extra) => {
@@ -7239,10 +7910,10 @@ var tool97 = {
7239
7910
  });
7240
7911
  }
7241
7912
  };
7242
- var remove_public_access_default = withStandardDecorators(tool97);
7913
+ var remove_public_access_default = withStandardDecorators(tool109);
7243
7914
 
7244
7915
  // src/umbraco-api/tools/public-access/index.ts
7245
- var collection20 = {
7916
+ var collection21 = {
7246
7917
  metadata: {
7247
7918
  name: "public-access",
7248
7919
  displayName: "Public Access",
@@ -7250,7 +7921,7 @@ var collection20 = {
7250
7921
  },
7251
7922
  tools: () => [get_public_access_default, set_public_access_default, remove_public_access_default]
7252
7923
  };
7253
- var public_access_default = collection20;
7924
+ var public_access_default = collection21;
7254
7925
 
7255
7926
  // src/umbraco-api/tools/helpers/runtime.ts
7256
7927
  var isHostedRuntime = () => {
@@ -7260,7 +7931,7 @@ var isHostedRuntime = () => {
7260
7931
  };
7261
7932
 
7262
7933
  // src/umbraco-api/tools/notifications/get/get-content-notifications.ts
7263
- var inputSchema98 = {
7934
+ var inputSchema110 = {
7264
7935
  id: z.string().uuid().describe("UUID of the content page to read notification subscriptions for")
7265
7936
  };
7266
7937
  var subscriptionSchema = z.object({
@@ -7268,16 +7939,16 @@ var subscriptionSchema = z.object({
7268
7939
  alias: z.string().describe("Human-readable action alias (e.g. publish, unpublish, save, delete)"),
7269
7940
  subscribed: z.boolean().describe("True if the current user is subscribed to this action")
7270
7941
  });
7271
- var outputSchema98 = z.object({
7942
+ var outputSchema110 = z.object({
7272
7943
  id: z.string(),
7273
7944
  subscriptions: z.array(subscriptionSchema),
7274
7945
  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")
7275
7946
  });
7276
- var tool98 = {
7947
+ var tool110 = {
7277
7948
  name: "get-content-notifications",
7278
7949
  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.",
7279
- inputSchema: inputSchema98,
7280
- outputSchema: outputSchema98,
7950
+ inputSchema: inputSchema110,
7951
+ outputSchema: outputSchema110,
7281
7952
  slices: ["read"],
7282
7953
  annotations: { readOnlyHint: true },
7283
7954
  enabled: isHostedRuntime,
@@ -7293,21 +7964,21 @@ var tool98 = {
7293
7964
  return createToolResult({ id, subscriptions, subscribedActionIds });
7294
7965
  }
7295
7966
  };
7296
- var get_content_notifications_default = withStandardDecorators(tool98);
7297
- var inputSchema99 = {
7967
+ var get_content_notifications_default = withStandardDecorators(tool110);
7968
+ var inputSchema111 = {
7298
7969
  id: z.string().uuid().describe("UUID of the content page to update notification subscriptions for"),
7299
7970
  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.")
7300
7971
  };
7301
- var outputSchema99 = z.object({
7972
+ var outputSchema111 = z.object({
7302
7973
  message: z.string(),
7303
7974
  id: z.string(),
7304
7975
  subscribedActionIds: z.array(z.string())
7305
7976
  });
7306
- var tool99 = {
7977
+ var tool111 = {
7307
7978
  name: "set-content-notifications",
7308
7979
  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.",
7309
- inputSchema: inputSchema99,
7310
- outputSchema: outputSchema99,
7980
+ inputSchema: inputSchema111,
7981
+ outputSchema: outputSchema111,
7311
7982
  slices: ["update"],
7312
7983
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
7313
7984
  enabled: isHostedRuntime,
@@ -7325,10 +7996,10 @@ var tool99 = {
7325
7996
  });
7326
7997
  }
7327
7998
  };
7328
- var set_content_notifications_default = withStandardDecorators(tool99);
7999
+ var set_content_notifications_default = withStandardDecorators(tool111);
7329
8000
 
7330
8001
  // src/umbraco-api/tools/notifications/index.ts
7331
- var collection21 = {
8002
+ var collection22 = {
7332
8003
  metadata: {
7333
8004
  name: "notifications",
7334
8005
  displayName: "Content Notifications",
@@ -7336,7 +8007,7 @@ var collection21 = {
7336
8007
  },
7337
8008
  tools: () => isHostedRuntime() ? [get_content_notifications_default, set_content_notifications_default] : []
7338
8009
  };
7339
- var notifications_default = collection21;
8010
+ var notifications_default = collection22;
7340
8011
  var mediaTools = {
7341
8012
  listRoot: "get-recycle-bin-media-root",
7342
8013
  listChildren: "get-recycle-bin-media-children",
@@ -7399,13 +8070,13 @@ function formatNamePreview(names, total) {
7399
8070
  }
7400
8071
 
7401
8072
  // src/umbraco-api/tools/recycle-bin/get/list-recycle-bin.ts
7402
- var inputSchema100 = {
8073
+ var inputSchema112 = {
7403
8074
  type: z.enum(["content", "media"]).describe("Which recycle bin to list: content (pages) or media."),
7404
8075
  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."),
7405
8076
  take: z.number().optional().default(20).describe("Number of results to return (default 20)"),
7406
8077
  skip: z.number().optional().default(0).describe("Number of results to skip for pagination")
7407
8078
  };
7408
- var outputSchema100 = z.object({
8079
+ var outputSchema112 = z.object({
7409
8080
  items: z.array(z.object({
7410
8081
  id: z.string(),
7411
8082
  name: z.string(),
@@ -7414,11 +8085,11 @@ var outputSchema100 = z.object({
7414
8085
  })).describe("Trashed items at this level of the recycle bin"),
7415
8086
  total: z.number().describe("Total number of trashed items at this level (before pagination)")
7416
8087
  });
7417
- var tool100 = {
8088
+ var tool112 = {
7418
8089
  name: "list-recycle-bin",
7419
8090
  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.",
7420
- inputSchema: inputSchema100,
7421
- outputSchema: outputSchema100,
8091
+ inputSchema: inputSchema112,
8092
+ outputSchema: outputSchema112,
7422
8093
  slices: ["list", "tree"],
7423
8094
  annotations: { readOnlyHint: true },
7424
8095
  handler: async ({ type, parentId, take, skip }) => {
@@ -7441,22 +8112,22 @@ var tool100 = {
7441
8112
  });
7442
8113
  }
7443
8114
  };
7444
- var list_recycle_bin_default = withStandardDecorators(tool100);
7445
- var inputSchema101 = {
8115
+ var list_recycle_bin_default = withStandardDecorators(tool112);
8116
+ var inputSchema113 = {
7446
8117
  id: z.string().uuid().describe("ID of the trashed item to permanently delete."),
7447
8118
  type: z.enum(["content", "media"]).describe("Which recycle bin the item is in.")
7448
8119
  };
7449
- var outputSchema101 = z.object({
8120
+ var outputSchema113 = z.object({
7450
8121
  message: z.string(),
7451
8122
  id: z.string(),
7452
8123
  name: z.string(),
7453
8124
  descendantCount: z.number().optional().describe("Descendants also deleted when the item was a folder")
7454
8125
  });
7455
- var tool101 = {
8126
+ var tool113 = {
7456
8127
  name: "permanent-delete-recycle-bin-item",
7457
8128
  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.",
7458
- inputSchema: inputSchema101,
7459
- outputSchema: outputSchema101,
8129
+ inputSchema: inputSchema113,
8130
+ outputSchema: outputSchema113,
7460
8131
  slices: ["delete"],
7461
8132
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
7462
8133
  handler: async ({ id, type }, extra) => {
@@ -7503,20 +8174,20 @@ var tool101 = {
7503
8174
  });
7504
8175
  }
7505
8176
  };
7506
- var permanent_delete_recycle_bin_item_default = withStandardDecorators(tool101);
7507
- var inputSchema102 = {
8177
+ var permanent_delete_recycle_bin_item_default = withStandardDecorators(tool113);
8178
+ var inputSchema114 = {
7508
8179
  type: z.enum(["content", "media"]).describe("Which recycle bin to empty.")
7509
8180
  };
7510
- var outputSchema102 = z.object({
8181
+ var outputSchema114 = z.object({
7511
8182
  message: z.string(),
7512
8183
  type: z.enum(["content", "media"]),
7513
8184
  topLevelCount: z.number().describe("Number of top-level items that were in the bin before emptying (descendants are not counted).")
7514
8185
  });
7515
- var tool102 = {
8186
+ var tool114 = {
7516
8187
  name: "empty-recycle-bin",
7517
8188
  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.",
7518
- inputSchema: inputSchema102,
7519
- outputSchema: outputSchema102,
8189
+ inputSchema: inputSchema114,
8190
+ outputSchema: outputSchema114,
7520
8191
  slices: ["delete"],
7521
8192
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
7522
8193
  handler: async ({ type }, extra) => {
@@ -7561,10 +8232,10 @@ var tool102 = {
7561
8232
  });
7562
8233
  }
7563
8234
  };
7564
- var empty_recycle_bin_default = withStandardDecorators(tool102);
8235
+ var empty_recycle_bin_default = withStandardDecorators(tool114);
7565
8236
 
7566
8237
  // src/umbraco-api/tools/recycle-bin/index.ts
7567
- var collection22 = {
8238
+ var collection23 = {
7568
8239
  metadata: {
7569
8240
  name: "recycle-bin",
7570
8241
  displayName: "Recycle Bin",
@@ -7572,9 +8243,9 @@ var collection22 = {
7572
8243
  },
7573
8244
  tools: () => [list_recycle_bin_default, permanent_delete_recycle_bin_item_default, empty_recycle_bin_default]
7574
8245
  };
7575
- var recycle_bin_default = collection22;
7576
- var inputSchema103 = {};
7577
- var outputSchema103 = z.object({
8246
+ var recycle_bin_default = collection23;
8247
+ var inputSchema115 = {};
8248
+ var outputSchema115 = z.object({
7578
8249
  id: z.string(),
7579
8250
  name: z.string(),
7580
8251
  userName: z.string(),
@@ -7596,11 +8267,11 @@ var outputSchema103 = z.object({
7596
8267
  documentStartNodeIds: z.array(z.string()).describe("Content node IDs the user is restricted to. Empty when hasDocumentRootAccess is true."),
7597
8268
  mediaStartNodeIds: z.array(z.string()).describe("Media node IDs the user is restricted to. Empty when hasMediaRootAccess is true.")
7598
8269
  });
7599
- var tool103 = {
8270
+ var tool115 = {
7600
8271
  name: "get-current-user",
7601
8272
  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.",
7602
- inputSchema: inputSchema103,
7603
- outputSchema: outputSchema103,
8273
+ inputSchema: inputSchema115,
8274
+ outputSchema: outputSchema115,
7604
8275
  slices: ["read"],
7605
8276
  annotations: { readOnlyHint: true },
7606
8277
  handler: async () => {
@@ -7639,10 +8310,10 @@ var tool103 = {
7639
8310
  });
7640
8311
  }
7641
8312
  };
7642
- var get_current_user_default = withStandardDecorators(tool103);
8313
+ var get_current_user_default = withStandardDecorators(tool115);
7643
8314
 
7644
8315
  // src/umbraco-api/tools/account/index.ts
7645
- var collection23 = {
8316
+ var collection24 = {
7646
8317
  metadata: {
7647
8318
  name: "account",
7648
8319
  displayName: "Account",
@@ -7650,22 +8321,7 @@ var collection23 = {
7650
8321
  },
7651
8322
  tools: () => [get_current_user_default]
7652
8323
  };
7653
- var account_default = collection23;
7654
- var toolSliceNames = [
7655
- // Base slices from toolkit (create, read, update, delete, list)
7656
- ...baseSliceNames,
7657
- // Query
7658
- "search",
7659
- // Navigation
7660
- "tree",
7661
- // Workflow
7662
- "publish",
7663
- // Versioning
7664
- "version",
7665
- // Movement
7666
- "move"
7667
- ];
7668
- var allSliceNames = [...toolSliceNames, "other"];
8324
+ var account_default = collection24;
7669
8325
 
7670
8326
  // src/config/mode-registry.ts
7671
8327
  var toolModes = [
@@ -7681,6 +8337,12 @@ var toolModes = [
7681
8337
  description: "Browse, search, upload, and manage media files and folders",
7682
8338
  collections: ["media", "media-management"]
7683
8339
  },
8340
+ {
8341
+ name: "library",
8342
+ displayName: "Library Elements",
8343
+ description: "Browse, view, and manage reusable Library elements (Umbraco 18 Library section)",
8344
+ collections: ["element"]
8345
+ },
7684
8346
  {
7685
8347
  name: "blueprints",
7686
8348
  displayName: "Blueprints",
@@ -7768,6 +8430,49 @@ var toolModes = [
7768
8430
  ];
7769
8431
  var allModes = [...toolModes];
7770
8432
  var allModeNames = toolModes.map((m) => m.name);
8433
+ var toolSliceNames = [
8434
+ // Base slices from toolkit (create, read, update, delete, list)
8435
+ ...baseSliceNames,
8436
+ // Query
8437
+ "search",
8438
+ // Navigation
8439
+ "tree",
8440
+ // Workflow
8441
+ "publish",
8442
+ // Versioning
8443
+ "version",
8444
+ // Movement
8445
+ "move"
8446
+ ];
8447
+ var allSliceNames = [...toolSliceNames, "other"];
8448
+
8449
+ // src/collections.ts
8450
+ var collections = [
8451
+ content_default,
8452
+ publishing_default,
8453
+ versioning_default,
8454
+ media_default,
8455
+ media_management_default,
8456
+ element_default,
8457
+ blueprint_default,
8458
+ language_default,
8459
+ translation_default,
8460
+ dictionary_default,
8461
+ tag_default,
8462
+ content_health_default,
8463
+ site_structure_default,
8464
+ bulk_operations_default,
8465
+ member_default,
8466
+ member_group_default,
8467
+ member_reporting_default,
8468
+ scheduling_default,
8469
+ redirect_default,
8470
+ relationships_default,
8471
+ public_access_default,
8472
+ notifications_default,
8473
+ recycle_bin_default,
8474
+ account_default
8475
+ ];
7771
8476
  var customFields = [
7772
8477
  {
7773
8478
  name: "disableMcpChaining",
@@ -7893,31 +8598,7 @@ initializeUmbracoFetch({
7893
8598
  clientSecret: serverConfig.umbraco.auth.clientSecret
7894
8599
  });
7895
8600
  var filterConfig = configLoader.loadFromConfig(serverConfig.umbraco);
7896
- var collections = [
7897
- content_default,
7898
- publishing_default,
7899
- versioning_default,
7900
- media_default,
7901
- media_management_default,
7902
- blueprint_default,
7903
- translation_default,
7904
- language_default,
7905
- dictionary_default,
7906
- tag_default,
7907
- content_health_default,
7908
- site_structure_default,
7909
- bulk_operations_default,
7910
- member_default,
7911
- member_group_default,
7912
- member_reporting_default,
7913
- scheduling_default,
7914
- redirect_default,
7915
- relationships_default,
7916
- public_access_default,
7917
- notifications_default,
7918
- recycle_bin_default,
7919
- account_default
7920
- ];
8601
+ var registeredCollections = collections;
7921
8602
  async function main() {
7922
8603
  const chainingEnabled = mcpServers.length > 0 && !serverConfig.custom.disableMcpChaining;
7923
8604
  let availableChainedTools;
@@ -7939,23 +8620,23 @@ async function main() {
7939
8620
  }
7940
8621
  let registeredToolCount = 0;
7941
8622
  let skippedByDeps = 0;
7942
- for (const collection24 of collections) {
7943
- const collectionName = collection24.metadata.name;
7944
- const tools = collection24.tools({});
7945
- for (const tool104 of tools) {
7946
- const toolWithDeps = CHAINED_DEPS[tool104.name] && !tool104.chainedDeps ? { ...tool104, chainedDeps: CHAINED_DEPS[tool104.name] } : tool104;
8623
+ for (const collection25 of registeredCollections) {
8624
+ const collectionName = collection25.metadata.name;
8625
+ const tools = collection25.tools({});
8626
+ for (const tool116 of tools) {
8627
+ const toolWithDeps = CHAINED_DEPS[tool116.name] && !tool116.chainedDeps ? { ...tool116, chainedDeps: CHAINED_DEPS[tool116.name] } : tool116;
7947
8628
  if (!shouldIncludeTool(toolWithDeps, { collectionName, config: filterConfig, availableChainedTools })) {
7948
- if (availableChainedTools && CHAINED_DEPS[tool104.name]) skippedByDeps++;
8629
+ if (availableChainedTools && CHAINED_DEPS[tool116.name]) skippedByDeps++;
7949
8630
  continue;
7950
8631
  }
7951
- const annotations = createToolAnnotations(tool104);
7952
- server.registerTool(tool104.name, {
7953
- description: tool104.description,
7954
- inputSchema: tool104.inputSchema,
7955
- outputSchema: tool104.outputSchema,
8632
+ const annotations = createToolAnnotations(tool116);
8633
+ server.registerTool(tool116.name, {
8634
+ description: tool116.description,
8635
+ inputSchema: tool116.inputSchema,
8636
+ outputSchema: tool116.outputSchema,
7956
8637
  annotations,
7957
- ...tool104._meta ? { _meta: tool104._meta } : {}
7958
- }, tool104.handler);
8638
+ ...tool116._meta ? { _meta: tool116._meta } : {}
8639
+ }, tool116.handler);
7959
8640
  registeredToolCount++;
7960
8641
  }
7961
8642
  }
@@ -7963,7 +8644,7 @@ async function main() {
7963
8644
  const transport = new StdioServerTransport();
7964
8645
  await server.connect(transport);
7965
8646
  console.error(
7966
- `MCP Server started with ${registeredToolCount} tool(s) from ${collections.length} collection(s)` + (skippedByDeps > 0 ? ` (${skippedByDeps} tool(s) hidden \u2014 chained deps not available for this user)` : "")
8647
+ `MCP Server started with ${registeredToolCount} tool(s) from ${registeredCollections.length} collection(s)` + (skippedByDeps > 0 ? ` (${skippedByDeps} tool(s) hidden \u2014 chained deps not available for this user)` : "")
7967
8648
  );
7968
8649
  }
7969
8650
  process.on("SIGINT", async () => {