@cplace/mcp-server 1.9.1 → 1.10.5

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.
Files changed (235) hide show
  1. package/README.md +12 -13
  2. package/dist/index.js +4 -0
  3. package/dist/index.js.map +1 -1
  4. package/dist/plugins/app-catalog.js +1 -1
  5. package/dist/plugins/app-catalog.js.map +1 -1
  6. package/dist/plugins/application-settings.d.ts.map +1 -1
  7. package/dist/plugins/application-settings.js +6 -3
  8. package/dist/plugins/application-settings.js.map +1 -1
  9. package/dist/plugins/core/widget-specifications/cf.cplace.platform.tableWidget/columns.md +6 -0
  10. package/dist/plugins/core.d.ts.map +1 -1
  11. package/dist/plugins/core.js +25 -13
  12. package/dist/plugins/core.js.map +1 -1
  13. package/dist/plugins/forms-wizard.js +2 -2
  14. package/dist/plugins/forms-wizard.js.map +1 -1
  15. package/dist/plugins/history.d.ts.map +1 -1
  16. package/dist/plugins/history.js +6 -3
  17. package/dist/plugins/history.js.map +1 -1
  18. package/dist/plugins/jobs.js +2 -2
  19. package/dist/plugins/jobs.js.map +1 -1
  20. package/dist/plugins/layouts.d.ts.map +1 -1
  21. package/dist/plugins/layouts.js +17 -8
  22. package/dist/plugins/layouts.js.map +1 -1
  23. package/dist/plugins/low-code.d.ts.map +1 -1
  24. package/dist/plugins/low-code.js +48 -17
  25. package/dist/plugins/low-code.js.map +1 -1
  26. package/dist/plugins/project-planning.d.ts.map +1 -1
  27. package/dist/plugins/project-planning.js +6 -3
  28. package/dist/plugins/project-planning.js.map +1 -1
  29. package/dist/plugins/resource-management.d.ts.map +1 -1
  30. package/dist/plugins/resource-management.js +6 -3
  31. package/dist/plugins/resource-management.js.map +1 -1
  32. package/dist/plugins/solution-management.d.ts.map +1 -1
  33. package/dist/plugins/solution-management.js +6 -3
  34. package/dist/plugins/solution-management.js.map +1 -1
  35. package/dist/plugins/types-write.d.ts.map +1 -1
  36. package/dist/plugins/types-write.js +6 -3
  37. package/dist/plugins/types-write.js.map +1 -1
  38. package/dist/plugins/widget-specifications.d.ts.map +1 -1
  39. package/dist/plugins/widget-specifications.js +2 -2
  40. package/dist/plugins/widget-specifications.js.map +1 -1
  41. package/dist/plugins/workspace-admin.d.ts.map +1 -1
  42. package/dist/plugins/workspace-admin.js +6 -3
  43. package/dist/plugins/workspace-admin.js.map +1 -1
  44. package/dist/str-replace-utils.js +1 -1
  45. package/dist/str-replace-utils.js.map +1 -1
  46. package/dist/tools/apps-catalog.d.ts +1 -1
  47. package/dist/tools/apps-catalog.d.ts.map +1 -1
  48. package/dist/tools/apps-catalog.js +16 -12
  49. package/dist/tools/apps-catalog.js.map +1 -1
  50. package/dist/tools/board-widget.d.ts +2 -2
  51. package/dist/tools/board-widget.d.ts.map +1 -1
  52. package/dist/tools/board-widget.js +354 -201
  53. package/dist/tools/board-widget.js.map +1 -1
  54. package/dist/tools/change-listeners.d.ts +2 -2
  55. package/dist/tools/change-listeners.d.ts.map +1 -1
  56. package/dist/tools/change-listeners.js +125 -57
  57. package/dist/tools/change-listeners.js.map +1 -1
  58. package/dist/tools/common-schemas.d.ts +1 -1
  59. package/dist/tools/common-schemas.d.ts.map +1 -1
  60. package/dist/tools/common-schemas.js +5 -3
  61. package/dist/tools/common-schemas.js.map +1 -1
  62. package/dist/tools/csv-export.d.ts +2 -2
  63. package/dist/tools/csv-export.d.ts.map +1 -1
  64. package/dist/tools/csv-export.js +29 -24
  65. package/dist/tools/csv-export.js.map +1 -1
  66. package/dist/tools/documents.d.ts +2 -2
  67. package/dist/tools/documents.d.ts.map +1 -1
  68. package/dist/tools/documents.js +34 -14
  69. package/dist/tools/documents.js.map +1 -1
  70. package/dist/tools/expert-settings.d.ts +3 -3
  71. package/dist/tools/expert-settings.d.ts.map +1 -1
  72. package/dist/tools/expert-settings.js +97 -38
  73. package/dist/tools/expert-settings.js.map +1 -1
  74. package/dist/tools/get-operations.d.ts +2 -2
  75. package/dist/tools/get-operations.d.ts.map +1 -1
  76. package/dist/tools/get-operations.js +29 -21
  77. package/dist/tools/get-operations.js.map +1 -1
  78. package/dist/tools/job-schedule-trigger.d.ts +2 -2
  79. package/dist/tools/job-schedule-trigger.d.ts.map +1 -1
  80. package/dist/tools/job-schedule-trigger.js +19 -10
  81. package/dist/tools/job-schedule-trigger.js.map +1 -1
  82. package/dist/tools/job-scripts.d.ts +2 -2
  83. package/dist/tools/job-scripts.d.ts.map +1 -1
  84. package/dist/tools/job-scripts.js +119 -55
  85. package/dist/tools/job-scripts.js.map +1 -1
  86. package/dist/tools/jobs.d.ts +2 -2
  87. package/dist/tools/jobs.d.ts.map +1 -1
  88. package/dist/tools/jobs.js +68 -38
  89. package/dist/tools/jobs.js.map +1 -1
  90. package/dist/tools/layout-richstring-shared.d.ts +24 -1
  91. package/dist/tools/layout-richstring-shared.d.ts.map +1 -1
  92. package/dist/tools/layout-richstring-shared.js +99 -1
  93. package/dist/tools/layout-richstring-shared.js.map +1 -1
  94. package/dist/tools/layout-richstring-widgets.d.ts +94 -2
  95. package/dist/tools/layout-richstring-widgets.d.ts.map +1 -1
  96. package/dist/tools/layout-richstring-widgets.js +247 -25
  97. package/dist/tools/layout-richstring-widgets.js.map +1 -1
  98. package/dist/tools/layout.d.ts +5 -4
  99. package/dist/tools/layout.d.ts.map +1 -1
  100. package/dist/tools/layout.js +235 -124
  101. package/dist/tools/layout.js.map +1 -1
  102. package/dist/tools/linting.d.ts +2 -2
  103. package/dist/tools/linting.d.ts.map +1 -1
  104. package/dist/tools/linting.js +5 -5
  105. package/dist/tools/linting.js.map +1 -1
  106. package/dist/tools/page-action-simulation.d.ts +18 -0
  107. package/dist/tools/page-action-simulation.d.ts.map +1 -0
  108. package/dist/tools/page-action-simulation.js +88 -0
  109. package/dist/tools/page-action-simulation.js.map +1 -0
  110. package/dist/tools/page-actions.d.ts +60 -0
  111. package/dist/tools/page-actions.d.ts.map +1 -0
  112. package/dist/tools/page-actions.js +284 -0
  113. package/dist/tools/page-actions.js.map +1 -0
  114. package/dist/tools/pages.d.ts +3 -3
  115. package/dist/tools/pages.d.ts.map +1 -1
  116. package/dist/tools/pages.js +237 -112
  117. package/dist/tools/pages.js.map +1 -1
  118. package/dist/tools/ppt-export-schemas.d.ts +1 -1
  119. package/dist/tools/ppt-export-schemas.d.ts.map +1 -1
  120. package/dist/tools/ppt-export-schemas.js +269 -122
  121. package/dist/tools/ppt-export-schemas.js.map +1 -1
  122. package/dist/tools/ppt-export.d.ts +2 -2
  123. package/dist/tools/ppt-export.d.ts.map +1 -1
  124. package/dist/tools/ppt-export.js +82 -43
  125. package/dist/tools/ppt-export.js.map +1 -1
  126. package/dist/tools/profile-management.d.ts +2 -2
  127. package/dist/tools/profile-management.d.ts.map +1 -1
  128. package/dist/tools/profile-management.js +109 -82
  129. package/dist/tools/profile-management.js.map +1 -1
  130. package/dist/tools/references.d.ts +2 -2
  131. package/dist/tools/references.d.ts.map +1 -1
  132. package/dist/tools/references.js +36 -24
  133. package/dist/tools/references.js.map +1 -1
  134. package/dist/tools/resource-planner-widget.d.ts +2 -2
  135. package/dist/tools/resource-planner-widget.d.ts.map +1 -1
  136. package/dist/tools/resource-planner-widget.js +334 -138
  137. package/dist/tools/resource-planner-widget.js.map +1 -1
  138. package/dist/tools/richstring-marker-resolver.d.ts +16 -0
  139. package/dist/tools/richstring-marker-resolver.d.ts.map +1 -0
  140. package/dist/tools/richstring-marker-resolver.js +47 -0
  141. package/dist/tools/richstring-marker-resolver.js.map +1 -0
  142. package/dist/tools/richstring-widgets.d.ts +6 -16
  143. package/dist/tools/richstring-widgets.d.ts.map +1 -1
  144. package/dist/tools/richstring-widgets.js +184 -129
  145. package/dist/tools/richstring-widgets.js.map +1 -1
  146. package/dist/tools/schedule.d.ts +2 -2
  147. package/dist/tools/schedule.d.ts.map +1 -1
  148. package/dist/tools/schedule.js +23 -14
  149. package/dist/tools/schedule.js.map +1 -1
  150. package/dist/tools/script-logs.d.ts +2 -2
  151. package/dist/tools/script-logs.d.ts.map +1 -1
  152. package/dist/tools/script-logs.js +71 -32
  153. package/dist/tools/script-logs.js.map +1 -1
  154. package/dist/tools/script.d.ts +2 -2
  155. package/dist/tools/script.d.ts.map +1 -1
  156. package/dist/tools/script.js +44 -26
  157. package/dist/tools/script.js.map +1 -1
  158. package/dist/tools/search.d.ts +2 -2
  159. package/dist/tools/search.d.ts.map +1 -1
  160. package/dist/tools/search.js +139 -102
  161. package/dist/tools/search.js.map +1 -1
  162. package/dist/tools/solution-packages.d.ts +2 -2
  163. package/dist/tools/solution-packages.d.ts.map +1 -1
  164. package/dist/tools/solution-packages.js +149 -61
  165. package/dist/tools/solution-packages.js.map +1 -1
  166. package/dist/tools/system.d.ts +2 -2
  167. package/dist/tools/system.d.ts.map +1 -1
  168. package/dist/tools/system.js +43 -21
  169. package/dist/tools/system.js.map +1 -1
  170. package/dist/tools/type-layouts.d.ts +2 -2
  171. package/dist/tools/type-layouts.d.ts.map +1 -1
  172. package/dist/tools/type-layouts.js +67 -31
  173. package/dist/tools/type-layouts.js.map +1 -1
  174. package/dist/tools/type-management.d.ts +86 -70
  175. package/dist/tools/type-management.d.ts.map +1 -1
  176. package/dist/tools/type-management.js +410 -138
  177. package/dist/tools/type-management.js.map +1 -1
  178. package/dist/tools/url-resolution.d.ts +2 -2
  179. package/dist/tools/url-resolution.d.ts.map +1 -1
  180. package/dist/tools/url-resolution.js +16 -12
  181. package/dist/tools/url-resolution.js.map +1 -1
  182. package/dist/tools/users.d.ts +2 -2
  183. package/dist/tools/users.d.ts.map +1 -1
  184. package/dist/tools/users.js +24 -14
  185. package/dist/tools/users.js.map +1 -1
  186. package/dist/tools/validators.d.ts +2 -2
  187. package/dist/tools/validators.d.ts.map +1 -1
  188. package/dist/tools/validators.js +68 -35
  189. package/dist/tools/validators.js.map +1 -1
  190. package/dist/tools/version-check.d.ts +2 -2
  191. package/dist/tools/version-check.d.ts.map +1 -1
  192. package/dist/tools/version-check.js +36 -30
  193. package/dist/tools/version-check.js.map +1 -1
  194. package/dist/tools/version-history.d.ts +2 -2
  195. package/dist/tools/version-history.d.ts.map +1 -1
  196. package/dist/tools/version-history.js +72 -41
  197. package/dist/tools/version-history.js.map +1 -1
  198. package/dist/tools/widget-simulation.d.ts +5 -6
  199. package/dist/tools/widget-simulation.d.ts.map +1 -1
  200. package/dist/tools/widget-simulation.js +60 -42
  201. package/dist/tools/widget-simulation.js.map +1 -1
  202. package/dist/tools/widget-tool-helpers.d.ts +17 -1
  203. package/dist/tools/widget-tool-helpers.d.ts.map +1 -1
  204. package/dist/tools/widget-tool-helpers.js +41 -6
  205. package/dist/tools/widget-tool-helpers.js.map +1 -1
  206. package/dist/tools/widgets.d.ts +2 -2
  207. package/dist/tools/widgets.d.ts.map +1 -1
  208. package/dist/tools/widgets.js +62 -43
  209. package/dist/tools/widgets.js.map +1 -1
  210. package/dist/tools/wizards.d.ts +2 -2
  211. package/dist/tools/wizards.d.ts.map +1 -1
  212. package/dist/tools/wizards.js +378 -182
  213. package/dist/tools/wizards.js.map +1 -1
  214. package/dist/tools/workflow-execution.d.ts +2 -2
  215. package/dist/tools/workflow-execution.d.ts.map +1 -1
  216. package/dist/tools/workflow-execution.js +27 -19
  217. package/dist/tools/workflow-execution.js.map +1 -1
  218. package/dist/tools/workflow-scripts.d.ts +2 -2
  219. package/dist/tools/workflow-scripts.d.ts.map +1 -1
  220. package/dist/tools/workflow-scripts.js +168 -81
  221. package/dist/tools/workflow-scripts.js.map +1 -1
  222. package/dist/tools/workflow.d.ts +2 -2
  223. package/dist/tools/workflow.d.ts.map +1 -1
  224. package/dist/tools/workflow.js +185 -74
  225. package/dist/tools/workflow.js.map +1 -1
  226. package/dist/tools/workspace-admin.d.ts +2 -2
  227. package/dist/tools/workspace-admin.d.ts.map +1 -1
  228. package/dist/tools/workspace-admin.js +82 -40
  229. package/dist/tools/workspace-admin.js.map +1 -1
  230. package/dist/tools/workspace-core.d.ts +2 -2
  231. package/dist/tools/workspace-core.d.ts.map +1 -1
  232. package/dist/tools/workspace-core.js +93 -53
  233. package/dist/tools/workspace-core.js.map +1 -1
  234. package/dist/utils/dateValidation.js.map +1 -1
  235. package/package.json +9 -4
@@ -1,6 +1,6 @@
1
- import { z } from "zod";
2
- import { debugLogWithTag } from "../logger.js";
3
- import { checkResponseSize } from "../utils.js";
1
+ import { z } from 'zod';
2
+ import { debugLogWithTag } from '../logger.js';
3
+ import { checkResponseSize } from '../utils.js';
4
4
  function stripPagePrefix(uid) {
5
5
  return uid.startsWith('page/') ? uid.substring(5) : uid;
6
6
  }
@@ -63,13 +63,13 @@ async function resolveWizard(client, workspaceId, wizardName) {
63
63
  debugLogWithTag('WIZARD_RESOLVE', `Resolving wizard '${wizardName}' in workspace '${workspaceId}'`);
64
64
  const cplaceFilter = {
65
65
  filters: [
66
- { type: "Type", types: [WIZARD_TYPE] },
67
- { type: "Workspace", workspaceIds: [workspaceId] },
68
- { type: "BuiltinAttributeValue", attribute: "name", operator: "equals", string: wizardName }
69
- ]
66
+ { type: 'Type', types: [WIZARD_TYPE] },
67
+ { type: 'Workspace', workspaceIds: [workspaceId] },
68
+ { type: 'BuiltinAttributeValue', attribute: 'name', operator: 'equals', string: wizardName },
69
+ ],
70
70
  };
71
71
  const searchResult = await client.makeApiRequest('json/search', 'GET', {
72
- filter: JSON.stringify(cplaceFilter)
72
+ filter: JSON.stringify(cplaceFilter),
73
73
  });
74
74
  const pages = searchResult?.results || [];
75
75
  if (pages.length === 0) {
@@ -86,13 +86,18 @@ async function resolveWizardWithSteps(client, workspaceId, wizardName) {
86
86
  debugLogWithTag('WIZARD_RESOLVE', `Resolving steps for wizard '${wizardName}' (${wizard.uid})`);
87
87
  const stepFilter = {
88
88
  filters: [
89
- { type: "Type", types: [STEP_TYPE] },
90
- { type: "Workspace", workspaceIds: [workspaceId] },
91
- { type: "CustomAttributeValue", attribute: STEP_ATTR.wizardRef, operator: "equals", reference: wizard.uid }
92
- ]
89
+ { type: 'Type', types: [STEP_TYPE] },
90
+ { type: 'Workspace', workspaceIds: [workspaceId] },
91
+ {
92
+ type: 'CustomAttributeValue',
93
+ attribute: STEP_ATTR.wizardRef,
94
+ operator: 'equals',
95
+ reference: wizard.uid,
96
+ },
97
+ ],
93
98
  };
94
99
  const searchResult = await client.makeApiRequest('json/search', 'GET', {
95
- filter: JSON.stringify(stepFilter)
100
+ filter: JSON.stringify(stepFilter),
96
101
  });
97
102
  const stepPages = searchResult?.results || [];
98
103
  const steps = new Map();
@@ -112,7 +117,7 @@ async function resolveTypeInternalNames(client, workspaceId, typeInternalNames)
112
117
  debugLogWithTag('WIZARD_RESOLVE', `Resolving type '${internalName}' in workspace '${workspaceId}'`);
113
118
  const result = await client.makeApiRequest('json/type-definition', 'GET', {
114
119
  workspaceId,
115
- internalName
120
+ internalName,
116
121
  });
117
122
  const uid = result.uid;
118
123
  if (!uid) {
@@ -124,7 +129,10 @@ async function resolveTypeInternalNames(client, workspaceId, typeInternalNames)
124
129
  }
125
130
  async function setWizardTriggerTypes(client, workspaceId, wizardUid, typeInternalNames) {
126
131
  try {
127
- await client.makeApiRequest('json/wizard/triggerTypes', 'POST', undefined, { wizardId: stripPagePrefix(wizardUid), triggerTypes: typeInternalNames });
132
+ await client.makeApiRequest('json/wizard/triggerTypes', 'POST', undefined, {
133
+ wizardId: stripPagePrefix(wizardUid),
134
+ triggerTypes: typeInternalNames,
135
+ });
128
136
  debugLogWithTag('WIZARD_MANAGE', `Set triggerTypes via dedicated endpoint for wizard '${wizardUid}'`);
129
137
  return { method: 'endpoint' };
130
138
  }
@@ -133,16 +141,17 @@ async function setWizardTriggerTypes(client, workspaceId, wizardUid, typeInterna
133
141
  if (errorMsg.includes('404') || errorMsg.includes('Not Found')) {
134
142
  debugLogWithTag('WIZARD_MANAGE', `Dedicated triggerTypes endpoint not available, falling back to page API`);
135
143
  const resolvedUids = await resolveTypeInternalNames(client, workspaceId, typeInternalNames);
136
- const bareIds = resolvedUids.map(uid => uid.replace(/^typeDefinition\//, ''));
144
+ const bareIds = resolvedUids.map((uid) => uid.replace(/^typeDefinition\//, ''));
137
145
  return { method: 'fallback', resolvedUids: bareIds };
138
146
  }
139
147
  throw error;
140
148
  }
141
149
  }
142
150
  function enhanceWizardError(errorMessage) {
143
- if (errorMessage.includes('cf.cplace.formsWizard') && (errorMessage.includes('not found') ||
144
- errorMessage.includes('Type definition not found') ||
145
- errorMessage.includes('Ungültiger Wert'))) {
151
+ if (errorMessage.includes('cf.cplace.formsWizard') &&
152
+ (errorMessage.includes('not found') ||
153
+ errorMessage.includes('Type definition not found') ||
154
+ errorMessage.includes('Ungültiger Wert'))) {
146
155
  return `${errorMessage}\nHint: The Forms Wizard app may not be installed in this workspace. Use cplace_install_workspace_app with qualifiedName 'cf.cplace.formsWizard' to install it.`;
147
156
  }
148
157
  return errorMessage;
@@ -161,7 +170,7 @@ async function configureFormStepAttributes(client, configPageUid, formAttributes
161
170
  attributes: {
162
171
  [FORM_CONFIG_ATTR.typeNameToAttributesMapping]: typeNameToAttributesMapping,
163
172
  [FORM_CONFIG_ATTR.layout]: JSON.stringify(layout),
164
- }
173
+ },
165
174
  });
166
175
  }
167
176
  function resolveStepTypeEnum(stepType) {
@@ -230,117 +239,175 @@ export const WIZARD_TOOL_DEFINITIONS = {
230
239
  [TOOL_MANAGE_WIZARD]: {
231
240
  description: "Create or update a Forms Wizard configuration. Wizards define multi-step guided workflows for data entry and process automation. Use 'create' to define a new wizard with display names, target workspaces, and behavior options. Use 'update' to modify an existing wizard's properties.",
232
241
  inputSchema: {
233
- operation: z.enum(["create", "update"]).describe("Operation type: 'create' for new wizards, 'update' for existing wizards"),
234
- workspaceId: z.string().describe("The workspace ID where the wizard lives (e.g., 'iwu7z9iscgr0')"),
235
- wizardName: z.string().describe("For create: the name to give the wizard. For update: identifies the wizard to modify."),
236
- localizedDisplayNames: z.record(z.string()).optional().describe("Localized display names (e.g., {\"en\": \"My Wizard\", \"de\": \"Mein Assistent\"})"),
237
- description: z.string().optional().describe("Wizard description text"),
238
- targetWorkspaces: z.array(z.string()).optional().describe("Workspace IDs where the wizard can be used"),
239
- triggeringTypes: z.array(z.string()).optional().describe("Type internal names that trigger this wizard (e.g., ['cf.example.Task'])"),
240
- autoPersist: z.boolean().optional().describe("Auto-persist changes after each step (default: false)"),
241
- refreshAfterFinish: z.boolean().optional().describe("Refresh page after wizard finishes (default: false)"),
242
- showProgressBar: z.boolean().optional().describe("Show progress bar during wizard execution"),
243
- showPercent: z.boolean().optional().describe("Show percentage in progress bar"),
242
+ operation: z
243
+ .enum(['create', 'update'])
244
+ .describe("Operation type: 'create' for new wizards, 'update' for existing wizards"),
245
+ workspaceId: z
246
+ .string()
247
+ .describe("The workspace ID where the wizard lives (e.g., 'iwu7z9iscgr0')"),
248
+ wizardName: z
249
+ .string()
250
+ .describe('For create: the name to give the wizard. For update: identifies the wizard to modify.'),
251
+ localizedDisplayNames: z
252
+ .record(z.string())
253
+ .optional()
254
+ .describe('Localized display names (e.g., {"en": "My Wizard", "de": "Mein Assistent"})'),
255
+ description: z.string().optional().describe('Wizard description text'),
256
+ targetWorkspaces: z
257
+ .array(z.string())
258
+ .optional()
259
+ .describe('Workspace IDs where the wizard can be used'),
260
+ triggeringTypes: z
261
+ .array(z.string())
262
+ .optional()
263
+ .describe("Type internal names that trigger this wizard (e.g., ['cf.example.Task'])"),
264
+ autoPersist: z
265
+ .boolean()
266
+ .optional()
267
+ .describe('Auto-persist changes after each step (default: false)'),
268
+ refreshAfterFinish: z
269
+ .boolean()
270
+ .optional()
271
+ .describe('Refresh page after wizard finishes (default: false)'),
272
+ showProgressBar: z.boolean().optional().describe('Show progress bar during wizard execution'),
273
+ showPercent: z.boolean().optional().describe('Show percentage in progress bar'),
244
274
  },
245
- annotations: { title: "Manage Wizard" }
275
+ annotations: { title: 'Manage Wizard' },
246
276
  },
247
277
  [TOOL_MANAGE_WIZARD_STEP]: {
248
- description: "Create or update a wizard step. Steps are the individual screens in a wizard flow. Each step has a type (form, info, table, decision, script) that determines its behavior and configuration options. Step type is immutable after creation.",
278
+ description: 'Create or update a wizard step. Steps are the individual screens in a wizard flow. Each step has a type (form, info, table, decision, script) that determines its behavior and configuration options. Step type is immutable after creation.',
249
279
  inputSchema: {
250
- operation: z.enum(["create", "update"]).describe("Operation type: 'create' for new steps, 'update' for existing steps"),
251
- workspaceId: z.string().describe("The workspace ID where the wizard lives"),
252
- wizardName: z.string().describe("Name of the parent wizard"),
280
+ operation: z
281
+ .enum(['create', 'update'])
282
+ .describe("Operation type: 'create' for new steps, 'update' for existing steps"),
283
+ workspaceId: z.string().describe('The workspace ID where the wizard lives'),
284
+ wizardName: z.string().describe('Name of the parent wizard'),
253
285
  identifier: z.string().describe("Unique step identifier (e.g., 'step-enter-details')"),
254
- stepType: z.enum(["form", "info", "table", "decision", "script"]).optional().describe("Step type — required for create, rejected for update (immutable). Types: form (data entry), info (display content), table (search/select), decision (branching), script (automation)"),
255
- title: z.record(z.string()).optional().describe("Localized step title (e.g., {\"en\": \"Enter Details\", \"de\": \"Details eingeben\"})"),
256
- description: z.string().optional().describe("Step description (rich text/HTML)"),
257
- targetTypes: z.array(z.string()).optional().describe("Form step: type internal names for data entry targets"),
258
- formAttributes: z.record(z.array(z.string())).optional().describe("Form step: map of target type names to attribute arrays to display in the form. IMPORTANT: builtin attributes (e.g., \"name\") use bare identifiers, while custom attributes must be wrapped in single quotes (e.g., \"'test.parentProject'\"). Example: {\"test.project\": [\"name\", \"'test.parentProject'\", \"'test.managers'\"]}. Automatically configures the form step's child configuration page."),
286
+ stepType: z
287
+ .enum(['form', 'info', 'table', 'decision', 'script'])
288
+ .optional()
289
+ .describe('Step type — required for create, rejected for update (immutable). Types: form (data entry), info (display content), table (search/select), decision (branching), script (automation)'),
290
+ title: z
291
+ .record(z.string())
292
+ .optional()
293
+ .describe('Localized step title (e.g., {"en": "Enter Details", "de": "Details eingeben"})'),
294
+ description: z.string().optional().describe('Step description (rich text/HTML)'),
295
+ targetTypes: z
296
+ .array(z.string())
297
+ .optional()
298
+ .describe('Form step: type internal names for data entry targets'),
299
+ formAttributes: z
300
+ .record(z.array(z.string()))
301
+ .optional()
302
+ .describe('Form step: map of target type names to attribute arrays to display in the form. IMPORTANT: builtin attributes (e.g., "name") use bare identifiers, while custom attributes must be wrapped in single quotes (e.g., "\'test.parentProject\'"). Example: {"test.project": ["name", "\'test.parentProject\'", "\'test.managers\'"]}. Automatically configures the form step\'s child configuration page.'),
259
303
  },
260
- annotations: { title: "Manage Wizard Step" }
304
+ annotations: { title: 'Manage Wizard Step' },
261
305
  },
262
306
  [TOOL_DELETE_WIZARD]: {
263
- description: "Delete a wizard and optionally all its child steps. By default, cascade-deletes all steps. Set cascadeDeleteSteps to false to delete only the wizard page.",
307
+ description: 'Delete a wizard and optionally all its child steps. By default, cascade-deletes all steps. Set cascadeDeleteSteps to false to delete only the wizard page.',
264
308
  inputSchema: {
265
- workspaceId: z.string().describe("The workspace ID where the wizard lives"),
266
- wizardName: z.string().describe("Name of the wizard to delete"),
267
- cascadeDeleteSteps: z.boolean().optional().default(true).describe("Delete all child steps too (default: true)"),
309
+ workspaceId: z.string().describe('The workspace ID where the wizard lives'),
310
+ wizardName: z.string().describe('Name of the wizard to delete'),
311
+ cascadeDeleteSteps: z
312
+ .boolean()
313
+ .optional()
314
+ .default(true)
315
+ .describe('Delete all child steps too (default: true)'),
268
316
  },
269
- annotations: { title: "Delete Wizard" }
317
+ annotations: { title: 'Delete Wizard' },
270
318
  },
271
319
  [TOOL_DELETE_WIZARD_STEP]: {
272
- description: "Delete a single wizard step by its identifier. The step is removed from the wizard; any flow references to this step should be updated separately.",
320
+ description: 'Delete a single wizard step by its identifier. The step is removed from the wizard; any flow references to this step should be updated separately.',
273
321
  inputSchema: {
274
- workspaceId: z.string().describe("The workspace ID where the wizard lives"),
275
- wizardName: z.string().describe("Name of the parent wizard"),
276
- identifier: z.string().describe("The identifier of the step to delete"),
322
+ workspaceId: z.string().describe('The workspace ID where the wizard lives'),
323
+ wizardName: z.string().describe('Name of the parent wizard'),
324
+ identifier: z.string().describe('The identifier of the step to delete'),
277
325
  },
278
- annotations: { title: "Delete Wizard Step" }
326
+ annotations: { title: 'Delete Wizard Step' },
279
327
  },
280
328
  [TOOL_CONFIGURE_WIZARD_FLOW]: {
281
- description: "Configure the complete step flow graph for a wizard in a single call. Sets the start step, final steps, optional summary/cleanup steps, and all step-to-step connections. All referenced step identifiers must already exist.",
329
+ description: 'Configure the complete step flow graph for a wizard in a single call. Sets the start step, final steps, optional summary/cleanup steps, and all step-to-step connections. All referenced step identifiers must already exist.',
282
330
  inputSchema: {
283
- workspaceId: z.string().describe("The workspace ID where the wizard lives"),
284
- wizardName: z.string().describe("Name of the wizard to configure"),
285
- startStep: z.string().describe("Identifier of the start step"),
286
- finalSteps: z.array(z.string()).describe("Identifiers of final steps (wizard ends after these)"),
287
- summaryStep: z.string().optional().describe("Identifier of the summary step (shown before finish)"),
288
- cleanupScriptStep: z.string().optional().describe("Identifier of the cleanup script step (runs on finish)"),
289
- stepConnections: z.array(z.object({
290
- from: z.string().describe("Step identifier for the source step"),
291
- nextSteps: z.array(z.string()).describe("Step identifiers for the next possible steps"),
292
- skipTo: z.string().optional().describe("Step identifier to skip to"),
293
- skipToFinish: z.boolean().optional().describe("Allow skipping to finish from this step"),
294
- skipToLabel: z.record(z.string()).optional().describe("Localized label for skip-to button"),
295
- })).describe("Connections between steps defining the flow graph"),
331
+ workspaceId: z.string().describe('The workspace ID where the wizard lives'),
332
+ wizardName: z.string().describe('Name of the wizard to configure'),
333
+ startStep: z.string().describe('Identifier of the start step'),
334
+ finalSteps: z
335
+ .array(z.string())
336
+ .describe('Identifiers of final steps (wizard ends after these)'),
337
+ summaryStep: z
338
+ .string()
339
+ .optional()
340
+ .describe('Identifier of the summary step (shown before finish)'),
341
+ cleanupScriptStep: z
342
+ .string()
343
+ .optional()
344
+ .describe('Identifier of the cleanup script step (runs on finish)'),
345
+ stepConnections: z
346
+ .array(z.object({
347
+ from: z.string().describe('Step identifier for the source step'),
348
+ nextSteps: z.array(z.string()).describe('Step identifiers for the next possible steps'),
349
+ skipTo: z.string().optional().describe('Step identifier to skip to'),
350
+ skipToFinish: z
351
+ .boolean()
352
+ .optional()
353
+ .describe('Allow skipping to finish from this step'),
354
+ skipToLabel: z
355
+ .record(z.string())
356
+ .optional()
357
+ .describe('Localized label for skip-to button'),
358
+ }))
359
+ .describe('Connections between steps defining the flow graph'),
296
360
  },
297
- annotations: { title: "Configure Wizard Flow" }
361
+ annotations: { title: 'Configure Wizard Flow' },
298
362
  },
299
363
  [TOOL_ACTIVATE_WIZARD]: {
300
- description: "Activate or deactivate a wizard. On activation, runs the server-side analysis check (validates start step, final steps, step reachability, etc.). If activation fails, automatically runs analysis and returns detailed error information.",
364
+ description: 'Activate or deactivate a wizard. On activation, runs the server-side analysis check (validates start step, final steps, step reachability, etc.). If activation fails, automatically runs analysis and returns detailed error information.',
301
365
  inputSchema: {
302
- workspaceId: z.string().describe("The workspace ID where the wizard lives"),
303
- wizardName: z.string().describe("Name of the wizard to activate"),
304
- activationState: z.enum(['ACTIVE', 'INACTIVE']).optional().describe("Target activation state (default: 'ACTIVE')"),
366
+ workspaceId: z.string().describe('The workspace ID where the wizard lives'),
367
+ wizardName: z.string().describe('Name of the wizard to activate'),
368
+ activationState: z
369
+ .enum(['ACTIVE', 'INACTIVE'])
370
+ .optional()
371
+ .describe("Target activation state (default: 'ACTIVE')"),
305
372
  },
306
- annotations: { title: "Activate Wizard" }
373
+ annotations: { title: 'Activate Wizard' },
307
374
  },
308
375
  [TOOL_GET_WIZARD_DETAILS]: {
309
- description: "Get detailed information about a wizard including all its steps, flow configuration, and activation state. Returns structured wizard-domain data with step identifiers, types, and connections.",
376
+ description: 'Get detailed information about a wizard including all its steps, flow configuration, and activation state. Returns structured wizard-domain data with step identifiers, types, and connections.',
310
377
  inputSchema: {
311
- workspaceId: z.string().describe("The workspace ID where the wizard lives"),
312
- wizardName: z.string().describe("Name of the wizard to inspect"),
378
+ workspaceId: z.string().describe('The workspace ID where the wizard lives'),
379
+ wizardName: z.string().describe('Name of the wizard to inspect'),
313
380
  },
314
- annotations: { title: "Get Wizard Details" }
381
+ annotations: { title: 'Get Wizard Details' },
315
382
  },
316
383
  [TOOL_LIST_WIZARDS]: {
317
- description: "List all wizards in a workspace. Returns wizard names, display names, and basic configuration summary.",
384
+ description: 'List all wizards in a workspace. Returns wizard names, display names, and basic configuration summary.',
318
385
  inputSchema: {
319
- workspaceId: z.string().describe("The workspace ID to search for wizards"),
386
+ workspaceId: z.string().describe('The workspace ID to search for wizards'),
320
387
  },
321
- annotations: { title: "List Wizards" }
388
+ annotations: { title: 'List Wizards' },
322
389
  },
323
390
  [TOOL_ANALYZE_WIZARD]: {
324
- description: "Run the wizard analysis checks without changing activation state. Returns results from all wizard-level analyzers (start step, step reachability, final steps, leaf nodes, skip configuration, external access) plus per-step type-specific analysis. Use this to validate wizard configuration before activation or to debug why activation fails.",
391
+ description: 'Run the wizard analysis checks without changing activation state. Returns results from all wizard-level analyzers (start step, step reachability, final steps, leaf nodes, skip configuration, external access) plus per-step type-specific analysis. Use this to validate wizard configuration before activation or to debug why activation fails.',
325
392
  inputSchema: {
326
- workspaceId: z.string().describe("The workspace ID where the wizard exists"),
327
- wizardName: z.string().describe("The name of the wizard to analyze"),
393
+ workspaceId: z.string().describe('The workspace ID where the wizard exists'),
394
+ wizardName: z.string().describe('The name of the wizard to analyze'),
328
395
  },
329
- annotations: { title: "Analyze Wizard Configuration" }
396
+ annotations: { title: 'Analyze Wizard Configuration' },
330
397
  },
331
398
  [TOOL_GET_WIZARD_ACTIVATION_STATE]: {
332
- description: "Get the current activation state of a wizard without changing it. Returns whether the wizard is ACTIVE or INACTIVE, and whether the state can be changed. Use this for pre-flight checks before activation, or to monitor wizard states across workspaces.",
399
+ description: 'Get the current activation state of a wizard without changing it. Returns whether the wizard is ACTIVE or INACTIVE, and whether the state can be changed. Use this for pre-flight checks before activation, or to monitor wizard states across workspaces.',
333
400
  inputSchema: {
334
- workspaceId: z.string().describe("The workspace ID where the wizard exists"),
335
- wizardName: z.string().describe("The name of the wizard to check"),
401
+ workspaceId: z.string().describe('The workspace ID where the wizard exists'),
402
+ wizardName: z.string().describe('The name of the wizard to check'),
336
403
  },
337
- annotations: { title: "Get Wizard Activation State" }
404
+ annotations: { title: 'Get Wizard Activation State' },
338
405
  },
339
406
  };
340
407
  export function registerWizardTools(server, client) {
341
408
  server.registerTool(TOOL_MANAGE_WIZARD, WIZARD_TOOL_DEFINITIONS[TOOL_MANAGE_WIZARD], async (params) => {
342
409
  try {
343
- if (params.operation === "create") {
410
+ if (params.operation === 'create') {
344
411
  const requestBody = {
345
412
  workspaceId: params.workspaceId,
346
413
  typeInternalName: WIZARD_TYPE,
@@ -371,12 +438,12 @@ export function registerWizardTools(server, client) {
371
438
  if (ttResult.method === 'fallback' && ttResult.resolvedUids) {
372
439
  await client.makeApiRequest('json/page', 'PATCH', undefined, {
373
440
  pageUID: wizardUid,
374
- attributes: { [WIZARD_ATTR.triggeringTypes]: ttResult.resolvedUids }
441
+ attributes: { [WIZARD_ATTR.triggeringTypes]: ttResult.resolvedUids },
375
442
  });
376
443
  }
377
444
  }
378
445
  return {
379
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
446
+ content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
380
447
  };
381
448
  }
382
449
  else {
@@ -405,8 +472,8 @@ export function registerWizardTools(server, client) {
405
472
  }
406
473
  else if (!hasTriggerTypesUpdate) {
407
474
  return {
408
- content: [{ type: "text", text: "No updates specified." }],
409
- isError: true
475
+ content: [{ type: 'text', text: 'No updates specified.' }],
476
+ isError: true,
410
477
  };
411
478
  }
412
479
  if (hasTriggerTypesUpdate && params.triggeringTypes !== undefined) {
@@ -415,37 +482,49 @@ export function registerWizardTools(server, client) {
415
482
  if (ttResult.method === 'fallback' && ttResult.resolvedUids) {
416
483
  await client.makeApiRequest('json/page', 'PATCH', undefined, {
417
484
  pageUID: resolved.uid,
418
- attributes: { [WIZARD_ATTR.triggeringTypes]: ttResult.resolvedUids }
485
+ attributes: { [WIZARD_ATTR.triggeringTypes]: ttResult.resolvedUids },
419
486
  });
420
487
  }
421
488
  }
422
489
  else {
423
490
  await client.makeApiRequest('json/page', 'PATCH', undefined, {
424
491
  pageUID: resolved.uid,
425
- attributes: { [WIZARD_ATTR.triggeringTypes]: params.triggeringTypes }
492
+ attributes: { [WIZARD_ATTR.triggeringTypes]: params.triggeringTypes },
426
493
  });
427
494
  }
428
495
  }
429
496
  return {
430
- content: [{ type: "text", text: JSON.stringify({ status: 'updated', wizardName: params.wizardName, uid: resolved.uid }, null, 2) }]
497
+ content: [
498
+ {
499
+ type: 'text',
500
+ text: JSON.stringify({ status: 'updated', wizardName: params.wizardName, uid: resolved.uid }, null, 2),
501
+ },
502
+ ],
431
503
  };
432
504
  }
433
505
  }
434
506
  catch (error) {
435
- const operationText = params.operation === "create" ? "creating" : "updating";
507
+ const operationText = params.operation === 'create' ? 'creating' : 'updating';
436
508
  return {
437
- content: [{ type: "text", text: enhanceWizardError(`Error ${operationText} wizard: ${error instanceof Error ? error.message : String(error)}`) }],
438
- isError: true
509
+ content: [
510
+ {
511
+ type: 'text',
512
+ text: enhanceWizardError(`Error ${operationText} wizard: ${error instanceof Error ? error.message : String(error)}`),
513
+ },
514
+ ],
515
+ isError: true,
439
516
  };
440
517
  }
441
518
  });
442
519
  server.registerTool(TOOL_MANAGE_WIZARD_STEP, WIZARD_TOOL_DEFINITIONS[TOOL_MANAGE_WIZARD_STEP], async (params) => {
443
520
  try {
444
- if (params.operation === "create") {
521
+ if (params.operation === 'create') {
445
522
  if (!params.stepType) {
446
523
  return {
447
- content: [{ type: "text", text: "Error: stepType is required for create operation" }],
448
- isError: true
524
+ content: [
525
+ { type: 'text', text: 'Error: stepType is required for create operation' },
526
+ ],
527
+ isError: true,
449
528
  };
450
529
  }
451
530
  const resolved = await resolveWizard(client, params.workspaceId, params.wizardName);
@@ -479,14 +558,19 @@ export function registerWizardTools(server, client) {
479
558
  }
480
559
  }
481
560
  return {
482
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
561
+ content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
483
562
  };
484
563
  }
485
564
  else {
486
565
  if (params.stepType !== undefined) {
487
566
  return {
488
- content: [{ type: "text", text: "Error: stepType is immutable after creation. Create a new step instead." }],
489
- isError: true
567
+ content: [
568
+ {
569
+ type: 'text',
570
+ text: 'Error: stepType is immutable after creation. Create a new step instead.',
571
+ },
572
+ ],
573
+ isError: true,
490
574
  };
491
575
  }
492
576
  const resolved = await resolveWizardWithSteps(client, params.workspaceId, params.wizardName);
@@ -494,8 +578,13 @@ export function registerWizardTools(server, client) {
494
578
  if (!stepUid) {
495
579
  const available = Array.from(resolved.steps.keys()).join(', ');
496
580
  return {
497
- content: [{ type: "text", text: `Error: Step '${params.identifier}' not found. Available: ${available}` }],
498
- isError: true
581
+ content: [
582
+ {
583
+ type: 'text',
584
+ text: `Error: Step '${params.identifier}' not found. Available: ${available}`,
585
+ },
586
+ ],
587
+ isError: true,
499
588
  };
500
589
  }
501
590
  const requestBody = { pageUID: stepUid };
@@ -509,8 +598,8 @@ export function registerWizardTools(server, client) {
509
598
  }
510
599
  if (Object.keys(attributes).length === 0 && !params.formAttributes) {
511
600
  return {
512
- content: [{ type: "text", text: "No updates specified." }],
513
- isError: true
601
+ content: [{ type: 'text', text: 'No updates specified.' }],
602
+ isError: true,
514
603
  };
515
604
  }
516
605
  let result;
@@ -531,15 +620,20 @@ export function registerWizardTools(server, client) {
531
620
  }
532
621
  }
533
622
  return {
534
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
623
+ content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
535
624
  };
536
625
  }
537
626
  }
538
627
  catch (error) {
539
- const operationText = params.operation === "create" ? "creating" : "updating";
628
+ const operationText = params.operation === 'create' ? 'creating' : 'updating';
540
629
  return {
541
- content: [{ type: "text", text: enhanceWizardError(`Error ${operationText} wizard step: ${error instanceof Error ? error.message : String(error)}`) }],
542
- isError: true
630
+ content: [
631
+ {
632
+ type: 'text',
633
+ text: enhanceWizardError(`Error ${operationText} wizard step: ${error instanceof Error ? error.message : String(error)}`),
634
+ },
635
+ ],
636
+ isError: true,
543
637
  };
544
638
  }
545
639
  });
@@ -550,23 +644,35 @@ export function registerWizardTools(server, client) {
550
644
  if (params.cascadeDeleteSteps !== false) {
551
645
  const result = await client.makeApiRequest('json/page/with-children', 'DELETE', undefined, {
552
646
  pageUID: resolved.uid,
553
- confirmDeleteChildren: true
647
+ confirmDeleteChildren: true,
554
648
  });
555
649
  return {
556
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
650
+ content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
557
651
  };
558
652
  }
559
653
  else {
560
- const result = await client.makeApiRequest('json/page', 'DELETE', { pageUID: resolved.uid });
654
+ const result = await client.makeApiRequest('json/page', 'DELETE', {
655
+ pageUID: resolved.uid,
656
+ });
561
657
  return {
562
- content: [{ type: "text", text: typeof result === 'object' ? JSON.stringify(result, null, 2) : String(result) }]
658
+ content: [
659
+ {
660
+ type: 'text',
661
+ text: typeof result === 'object' ? JSON.stringify(result, null, 2) : String(result),
662
+ },
663
+ ],
563
664
  };
564
665
  }
565
666
  }
566
667
  catch (error) {
567
668
  return {
568
- content: [{ type: "text", text: enhanceWizardError(`Error deleting wizard: ${error instanceof Error ? error.message : String(error)}`) }],
569
- isError: true
669
+ content: [
670
+ {
671
+ type: 'text',
672
+ text: enhanceWizardError(`Error deleting wizard: ${error instanceof Error ? error.message : String(error)}`),
673
+ },
674
+ ],
675
+ isError: true,
570
676
  };
571
677
  }
572
678
  });
@@ -577,23 +683,38 @@ export function registerWizardTools(server, client) {
577
683
  if (!stepUid) {
578
684
  const available = Array.from(resolved.steps.keys()).join(', ');
579
685
  return {
580
- content: [{ type: "text", text: `Error: Step '${params.identifier}' not found. Available: ${available}` }],
581
- isError: true
686
+ content: [
687
+ {
688
+ type: 'text',
689
+ text: `Error: Step '${params.identifier}' not found. Available: ${available}`,
690
+ },
691
+ ],
692
+ isError: true,
582
693
  };
583
694
  }
584
695
  debugLogWithTag('WIZARD_STEP_DELETE', `Deleting step '${params.identifier}' (${stepUid})`);
585
696
  const result = await client.makeApiRequest('json/page/with-children', 'DELETE', undefined, {
586
697
  pageUID: stepUid,
587
- confirmDeleteChildren: true
698
+ confirmDeleteChildren: true,
588
699
  });
589
700
  return {
590
- content: [{ type: "text", text: typeof result === 'object' ? JSON.stringify(result, null, 2) : String(result) }]
701
+ content: [
702
+ {
703
+ type: 'text',
704
+ text: typeof result === 'object' ? JSON.stringify(result, null, 2) : String(result),
705
+ },
706
+ ],
591
707
  };
592
708
  }
593
709
  catch (error) {
594
710
  return {
595
- content: [{ type: "text", text: enhanceWizardError(`Error deleting wizard step: ${error instanceof Error ? error.message : String(error)}`) }],
596
- isError: true
711
+ content: [
712
+ {
713
+ type: 'text',
714
+ text: enhanceWizardError(`Error deleting wizard step: ${error instanceof Error ? error.message : String(error)}`),
715
+ },
716
+ ],
717
+ isError: true,
597
718
  };
598
719
  }
599
720
  });
@@ -605,22 +726,31 @@ export function registerWizardTools(server, client) {
605
726
  ...params.finalSteps,
606
727
  ...(params.summaryStep ? [params.summaryStep] : []),
607
728
  ...(params.cleanupScriptStep ? [params.cleanupScriptStep] : []),
608
- ...params.stepConnections.flatMap(c => [c.from, ...c.nextSteps, ...(c.skipTo ? [c.skipTo] : [])])
729
+ ...params.stepConnections.flatMap((c) => [
730
+ c.from,
731
+ ...c.nextSteps,
732
+ ...(c.skipTo ? [c.skipTo] : []),
733
+ ]),
609
734
  ]);
610
735
  for (const id of allReferencedIds) {
611
736
  if (!resolved.steps.has(id)) {
612
737
  return {
613
- content: [{ type: "text", text: `Error: Step '${id}' not found. Available: ${Array.from(resolved.steps.keys()).join(', ')}` }],
614
- isError: true
738
+ content: [
739
+ {
740
+ type: 'text',
741
+ text: `Error: Step '${id}' not found. Available: ${Array.from(resolved.steps.keys()).join(', ')}`,
742
+ },
743
+ ],
744
+ isError: true,
615
745
  };
616
746
  }
617
747
  }
618
748
  debugLogWithTag('WIZARD_FLOW', `Configuring flow for wizard '${params.wizardName}' with ${params.stepConnections.length} connections`);
619
749
  for (const conn of params.stepConnections) {
620
750
  const stepUid = resolved.steps.get(conn.from);
621
- const nextStepUids = conn.nextSteps.map(id => resolved.steps.get(id));
751
+ const nextStepUids = conn.nextSteps.map((id) => resolved.steps.get(id));
622
752
  const attributes = {
623
- [STEP_ATTR.nextPossibleSteps]: nextStepUids
753
+ [STEP_ATTR.nextPossibleSteps]: nextStepUids,
624
754
  };
625
755
  if (conn.skipTo)
626
756
  attributes[STEP_ATTR.skipTo] = resolved.steps.get(conn.skipTo);
@@ -630,12 +760,12 @@ export function registerWizardTools(server, client) {
630
760
  attributes[STEP_ATTR.skipToLabel] = conn.skipToLabel;
631
761
  await client.makeApiRequest('json/page', 'PATCH', undefined, {
632
762
  pageUID: stepUid,
633
- attributes
763
+ attributes,
634
764
  });
635
765
  }
636
766
  const wizardAttributes = {
637
767
  [WIZARD_ATTR.startStep]: resolved.steps.get(params.startStep),
638
- [WIZARD_ATTR.finalSteps]: params.finalSteps.map(id => resolved.steps.get(id)),
768
+ [WIZARD_ATTR.finalSteps]: params.finalSteps.map((id) => resolved.steps.get(id)),
639
769
  };
640
770
  if (params.summaryStep) {
641
771
  wizardAttributes[WIZARD_ATTR.summaryStep] = resolved.steps.get(params.summaryStep);
@@ -645,21 +775,31 @@ export function registerWizardTools(server, client) {
645
775
  }
646
776
  await client.makeApiRequest('json/page', 'PATCH', undefined, {
647
777
  pageUID: resolved.wizard.uid,
648
- attributes: wizardAttributes
778
+ attributes: wizardAttributes,
649
779
  });
650
780
  return {
651
- content: [{ type: "text", text: JSON.stringify({
781
+ content: [
782
+ {
783
+ type: 'text',
784
+ text: JSON.stringify({
652
785
  configured: true,
653
786
  wizardName: params.wizardName,
654
787
  stepCount: resolved.steps.size,
655
- connectionCount: params.stepConnections.length
656
- }, null, 2) }]
788
+ connectionCount: params.stepConnections.length,
789
+ }, null, 2),
790
+ },
791
+ ],
657
792
  };
658
793
  }
659
794
  catch (error) {
660
795
  return {
661
- content: [{ type: "text", text: enhanceWizardError(`Error configuring wizard flow: ${error instanceof Error ? error.message : String(error)}`) }],
662
- isError: true
796
+ content: [
797
+ {
798
+ type: 'text',
799
+ text: enhanceWizardError(`Error configuring wizard flow: ${error instanceof Error ? error.message : String(error)}`),
800
+ },
801
+ ],
802
+ isError: true,
663
803
  };
664
804
  }
665
805
  });
@@ -667,48 +807,70 @@ export function registerWizardTools(server, client) {
667
807
  try {
668
808
  const resolved = await resolveWizard(client, params.workspaceId, params.wizardName);
669
809
  debugLogWithTag('WIZARD_ACTIVATE', `Activating wizard '${params.wizardName}' (${resolved.uid})`);
670
- const response = await client.makeApiRequest('json/wizard/activation', 'POST', undefined, { wizardId: stripPagePrefix(resolved.uid), activationState: params.activationState || 'ACTIVE' });
810
+ const response = await client.makeApiRequest('json/wizard/activation', 'POST', undefined, {
811
+ wizardId: stripPagePrefix(resolved.uid),
812
+ activationState: params.activationState || 'ACTIVE',
813
+ });
671
814
  if (response?.activationState === 'ACTIVE' || response?.activationState === 'INACTIVE') {
672
815
  return {
673
- content: [{ type: "text", text: JSON.stringify({
816
+ content: [
817
+ {
818
+ type: 'text',
819
+ text: JSON.stringify({
674
820
  status: response.activationState === 'ACTIVE' ? 'activated' : 'deactivated',
675
821
  wizardName: params.wizardName,
676
822
  activationState: response.activationState,
677
- canChangeState: response.canChangeState
678
- }, null, 2) }]
823
+ canChangeState: response.canChangeState,
824
+ }, null, 2),
825
+ },
826
+ ],
679
827
  };
680
828
  }
681
829
  else {
682
830
  debugLogWithTag('WIZARD_ACTIVATE', `Activation failed, running analysis for wizard '${params.wizardName}'`);
683
831
  let analysisResults = null;
684
832
  try {
685
- analysisResults = await client.makeApiRequest('json/wizard/analysis', 'GET', { wizardId: stripPagePrefix(resolved.uid) });
833
+ analysisResults = await client.makeApiRequest('json/wizard/analysis', 'GET', {
834
+ wizardId: stripPagePrefix(resolved.uid),
835
+ });
686
836
  }
687
837
  catch (analysisError) {
688
838
  debugLogWithTag('WIZARD_ACTIVATE', `Auto-analysis also failed: ${analysisError}`);
689
839
  }
690
840
  return {
691
- content: [{ type: "text", text: JSON.stringify({
841
+ content: [
842
+ {
843
+ type: 'text',
844
+ text: JSON.stringify({
692
845
  status: 'failed',
693
846
  wizardName: params.wizardName,
694
847
  error: response || 'Activation failed — state was not changed',
695
- ...(analysisResults ? { analysisResults } : {})
696
- }, null, 2) }],
697
- isError: true
848
+ ...(analysisResults ? { analysisResults } : {}),
849
+ }, null, 2),
850
+ },
851
+ ],
852
+ isError: true,
698
853
  };
699
854
  }
700
855
  }
701
856
  catch (error) {
702
857
  return {
703
- content: [{ type: "text", text: enhanceWizardError(`Error activating wizard: ${error instanceof Error ? error.message : String(error)}`) }],
704
- isError: true
858
+ content: [
859
+ {
860
+ type: 'text',
861
+ text: enhanceWizardError(`Error activating wizard: ${error instanceof Error ? error.message : String(error)}`),
862
+ },
863
+ ],
864
+ isError: true,
705
865
  };
706
866
  }
707
867
  });
708
868
  server.registerTool(TOOL_GET_WIZARD_DETAILS, WIZARD_TOOL_DEFINITIONS[TOOL_GET_WIZARD_DETAILS], async (params) => {
709
869
  try {
710
870
  const resolved = await resolveWizardWithSteps(client, params.workspaceId, params.wizardName);
711
- const wizardPage = await client.makeApiRequest('json/page', 'GET', { pageUID: resolved.wizard.uid });
871
+ const wizardPage = await client.makeApiRequest('json/page', 'GET', {
872
+ pageUID: resolved.wizard.uid,
873
+ });
712
874
  const stepDetails = [];
713
875
  for (const [identifier, uid] of resolved.steps) {
714
876
  const stepPage = await client.makeApiRequest('json/page', 'GET', { pageUID: uid });
@@ -716,30 +878,35 @@ export function registerWizardTools(server, client) {
716
878
  identifier,
717
879
  uid,
718
880
  name: stepPage.name,
719
- ...extractStepSummary(stepPage)
881
+ ...extractStepSummary(stepPage),
720
882
  });
721
883
  }
722
884
  const result = {
723
885
  wizardName: params.wizardName,
724
886
  uid: resolved.wizard.uid,
725
887
  ...extractWizardSummary(wizardPage),
726
- steps: stepDetails
888
+ steps: stepDetails,
727
889
  };
728
890
  const sizeCheck = checkResponseSize(result);
729
891
  if (sizeCheck.tooLarge) {
730
892
  return {
731
- content: [{ type: "text", text: sizeCheck.suggestion }],
732
- isError: true
893
+ content: [{ type: 'text', text: sizeCheck.suggestion }],
894
+ isError: true,
733
895
  };
734
896
  }
735
897
  return {
736
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
898
+ content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
737
899
  };
738
900
  }
739
901
  catch (error) {
740
902
  return {
741
- content: [{ type: "text", text: `Error getting wizard details: ${error instanceof Error ? error.message : String(error)}` }],
742
- isError: true
903
+ content: [
904
+ {
905
+ type: 'text',
906
+ text: `Error getting wizard details: ${error instanceof Error ? error.message : String(error)}`,
907
+ },
908
+ ],
909
+ isError: true,
743
910
  };
744
911
  }
745
912
  });
@@ -747,34 +914,39 @@ export function registerWizardTools(server, client) {
747
914
  try {
748
915
  const listFilter = {
749
916
  filters: [
750
- { type: "Type", types: [WIZARD_TYPE] },
751
- { type: "Workspace", workspaceIds: [params.workspaceId] }
752
- ]
917
+ { type: 'Type', types: [WIZARD_TYPE] },
918
+ { type: 'Workspace', workspaceIds: [params.workspaceId] },
919
+ ],
753
920
  };
754
921
  const searchResult = await client.makeApiRequest('json/search', 'GET', {
755
- filter: JSON.stringify(listFilter)
922
+ filter: JSON.stringify(listFilter),
756
923
  });
757
924
  const wizards = (searchResult?.results || []).map((page) => ({
758
925
  name: page.name,
759
926
  uid: page.uid || page.id,
760
- ...extractWizardListSummary(page)
927
+ ...extractWizardListSummary(page),
761
928
  }));
762
929
  const result = { wizards, count: wizards.length };
763
930
  const sizeCheck = checkResponseSize(result);
764
931
  if (sizeCheck.tooLarge) {
765
932
  return {
766
- content: [{ type: "text", text: sizeCheck.suggestion }],
767
- isError: true
933
+ content: [{ type: 'text', text: sizeCheck.suggestion }],
934
+ isError: true,
768
935
  };
769
936
  }
770
937
  return {
771
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
938
+ content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
772
939
  };
773
940
  }
774
941
  catch (error) {
775
942
  return {
776
- content: [{ type: "text", text: `Error listing wizards: ${error instanceof Error ? error.message : String(error)}` }],
777
- isError: true
943
+ content: [
944
+ {
945
+ type: 'text',
946
+ text: `Error listing wizards: ${error instanceof Error ? error.message : String(error)}`,
947
+ },
948
+ ],
949
+ isError: true,
778
950
  };
779
951
  }
780
952
  });
@@ -782,25 +954,37 @@ export function registerWizardTools(server, client) {
782
954
  try {
783
955
  const resolved = await resolveWizard(client, params.workspaceId, params.wizardName);
784
956
  debugLogWithTag('WIZARD_ANALYZE', `Analyzing wizard '${params.wizardName}' (${resolved.uid})`);
785
- const response = await client.makeApiRequest('json/wizard/analysis', 'GET', { wizardId: stripPagePrefix(resolved.uid) });
957
+ const response = await client.makeApiRequest('json/wizard/analysis', 'GET', {
958
+ wizardId: stripPagePrefix(resolved.uid),
959
+ });
786
960
  const sizeCheck = checkResponseSize(response);
787
961
  if (sizeCheck.tooLarge) {
788
962
  return {
789
- content: [{ type: "text", text: sizeCheck.suggestion }],
790
- isError: true
963
+ content: [{ type: 'text', text: sizeCheck.suggestion }],
964
+ isError: true,
791
965
  };
792
966
  }
793
967
  return {
794
- content: [{ type: "text", text: JSON.stringify({
968
+ content: [
969
+ {
970
+ type: 'text',
971
+ text: JSON.stringify({
795
972
  wizardName: params.wizardName,
796
- analysisResults: response
797
- }, null, 2) }]
973
+ analysisResults: response,
974
+ }, null, 2),
975
+ },
976
+ ],
798
977
  };
799
978
  }
800
979
  catch (error) {
801
980
  return {
802
- content: [{ type: "text", text: `Error analyzing wizard: ${error instanceof Error ? error.message : String(error)}` }],
803
- isError: true
981
+ content: [
982
+ {
983
+ type: 'text',
984
+ text: `Error analyzing wizard: ${error instanceof Error ? error.message : String(error)}`,
985
+ },
986
+ ],
987
+ isError: true,
804
988
  };
805
989
  }
806
990
  });
@@ -808,26 +992,38 @@ export function registerWizardTools(server, client) {
808
992
  try {
809
993
  const resolved = await resolveWizard(client, params.workspaceId, params.wizardName);
810
994
  debugLogWithTag('WIZARD_ACTIVATION_STATE', `Getting activation state for wizard '${params.wizardName}' (${resolved.uid})`);
811
- const response = await client.makeApiRequest('json/wizard/activation', 'GET', { wizardId: stripPagePrefix(resolved.uid) });
995
+ const response = await client.makeApiRequest('json/wizard/activation', 'GET', {
996
+ wizardId: stripPagePrefix(resolved.uid),
997
+ });
812
998
  const sizeCheck = checkResponseSize(response);
813
999
  if (sizeCheck.tooLarge) {
814
1000
  return {
815
- content: [{ type: "text", text: sizeCheck.suggestion }],
816
- isError: true
1001
+ content: [{ type: 'text', text: sizeCheck.suggestion }],
1002
+ isError: true,
817
1003
  };
818
1004
  }
819
1005
  return {
820
- content: [{ type: "text", text: JSON.stringify({
1006
+ content: [
1007
+ {
1008
+ type: 'text',
1009
+ text: JSON.stringify({
821
1010
  wizardName: params.wizardName,
822
1011
  activationState: response.activationState,
823
- canChangeState: response.canChangeState
824
- }, null, 2) }]
1012
+ canChangeState: response.canChangeState,
1013
+ }, null, 2),
1014
+ },
1015
+ ],
825
1016
  };
826
1017
  }
827
1018
  catch (error) {
828
1019
  return {
829
- content: [{ type: "text", text: `Error getting wizard activation state: ${error instanceof Error ? error.message : String(error)}` }],
830
- isError: true
1020
+ content: [
1021
+ {
1022
+ type: 'text',
1023
+ text: `Error getting wizard activation state: ${error instanceof Error ? error.message : String(error)}`,
1024
+ },
1025
+ ],
1026
+ isError: true,
831
1027
  };
832
1028
  }
833
1029
  });