@umbraco-automate/mcp 17.6.0

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 ADDED
@@ -0,0 +1,4755 @@
1
+ #!/usr/bin/env node
2
+ import { config } from 'dotenv';
3
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
4
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
5
+ import { withStandardDecorators, createMcpClientManager, baseSliceNames, configureApiClient, initializeUmbracoFetch, createCollectionConfigLoader, handleCliCommands, checkUmbracoVersion, UmbracoManagementClient, SERVER_INFORMATION_PATH, CAPTURE_RAW_HTTP_RESPONSE, configureVersionCheckHook, getVersionCheckMessage, shouldIncludeTool, createToolAnnotations, registerToolCollection, getRegisteredOutputSchema, createToolResult, executeGetItemsApiCall, executeVoidApiCall, executeGetApiCall, getApiClient, ToolValidationError, createToolResultError, UmbracoApiError, getServerConfig, normalizeBaseUrl, discoverProxiedTools, parseProxiedToolName, useDraft202012ToolSchemas } from '@umbraco-cms/mcp-server-sdk';
6
+ import * as zod from 'zod';
7
+ import { z } from 'zod';
8
+ import { randomUUID } from 'crypto';
9
+ import path from 'path';
10
+ import { fileURLToPath } from 'url';
11
+
12
+ config({ quiet: true });
13
+
14
+ // package.json
15
+ var package_default = {
16
+ version: "17.6.0"};
17
+ var customInstance = async (config2, options) => {
18
+ const mergedConfig = { ...config2, ...options };
19
+ return UmbracoManagementClient(mergedConfig, mergedConfig);
20
+ };
21
+
22
+ // src/umbraco-api/api/generated/umbracoAutomateManagementApi.ts
23
+ var getUmbracoAutomateManagementAPI = () => {
24
+ const postApprovalsByRunIdStepsByStepIdDecision = (runId, stepId, approvalDecisionRequestModel, options) => {
25
+ return customInstance(
26
+ {
27
+ url: `/umbraco/automate/management/api/v1/approvals/${runId}/steps/${stepId}/decision`,
28
+ method: "POST",
29
+ headers: { "Content-Type": "application/json" },
30
+ data: approvalDecisionRequestModel
31
+ },
32
+ options
33
+ );
34
+ };
35
+ const getApprovalsPending = (options) => {
36
+ return customInstance(
37
+ {
38
+ url: `/umbraco/automate/management/api/v1/approvals/pending`,
39
+ method: "GET"
40
+ },
41
+ options
42
+ );
43
+ };
44
+ const postAutomations = (createAutomationRequestModel, options) => {
45
+ return customInstance(
46
+ {
47
+ url: `/umbraco/automate/management/api/v1/automations`,
48
+ method: "POST",
49
+ headers: { "Content-Type": "application/json" },
50
+ data: createAutomationRequestModel
51
+ },
52
+ options
53
+ );
54
+ };
55
+ const getAutomations = (params, options) => {
56
+ return customInstance(
57
+ {
58
+ url: `/umbraco/automate/management/api/v1/automations`,
59
+ method: "GET",
60
+ params
61
+ },
62
+ options
63
+ );
64
+ };
65
+ const deleteAutomationsById = (id, options) => {
66
+ return customInstance(
67
+ {
68
+ url: `/umbraco/automate/management/api/v1/automations/${id}`,
69
+ method: "DELETE"
70
+ },
71
+ options
72
+ );
73
+ };
74
+ const getAutomationsById = (id, options) => {
75
+ return customInstance(
76
+ {
77
+ url: `/umbraco/automate/management/api/v1/automations/${id}`,
78
+ method: "GET"
79
+ },
80
+ options
81
+ );
82
+ };
83
+ const putAutomationsById = (id, updateAutomationRequestModel, options) => {
84
+ return customInstance(
85
+ {
86
+ url: `/umbraco/automate/management/api/v1/automations/${id}`,
87
+ method: "PUT",
88
+ headers: { "Content-Type": "application/json" },
89
+ data: updateAutomationRequestModel
90
+ },
91
+ options
92
+ );
93
+ };
94
+ const getAutomationsByIdAncestors = (id, options) => {
95
+ return customInstance(
96
+ {
97
+ url: `/umbraco/automate/management/api/v1/automations/${id}/ancestors`,
98
+ method: "GET"
99
+ },
100
+ options
101
+ );
102
+ };
103
+ const getAutomationsByIdExport = (id, params, options) => {
104
+ return customInstance(
105
+ {
106
+ url: `/umbraco/automate/management/api/v1/automations/${id}/export`,
107
+ method: "GET",
108
+ params
109
+ },
110
+ options
111
+ );
112
+ };
113
+ const putAutomationsByIdImport = (id, automationExportModel, options) => {
114
+ return customInstance(
115
+ {
116
+ url: `/umbraco/automate/management/api/v1/automations/${id}/import`,
117
+ method: "PUT",
118
+ headers: { "Content-Type": "application/json" },
119
+ data: automationExportModel
120
+ },
121
+ options
122
+ );
123
+ };
124
+ const postAutomationsByIdPublish = (id, options) => {
125
+ return customInstance(
126
+ {
127
+ url: `/umbraco/automate/management/api/v1/automations/${id}/publish`,
128
+ method: "POST"
129
+ },
130
+ options
131
+ );
132
+ };
133
+ const postAutomationsByIdReEnable = (id, options) => {
134
+ return customInstance(
135
+ {
136
+ url: `/umbraco/automate/management/api/v1/automations/${id}/re-enable`,
137
+ method: "POST"
138
+ },
139
+ options
140
+ );
141
+ };
142
+ const getAutomationsByIdRuns = (id, params, options) => {
143
+ return customInstance(
144
+ {
145
+ url: `/umbraco/automate/management/api/v1/automations/${id}/runs`,
146
+ method: "GET",
147
+ params
148
+ },
149
+ options
150
+ );
151
+ };
152
+ const postAutomationsByIdTrigger = (id, options) => {
153
+ return customInstance(
154
+ {
155
+ url: `/umbraco/automate/management/api/v1/automations/${id}/trigger`,
156
+ method: "POST"
157
+ },
158
+ options
159
+ );
160
+ };
161
+ const postAutomationsByIdUnpublish = (id, options) => {
162
+ return customInstance(
163
+ {
164
+ url: `/umbraco/automate/management/api/v1/automations/${id}/unpublish`,
165
+ method: "POST"
166
+ },
167
+ options
168
+ );
169
+ };
170
+ const getAutomationsByIdWebhookUrl = (id, options) => {
171
+ return customInstance(
172
+ {
173
+ url: `/umbraco/automate/management/api/v1/automations/${id}/webhook-url`,
174
+ method: "GET"
175
+ },
176
+ options
177
+ );
178
+ };
179
+ const getAutomationsGroupsByGroupId = (groupId, options) => {
180
+ return customInstance(
181
+ {
182
+ url: `/umbraco/automate/management/api/v1/automations/groups/${groupId}`,
183
+ method: "GET"
184
+ },
185
+ options
186
+ );
187
+ };
188
+ const postAutomationsImport = (importAutomationRequestModel, options) => {
189
+ return customInstance(
190
+ {
191
+ url: `/umbraco/automate/management/api/v1/automations/import`,
192
+ method: "POST",
193
+ headers: { "Content-Type": "application/json" },
194
+ data: importAutomationRequestModel
195
+ },
196
+ options
197
+ );
198
+ };
199
+ const postAutomationsImportValidate = (importAutomationRequestModel, options) => {
200
+ return customInstance(
201
+ {
202
+ url: `/umbraco/automate/management/api/v1/automations/import/validate`,
203
+ method: "POST",
204
+ headers: { "Content-Type": "application/json" },
205
+ data: importAutomationRequestModel
206
+ },
207
+ options
208
+ );
209
+ };
210
+ const getCatalogueActions = (params, options) => {
211
+ return customInstance(
212
+ {
213
+ url: `/umbraco/automate/management/api/v1/catalogue/actions`,
214
+ method: "GET",
215
+ params
216
+ },
217
+ options
218
+ );
219
+ };
220
+ const getCatalogueConnectionTypes = (options) => {
221
+ return customInstance(
222
+ {
223
+ url: `/umbraco/automate/management/api/v1/catalogue/connection-types`,
224
+ method: "GET"
225
+ },
226
+ options
227
+ );
228
+ };
229
+ const getCatalogueControlFlows = (options) => {
230
+ return customInstance(
231
+ {
232
+ url: `/umbraco/automate/management/api/v1/catalogue/control-flows`,
233
+ method: "GET"
234
+ },
235
+ options
236
+ );
237
+ };
238
+ const getCatalogueNotificationChannels = (options) => {
239
+ return customInstance(
240
+ {
241
+ url: `/umbraco/automate/management/api/v1/catalogue/notification-channels`,
242
+ method: "GET"
243
+ },
244
+ options
245
+ );
246
+ };
247
+ const getCatalogueStepTypes = (params, options) => {
248
+ return customInstance(
249
+ {
250
+ url: `/umbraco/automate/management/api/v1/catalogue/step-types`,
251
+ method: "GET",
252
+ params
253
+ },
254
+ options
255
+ );
256
+ };
257
+ const postCatalogueStepTypesByAliasOutcomes = (alias, resolveOutcomesRequestModel, options) => {
258
+ return customInstance(
259
+ {
260
+ url: `/umbraco/automate/management/api/v1/catalogue/step-types/${alias}/outcomes`,
261
+ method: "POST",
262
+ headers: { "Content-Type": "application/json" },
263
+ data: resolveOutcomesRequestModel
264
+ },
265
+ options
266
+ );
267
+ };
268
+ const postCatalogueStepTypesByAliasOutputSchema = (alias, resolveOutputSchemaRequestModel, options) => {
269
+ return customInstance(
270
+ {
271
+ url: `/umbraco/automate/management/api/v1/catalogue/step-types/${alias}/output-schema`,
272
+ method: "POST",
273
+ headers: { "Content-Type": "application/json" },
274
+ data: resolveOutputSchemaRequestModel
275
+ },
276
+ options
277
+ );
278
+ };
279
+ const getCatalogueTriggers = (params, options) => {
280
+ return customInstance(
281
+ {
282
+ url: `/umbraco/automate/management/api/v1/catalogue/triggers`,
283
+ method: "GET",
284
+ params
285
+ },
286
+ options
287
+ );
288
+ };
289
+ const getCatalogueWebhookAuthenticators = (options) => {
290
+ return customInstance(
291
+ {
292
+ url: `/umbraco/automate/management/api/v1/catalogue/webhook-authenticators`,
293
+ method: "GET"
294
+ },
295
+ options
296
+ );
297
+ };
298
+ const postConnections = (createConnectionRequestModel, options) => {
299
+ return customInstance(
300
+ {
301
+ url: `/umbraco/automate/management/api/v1/connections`,
302
+ method: "POST",
303
+ headers: { "Content-Type": "application/json" },
304
+ data: createConnectionRequestModel
305
+ },
306
+ options
307
+ );
308
+ };
309
+ const getConnections = (params, options) => {
310
+ return customInstance(
311
+ {
312
+ url: `/umbraco/automate/management/api/v1/connections`,
313
+ method: "GET",
314
+ params
315
+ },
316
+ options
317
+ );
318
+ };
319
+ const deleteConnectionsById = (id, options) => {
320
+ return customInstance(
321
+ {
322
+ url: `/umbraco/automate/management/api/v1/connections/${id}`,
323
+ method: "DELETE"
324
+ },
325
+ options
326
+ );
327
+ };
328
+ const getConnectionsById = (id, options) => {
329
+ return customInstance(
330
+ {
331
+ url: `/umbraco/automate/management/api/v1/connections/${id}`,
332
+ method: "GET"
333
+ },
334
+ options
335
+ );
336
+ };
337
+ const putConnectionsById = (id, updateConnectionRequestModel, options) => {
338
+ return customInstance(
339
+ {
340
+ url: `/umbraco/automate/management/api/v1/connections/${id}`,
341
+ method: "PUT",
342
+ headers: { "Content-Type": "application/json" },
343
+ data: updateConnectionRequestModel
344
+ },
345
+ options
346
+ );
347
+ };
348
+ const postConnectionsByIdTest = (id, options) => {
349
+ return customInstance(
350
+ {
351
+ url: `/umbraco/automate/management/api/v1/connections/${id}/test`,
352
+ method: "POST"
353
+ },
354
+ options
355
+ );
356
+ };
357
+ const getMetrics = (params, options) => {
358
+ return customInstance(
359
+ {
360
+ url: `/umbraco/automate/management/api/v1/metrics`,
361
+ method: "GET",
362
+ params
363
+ },
364
+ options
365
+ );
366
+ };
367
+ const getMetricsByAutomation = (params, options) => {
368
+ return customInstance(
369
+ {
370
+ url: `/umbraco/automate/management/api/v1/metrics/by-automation`,
371
+ method: "GET",
372
+ params
373
+ },
374
+ options
375
+ );
376
+ };
377
+ const getRuns = (params, options) => {
378
+ return customInstance(
379
+ {
380
+ url: `/umbraco/automate/management/api/v1/runs`,
381
+ method: "GET",
382
+ params
383
+ },
384
+ options
385
+ );
386
+ };
387
+ const getRunsById = (id, options) => {
388
+ return customInstance(
389
+ {
390
+ url: `/umbraco/automate/management/api/v1/runs/${id}`,
391
+ method: "GET"
392
+ },
393
+ options
394
+ );
395
+ };
396
+ const postRunsByIdReplay = (id, options) => {
397
+ return customInstance(
398
+ {
399
+ url: `/umbraco/automate/management/api/v1/runs/${id}/replay`,
400
+ method: "POST"
401
+ },
402
+ options
403
+ );
404
+ };
405
+ const postRunsByIdResume = (id, options) => {
406
+ return customInstance(
407
+ {
408
+ url: `/umbraco/automate/management/api/v1/runs/${id}/resume`,
409
+ method: "POST"
410
+ },
411
+ options
412
+ );
413
+ };
414
+ const getRunsByIdStepRunsByStepRunIdData = (id, stepRunId, options) => {
415
+ return customInstance(
416
+ {
417
+ url: `/umbraco/automate/management/api/v1/runs/${id}/step-runs/${stepRunId}/data`,
418
+ method: "GET"
419
+ },
420
+ options
421
+ );
422
+ };
423
+ const postRunsByIdSuspend = (id, options) => {
424
+ return customInstance(
425
+ {
426
+ url: `/umbraco/automate/management/api/v1/runs/${id}/suspend`,
427
+ method: "POST"
428
+ },
429
+ options
430
+ );
431
+ };
432
+ const postRunsByIdTerminate = (id, options) => {
433
+ return customInstance(
434
+ {
435
+ url: `/umbraco/automate/management/api/v1/runs/${id}/terminate`,
436
+ method: "POST"
437
+ },
438
+ options
439
+ );
440
+ };
441
+ const getRunsByIdTriggerData = (id, options) => {
442
+ return customInstance(
443
+ {
444
+ url: `/umbraco/automate/management/api/v1/runs/${id}/trigger-data`,
445
+ method: "GET"
446
+ },
447
+ options
448
+ );
449
+ };
450
+ const getVersionHistoryByEntityTypeByEntityId = (entityType, entityId, params, options) => {
451
+ return customInstance(
452
+ {
453
+ url: `/umbraco/automate/management/api/v1/version-history/${entityType}/${entityId}`,
454
+ method: "GET",
455
+ params
456
+ },
457
+ options
458
+ );
459
+ };
460
+ const getVersionHistoryByEntityTypeByEntityIdByEntityVersion = (entityType, entityId, entityVersion, options) => {
461
+ return customInstance(
462
+ {
463
+ url: `/umbraco/automate/management/api/v1/version-history/${entityType}/${entityId}/${entityVersion}`,
464
+ method: "GET"
465
+ },
466
+ options
467
+ );
468
+ };
469
+ const postVersionHistoryByEntityTypeByEntityIdByEntityVersionRollback = (entityType, entityId, entityVersion, options) => {
470
+ return customInstance(
471
+ {
472
+ url: `/umbraco/automate/management/api/v1/version-history/${entityType}/${entityId}/${entityVersion}/rollback`,
473
+ method: "POST"
474
+ },
475
+ options
476
+ );
477
+ };
478
+ const getVersionHistoryByEntityTypeByEntityIdByFromEntityVersionCompareByToEntityVersion = (entityType, entityId, fromEntityVersion, toEntityVersion, options) => {
479
+ return customInstance(
480
+ {
481
+ url: `/umbraco/automate/management/api/v1/version-history/${entityType}/${entityId}/${fromEntityVersion}/compare/${toEntityVersion}`,
482
+ method: "GET"
483
+ },
484
+ options
485
+ );
486
+ };
487
+ const getVersionHistorySupportedTypes = (options) => {
488
+ return customInstance(
489
+ {
490
+ url: `/umbraco/automate/management/api/v1/version-history/supported-types`,
491
+ method: "GET"
492
+ },
493
+ options
494
+ );
495
+ };
496
+ const postWorkspaces = (createWorkspaceRequestModel, options) => {
497
+ return customInstance(
498
+ {
499
+ url: `/umbraco/automate/management/api/v1/workspaces`,
500
+ method: "POST",
501
+ headers: { "Content-Type": "application/json" },
502
+ data: createWorkspaceRequestModel
503
+ },
504
+ options
505
+ );
506
+ };
507
+ const getWorkspaces = (params, options) => {
508
+ return customInstance(
509
+ {
510
+ url: `/umbraco/automate/management/api/v1/workspaces`,
511
+ method: "GET",
512
+ params
513
+ },
514
+ options
515
+ );
516
+ };
517
+ const deleteWorkspacesById = (id, options) => {
518
+ return customInstance(
519
+ {
520
+ url: `/umbraco/automate/management/api/v1/workspaces/${id}`,
521
+ method: "DELETE"
522
+ },
523
+ options
524
+ );
525
+ };
526
+ const getWorkspacesById = (id, options) => {
527
+ return customInstance(
528
+ {
529
+ url: `/umbraco/automate/management/api/v1/workspaces/${id}`,
530
+ method: "GET"
531
+ },
532
+ options
533
+ );
534
+ };
535
+ const putWorkspacesById = (id, updateWorkspaceRequestModel, options) => {
536
+ return customInstance(
537
+ {
538
+ url: `/umbraco/automate/management/api/v1/workspaces/${id}`,
539
+ method: "PUT",
540
+ headers: { "Content-Type": "application/json" },
541
+ data: updateWorkspaceRequestModel
542
+ },
543
+ options
544
+ );
545
+ };
546
+ const postWorkspacesByIdGroups = (id, createWorkspaceGroupRequestModel, options) => {
547
+ return customInstance(
548
+ {
549
+ url: `/umbraco/automate/management/api/v1/workspaces/${id}/groups`,
550
+ method: "POST",
551
+ headers: { "Content-Type": "application/json" },
552
+ data: createWorkspaceGroupRequestModel
553
+ },
554
+ options
555
+ );
556
+ };
557
+ const getWorkspacesByIdGroups = (id, params, options) => {
558
+ return customInstance(
559
+ {
560
+ url: `/umbraco/automate/management/api/v1/workspaces/${id}/groups`,
561
+ method: "GET",
562
+ params
563
+ },
564
+ options
565
+ );
566
+ };
567
+ const deleteWorkspacesByIdGroupsByGroupId = (id, groupId, options) => {
568
+ return customInstance(
569
+ {
570
+ url: `/umbraco/automate/management/api/v1/workspaces/${id}/groups/${groupId}`,
571
+ method: "DELETE"
572
+ },
573
+ options
574
+ );
575
+ };
576
+ const getWorkspacesByIdGroupsByGroupId = (id, groupId, options) => {
577
+ return customInstance(
578
+ {
579
+ url: `/umbraco/automate/management/api/v1/workspaces/${id}/groups/${groupId}`,
580
+ method: "GET"
581
+ },
582
+ options
583
+ );
584
+ };
585
+ const putWorkspacesByIdGroupsByGroupId = (id, groupId, updateWorkspaceGroupRequestModel, options) => {
586
+ return customInstance(
587
+ {
588
+ url: `/umbraco/automate/management/api/v1/workspaces/${id}/groups/${groupId}`,
589
+ method: "PUT",
590
+ headers: { "Content-Type": "application/json" },
591
+ data: updateWorkspaceGroupRequestModel
592
+ },
593
+ options
594
+ );
595
+ };
596
+ return { postApprovalsByRunIdStepsByStepIdDecision, getApprovalsPending, postAutomations, getAutomations, deleteAutomationsById, getAutomationsById, putAutomationsById, getAutomationsByIdAncestors, getAutomationsByIdExport, putAutomationsByIdImport, postAutomationsByIdPublish, postAutomationsByIdReEnable, getAutomationsByIdRuns, postAutomationsByIdTrigger, postAutomationsByIdUnpublish, getAutomationsByIdWebhookUrl, getAutomationsGroupsByGroupId, postAutomationsImport, postAutomationsImportValidate, getCatalogueActions, getCatalogueConnectionTypes, getCatalogueControlFlows, getCatalogueNotificationChannels, getCatalogueStepTypes, postCatalogueStepTypesByAliasOutcomes, postCatalogueStepTypesByAliasOutputSchema, getCatalogueTriggers, getCatalogueWebhookAuthenticators, postConnections, getConnections, deleteConnectionsById, getConnectionsById, putConnectionsById, postConnectionsByIdTest, getMetrics, getMetricsByAutomation, getRuns, getRunsById, postRunsByIdReplay, postRunsByIdResume, getRunsByIdStepRunsByStepRunIdData, postRunsByIdSuspend, postRunsByIdTerminate, getRunsByIdTriggerData, getVersionHistoryByEntityTypeByEntityId, getVersionHistoryByEntityTypeByEntityIdByEntityVersion, postVersionHistoryByEntityTypeByEntityIdByEntityVersionRollback, getVersionHistoryByEntityTypeByEntityIdByFromEntityVersionCompareByToEntityVersion, getVersionHistorySupportedTypes, postWorkspaces, getWorkspaces, deleteWorkspacesById, getWorkspacesById, putWorkspacesById, postWorkspacesByIdGroups, getWorkspacesByIdGroups, deleteWorkspacesByIdGroupsByGroupId, getWorkspacesByIdGroupsByGroupId, putWorkspacesByIdGroupsByGroupId };
597
+ };
598
+ var getServerInfoTool = {
599
+ name: "get-server-info",
600
+ description: "Gets Umbraco server information including version and runtime details.",
601
+ slices: ["read"],
602
+ annotations: {
603
+ readOnlyHint: true
604
+ },
605
+ handler: async () => {
606
+ const response = await UmbracoManagementClient(
607
+ { url: SERVER_INFORMATION_PATH, method: "GET" },
608
+ CAPTURE_RAW_HTTP_RESPONSE
609
+ );
610
+ return createToolResult(response.data);
611
+ }
612
+ };
613
+ var get_server_info_default = withStandardDecorators(getServerInfoTool);
614
+
615
+ // src/umbraco-api/tools/umbraco-server/index.ts
616
+ var collection = {
617
+ metadata: {
618
+ name: "umbraco-server",
619
+ displayName: "Umbraco Server",
620
+ description: "Server information and status from the Umbraco Management API"
621
+ },
622
+ tools: () => [get_server_info_default]
623
+ };
624
+ var umbraco_server_default = collection;
625
+ var postApprovalsByRunIdStepsByStepIdDecisionParams = zod.object({
626
+ "runId": zod.guid(),
627
+ "stepId": zod.guid()
628
+ });
629
+ var postApprovalsByRunIdStepsByStepIdDecisionBody = zod.object({
630
+ "outcome": zod.enum(["Approved", "Rejected"]),
631
+ "comment": zod.string().nullish()
632
+ });
633
+ zod.unknown();
634
+ var getApprovalsPendingResponseItem = zod.object({
635
+ "runId": zod.guid(),
636
+ "stepId": zod.guid(),
637
+ "automationId": zod.guid(),
638
+ "automationName": zod.string(),
639
+ "prompt": zod.string().nullish(),
640
+ "requestedUtc": zod.iso.datetime({ "local": true, "offset": true }).nullish()
641
+ });
642
+ var getApprovalsPendingResponse = zod.array(getApprovalsPendingResponseItem);
643
+ zod.object({
644
+ "alias": zod.string().min(1),
645
+ "name": zod.string().min(1),
646
+ "description": zod.string().nullish(),
647
+ "workspaceId": zod.guid(),
648
+ "groupId": zod.guid().nullish(),
649
+ "trigger": zod.object({
650
+ "triggerAlias": zod.string(),
651
+ "settings": zod.record(zod.string(), zod.unknown().nullable())
652
+ }).nullish(),
653
+ "steps": zod.array(zod.object({
654
+ "id": zod.guid(),
655
+ "actionAlias": zod.string(),
656
+ "name": zod.string(),
657
+ "alias": zod.string().nullish(),
658
+ "connectionId": zod.guid().nullish(),
659
+ "settings": zod.record(zod.string(), zod.unknown().nullable()),
660
+ "inputMappings": zod.record(zod.string(), zod.string()),
661
+ "position": zod.object({
662
+ "x": zod.number(),
663
+ "y": zod.number()
664
+ }),
665
+ "errorBehavior": zod.enum(["Retry", "Suspend", "Terminate", "Compensate"]),
666
+ "retryInterval": zod.string().nullish(),
667
+ "maxRetries": zod.int().nullish()
668
+ })),
669
+ "connections": zod.array(zod.object({
670
+ "sourceStepId": zod.guid(),
671
+ "sourceHandle": zod.string().nullish(),
672
+ "targetStepId": zod.guid(),
673
+ "targetHandle": zod.string().nullish(),
674
+ "outcome": zod.string().nullish(),
675
+ "filter": zod.object({
676
+ "groups": zod.array(zod.object({
677
+ "conditions": zod.array(zod.object({
678
+ "leftOperand": zod.string(),
679
+ "operator": zod.enum(["Equals", "NotEquals", "Contains", "NotContains", "StartsWith", "EndsWith", "GreaterThan", "LessThan", "GreaterThanOrEquals", "LessThanOrEquals", "IsEmpty", "IsNotEmpty"]),
680
+ "rightOperand": zod.string()
681
+ }))
682
+ }))
683
+ }).nullish()
684
+ })),
685
+ "canvasState": zod.string().nullish(),
686
+ "notificationSettings": zod.object({
687
+ "channels": zod.array(zod.object({
688
+ "channelAlias": zod.string(),
689
+ "settings": zod.record(zod.string(), zod.unknown().nullable()),
690
+ "isEnabled": zod.boolean(),
691
+ "notifyOn": zod.enum(["Never", "Failed", "Suspended", "FailedOrSuspended", "Completed", "Recovered", "Disabled", "Warning", "ReEnabled", "Resumed", "Rejected"])
692
+ }))
693
+ }).nullish()
694
+ });
695
+ zod.void();
696
+ var getAutomationsQueryTakeDefault = 100;
697
+ var getAutomationsQueryParams = zod.object({
698
+ "filter": zod.string().optional(),
699
+ "groupId": zod.guid().optional(),
700
+ "workspaceId": zod.guid().optional(),
701
+ "skip": zod.coerce.number().int().optional(),
702
+ "take": zod.coerce.number().int().default(getAutomationsQueryTakeDefault)
703
+ });
704
+ var getAutomationsResponse = zod.object({
705
+ "total": zod.int(),
706
+ "items": zod.array(zod.object({
707
+ "id": zod.guid(),
708
+ "alias": zod.string().min(1),
709
+ "name": zod.string().min(1),
710
+ "description": zod.string().nullish(),
711
+ "workspaceId": zod.guid(),
712
+ "groupId": zod.guid().nullish(),
713
+ "status": zod.enum(["Draft", "Published", "Unpublished"]),
714
+ "triggerAlias": zod.string().nullish(),
715
+ "version": zod.int(),
716
+ "publishedVersion": zod.int().nullish(),
717
+ "dateCreated": zod.iso.datetime({ "local": true, "offset": true }),
718
+ "dateModified": zod.iso.datetime({ "local": true, "offset": true }),
719
+ "health": zod.enum(["Healthy", "Degraded", "Disabled"])
720
+ }))
721
+ });
722
+ var deleteAutomationsByIdParams = zod.object({
723
+ "id": zod.guid()
724
+ });
725
+ zod.unknown();
726
+ var getAutomationsByIdParams = zod.object({
727
+ "id": zod.guid()
728
+ });
729
+ var getAutomationsByIdResponse = zod.object({
730
+ "id": zod.guid(),
731
+ "alias": zod.string().min(1),
732
+ "name": zod.string().min(1),
733
+ "description": zod.string().nullish(),
734
+ "status": zod.enum(["Draft", "Published", "Unpublished"]),
735
+ "publishedVersion": zod.int().nullish(),
736
+ "workspaceId": zod.guid(),
737
+ "groupId": zod.guid().nullish(),
738
+ "trigger": zod.object({
739
+ "triggerAlias": zod.string(),
740
+ "settings": zod.record(zod.string(), zod.unknown().nullable())
741
+ }).nullish(),
742
+ "steps": zod.array(zod.object({
743
+ "id": zod.guid(),
744
+ "actionAlias": zod.string(),
745
+ "name": zod.string(),
746
+ "alias": zod.string().nullish(),
747
+ "connectionId": zod.guid().nullish(),
748
+ "settings": zod.record(zod.string(), zod.unknown().nullable()),
749
+ "inputMappings": zod.record(zod.string(), zod.string()),
750
+ "position": zod.object({
751
+ "x": zod.number(),
752
+ "y": zod.number()
753
+ }),
754
+ "errorBehavior": zod.enum(["Retry", "Suspend", "Terminate", "Compensate"]),
755
+ "retryInterval": zod.string().nullish(),
756
+ "maxRetries": zod.int().nullish()
757
+ })),
758
+ "connections": zod.array(zod.object({
759
+ "sourceStepId": zod.guid(),
760
+ "sourceHandle": zod.string().nullish(),
761
+ "targetStepId": zod.guid(),
762
+ "targetHandle": zod.string().nullish(),
763
+ "outcome": zod.string().nullish(),
764
+ "filter": zod.object({
765
+ "groups": zod.array(zod.object({
766
+ "conditions": zod.array(zod.object({
767
+ "leftOperand": zod.string(),
768
+ "operator": zod.enum(["Equals", "NotEquals", "Contains", "NotContains", "StartsWith", "EndsWith", "GreaterThan", "LessThan", "GreaterThanOrEquals", "LessThanOrEquals", "IsEmpty", "IsNotEmpty"]),
769
+ "rightOperand": zod.string()
770
+ }))
771
+ }))
772
+ }).nullish()
773
+ })),
774
+ "canvasState": zod.string().nullish(),
775
+ "version": zod.int(),
776
+ "dateCreated": zod.iso.datetime({ "local": true, "offset": true }),
777
+ "dateModified": zod.iso.datetime({ "local": true, "offset": true }),
778
+ "notificationSettings": zod.object({
779
+ "channels": zod.array(zod.object({
780
+ "channelAlias": zod.string(),
781
+ "settings": zod.record(zod.string(), zod.unknown().nullable()),
782
+ "isEnabled": zod.boolean(),
783
+ "notifyOn": zod.enum(["Never", "Failed", "Suspended", "FailedOrSuspended", "Completed", "Recovered", "Disabled", "Warning", "ReEnabled", "Resumed", "Rejected"])
784
+ }))
785
+ }).nullish(),
786
+ "health": zod.enum(["Healthy", "Degraded", "Disabled"]),
787
+ "warningIssuedUtc": zod.iso.datetime({ "local": true, "offset": true }).nullish(),
788
+ "disabledUtc": zod.iso.datetime({ "local": true, "offset": true }).nullish()
789
+ });
790
+ zod.object({
791
+ "id": zod.guid()
792
+ });
793
+ var putAutomationsByIdBodyOneVersionMax = 2147483647;
794
+ zod.object({
795
+ "alias": zod.string().min(1),
796
+ "name": zod.string().min(1),
797
+ "description": zod.string().nullish(),
798
+ "groupId": zod.guid().nullish(),
799
+ "trigger": zod.object({
800
+ "triggerAlias": zod.string(),
801
+ "settings": zod.record(zod.string(), zod.unknown().nullable())
802
+ }).nullish(),
803
+ "steps": zod.array(zod.object({
804
+ "id": zod.guid(),
805
+ "actionAlias": zod.string(),
806
+ "name": zod.string(),
807
+ "alias": zod.string().nullish(),
808
+ "connectionId": zod.guid().nullish(),
809
+ "settings": zod.record(zod.string(), zod.unknown().nullable()),
810
+ "inputMappings": zod.record(zod.string(), zod.string()),
811
+ "position": zod.object({
812
+ "x": zod.number(),
813
+ "y": zod.number()
814
+ }),
815
+ "errorBehavior": zod.enum(["Retry", "Suspend", "Terminate", "Compensate"]),
816
+ "retryInterval": zod.string().nullish(),
817
+ "maxRetries": zod.int().nullish()
818
+ })),
819
+ "connections": zod.array(zod.object({
820
+ "sourceStepId": zod.guid(),
821
+ "sourceHandle": zod.string().nullish(),
822
+ "targetStepId": zod.guid(),
823
+ "targetHandle": zod.string().nullish(),
824
+ "outcome": zod.string().nullish(),
825
+ "filter": zod.object({
826
+ "groups": zod.array(zod.object({
827
+ "conditions": zod.array(zod.object({
828
+ "leftOperand": zod.string(),
829
+ "operator": zod.enum(["Equals", "NotEquals", "Contains", "NotContains", "StartsWith", "EndsWith", "GreaterThan", "LessThan", "GreaterThanOrEquals", "LessThanOrEquals", "IsEmpty", "IsNotEmpty"]),
830
+ "rightOperand": zod.string()
831
+ }))
832
+ }))
833
+ }).nullish()
834
+ })),
835
+ "canvasState": zod.string().nullish(),
836
+ "notificationSettings": zod.object({
837
+ "channels": zod.array(zod.object({
838
+ "channelAlias": zod.string(),
839
+ "settings": zod.record(zod.string(), zod.unknown().nullable()),
840
+ "isEnabled": zod.boolean(),
841
+ "notifyOn": zod.enum(["Never", "Failed", "Suspended", "FailedOrSuspended", "Completed", "Recovered", "Disabled", "Warning", "ReEnabled", "Resumed", "Rejected"])
842
+ }))
843
+ }).nullish(),
844
+ "version": zod.int().min(1).max(putAutomationsByIdBodyOneVersionMax)
845
+ });
846
+ zod.unknown();
847
+ var getAutomationsByIdAncestorsParams = zod.object({
848
+ "id": zod.guid()
849
+ });
850
+ var getAutomationsByIdAncestorsResponseItem = zod.object({
851
+ "id": zod.guid(),
852
+ "entityType": zod.string().min(1),
853
+ "name": zod.string().min(1),
854
+ "parentId": zod.guid().nullish(),
855
+ "parentEntityType": zod.string().nullish(),
856
+ "hasChildren": zod.boolean(),
857
+ "isFolder": zod.boolean()
858
+ });
859
+ var getAutomationsByIdAncestorsResponse = zod.array(getAutomationsByIdAncestorsResponseItem);
860
+ var getAutomationsByIdExportParams = zod.object({
861
+ "id": zod.guid()
862
+ });
863
+ var getAutomationsByIdExportQueryParams = zod.object({
864
+ "include": zod.string().optional()
865
+ });
866
+ var getAutomationsByIdExportResponse = zod.object({
867
+ "formatVersion": zod.string(),
868
+ "exportedAt": zod.iso.datetime({ "local": true, "offset": true }),
869
+ "exportedFrom": zod.object({
870
+ "product": zod.string(),
871
+ "version": zod.string()
872
+ }),
873
+ "automation": zod.object({
874
+ "id": zod.guid(),
875
+ "alias": zod.string(),
876
+ "name": zod.string(),
877
+ "description": zod.string().nullish(),
878
+ "trigger": zod.object({
879
+ "triggerAlias": zod.string(),
880
+ "settings": zod.record(zod.string(), zod.unknown().nullable())
881
+ }).nullish(),
882
+ "steps": zod.array(zod.object({
883
+ "id": zod.guid(),
884
+ "actionAlias": zod.string(),
885
+ "name": zod.string(),
886
+ "alias": zod.string().nullish(),
887
+ "connectionAlias": zod.string().nullish(),
888
+ "settings": zod.record(zod.string(), zod.unknown().nullable()),
889
+ "inputMappings": zod.record(zod.string(), zod.string()),
890
+ "position": zod.object({
891
+ "x": zod.number(),
892
+ "y": zod.number()
893
+ }),
894
+ "errorBehavior": zod.enum(["Retry", "Suspend", "Terminate", "Compensate"]),
895
+ "retryInterval": zod.string().nullish(),
896
+ "maxRetries": zod.int().nullish()
897
+ })),
898
+ "connections": zod.array(zod.object({
899
+ "sourceStepId": zod.guid(),
900
+ "sourceHandle": zod.string().nullish(),
901
+ "targetStepId": zod.guid(),
902
+ "targetHandle": zod.string().nullish(),
903
+ "outcome": zod.string().nullish(),
904
+ "filter": zod.object({
905
+ "groups": zod.array(zod.object({
906
+ "conditions": zod.array(zod.object({
907
+ "leftOperand": zod.string(),
908
+ "operator": zod.enum(["Equals", "NotEquals", "Contains", "NotContains", "StartsWith", "EndsWith", "GreaterThan", "LessThan", "GreaterThanOrEquals", "LessThanOrEquals", "IsEmpty", "IsNotEmpty"]),
909
+ "rightOperand": zod.string()
910
+ }))
911
+ }))
912
+ }).nullish()
913
+ })),
914
+ "canvasState": zod.string().nullish(),
915
+ "notificationSettings": zod.object({
916
+ "channels": zod.array(zod.object({
917
+ "channelAlias": zod.string(),
918
+ "settings": zod.record(zod.string(), zod.unknown().nullable()),
919
+ "isEnabled": zod.boolean(),
920
+ "notifyOn": zod.enum(["Never", "Failed", "Suspended", "FailedOrSuspended", "Completed", "Recovered", "Disabled", "Warning", "ReEnabled", "Resumed", "Rejected"])
921
+ }))
922
+ }).nullish()
923
+ }),
924
+ "connectionReferences": zod.array(zod.object({
925
+ "alias": zod.string(),
926
+ "type": zod.string(),
927
+ "name": zod.string()
928
+ }))
929
+ });
930
+ var putAutomationsByIdImportParams = zod.object({
931
+ "id": zod.guid()
932
+ });
933
+ var putAutomationsByIdImportBody = zod.object({
934
+ "formatVersion": zod.string(),
935
+ "exportedAt": zod.iso.datetime({ "local": true, "offset": true }),
936
+ "exportedFrom": zod.object({
937
+ "product": zod.string(),
938
+ "version": zod.string()
939
+ }),
940
+ "automation": zod.object({
941
+ "id": zod.guid(),
942
+ "alias": zod.string(),
943
+ "name": zod.string(),
944
+ "description": zod.string().nullish(),
945
+ "trigger": zod.object({
946
+ "triggerAlias": zod.string(),
947
+ "settings": zod.record(zod.string(), zod.unknown().nullable())
948
+ }).nullish(),
949
+ "steps": zod.array(zod.object({
950
+ "id": zod.guid(),
951
+ "actionAlias": zod.string(),
952
+ "name": zod.string(),
953
+ "alias": zod.string().nullish(),
954
+ "connectionAlias": zod.string().nullish(),
955
+ "settings": zod.record(zod.string(), zod.unknown().nullable()),
956
+ "inputMappings": zod.record(zod.string(), zod.string()),
957
+ "position": zod.object({
958
+ "x": zod.number(),
959
+ "y": zod.number()
960
+ }),
961
+ "errorBehavior": zod.enum(["Retry", "Suspend", "Terminate", "Compensate"]),
962
+ "retryInterval": zod.string().nullish(),
963
+ "maxRetries": zod.int().nullish()
964
+ })),
965
+ "connections": zod.array(zod.object({
966
+ "sourceStepId": zod.guid(),
967
+ "sourceHandle": zod.string().nullish(),
968
+ "targetStepId": zod.guid(),
969
+ "targetHandle": zod.string().nullish(),
970
+ "outcome": zod.string().nullish(),
971
+ "filter": zod.object({
972
+ "groups": zod.array(zod.object({
973
+ "conditions": zod.array(zod.object({
974
+ "leftOperand": zod.string(),
975
+ "operator": zod.enum(["Equals", "NotEquals", "Contains", "NotContains", "StartsWith", "EndsWith", "GreaterThan", "LessThan", "GreaterThanOrEquals", "LessThanOrEquals", "IsEmpty", "IsNotEmpty"]),
976
+ "rightOperand": zod.string()
977
+ }))
978
+ }))
979
+ }).nullish()
980
+ })),
981
+ "canvasState": zod.string().nullish(),
982
+ "notificationSettings": zod.object({
983
+ "channels": zod.array(zod.object({
984
+ "channelAlias": zod.string(),
985
+ "settings": zod.record(zod.string(), zod.unknown().nullable()),
986
+ "isEnabled": zod.boolean(),
987
+ "notifyOn": zod.enum(["Never", "Failed", "Suspended", "FailedOrSuspended", "Completed", "Recovered", "Disabled", "Warning", "ReEnabled", "Resumed", "Rejected"])
988
+ }))
989
+ }).nullish()
990
+ }),
991
+ "connectionReferences": zod.array(zod.object({
992
+ "alias": zod.string(),
993
+ "type": zod.string(),
994
+ "name": zod.string()
995
+ }))
996
+ });
997
+ var putAutomationsByIdImportResponse = zod.object({
998
+ "success": zod.boolean(),
999
+ "automationId": zod.guid().nullish(),
1000
+ "automationAlias": zod.string().nullish(),
1001
+ "errors": zod.array(zod.string()),
1002
+ "warnings": zod.array(zod.string())
1003
+ });
1004
+ var postAutomationsByIdPublishParams = zod.object({
1005
+ "id": zod.guid()
1006
+ });
1007
+ zod.unknown();
1008
+ var postAutomationsByIdReEnableParams = zod.object({
1009
+ "id": zod.guid()
1010
+ });
1011
+ zod.unknown();
1012
+ var getAutomationsByIdRunsParams = zod.object({
1013
+ "id": zod.guid()
1014
+ });
1015
+ var getAutomationsByIdRunsQueryTakeDefault = 100;
1016
+ var getAutomationsByIdRunsQueryParams = zod.object({
1017
+ "skip": zod.coerce.number().int().optional(),
1018
+ "take": zod.coerce.number().int().default(getAutomationsByIdRunsQueryTakeDefault)
1019
+ });
1020
+ var getAutomationsByIdRunsResponse = zod.object({
1021
+ "total": zod.int(),
1022
+ "items": zod.array(zod.object({
1023
+ "id": zod.guid(),
1024
+ "automationId": zod.guid(),
1025
+ "automationVersion": zod.int(),
1026
+ "status": zod.enum(["Pending", "Running", "Completed", "Failed", "Suspended", "Cancelled", "Rejected"]),
1027
+ "startedUtc": zod.iso.datetime({ "local": true, "offset": true }).nullish(),
1028
+ "completedUtc": zod.iso.datetime({ "local": true, "offset": true }).nullish(),
1029
+ "initiatedBy": zod.string().min(1),
1030
+ "correlationId": zod.string().nullish(),
1031
+ "error": zod.string().nullish(),
1032
+ "triggerAlias": zod.string().nullish(),
1033
+ "stepRuns": zod.array(zod.object({
1034
+ "id": zod.guid(),
1035
+ "stepId": zod.guid(),
1036
+ "actionAlias": zod.string().min(1),
1037
+ "status": zod.enum(["Pending", "Running", "Completed", "Failed", "Skipped", "WaitingForInput", "Sleeping", "Rejected", "Cancelled"]),
1038
+ "startedUtc": zod.iso.datetime({ "local": true, "offset": true }).nullish(),
1039
+ "completedUtc": zod.iso.datetime({ "local": true, "offset": true }).nullish(),
1040
+ "error": zod.string().nullish(),
1041
+ "retryCount": zod.int(),
1042
+ "durationMs": zod.number().nullish(),
1043
+ "branchOutcome": zod.string().nullish(),
1044
+ "iterationIndex": zod.int().nullish(),
1045
+ "iterationTotal": zod.int().nullish(),
1046
+ "logEntries": zod.array(zod.object({
1047
+ "timestampUtc": zod.iso.datetime({ "local": true, "offset": true }),
1048
+ "level": zod.enum(["Debug", "Info", "Warning", "Error"]),
1049
+ "message": zod.string().min(1)
1050
+ }))
1051
+ }))
1052
+ }))
1053
+ });
1054
+ var postAutomationsByIdTriggerParams = zod.object({
1055
+ "id": zod.guid()
1056
+ });
1057
+ zod.void();
1058
+ var postAutomationsByIdUnpublishParams = zod.object({
1059
+ "id": zod.guid()
1060
+ });
1061
+ zod.unknown();
1062
+ var getAutomationsByIdWebhookUrlParams = zod.object({
1063
+ "id": zod.guid()
1064
+ });
1065
+ var getAutomationsByIdWebhookUrlResponse = zod.object({
1066
+ "url": zod.string().min(1)
1067
+ });
1068
+ var getAutomationsGroupsByGroupIdParams = zod.object({
1069
+ "groupId": zod.guid()
1070
+ });
1071
+ var getAutomationsGroupsByGroupIdResponse = zod.object({
1072
+ "id": zod.guid(),
1073
+ "name": zod.string().min(1),
1074
+ "parentId": zod.guid().nullish(),
1075
+ "workspaceId": zod.guid(),
1076
+ "dateCreated": zod.iso.datetime({ "local": true, "offset": true })
1077
+ });
1078
+ var postAutomationsImportBody = zod.object({
1079
+ "workspaceId": zod.guid(),
1080
+ "exportModel": zod.object({
1081
+ "formatVersion": zod.string(),
1082
+ "exportedAt": zod.iso.datetime({ "local": true, "offset": true }),
1083
+ "exportedFrom": zod.object({
1084
+ "product": zod.string(),
1085
+ "version": zod.string()
1086
+ }),
1087
+ "automation": zod.object({
1088
+ "id": zod.guid(),
1089
+ "alias": zod.string(),
1090
+ "name": zod.string(),
1091
+ "description": zod.string().nullish(),
1092
+ "trigger": zod.object({
1093
+ "triggerAlias": zod.string(),
1094
+ "settings": zod.record(zod.string(), zod.unknown().nullable())
1095
+ }).nullish(),
1096
+ "steps": zod.array(zod.object({
1097
+ "id": zod.guid(),
1098
+ "actionAlias": zod.string(),
1099
+ "name": zod.string(),
1100
+ "alias": zod.string().nullish(),
1101
+ "connectionAlias": zod.string().nullish(),
1102
+ "settings": zod.record(zod.string(), zod.unknown().nullable()),
1103
+ "inputMappings": zod.record(zod.string(), zod.string()),
1104
+ "position": zod.object({
1105
+ "x": zod.number(),
1106
+ "y": zod.number()
1107
+ }),
1108
+ "errorBehavior": zod.enum(["Retry", "Suspend", "Terminate", "Compensate"]),
1109
+ "retryInterval": zod.string().nullish(),
1110
+ "maxRetries": zod.int().nullish()
1111
+ })),
1112
+ "connections": zod.array(zod.object({
1113
+ "sourceStepId": zod.guid(),
1114
+ "sourceHandle": zod.string().nullish(),
1115
+ "targetStepId": zod.guid(),
1116
+ "targetHandle": zod.string().nullish(),
1117
+ "outcome": zod.string().nullish(),
1118
+ "filter": zod.object({
1119
+ "groups": zod.array(zod.object({
1120
+ "conditions": zod.array(zod.object({
1121
+ "leftOperand": zod.string(),
1122
+ "operator": zod.enum(["Equals", "NotEquals", "Contains", "NotContains", "StartsWith", "EndsWith", "GreaterThan", "LessThan", "GreaterThanOrEquals", "LessThanOrEquals", "IsEmpty", "IsNotEmpty"]),
1123
+ "rightOperand": zod.string()
1124
+ }))
1125
+ }))
1126
+ }).nullish()
1127
+ })),
1128
+ "canvasState": zod.string().nullish(),
1129
+ "notificationSettings": zod.object({
1130
+ "channels": zod.array(zod.object({
1131
+ "channelAlias": zod.string(),
1132
+ "settings": zod.record(zod.string(), zod.unknown().nullable()),
1133
+ "isEnabled": zod.boolean(),
1134
+ "notifyOn": zod.enum(["Never", "Failed", "Suspended", "FailedOrSuspended", "Completed", "Recovered", "Disabled", "Warning", "ReEnabled", "Resumed", "Rejected"])
1135
+ }))
1136
+ }).nullish()
1137
+ }),
1138
+ "connectionReferences": zod.array(zod.object({
1139
+ "alias": zod.string(),
1140
+ "type": zod.string(),
1141
+ "name": zod.string()
1142
+ }))
1143
+ })
1144
+ });
1145
+ var postAutomationsImportResponse = zod.object({
1146
+ "success": zod.boolean(),
1147
+ "automationId": zod.guid().nullish(),
1148
+ "automationAlias": zod.string().nullish(),
1149
+ "errors": zod.array(zod.string()),
1150
+ "warnings": zod.array(zod.string())
1151
+ });
1152
+ var postAutomationsImportValidateBody = zod.object({
1153
+ "workspaceId": zod.guid(),
1154
+ "exportModel": zod.object({
1155
+ "formatVersion": zod.string(),
1156
+ "exportedAt": zod.iso.datetime({ "local": true, "offset": true }),
1157
+ "exportedFrom": zod.object({
1158
+ "product": zod.string(),
1159
+ "version": zod.string()
1160
+ }),
1161
+ "automation": zod.object({
1162
+ "id": zod.guid(),
1163
+ "alias": zod.string(),
1164
+ "name": zod.string(),
1165
+ "description": zod.string().nullish(),
1166
+ "trigger": zod.object({
1167
+ "triggerAlias": zod.string(),
1168
+ "settings": zod.record(zod.string(), zod.unknown().nullable())
1169
+ }).nullish(),
1170
+ "steps": zod.array(zod.object({
1171
+ "id": zod.guid(),
1172
+ "actionAlias": zod.string(),
1173
+ "name": zod.string(),
1174
+ "alias": zod.string().nullish(),
1175
+ "connectionAlias": zod.string().nullish(),
1176
+ "settings": zod.record(zod.string(), zod.unknown().nullable()),
1177
+ "inputMappings": zod.record(zod.string(), zod.string()),
1178
+ "position": zod.object({
1179
+ "x": zod.number(),
1180
+ "y": zod.number()
1181
+ }),
1182
+ "errorBehavior": zod.enum(["Retry", "Suspend", "Terminate", "Compensate"]),
1183
+ "retryInterval": zod.string().nullish(),
1184
+ "maxRetries": zod.int().nullish()
1185
+ })),
1186
+ "connections": zod.array(zod.object({
1187
+ "sourceStepId": zod.guid(),
1188
+ "sourceHandle": zod.string().nullish(),
1189
+ "targetStepId": zod.guid(),
1190
+ "targetHandle": zod.string().nullish(),
1191
+ "outcome": zod.string().nullish(),
1192
+ "filter": zod.object({
1193
+ "groups": zod.array(zod.object({
1194
+ "conditions": zod.array(zod.object({
1195
+ "leftOperand": zod.string(),
1196
+ "operator": zod.enum(["Equals", "NotEquals", "Contains", "NotContains", "StartsWith", "EndsWith", "GreaterThan", "LessThan", "GreaterThanOrEquals", "LessThanOrEquals", "IsEmpty", "IsNotEmpty"]),
1197
+ "rightOperand": zod.string()
1198
+ }))
1199
+ }))
1200
+ }).nullish()
1201
+ })),
1202
+ "canvasState": zod.string().nullish(),
1203
+ "notificationSettings": zod.object({
1204
+ "channels": zod.array(zod.object({
1205
+ "channelAlias": zod.string(),
1206
+ "settings": zod.record(zod.string(), zod.unknown().nullable()),
1207
+ "isEnabled": zod.boolean(),
1208
+ "notifyOn": zod.enum(["Never", "Failed", "Suspended", "FailedOrSuspended", "Completed", "Recovered", "Disabled", "Warning", "ReEnabled", "Resumed", "Rejected"])
1209
+ }))
1210
+ }).nullish()
1211
+ }),
1212
+ "connectionReferences": zod.array(zod.object({
1213
+ "alias": zod.string(),
1214
+ "type": zod.string(),
1215
+ "name": zod.string()
1216
+ }))
1217
+ })
1218
+ });
1219
+ var postAutomationsImportValidateResponse = zod.object({
1220
+ "success": zod.boolean(),
1221
+ "automationId": zod.guid().nullish(),
1222
+ "automationAlias": zod.string().nullish(),
1223
+ "errors": zod.array(zod.string()),
1224
+ "warnings": zod.array(zod.string())
1225
+ });
1226
+ var getCatalogueActionsQueryParams = zod.object({
1227
+ "workspaceId": zod.guid().optional()
1228
+ });
1229
+ var getCatalogueActionsResponseItem = zod.object({
1230
+ "alias": zod.string().min(1),
1231
+ "name": zod.string().min(1),
1232
+ "description": zod.string().nullish(),
1233
+ "group": zod.string().nullish(),
1234
+ "icon": zod.string().nullish(),
1235
+ "connectionTypeAlias": zod.string().nullish(),
1236
+ "settingsSchema": zod.object({
1237
+ "fields": zod.array(zod.object({
1238
+ "key": zod.string().min(1),
1239
+ "label": zod.string(),
1240
+ "description": zod.string().nullish(),
1241
+ "valueKind": zod.enum(["String", "Scalar", "Collection"]),
1242
+ "editorUiAlias": zod.string().nullish(),
1243
+ "editorConfig": zod.string().nullish(),
1244
+ "defaultValue": zod.unknown().nullish(),
1245
+ "sortOrder": zod.int(),
1246
+ "isSensitive": zod.boolean(),
1247
+ "isRequired": zod.boolean(),
1248
+ "group": zod.string().nullish(),
1249
+ "supportsBindings": zod.boolean(),
1250
+ "visibleWhen": zod.object({
1251
+ "key": zod.string(),
1252
+ "values": zod.array(zod.string())
1253
+ }).nullish()
1254
+ }))
1255
+ }).nullish(),
1256
+ "outputSchema": zod.record(zod.string(), zod.unknown().nullable()).nullish(),
1257
+ "hasDynamicOutputSchema": zod.boolean(),
1258
+ "outcomes": zod.array(zod.object({
1259
+ "key": zod.string().min(1),
1260
+ "label": zod.string().min(1),
1261
+ "isDefault": zod.boolean(),
1262
+ "description": zod.string().nullish()
1263
+ })),
1264
+ "hasDynamicOutcomes": zod.boolean(),
1265
+ "type": zod.string().min(1)
1266
+ });
1267
+ var getCatalogueActionsResponse = zod.array(getCatalogueActionsResponseItem);
1268
+ var getCatalogueConnectionTypesResponseItem = zod.object({
1269
+ "alias": zod.string().min(1),
1270
+ "name": zod.string().min(1),
1271
+ "description": zod.string().nullish(),
1272
+ "group": zod.string().nullish(),
1273
+ "icon": zod.string().nullish(),
1274
+ "settingsSchema": zod.object({
1275
+ "fields": zod.array(zod.object({
1276
+ "key": zod.string().min(1),
1277
+ "label": zod.string(),
1278
+ "description": zod.string().nullish(),
1279
+ "valueKind": zod.enum(["String", "Scalar", "Collection"]),
1280
+ "editorUiAlias": zod.string().nullish(),
1281
+ "editorConfig": zod.string().nullish(),
1282
+ "defaultValue": zod.unknown().nullish(),
1283
+ "sortOrder": zod.int(),
1284
+ "isSensitive": zod.boolean(),
1285
+ "isRequired": zod.boolean(),
1286
+ "group": zod.string().nullish(),
1287
+ "supportsBindings": zod.boolean(),
1288
+ "visibleWhen": zod.object({
1289
+ "key": zod.string(),
1290
+ "values": zod.array(zod.string())
1291
+ }).nullish()
1292
+ }))
1293
+ }).nullish()
1294
+ });
1295
+ var getCatalogueConnectionTypesResponse = zod.array(getCatalogueConnectionTypesResponseItem);
1296
+ var getCatalogueControlFlowsResponseItem = zod.object({
1297
+ "alias": zod.string().min(1),
1298
+ "name": zod.string().min(1),
1299
+ "description": zod.string().nullish(),
1300
+ "group": zod.string().nullish(),
1301
+ "icon": zod.string().nullish(),
1302
+ "connectionTypeAlias": zod.string().nullish(),
1303
+ "settingsSchema": zod.object({
1304
+ "fields": zod.array(zod.object({
1305
+ "key": zod.string().min(1),
1306
+ "label": zod.string(),
1307
+ "description": zod.string().nullish(),
1308
+ "valueKind": zod.enum(["String", "Scalar", "Collection"]),
1309
+ "editorUiAlias": zod.string().nullish(),
1310
+ "editorConfig": zod.string().nullish(),
1311
+ "defaultValue": zod.unknown().nullish(),
1312
+ "sortOrder": zod.int(),
1313
+ "isSensitive": zod.boolean(),
1314
+ "isRequired": zod.boolean(),
1315
+ "group": zod.string().nullish(),
1316
+ "supportsBindings": zod.boolean(),
1317
+ "visibleWhen": zod.object({
1318
+ "key": zod.string(),
1319
+ "values": zod.array(zod.string())
1320
+ }).nullish()
1321
+ }))
1322
+ }).nullish(),
1323
+ "outputSchema": zod.record(zod.string(), zod.unknown().nullable()).nullish(),
1324
+ "hasDynamicOutputSchema": zod.boolean(),
1325
+ "outcomes": zod.array(zod.object({
1326
+ "key": zod.string().min(1),
1327
+ "label": zod.string().min(1),
1328
+ "isDefault": zod.boolean(),
1329
+ "description": zod.string().nullish()
1330
+ })),
1331
+ "hasDynamicOutcomes": zod.boolean(),
1332
+ "type": zod.string().min(1)
1333
+ });
1334
+ var getCatalogueControlFlowsResponse = zod.array(getCatalogueControlFlowsResponseItem);
1335
+ var getCatalogueNotificationChannelsResponseItem = zod.object({
1336
+ "alias": zod.string().min(1),
1337
+ "name": zod.string().min(1),
1338
+ "description": zod.string().nullish(),
1339
+ "icon": zod.string().nullish(),
1340
+ "settingsSchema": zod.object({
1341
+ "fields": zod.array(zod.object({
1342
+ "key": zod.string().min(1),
1343
+ "label": zod.string(),
1344
+ "description": zod.string().nullish(),
1345
+ "valueKind": zod.enum(["String", "Scalar", "Collection"]),
1346
+ "editorUiAlias": zod.string().nullish(),
1347
+ "editorConfig": zod.string().nullish(),
1348
+ "defaultValue": zod.unknown().nullish(),
1349
+ "sortOrder": zod.int(),
1350
+ "isSensitive": zod.boolean(),
1351
+ "isRequired": zod.boolean(),
1352
+ "group": zod.string().nullish(),
1353
+ "supportsBindings": zod.boolean(),
1354
+ "visibleWhen": zod.object({
1355
+ "key": zod.string(),
1356
+ "values": zod.array(zod.string())
1357
+ }).nullish()
1358
+ }))
1359
+ }).nullish()
1360
+ });
1361
+ var getCatalogueNotificationChannelsResponse = zod.array(getCatalogueNotificationChannelsResponseItem);
1362
+ var getCatalogueStepTypesQueryParams = zod.object({
1363
+ "type": zod.string().optional()
1364
+ });
1365
+ var getCatalogueStepTypesResponseItem = zod.object({
1366
+ "alias": zod.string().min(1),
1367
+ "name": zod.string().min(1),
1368
+ "description": zod.string().nullish(),
1369
+ "group": zod.string().nullish(),
1370
+ "icon": zod.string().nullish(),
1371
+ "connectionTypeAlias": zod.string().nullish(),
1372
+ "settingsSchema": zod.object({
1373
+ "fields": zod.array(zod.object({
1374
+ "key": zod.string().min(1),
1375
+ "label": zod.string(),
1376
+ "description": zod.string().nullish(),
1377
+ "valueKind": zod.enum(["String", "Scalar", "Collection"]),
1378
+ "editorUiAlias": zod.string().nullish(),
1379
+ "editorConfig": zod.string().nullish(),
1380
+ "defaultValue": zod.unknown().nullish(),
1381
+ "sortOrder": zod.int(),
1382
+ "isSensitive": zod.boolean(),
1383
+ "isRequired": zod.boolean(),
1384
+ "group": zod.string().nullish(),
1385
+ "supportsBindings": zod.boolean(),
1386
+ "visibleWhen": zod.object({
1387
+ "key": zod.string(),
1388
+ "values": zod.array(zod.string())
1389
+ }).nullish()
1390
+ }))
1391
+ }).nullish(),
1392
+ "outputSchema": zod.record(zod.string(), zod.unknown().nullable()).nullish(),
1393
+ "hasDynamicOutputSchema": zod.boolean(),
1394
+ "outcomes": zod.array(zod.object({
1395
+ "key": zod.string().min(1),
1396
+ "label": zod.string().min(1),
1397
+ "isDefault": zod.boolean(),
1398
+ "description": zod.string().nullish()
1399
+ })),
1400
+ "hasDynamicOutcomes": zod.boolean(),
1401
+ "type": zod.string().min(1)
1402
+ });
1403
+ var getCatalogueStepTypesResponse = zod.array(getCatalogueStepTypesResponseItem);
1404
+ zod.object({
1405
+ "alias": zod.string()
1406
+ });
1407
+ zod.object({
1408
+ "settings": zod.record(zod.string(), zod.unknown().nullable())
1409
+ });
1410
+ var postCatalogueStepTypesByAliasOutcomesResponseItem = zod.object({
1411
+ "key": zod.string().min(1),
1412
+ "label": zod.string().min(1),
1413
+ "isDefault": zod.boolean(),
1414
+ "description": zod.string().nullish()
1415
+ });
1416
+ zod.array(postCatalogueStepTypesByAliasOutcomesResponseItem);
1417
+ zod.object({
1418
+ "alias": zod.string()
1419
+ });
1420
+ zod.object({
1421
+ "settings": zod.record(zod.string(), zod.unknown().nullable())
1422
+ });
1423
+ zod.record(zod.string(), zod.unknown());
1424
+ var getCatalogueTriggersQueryParams = zod.object({
1425
+ "workspaceId": zod.guid().optional()
1426
+ });
1427
+ var getCatalogueTriggersResponseItem = zod.object({
1428
+ "alias": zod.string().min(1),
1429
+ "name": zod.string().min(1),
1430
+ "description": zod.string().nullish(),
1431
+ "group": zod.string().nullish(),
1432
+ "icon": zod.string().nullish(),
1433
+ "connectionTypeAlias": zod.string().nullish(),
1434
+ "settingsSchema": zod.object({
1435
+ "fields": zod.array(zod.object({
1436
+ "key": zod.string().min(1),
1437
+ "label": zod.string(),
1438
+ "description": zod.string().nullish(),
1439
+ "valueKind": zod.enum(["String", "Scalar", "Collection"]),
1440
+ "editorUiAlias": zod.string().nullish(),
1441
+ "editorConfig": zod.string().nullish(),
1442
+ "defaultValue": zod.unknown().nullish(),
1443
+ "sortOrder": zod.int(),
1444
+ "isSensitive": zod.boolean(),
1445
+ "isRequired": zod.boolean(),
1446
+ "group": zod.string().nullish(),
1447
+ "supportsBindings": zod.boolean(),
1448
+ "visibleWhen": zod.object({
1449
+ "key": zod.string(),
1450
+ "values": zod.array(zod.string())
1451
+ }).nullish()
1452
+ }))
1453
+ }).nullish(),
1454
+ "outputSchema": zod.record(zod.string(), zod.unknown().nullable()).nullish(),
1455
+ "hasDynamicOutputSchema": zod.boolean(),
1456
+ "outcomes": zod.array(zod.object({
1457
+ "key": zod.string().min(1),
1458
+ "label": zod.string().min(1),
1459
+ "isDefault": zod.boolean(),
1460
+ "description": zod.string().nullish()
1461
+ })),
1462
+ "hasDynamicOutcomes": zod.boolean(),
1463
+ "type": zod.string().min(1),
1464
+ "supportsManualRun": zod.boolean()
1465
+ });
1466
+ zod.array(getCatalogueTriggersResponseItem);
1467
+ var getCatalogueWebhookAuthenticatorsResponseItem = zod.object({
1468
+ "alias": zod.string().min(1),
1469
+ "name": zod.string().min(1),
1470
+ "description": zod.string().nullish(),
1471
+ "settingsSchema": zod.object({
1472
+ "fields": zod.array(zod.object({
1473
+ "key": zod.string().min(1),
1474
+ "label": zod.string(),
1475
+ "description": zod.string().nullish(),
1476
+ "valueKind": zod.enum(["String", "Scalar", "Collection"]),
1477
+ "editorUiAlias": zod.string().nullish(),
1478
+ "editorConfig": zod.string().nullish(),
1479
+ "defaultValue": zod.unknown().nullish(),
1480
+ "sortOrder": zod.int(),
1481
+ "isSensitive": zod.boolean(),
1482
+ "isRequired": zod.boolean(),
1483
+ "group": zod.string().nullish(),
1484
+ "supportsBindings": zod.boolean(),
1485
+ "visibleWhen": zod.object({
1486
+ "key": zod.string(),
1487
+ "values": zod.array(zod.string())
1488
+ }).nullish()
1489
+ }))
1490
+ }).nullish()
1491
+ });
1492
+ var getCatalogueWebhookAuthenticatorsResponse = zod.array(getCatalogueWebhookAuthenticatorsResponseItem);
1493
+ var postConnectionsBody = zod.object({
1494
+ "alias": zod.string().min(1),
1495
+ "name": zod.string().min(1),
1496
+ "type": zod.string().min(1),
1497
+ "settings": zod.record(zod.string(), zod.unknown().nullable())
1498
+ });
1499
+ zod.void();
1500
+ var getConnectionsQueryTakeDefault = 100;
1501
+ var getConnectionsQueryParams = zod.object({
1502
+ "filter": zod.string().optional(),
1503
+ "skip": zod.coerce.number().int().optional(),
1504
+ "take": zod.coerce.number().int().default(getConnectionsQueryTakeDefault)
1505
+ });
1506
+ var getConnectionsResponse = zod.object({
1507
+ "total": zod.int(),
1508
+ "items": zod.array(zod.object({
1509
+ "id": zod.guid(),
1510
+ "alias": zod.string().min(1),
1511
+ "name": zod.string().min(1),
1512
+ "type": zod.string().min(1),
1513
+ "version": zod.int(),
1514
+ "dateCreated": zod.iso.datetime({ "local": true, "offset": true }),
1515
+ "dateModified": zod.iso.datetime({ "local": true, "offset": true })
1516
+ }))
1517
+ });
1518
+ var deleteConnectionsByIdParams = zod.object({
1519
+ "id": zod.guid()
1520
+ });
1521
+ zod.unknown();
1522
+ var getConnectionsByIdParams = zod.object({
1523
+ "id": zod.guid()
1524
+ });
1525
+ var getConnectionsByIdResponse = zod.object({
1526
+ "id": zod.guid(),
1527
+ "alias": zod.string().min(1),
1528
+ "name": zod.string().min(1),
1529
+ "type": zod.string().min(1),
1530
+ "settings": zod.record(zod.string(), zod.unknown().nullable()),
1531
+ "version": zod.int(),
1532
+ "dateCreated": zod.iso.datetime({ "local": true, "offset": true }),
1533
+ "dateModified": zod.iso.datetime({ "local": true, "offset": true })
1534
+ });
1535
+ var putConnectionsByIdParams = zod.object({
1536
+ "id": zod.guid()
1537
+ });
1538
+ var putConnectionsByIdBodyOneVersionMax = 2147483647;
1539
+ var putConnectionsByIdBody = zod.object({
1540
+ "alias": zod.string().min(1),
1541
+ "name": zod.string().min(1),
1542
+ "type": zod.string().min(1),
1543
+ "settings": zod.record(zod.string(), zod.unknown().nullable()),
1544
+ "version": zod.int().min(1).max(putConnectionsByIdBodyOneVersionMax)
1545
+ });
1546
+ zod.unknown();
1547
+ var postConnectionsByIdTestParams = zod.object({
1548
+ "id": zod.guid()
1549
+ });
1550
+ var postConnectionsByIdTestResponse = zod.object({
1551
+ "status": zod.enum(["Success", "Warning", "Failure"]),
1552
+ "message": zod.string().nullish(),
1553
+ "details": zod.array(zod.string())
1554
+ });
1555
+ var getMetricsQueryParams = zod.object({
1556
+ "workspaceId": zod.guid().optional(),
1557
+ "from": zod.iso.datetime({ "local": true, "offset": true }).optional(),
1558
+ "to": zod.iso.datetime({ "local": true, "offset": true }).optional()
1559
+ });
1560
+ var getMetricsResponse = zod.object({
1561
+ "totalRuns": zod.int(),
1562
+ "byStatus": zod.object({
1563
+ "Pending": zod.int(),
1564
+ "Running": zod.int(),
1565
+ "Completed": zod.int(),
1566
+ "Failed": zod.int(),
1567
+ "Suspended": zod.int(),
1568
+ "Cancelled": zod.int(),
1569
+ "Rejected": zod.int()
1570
+ }),
1571
+ "successRate": zod.number()
1572
+ });
1573
+ var getMetricsByAutomationQueryTakeDefault = 10;
1574
+ var getMetricsByAutomationQueryParams = zod.object({
1575
+ "workspaceId": zod.guid().optional(),
1576
+ "from": zod.iso.datetime({ "local": true, "offset": true }).optional(),
1577
+ "to": zod.iso.datetime({ "local": true, "offset": true }).optional(),
1578
+ "take": zod.coerce.number().int().default(getMetricsByAutomationQueryTakeDefault)
1579
+ });
1580
+ var getMetricsByAutomationResponseItem = zod.object({
1581
+ "automationId": zod.guid(),
1582
+ "automationName": zod.string(),
1583
+ "totalRuns": zod.int(),
1584
+ "successCount": zod.int(),
1585
+ "failCount": zod.int()
1586
+ });
1587
+ zod.array(getMetricsByAutomationResponseItem);
1588
+ var getRunsQueryTakeDefault = 100;
1589
+ var getRunsQueryParams = zod.object({
1590
+ "skip": zod.coerce.number().int().optional(),
1591
+ "take": zod.coerce.number().int().default(getRunsQueryTakeDefault)
1592
+ });
1593
+ var getRunsResponse = zod.object({
1594
+ "total": zod.int(),
1595
+ "items": zod.array(zod.object({
1596
+ "id": zod.guid(),
1597
+ "automationId": zod.guid(),
1598
+ "automationName": zod.string().min(1),
1599
+ "automationVersion": zod.int(),
1600
+ "status": zod.enum(["Pending", "Running", "Completed", "Failed", "Suspended", "Cancelled", "Rejected"]),
1601
+ "startedUtc": zod.iso.datetime({ "local": true, "offset": true }).nullish(),
1602
+ "completedUtc": zod.iso.datetime({ "local": true, "offset": true }).nullish(),
1603
+ "initiatedBy": zod.string().min(1),
1604
+ "correlationId": zod.string().nullish(),
1605
+ "error": zod.string().nullish()
1606
+ }))
1607
+ });
1608
+ var getRunsByIdParams = zod.object({
1609
+ "id": zod.guid()
1610
+ });
1611
+ var getRunsByIdResponse = zod.object({
1612
+ "id": zod.guid(),
1613
+ "automationId": zod.guid(),
1614
+ "automationVersion": zod.int(),
1615
+ "status": zod.enum(["Pending", "Running", "Completed", "Failed", "Suspended", "Cancelled", "Rejected"]),
1616
+ "startedUtc": zod.iso.datetime({ "local": true, "offset": true }).nullish(),
1617
+ "completedUtc": zod.iso.datetime({ "local": true, "offset": true }).nullish(),
1618
+ "initiatedBy": zod.string().min(1),
1619
+ "correlationId": zod.string().nullish(),
1620
+ "error": zod.string().nullish(),
1621
+ "triggerAlias": zod.string().nullish(),
1622
+ "stepRuns": zod.array(zod.object({
1623
+ "id": zod.guid(),
1624
+ "stepId": zod.guid(),
1625
+ "actionAlias": zod.string().min(1),
1626
+ "status": zod.enum(["Pending", "Running", "Completed", "Failed", "Skipped", "WaitingForInput", "Sleeping", "Rejected", "Cancelled"]),
1627
+ "startedUtc": zod.iso.datetime({ "local": true, "offset": true }).nullish(),
1628
+ "completedUtc": zod.iso.datetime({ "local": true, "offset": true }).nullish(),
1629
+ "error": zod.string().nullish(),
1630
+ "retryCount": zod.int(),
1631
+ "durationMs": zod.number().nullish(),
1632
+ "branchOutcome": zod.string().nullish(),
1633
+ "iterationIndex": zod.int().nullish(),
1634
+ "iterationTotal": zod.int().nullish(),
1635
+ "logEntries": zod.array(zod.object({
1636
+ "timestampUtc": zod.iso.datetime({ "local": true, "offset": true }),
1637
+ "level": zod.enum(["Debug", "Info", "Warning", "Error"]),
1638
+ "message": zod.string().min(1)
1639
+ }))
1640
+ }))
1641
+ });
1642
+ var postRunsByIdReplayParams = zod.object({
1643
+ "id": zod.guid()
1644
+ });
1645
+ zod.void();
1646
+ var postRunsByIdResumeParams = zod.object({
1647
+ "id": zod.guid()
1648
+ });
1649
+ zod.void();
1650
+ zod.object({
1651
+ "id": zod.guid(),
1652
+ "stepRunId": zod.guid()
1653
+ });
1654
+ zod.object({
1655
+ "input": zod.string().nullish(),
1656
+ "inputTruncated": zod.boolean(),
1657
+ "output": zod.string().nullish(),
1658
+ "outputTruncated": zod.boolean()
1659
+ });
1660
+ var postRunsByIdSuspendParams = zod.object({
1661
+ "id": zod.guid()
1662
+ });
1663
+ zod.void();
1664
+ var postRunsByIdTerminateParams = zod.object({
1665
+ "id": zod.guid()
1666
+ });
1667
+ zod.void();
1668
+ zod.object({
1669
+ "id": zod.guid()
1670
+ });
1671
+ zod.object({
1672
+ "triggerData": zod.string().nullish(),
1673
+ "triggerDataTruncated": zod.boolean()
1674
+ });
1675
+ var getVersionHistoryByEntityTypeByEntityIdParams = zod.object({
1676
+ "entityType": zod.string(),
1677
+ "entityId": zod.guid()
1678
+ });
1679
+ var getVersionHistoryByEntityTypeByEntityIdQueryTakeDefault = 10;
1680
+ var getVersionHistoryByEntityTypeByEntityIdQueryParams = zod.object({
1681
+ "skip": zod.coerce.number().int().optional(),
1682
+ "take": zod.coerce.number().int().default(getVersionHistoryByEntityTypeByEntityIdQueryTakeDefault)
1683
+ });
1684
+ var getVersionHistoryByEntityTypeByEntityIdResponse = zod.object({
1685
+ "currentVersion": zod.int(),
1686
+ "totalVersions": zod.int(),
1687
+ "publishedVersion": zod.int().nullish(),
1688
+ "versions": zod.array(zod.object({
1689
+ "id": zod.guid(),
1690
+ "entityId": zod.guid(),
1691
+ "version": zod.int(),
1692
+ "dateCreated": zod.iso.datetime({ "local": true, "offset": true }),
1693
+ "createdByUserId": zod.guid().nullish(),
1694
+ "changeDescription": zod.string().nullish(),
1695
+ "isPublished": zod.boolean()
1696
+ }))
1697
+ });
1698
+ var getVersionHistoryByEntityTypeByEntityIdByEntityVersionParams = zod.object({
1699
+ "entityType": zod.string(),
1700
+ "entityId": zod.guid(),
1701
+ "entityVersion": zod.int()
1702
+ });
1703
+ var getVersionHistoryByEntityTypeByEntityIdByEntityVersionResponse = zod.object({
1704
+ "id": zod.guid(),
1705
+ "entityId": zod.guid(),
1706
+ "version": zod.int(),
1707
+ "dateCreated": zod.iso.datetime({ "local": true, "offset": true }),
1708
+ "createdByUserId": zod.guid().nullish(),
1709
+ "changeDescription": zod.string().nullish(),
1710
+ "isPublished": zod.boolean()
1711
+ });
1712
+ var postVersionHistoryByEntityTypeByEntityIdByEntityVersionRollbackParams = zod.object({
1713
+ "entityType": zod.string(),
1714
+ "entityId": zod.guid(),
1715
+ "entityVersion": zod.int()
1716
+ });
1717
+ zod.void();
1718
+ var getVersionHistoryByEntityTypeByEntityIdByFromEntityVersionCompareByToEntityVersionParams = zod.object({
1719
+ "entityType": zod.string(),
1720
+ "entityId": zod.guid(),
1721
+ "fromEntityVersion": zod.int(),
1722
+ "toEntityVersion": zod.int()
1723
+ });
1724
+ var getVersionHistoryByEntityTypeByEntityIdByFromEntityVersionCompareByToEntityVersionResponse = zod.object({
1725
+ "fromVersion": zod.int(),
1726
+ "toVersion": zod.int(),
1727
+ "changes": zod.array(zod.object({
1728
+ "path": zod.string().min(1),
1729
+ "oldValue": zod.string().nullish(),
1730
+ "newValue": zod.string().nullish()
1731
+ }))
1732
+ });
1733
+ var getVersionHistorySupportedTypesResponseItem = zod.string();
1734
+ zod.array(getVersionHistorySupportedTypesResponseItem);
1735
+ zod.object({
1736
+ "alias": zod.string().min(1),
1737
+ "name": zod.string().min(1),
1738
+ "serviceAccountKey": zod.guid(),
1739
+ "userGroups": zod.array(zod.guid()),
1740
+ "allowedConnections": zod.array(zod.guid())
1741
+ });
1742
+ zod.void();
1743
+ var getWorkspacesQueryTakeDefault = 100;
1744
+ var getWorkspacesQueryParams = zod.object({
1745
+ "filter": zod.string().optional(),
1746
+ "skip": zod.coerce.number().int().optional(),
1747
+ "take": zod.coerce.number().int().default(getWorkspacesQueryTakeDefault)
1748
+ });
1749
+ var getWorkspacesResponse = zod.object({
1750
+ "total": zod.int(),
1751
+ "items": zod.array(zod.object({
1752
+ "id": zod.guid(),
1753
+ "alias": zod.string().min(1),
1754
+ "name": zod.string().min(1),
1755
+ "serviceAccountKey": zod.guid(),
1756
+ "version": zod.int(),
1757
+ "dateCreated": zod.iso.datetime({ "local": true, "offset": true }),
1758
+ "dateModified": zod.iso.datetime({ "local": true, "offset": true })
1759
+ }))
1760
+ });
1761
+ zod.object({
1762
+ "id": zod.guid()
1763
+ });
1764
+ zod.unknown();
1765
+ zod.object({
1766
+ "id": zod.guid()
1767
+ });
1768
+ var getWorkspacesByIdResponse = zod.object({
1769
+ "id": zod.guid(),
1770
+ "alias": zod.string().min(1),
1771
+ "name": zod.string().min(1),
1772
+ "serviceAccountKey": zod.guid(),
1773
+ "userGroups": zod.array(zod.guid()),
1774
+ "allowedConnections": zod.array(zod.guid()),
1775
+ "version": zod.int(),
1776
+ "dateCreated": zod.iso.datetime({ "local": true, "offset": true }),
1777
+ "dateModified": zod.iso.datetime({ "local": true, "offset": true })
1778
+ });
1779
+ zod.object({
1780
+ "id": zod.guid()
1781
+ });
1782
+ var putWorkspacesByIdBodyOneVersionMax = 2147483647;
1783
+ var putWorkspacesByIdBody = zod.object({
1784
+ "alias": zod.string().min(1),
1785
+ "name": zod.string().min(1),
1786
+ "serviceAccountKey": zod.guid(),
1787
+ "userGroups": zod.array(zod.guid()),
1788
+ "allowedConnections": zod.array(zod.guid()),
1789
+ "version": zod.int().min(1).max(putWorkspacesByIdBodyOneVersionMax)
1790
+ });
1791
+ zod.unknown();
1792
+ zod.object({
1793
+ "id": zod.guid()
1794
+ });
1795
+ zod.object({
1796
+ "name": zod.string().min(1),
1797
+ "parentId": zod.guid().nullish()
1798
+ });
1799
+ zod.void();
1800
+ zod.object({
1801
+ "id": zod.guid()
1802
+ });
1803
+ zod.object({
1804
+ "parentGroupId": zod.guid().optional()
1805
+ });
1806
+ var getWorkspacesByIdGroupsResponseItem = zod.object({
1807
+ "id": zod.guid(),
1808
+ "name": zod.string().min(1),
1809
+ "parentId": zod.guid().nullish(),
1810
+ "workspaceId": zod.guid(),
1811
+ "dateCreated": zod.iso.datetime({ "local": true, "offset": true })
1812
+ });
1813
+ var getWorkspacesByIdGroupsResponse = zod.array(getWorkspacesByIdGroupsResponseItem);
1814
+ zod.object({
1815
+ "id": zod.guid(),
1816
+ "groupId": zod.guid()
1817
+ });
1818
+ zod.unknown();
1819
+ zod.object({
1820
+ "id": zod.guid(),
1821
+ "groupId": zod.guid()
1822
+ });
1823
+ var getWorkspacesByIdGroupsByGroupIdResponse = zod.object({
1824
+ "id": zod.guid(),
1825
+ "name": zod.string().min(1),
1826
+ "parentId": zod.guid().nullish(),
1827
+ "workspaceId": zod.guid(),
1828
+ "dateCreated": zod.iso.datetime({ "local": true, "offset": true })
1829
+ });
1830
+ zod.object({
1831
+ "id": zod.guid(),
1832
+ "groupId": zod.guid()
1833
+ });
1834
+ var putWorkspacesByIdGroupsByGroupIdBody = zod.object({
1835
+ "name": zod.string().min(1),
1836
+ "parentId": zod.guid().nullish()
1837
+ });
1838
+ zod.unknown();
1839
+
1840
+ // src/umbraco-api/tools/approvals/get/list-pending-approvals.ts
1841
+ var outputSchema = z.object({ items: getApprovalsPendingResponse });
1842
+ var listPendingApprovalsTool = {
1843
+ name: "list-pending-approvals",
1844
+ description: "Lists workflow run steps that are currently paused and waiting for a human approve/reject decision. Each item includes the runId and stepId needed to submit a decision, plus the automation it belongs to and the prompt shown to the approver. Use this to find what is blocked on approval before calling decide-approval-step.",
1845
+ slices: ["list"],
1846
+ annotations: {
1847
+ readOnlyHint: true
1848
+ },
1849
+ outputSchema,
1850
+ handler: async () => {
1851
+ return executeGetItemsApiCall((client) => client.getApprovalsPending(CAPTURE_RAW_HTTP_RESPONSE));
1852
+ }
1853
+ };
1854
+ var list_pending_approvals_default = withStandardDecorators(listPendingApprovalsTool);
1855
+ var inputSchema = {
1856
+ runId: postApprovalsByRunIdStepsByStepIdDecisionParams.shape.runId.describe(
1857
+ "ID of the paused workflow run, from list-pending-approvals."
1858
+ ),
1859
+ stepId: postApprovalsByRunIdStepsByStepIdDecisionParams.shape.stepId.describe(
1860
+ "ID of the pending approval step within the run, from list-pending-approvals."
1861
+ ),
1862
+ outcome: postApprovalsByRunIdStepsByStepIdDecisionBody.shape.outcome.describe(
1863
+ "The decision: 'Approved' resumes the run past this step, 'Rejected' fails the run at this step."
1864
+ ),
1865
+ comment: postApprovalsByRunIdStepsByStepIdDecisionBody.shape.comment.describe(
1866
+ "Optional free-text reason or note to record alongside the decision."
1867
+ )
1868
+ };
1869
+ var DecideApprovalStepTool = {
1870
+ name: "decide-approval-step",
1871
+ description: "Submits a human approve/reject decision for a workflow run step that is currently paused waiting for approval. Get the runId and stepId from list-pending-approvals \u2014 only steps returned by that tool are valid targets. Setting outcome to 'Approved' unblocks the run so it continues past this step; 'Rejected' fails the run at this step. Not idempotent \u2014 a step can only be decided once, so calling this again for a step that has already been decided will error rather than silently succeed.",
1872
+ inputSchema,
1873
+ slices: ["action"],
1874
+ annotations: {
1875
+ idempotentHint: false
1876
+ },
1877
+ handler: async ({ runId, stepId, outcome, comment }) => {
1878
+ return executeVoidApiCall(
1879
+ (client) => client.postApprovalsByRunIdStepsByStepIdDecision(
1880
+ runId,
1881
+ stepId,
1882
+ { outcome, comment },
1883
+ CAPTURE_RAW_HTTP_RESPONSE
1884
+ )
1885
+ );
1886
+ }
1887
+ };
1888
+ var decide_approval_step_default = withStandardDecorators(DecideApprovalStepTool);
1889
+
1890
+ // src/umbraco-api/tools/approvals/index.ts
1891
+ var collection2 = {
1892
+ metadata: {
1893
+ name: "approvals",
1894
+ displayName: "Approvals",
1895
+ description: "Find workflow run steps paused waiting for human approval, and submit approve/reject decisions to unblock or fail them."
1896
+ },
1897
+ tools: () => [list_pending_approvals_default, decide_approval_step_default]
1898
+ };
1899
+ var approvals_default = collection2;
1900
+ var inputSchema2 = {
1901
+ ...getAutomationsQueryParams.shape,
1902
+ filter: getAutomationsQueryParams.shape.filter.describe(
1903
+ "Optional text matched against automation name and alias."
1904
+ ),
1905
+ groupId: getAutomationsQueryParams.shape.groupId.describe(
1906
+ "Optional. Only return automations filed in this workspace group."
1907
+ ),
1908
+ workspaceId: getAutomationsQueryParams.shape.workspaceId.describe(
1909
+ "Optional. Only return automations in this workspace (id from list-workspaces)."
1910
+ )
1911
+ };
1912
+ var listAutomationsTool = {
1913
+ name: "list-automations",
1914
+ description: "Lists automations with optional filtering by name/alias (filter), workspaceId, or groupId, with cursor paging (pass nextCursor from the previous response). Each item is a summary (id, alias, name, status, health, triggerAlias, version) - use get-automation with the returned id to fetch the full step/connection graph before editing.",
1915
+ inputSchema: inputSchema2,
1916
+ outputSchema: getAutomationsResponse,
1917
+ slices: ["list"],
1918
+ annotations: {
1919
+ readOnlyHint: true
1920
+ },
1921
+ handler: async (params) => {
1922
+ return executeGetApiCall(
1923
+ (client) => client.getAutomations(params, CAPTURE_RAW_HTTP_RESPONSE)
1924
+ );
1925
+ }
1926
+ };
1927
+ var list_automations_default = withStandardDecorators(listAutomationsTool);
1928
+ var inputSchema3 = {
1929
+ ...getAutomationsByIdParams.shape,
1930
+ id: getAutomationsByIdParams.shape.id.describe(
1931
+ "Id of the automation (from list-automations or create-automation)."
1932
+ )
1933
+ };
1934
+ var getAutomationTool = {
1935
+ name: "get-automation",
1936
+ description: "Gets the full definition of an automation by id: trigger, steps, connections, canvas state, notification settings, status, health and version. Read this before calling update-automation so the full body (including steps/connections) is preserved when saving.",
1937
+ inputSchema: inputSchema3,
1938
+ outputSchema: getAutomationsByIdResponse,
1939
+ slices: ["read"],
1940
+ annotations: {
1941
+ readOnlyHint: true
1942
+ },
1943
+ handler: async ({ id }) => {
1944
+ return executeGetApiCall(
1945
+ (client) => client.getAutomationsById(id, CAPTURE_RAW_HTTP_RESPONSE)
1946
+ );
1947
+ }
1948
+ };
1949
+ var get_automation_default = withStandardDecorators(getAutomationTool);
1950
+ var outputSchema2 = z.object({ items: getAutomationsByIdAncestorsResponse });
1951
+ var inputSchema4 = {
1952
+ ...getAutomationsByIdAncestorsParams.shape,
1953
+ id: getAutomationsByIdAncestorsParams.shape.id.describe(
1954
+ "Id of the automation (from list-automations or create-automation)."
1955
+ )
1956
+ };
1957
+ var getAutomationAncestorsTool = {
1958
+ name: "get-automation-ancestors",
1959
+ description: "Lists the ancestor entities (workspace groups/folders) above an automation, ordered from the immediate parent up to the root. Use this to build breadcrumbs or to discover the groupId hierarchy an automation lives in.",
1960
+ inputSchema: inputSchema4,
1961
+ outputSchema: outputSchema2,
1962
+ slices: ["tree"],
1963
+ annotations: {
1964
+ readOnlyHint: true
1965
+ },
1966
+ handler: async ({ id }) => {
1967
+ return executeGetItemsApiCall((client) => client.getAutomationsByIdAncestors(id, CAPTURE_RAW_HTTP_RESPONSE));
1968
+ }
1969
+ };
1970
+ var get_automation_ancestors_default = withStandardDecorators(getAutomationAncestorsTool);
1971
+ var inputSchema5 = {
1972
+ ...getAutomationsByIdExportParams.shape,
1973
+ ...getAutomationsByIdExportQueryParams.shape,
1974
+ id: getAutomationsByIdExportParams.shape.id.describe(
1975
+ "Id of the automation to export."
1976
+ ),
1977
+ include: getAutomationsByIdExportQueryParams.shape.include.describe(
1978
+ "Optional. Limits which parts of the automation are exported. Omit to export everything."
1979
+ )
1980
+ };
1981
+ var exportAutomationTool = {
1982
+ name: "export-automation",
1983
+ description: "Exports an automation as a portable definition (trigger, steps, connections, canvas state, notification settings, referenced connection types) suitable for backup or moving to another workspace. Optionally scope what's included via 'include'. Re-import the result with import-automation (new automation) or import-automation-into-existing (overwrite an existing one), or dry-run it first with validate-automation-import.",
1984
+ inputSchema: inputSchema5,
1985
+ outputSchema: getAutomationsByIdExportResponse,
1986
+ slices: ["export"],
1987
+ annotations: {
1988
+ readOnlyHint: true
1989
+ },
1990
+ handler: async ({ id, include }) => {
1991
+ const params = { include };
1992
+ return executeGetApiCall(
1993
+ (client) => client.getAutomationsByIdExport(id, params, CAPTURE_RAW_HTTP_RESPONSE)
1994
+ );
1995
+ }
1996
+ };
1997
+ var export_automation_default = withStandardDecorators(exportAutomationTool);
1998
+ var inputSchema6 = {
1999
+ ...getAutomationsByIdRunsParams.shape,
2000
+ ...getAutomationsByIdRunsQueryParams.shape,
2001
+ id: getAutomationsByIdRunsParams.shape.id.describe(
2002
+ "Id of the automation whose runs to list."
2003
+ )
2004
+ };
2005
+ var listAutomationRunsTool = {
2006
+ name: "list-automation-runs",
2007
+ description: "Lists runs (executions) of an automation, newest first, with cursor paging (pass nextCursor from the previous response). Each run includes its status, timing, correlation id, error (if any), and a full step-by-step run history. Use this to investigate whether/how an automation has been executing, or to check the outcome of a run started via trigger-automation.",
2008
+ inputSchema: inputSchema6,
2009
+ outputSchema: getAutomationsByIdRunsResponse,
2010
+ slices: ["list"],
2011
+ annotations: {
2012
+ readOnlyHint: true
2013
+ },
2014
+ handler: async ({ id, skip, take }) => {
2015
+ const params = { skip, take };
2016
+ return executeGetApiCall(
2017
+ (client) => client.getAutomationsByIdRuns(id, params, CAPTURE_RAW_HTTP_RESPONSE)
2018
+ );
2019
+ }
2020
+ };
2021
+ var list_automation_runs_default = withStandardDecorators(listAutomationRunsTool);
2022
+ var umbracoBaseUrl;
2023
+ function setUmbracoBaseUrl(baseUrl2) {
2024
+ umbracoBaseUrl = baseUrl2 ? normalizeBaseUrl(baseUrl2) : void 0;
2025
+ }
2026
+ function getUmbracoBaseUrl() {
2027
+ return umbracoBaseUrl;
2028
+ }
2029
+ var AUTOMATE_FEATURE_MIN_VERSIONS = {
2030
+ /**
2031
+ * "approved" / "rejected" outputs on Request Approval. Before them the step has one
2032
+ * plain output that runs on approval, and a rejection fails the run.
2033
+ */
2034
+ approvalOutcomes: { 17: "17.2.0", 18: "18.2.0" },
2035
+ /** A "done" output on While/ForEach/Parallel that runs once after the container. */
2036
+ containerDone: { 17: "17.3.0", 18: "18.3.0" },
2037
+ /** GET /automations/{id}/webhook-url. */
2038
+ webhookUrlEndpoint: { 17: "17.4.0", 18: "18.4.0" },
2039
+ /** TriggerItemResponseModel.supportsManualRun. */
2040
+ triggerSupportsManualRun: { 17: "17.4.0", 18: "18.4.0" }
2041
+ };
2042
+ function parseVersion(version) {
2043
+ const [major, minor, patch = 0] = (version ?? "").split(/[.+-]/).map(Number);
2044
+ if (!Number.isFinite(major) || !Number.isFinite(minor) || !Number.isFinite(patch)) return void 0;
2045
+ return [major, minor, patch];
2046
+ }
2047
+ function compareVersions(a, b) {
2048
+ return a[0] - b[0] || a[1] - b[1] || a[2] - b[2];
2049
+ }
2050
+ function automateVersionSupports(feature, version) {
2051
+ const installed = parseVersion(version);
2052
+ if (!installed) return true;
2053
+ const minimums = AUTOMATE_FEATURE_MIN_VERSIONS[feature];
2054
+ const minimum = parseVersion(minimums[installed[0]]);
2055
+ if (minimum) return compareVersions(installed, minimum) >= 0;
2056
+ const majors = Object.keys(minimums).map(Number);
2057
+ return installed[0] > Math.max(...majors);
2058
+ }
2059
+ function minimumAutomateVersion(feature, version) {
2060
+ const major = parseVersion(version)?.[0];
2061
+ const minimum = major === void 0 ? void 0 : AUTOMATE_FEATURE_MIN_VERSIONS[feature][major];
2062
+ return minimum?.replace(/\.0$/, "");
2063
+ }
2064
+ function describeMinimumAutomateVersion(feature) {
2065
+ return Object.entries(AUTOMATE_FEATURE_MIN_VERSIONS[feature]).map(([major, version]) => `${version.replace(/\.0$/, "")}+ (Umbraco ${major})`).join(" / ");
2066
+ }
2067
+ async function getAutomateVersion() {
2068
+ try {
2069
+ const response = await UmbracoManagementClient(
2070
+ { method: "GET", url: "/umbraco/management/api/v1/manifest/manifest" },
2071
+ CAPTURE_RAW_HTTP_RESPONSE
2072
+ );
2073
+ return response.data?.find?.((p) => p.id === "Umbraco.Automate")?.version;
2074
+ } catch {
2075
+ return void 0;
2076
+ }
2077
+ }
2078
+
2079
+ // src/umbraco-api/tools/automations/get/get-automation-webhook-url.ts
2080
+ var inputSchema7 = {
2081
+ ...getAutomationsByIdWebhookUrlParams.shape,
2082
+ id: getAutomationsByIdWebhookUrlParams.shape.id.describe(
2083
+ "Id of the automation (from list-automations or create-automation)."
2084
+ )
2085
+ };
2086
+ var outputSchema3 = getAutomationsByIdWebhookUrlResponse.extend({
2087
+ note: z.string().optional().describe("Present when the URL was derived rather than reported by Umbraco.")
2088
+ });
2089
+ var WEBHOOK_RECEIVER_PATH = "/automate/webhook";
2090
+ var isMissingEndpoint = (response) => response.status === 404 && !(response.data && typeof response.data === "object" && "title" in response.data);
2091
+ var throwApiError = (response) => {
2092
+ throw new UmbracoApiError(
2093
+ response.data || {
2094
+ status: response.status,
2095
+ detail: response.statusText
2096
+ }
2097
+ );
2098
+ };
2099
+ var getAutomationWebhookUrlTool = {
2100
+ name: "get-automation-webhook-url",
2101
+ description: "Gets the inbound webhook URL for an automation whose trigger is webhook-based. Share this URL with the external system that should invoke the automation. For automations with a different trigger type, this endpoint is not meaningful.",
2102
+ inputSchema: inputSchema7,
2103
+ outputSchema: outputSchema3,
2104
+ slices: ["read"],
2105
+ annotations: {
2106
+ readOnlyHint: true
2107
+ },
2108
+ handler: async ({ id }) => {
2109
+ const client = getApiClient();
2110
+ const response = await client.getAutomationsByIdWebhookUrl(
2111
+ id,
2112
+ CAPTURE_RAW_HTTP_RESPONSE
2113
+ );
2114
+ if (response.status === 200) {
2115
+ return createToolResult(response.data);
2116
+ }
2117
+ if (!isMissingEndpoint(response)) {
2118
+ return throwApiError(response);
2119
+ }
2120
+ const automation = await client.getAutomationsById(
2121
+ id,
2122
+ CAPTURE_RAW_HTTP_RESPONSE
2123
+ );
2124
+ if (automation.status !== 200) {
2125
+ return throwApiError(automation);
2126
+ }
2127
+ const path2 = `${WEBHOOK_RECEIVER_PATH}/${id}`;
2128
+ const baseUrl2 = getUmbracoBaseUrl();
2129
+ const versionNote = `this Umbraco Automate version does not report webhook URLs (that needs ${describeMinimumAutomateVersion("webhookUrlEndpoint")}).`;
2130
+ return createToolResult({
2131
+ url: baseUrl2 ? `${baseUrl2}${path2}` : path2,
2132
+ note: baseUrl2 ? `Derived from the configured Umbraco base URL: ${versionNote} If the site's public domain differs from that base URL, use the public domain instead.` : `Path relative to the Umbraco site's public URL: ${versionNote}`
2133
+ });
2134
+ }
2135
+ };
2136
+ var get_automation_webhook_url_default = withStandardDecorators(getAutomationWebhookUrlTool);
2137
+ var inputSchema8 = {
2138
+ ...getAutomationsGroupsByGroupIdParams.shape,
2139
+ groupId: getAutomationsGroupsByGroupIdParams.shape.groupId.describe(
2140
+ "Id of the workspace group (an automation's groupId, or an id from list-workspace-groups)."
2141
+ )
2142
+ };
2143
+ var getAutomationGroupTool = {
2144
+ name: "get-automation-group",
2145
+ description: "Gets a single workspace group (folder used to organize automations) by id, including its parent group and owning workspace. Use list-automations with groupId to list the automations inside this group.",
2146
+ inputSchema: inputSchema8,
2147
+ outputSchema: getAutomationsGroupsByGroupIdResponse,
2148
+ slices: ["read"],
2149
+ annotations: {
2150
+ readOnlyHint: true
2151
+ },
2152
+ handler: async ({ groupId }) => {
2153
+ return executeGetApiCall(
2154
+ (client) => client.getAutomationsGroupsByGroupId(groupId, CAPTURE_RAW_HTTP_RESPONSE)
2155
+ );
2156
+ }
2157
+ };
2158
+ var get_automation_group_default = withStandardDecorators(getAutomationGroupTool);
2159
+ var inputSchema9 = {
2160
+ alias: z.string().min(1).describe("Unique, code-friendly alias for the automation (e.g. 'notify-on-publish')."),
2161
+ name: z.string().min(1).describe("Human-readable display name."),
2162
+ description: z.string().optional().describe("Optional description of what this automation does."),
2163
+ workspaceId: z.string().uuid().describe(
2164
+ "Id of the workspace this automation belongs to. Not validated against existing workspaces at creation time (verified against the live API) - pass an id from list-workspaces/get-workspace to avoid creating an automation under a workspace that doesn't exist."
2165
+ ),
2166
+ groupId: z.string().uuid().optional().describe("Optional id of the workspace group (folder) to create the automation in.")
2167
+ };
2168
+ var outputSchema4 = z.object({
2169
+ message: z.string(),
2170
+ id: z.string().uuid()
2171
+ });
2172
+ var createAutomationTool = {
2173
+ name: "create-automation",
2174
+ description: "Creates a new draft automation with no trigger, steps or connections yet - just alias, name, description and workspace/group placement. The automation starts in Draft status and has no effect until it has a trigger and steps configured and publish-automation is called. Follow up with set-automation-trigger, then add-automation-step and connect-automation-steps to build out the graph.",
2175
+ inputSchema: inputSchema9,
2176
+ outputSchema: outputSchema4,
2177
+ slices: ["create"],
2178
+ handler: async (model) => {
2179
+ const client = getApiClient();
2180
+ const body = {
2181
+ alias: model.alias,
2182
+ name: model.name,
2183
+ description: model.description ?? null,
2184
+ workspaceId: model.workspaceId,
2185
+ groupId: model.groupId ?? null,
2186
+ trigger: null,
2187
+ steps: [],
2188
+ connections: [],
2189
+ canvasState: null,
2190
+ notificationSettings: null
2191
+ };
2192
+ const response = await client.postAutomations(
2193
+ body,
2194
+ CAPTURE_RAW_HTTP_RESPONSE
2195
+ );
2196
+ const locationHeader = response.headers?.location || response.headers?.Location;
2197
+ if (!locationHeader) {
2198
+ throw new Error(
2199
+ "No Location header in response - cannot determine created automation ID"
2200
+ );
2201
+ }
2202
+ const idMatch = locationHeader.match(/\/([a-f0-9-]{36})$/i);
2203
+ if (!idMatch) {
2204
+ throw new Error(
2205
+ `Could not extract ID from Location header: ${locationHeader}`
2206
+ );
2207
+ }
2208
+ return createToolResult({
2209
+ message: `Automation "${model.name}" created successfully`,
2210
+ id: idMatch[1]
2211
+ });
2212
+ }
2213
+ };
2214
+ var create_automation_default = withStandardDecorators(createAutomationTool);
2215
+ var inputSchema10 = {
2216
+ ...postAutomationsByIdPublishParams.shape,
2217
+ id: postAutomationsByIdPublishParams.shape.id.describe(
2218
+ "Id of the automation to publish. It must already have a trigger and at least one step."
2219
+ )
2220
+ };
2221
+ var publishAutomationTool = {
2222
+ name: "publish-automation",
2223
+ description: "Publishes an automation, making its current version live. This activates the trigger so the automation can start running for real - only use when the automation's trigger, steps and connections are ready. Publishing checks that a trigger is set, the workspace's service account, allowed connections and section access, and that `${steps.\u2026}` bindings name existing steps. It does not check ids inside settings (forms, document types, content), `${trigger.\u2026}` field names or setting values - mistakes there only show up when a run fails. An automation's `health` reflects the error rate of its runs, not whether its configuration is valid. Use unpublish-automation to stop it from running without deleting it.",
2224
+ inputSchema: inputSchema10,
2225
+ slices: ["publish"],
2226
+ annotations: {
2227
+ idempotentHint: true
2228
+ },
2229
+ handler: async ({ id }) => {
2230
+ return executeVoidApiCall(
2231
+ (client) => client.postAutomationsByIdPublish(id, CAPTURE_RAW_HTTP_RESPONSE)
2232
+ );
2233
+ }
2234
+ };
2235
+ var publish_automation_default = withStandardDecorators(publishAutomationTool);
2236
+ var inputSchema11 = {
2237
+ ...postAutomationsByIdUnpublishParams.shape,
2238
+ id: postAutomationsByIdUnpublishParams.shape.id.describe(
2239
+ "Id of the automation to unpublish."
2240
+ )
2241
+ };
2242
+ var unpublishAutomationTool = {
2243
+ name: "unpublish-automation",
2244
+ description: "Unpublishes an automation, taking it offline so its trigger stops firing and no new runs can start. The automation definition and run history are preserved - use publish-automation to make it live again.",
2245
+ inputSchema: inputSchema11,
2246
+ slices: ["publish"],
2247
+ annotations: {
2248
+ idempotentHint: true
2249
+ },
2250
+ handler: async ({ id }) => {
2251
+ return executeVoidApiCall(
2252
+ (client) => client.postAutomationsByIdUnpublish(id, CAPTURE_RAW_HTTP_RESPONSE)
2253
+ );
2254
+ }
2255
+ };
2256
+ var unpublish_automation_default = withStandardDecorators(unpublishAutomationTool);
2257
+ var inputSchema12 = {
2258
+ ...postAutomationsByIdReEnableParams.shape,
2259
+ id: postAutomationsByIdReEnableParams.shape.id.describe(
2260
+ "Id of the automation to re-enable."
2261
+ )
2262
+ };
2263
+ var reEnableAutomationTool = {
2264
+ name: "re-enable-automation",
2265
+ description: "Re-enables an automation that was automatically disabled by Umbraco after repeated failures (health = Disabled), allowing its trigger to fire again. Check list-automation-runs first to understand why it was disabled - re-enabling without fixing the cause will likely lead to it being disabled again.",
2266
+ inputSchema: inputSchema12,
2267
+ slices: ["action"],
2268
+ handler: async ({ id }) => {
2269
+ return executeVoidApiCall(
2270
+ (client) => client.postAutomationsByIdReEnable(id, CAPTURE_RAW_HTTP_RESPONSE)
2271
+ );
2272
+ }
2273
+ };
2274
+ var re_enable_automation_default = withStandardDecorators(reEnableAutomationTool);
2275
+ var inputSchema13 = {
2276
+ ...postAutomationsByIdTriggerParams.shape,
2277
+ id: postAutomationsByIdTriggerParams.shape.id.describe(
2278
+ "Id of the published automation to run now."
2279
+ )
2280
+ };
2281
+ var triggerAutomationTool = {
2282
+ name: "trigger-automation",
2283
+ description: "Manually starts a new run of an automation immediately, bypassing its configured trigger condition. The automation must be published first (publish-automation) - this fails on a Draft or Unpublished automation. Has a real side effect - it executes the automation's steps right now. Use list-automation-runs afterwards to see the resulting run and its outcome.",
2284
+ inputSchema: inputSchema13,
2285
+ slices: ["action"],
2286
+ handler: async ({ id }) => {
2287
+ return executeVoidApiCall(
2288
+ (client) => client.postAutomationsByIdTrigger(id, CAPTURE_RAW_HTTP_RESPONSE)
2289
+ );
2290
+ }
2291
+ };
2292
+ var trigger_automation_default = withStandardDecorators(triggerAutomationTool);
2293
+ var inputSchema14 = {
2294
+ workspaceId: postAutomationsImportBody.shape.workspaceId.describe(
2295
+ "Id of the workspace to create the automation in (from list-workspaces)."
2296
+ ),
2297
+ exportModel: z.object(postAutomationsImportBody.shape.exportModel.shape).describe(
2298
+ "The exact object returned by export-automation, passed through unmodified. Not meant to be written by hand."
2299
+ )
2300
+ };
2301
+ var importAutomationTool = {
2302
+ name: "import-automation",
2303
+ description: "Creates a new automation in the given workspace from an exported definition (see export-automation for the exportModel shape). `exportModel` should be the exact object returned by export-automation, passed through unmodified - it is not meant to be hand-authored; to build an automation's graph yourself, use create-automation followed by add-automation-step/connect-automation-steps/set-automation-trigger instead. This reuses the exported automation's original id rather than generating a new one - importing the same export twice, or into a workspace where that id already exists, will fail. Use validate-automation-import first to check for problems without making changes.",
2304
+ inputSchema: inputSchema14,
2305
+ outputSchema: postAutomationsImportResponse,
2306
+ slices: ["import"],
2307
+ handler: async (model) => {
2308
+ const body = {
2309
+ workspaceId: model.workspaceId,
2310
+ exportModel: model.exportModel
2311
+ };
2312
+ return executeGetApiCall((client) => client.postAutomationsImport(body, CAPTURE_RAW_HTTP_RESPONSE));
2313
+ }
2314
+ };
2315
+ var import_automation_default = withStandardDecorators(importAutomationTool);
2316
+ var inputSchema15 = {
2317
+ workspaceId: postAutomationsImportValidateBody.shape.workspaceId.describe(
2318
+ "Id of the workspace to validate the import against (from list-workspaces)."
2319
+ ),
2320
+ exportModel: z.object(postAutomationsImportValidateBody.shape.exportModel.shape).describe(
2321
+ "The exact object returned by export-automation, passed through unmodified. Not meant to be written by hand."
2322
+ )
2323
+ };
2324
+ var validateAutomationImportTool = {
2325
+ name: "validate-automation-import",
2326
+ description: "Validates an automation import payload (see export-automation for the exportModel shape) against a workspace without creating or changing anything. `exportModel` should be the exact object returned by export-automation, passed through unmodified rather than hand-authored. Returns success plus any errors/warnings (e.g. connections referenced by the export that don't exist in this workspace). Call import-automation with the same payload once this reports success.",
2327
+ inputSchema: inputSchema15,
2328
+ outputSchema: postAutomationsImportValidateResponse,
2329
+ slices: ["import"],
2330
+ annotations: {
2331
+ readOnlyHint: true
2332
+ },
2333
+ handler: async (model) => {
2334
+ const body = {
2335
+ workspaceId: model.workspaceId,
2336
+ exportModel: model.exportModel
2337
+ };
2338
+ return executeGetApiCall(
2339
+ (client) => client.postAutomationsImportValidate(body, CAPTURE_RAW_HTTP_RESPONSE)
2340
+ );
2341
+ }
2342
+ };
2343
+ var validate_automation_import_default = withStandardDecorators(validateAutomationImportTool);
2344
+ var IF_ALIAS = "umbracoAutomate.if";
2345
+ var SWITCH_ALIAS = "umbracoAutomate.switch";
2346
+ var APPROVAL_ALIAS = "umbracoAutomate.requestApproval";
2347
+ var PARALLEL_ALIAS = "umbracoAutomate.parallel";
2348
+ var CONTAINER_ALIASES = /* @__PURE__ */ new Set(["umbracoAutomate.while", "umbracoAutomate.forEach", PARALLEL_ALIAS]);
2349
+ var BODY_HANDLE = "body";
2350
+ var DONE_HANDLE = "done";
2351
+ var CONTAINER_SYNONYMS = {
2352
+ body: BODY_HANDLE,
2353
+ loop: BODY_HANDLE,
2354
+ each: BODY_HANDLE,
2355
+ iteration: BODY_HANDLE,
2356
+ branch: BODY_HANDLE,
2357
+ done: DONE_HANDLE,
2358
+ after: DONE_HANDLE,
2359
+ exit: DONE_HANDLE,
2360
+ complete: DONE_HANDLE,
2361
+ completed: DONE_HANDLE,
2362
+ next: DONE_HANDLE
2363
+ };
2364
+ function switchCaseNames(step) {
2365
+ const cases = step.settings?.cases;
2366
+ if (!Array.isArray(cases)) return [];
2367
+ return cases.map((c) => c && typeof c === "object" ? c.Name ?? c.name : void 0).filter((name) => typeof name === "string" && name.length > 0);
2368
+ }
2369
+ function getStepOutputs(step) {
2370
+ if (step.actionAlias === IF_ALIAS) return ["true", "false"];
2371
+ if (step.actionAlias === SWITCH_ALIAS) return [...switchCaseNames(step), "default"];
2372
+ if (step.actionAlias === APPROVAL_ALIAS) return ["approved", "rejected"];
2373
+ if (CONTAINER_ALIASES.has(step.actionAlias)) return [BODY_HANDLE, DONE_HANDLE];
2374
+ return void 0;
2375
+ }
2376
+ function isSingleConnectionOutput(step, output) {
2377
+ return CONTAINER_ALIASES.has(step.actionAlias) && output === DONE_HANDLE;
2378
+ }
2379
+ function resolveConnectionOutput(step, outcome) {
2380
+ const outputs = step ? getStepOutputs(step) : void 0;
2381
+ if (!step || !outputs) {
2382
+ return { sourceHandle: null, outcome: outcome ?? null };
2383
+ }
2384
+ const label = step.alias ?? step.id;
2385
+ const valid = outputs.map((o) => `"${o}"`).join(", ");
2386
+ if (!outcome) {
2387
+ throw new ToolValidationError({
2388
+ title: "Outcome required",
2389
+ detail: `Step "${label}" (${step.actionAlias}) has named outputs, so connections from it must pass outcome - one of ${valid}.`
2390
+ });
2391
+ }
2392
+ const wanted = outcome.trim();
2393
+ const match = outputs.find((o) => o === wanted) ?? outputs.find((o) => o.toLowerCase() === wanted.toLowerCase()) ?? (CONTAINER_ALIASES.has(step.actionAlias) ? CONTAINER_SYNONYMS[wanted.toLowerCase()] : void 0);
2394
+ if (!match) {
2395
+ throw new ToolValidationError({
2396
+ title: "Unknown outcome",
2397
+ detail: `Step "${label}" (${step.actionAlias}) has no output "${outcome}". Valid outcomes: ${valid}.${step.actionAlias === SWITCH_ALIAS ? " Switch outputs are its case names - add the case with update-automation-step first." : ""}`
2398
+ });
2399
+ }
2400
+ return { sourceHandle: match, outcome: match };
2401
+ }
2402
+ var OUTCOME_HELP = `Which named output of the source step this connection leaves from. Required when the source step has named outputs, and must match one exactly (matching is case-insensitive here and saved in the exact form): If - "true"/"false"; Switch - one of its case names, or "default"; Request Approval - "approved"/"rejected" (needs Umbraco Automate ${describeMinimumAutomateVersion("approvalOutcomes")}; before that it has a single output that runs on approval - omit outcome); While/ForEach/Parallel - "body" (runs inside the loop/branch; "loop" also accepted) or "done" (runs once afterwards; "after" also accepted; needs Umbraco Automate ${describeMinimumAutomateVersion("containerDone")}, before which a container has only a body). Omit for steps with a single output, and for the trigger.`;
2403
+
2404
+ // src/umbraco-api/tools/automations/_shared/canvas-layout.ts
2405
+ var TRIGGER_STEP_ID = "00000000-0000-0000-0000-000000000000";
2406
+ var VERTICAL_GAP = 72;
2407
+ var HORIZONTAL_GAP = 40;
2408
+ var SWITCH_CHILD_OFFSET = 32;
2409
+ var ADD_BUTTON_ROOM = 28;
2410
+ var NODE_MIN_WIDTH = 220;
2411
+ var NODE_MAX_WIDTH = 280;
2412
+ var NODE_BORDER = 2;
2413
+ var HEADER_CHROME = 146;
2414
+ var EDIT_BUTTON_WIDTH = 28;
2415
+ var BODY_CHROME = 28;
2416
+ var CHIP_PADDING = 12;
2417
+ var MONOSPACE_CHAR_WIDTH = 6.6;
2418
+ var SWITCH_ROW_CHROME = 34;
2419
+ var TRIGGER_TAG_WIDTH = 68.3;
2420
+ var HEIGHTS = { trigger: 65, action: 115, branch: 117, container: 144 };
2421
+ var SWITCH_HEADER_HEIGHT = 88;
2422
+ var SWITCH_ROW_HEIGHT = 45;
2423
+ var SWITCH_FIRST_HANDLE_Y = 110;
2424
+ var APPROVAL_ALIAS2 = "umbracoAutomate.requestApproval";
2425
+ var BRANCH_ALIASES = /* @__PURE__ */ new Set(["umbracoAutomate.if", APPROVAL_ALIAS2]);
2426
+ var CONTAINER_ALIASES2 = /* @__PURE__ */ new Set(["umbracoAutomate.while", "umbracoAutomate.forEach", "umbracoAutomate.parallel"]);
2427
+ var SWITCH_ALIAS2 = "umbracoAutomate.switch";
2428
+ var asciiTable = (csv) => csv.split(",").map(Number);
2429
+ var LABEL_WIDTHS = asciiTable(
2430
+ "3.4,3.93,5.54,8.12,8.12,11.47,10.13,2.96,3.84,3.84,5.95,8.12,3.28,5.22,3.33,6.52,8.12,8.12,8.12,8.12,8.12,8.12,8.12,8.12,8.12,8.12,3.6,3.79,8.12,8.12,8.12,6.44,11.81,9.72,9.22,9.26,10.65,8.05,7.92,10.16,10.79,4.15,6.01,9.6,7.27,13.23,10.79,11.31,8.67,11.31,9,7.68,8.4,10.39,9.72,14.71,9.39,9.07,8.48,4.39,6.52,4.39,8.12,6.53,5.6,7.11,7.95,6.75,7.95,7.48,5.02,7.39,7.9,3.56,3.56,7.48,3.48,11.72,7.9,8.04,7.95,7.95,5.22,6.15,5.21,7.9,7.39,11.23,7.31,7.38,6.43,4.28,3.65,4.28,8.12"
2431
+ );
2432
+ var CASE_WIDTHS = asciiTable(
2433
+ "3.07,3.23,4.45,6.96,6.96,9.62,8.54,2.45,3.2,3.2,5.1,6.96,2.72,4.46,2.83,5.42,6.96,6.96,6.96,6.96,6.96,6.96,6.96,6.96,6.96,6.96,3,3.14,6.96,6.96,6.96,5.37,10.04,8.12,7.76,8.02,9.13,6.93,6.79,8.77,9.16,3.36,5.07,7.95,6.16,11.14,9.16,9.61,7.21,9.61,7.52,6.51,7.09,8.83,8.12,12.43,7.79,7.49,7.22,3.67,5.42,3.67,6.96,5.51,4.8,5.96,6.72,5.73,6.72,6.34,4.21,6.24,6.7,2.88,2.88,6.1,2.83,9.87,6.7,6.8,6.73,6.72,4.37,5.2,4.3,6.69,6.19,9.43,5.98,6.19,5.42,3.61,3.01,3.61,6.96"
2434
+ );
2435
+ function textWidth(text, table) {
2436
+ const fallback = table[33 + 1] ?? 8;
2437
+ let width = 0;
2438
+ for (const ch of text) {
2439
+ const code = ch.codePointAt(0) ?? 0;
2440
+ width += code >= 32 && code <= 126 ? table[code - 32] : fallback;
2441
+ }
2442
+ return width;
2443
+ }
2444
+ var clampWidth = (content) => Math.min(NODE_MAX_WIDTH, Math.max(NODE_MIN_WIDTH, content)) + NODE_BORDER;
2445
+ var chipWidth = (text) => text ? BODY_CHROME + CHIP_PADDING + text.length * MONOSPACE_CHAR_WIDTH : 0;
2446
+ function stepBox(step, options) {
2447
+ const label = step.name ?? step.actionAlias;
2448
+ const header = textWidth(label, LABEL_WIDTHS) + HEADER_CHROME;
2449
+ const isBranch = BRANCH_ALIASES.has(step.actionAlias) && (step.actionAlias !== APPROVAL_ALIAS2 || options.approvalOutcomes !== false);
2450
+ if (isBranch) {
2451
+ const width2 = clampWidth(Math.max(header, chipWidth(step.alias)));
2452
+ const [first] = getStepOutputs(step) ?? [];
2453
+ return {
2454
+ width: width2,
2455
+ height: HEIGHTS.branch,
2456
+ outputX: (o) => (o === first ? 0.3 : 0.7) * width2,
2457
+ isSwitch: false
2458
+ };
2459
+ }
2460
+ if (CONTAINER_ALIASES2.has(step.actionAlias)) {
2461
+ const width2 = NODE_MAX_WIDTH + NODE_BORDER;
2462
+ return { width: width2, height: HEIGHTS.container, outputX: (o) => (o === "done" ? 0.7 : 0.3) * width2, isSwitch: false };
2463
+ }
2464
+ if (step.actionAlias === SWITCH_ALIAS2) {
2465
+ const outputs = getStepOutputs(step) ?? ["default"];
2466
+ const rows = Math.max(0, ...outputs.map((o) => SWITCH_ROW_CHROME + textWidth(o, CASE_WIDTHS)));
2467
+ const width2 = clampWidth(Math.max(header, chipWidth(step.alias), rows));
2468
+ return { width: width2, height: SWITCH_HEADER_HEIGHT + SWITCH_ROW_HEIGHT * outputs.length, outputX: () => width2, isSwitch: true };
2469
+ }
2470
+ const width = NODE_MAX_WIDTH + NODE_BORDER;
2471
+ return { width, height: HEIGHTS.action, outputX: () => width / 2, isSwitch: false };
2472
+ }
2473
+ function triggerBox({ name, hasSettings }) {
2474
+ const chrome = HEADER_CHROME - (hasSettings ? 0 : EDIT_BUTTON_WIDTH);
2475
+ const width = clampWidth(Math.max(textWidth(name, LABEL_WIDTHS), TRIGGER_TAG_WIDTH) + chrome);
2476
+ return { width, height: HEIGHTS.trigger, outputX: () => width / 2, isSwitch: false };
2477
+ }
2478
+ function computeCanvasLayout(steps, connections, triggerLabel, options = {}) {
2479
+ const stepById = new Map(steps.map((s) => [s.id, s]));
2480
+ const boxes = new Map(steps.map((s) => [s.id, stepBox(s, options)]));
2481
+ boxes.set(TRIGGER_STEP_ID, triggerBox(triggerLabel));
2482
+ const outputRank = (sourceId, c) => {
2483
+ const outputs = stepById.has(sourceId) ? getStepOutputs(stepById.get(sourceId)) : void 0;
2484
+ const name = c.sourceHandle ?? c.outcome ?? null;
2485
+ const rank = outputs && name ? outputs.indexOf(name) : -1;
2486
+ return rank === -1 ? Number.MAX_SAFE_INTEGER : rank;
2487
+ };
2488
+ const outgoing = /* @__PURE__ */ new Map();
2489
+ const incoming = /* @__PURE__ */ new Map();
2490
+ connections.forEach((c) => {
2491
+ if (!boxes.has(c.sourceStepId) || !stepById.has(c.targetStepId)) return;
2492
+ (outgoing.get(c.sourceStepId) ?? outgoing.set(c.sourceStepId, []).get(c.sourceStepId)).push(c);
2493
+ (incoming.get(c.targetStepId) ?? incoming.set(c.targetStepId, []).get(c.targetStepId)).push(c);
2494
+ });
2495
+ for (const [sourceId, list] of outgoing) {
2496
+ const order = new Map(list.map((c, i) => [c, i]));
2497
+ list.sort((a, b) => outputRank(sourceId, a) - outputRank(sourceId, b) || order.get(a) - order.get(b));
2498
+ }
2499
+ const top = /* @__PURE__ */ new Map([[TRIGGER_STEP_ID, 0]]);
2500
+ const pending = new Map(steps.map((s) => [s.id, incoming.get(s.id)?.length ?? 0]));
2501
+ const queue = [TRIGGER_STEP_ID];
2502
+ while (queue.length) {
2503
+ const id = queue.shift();
2504
+ const bottom = top.get(id) + boxes.get(id).height;
2505
+ for (const c of outgoing.get(id) ?? []) {
2506
+ top.set(c.targetStepId, Math.max(top.get(c.targetStepId) ?? 0, bottom + VERTICAL_GAP));
2507
+ const left = pending.get(c.targetStepId) - 1;
2508
+ pending.set(c.targetStepId, left);
2509
+ if (left === 0) queue.push(c.targetStepId);
2510
+ }
2511
+ }
2512
+ const reached = (id) => id === TRIGGER_STEP_ID || pending.get(id) === 0 && top.has(id);
2513
+ const treeChildren = /* @__PURE__ */ new Map();
2514
+ for (const step of steps) {
2515
+ if (!reached(step.id)) continue;
2516
+ const parents = (incoming.get(step.id) ?? []).filter((c) => reached(c.sourceStepId));
2517
+ const primary = parents.reduce((best, c) => {
2518
+ const bottom = (c2) => top.get(c2.sourceStepId) + boxes.get(c2.sourceStepId).height;
2519
+ return !best || bottom(c) > bottom(best) ? c : best;
2520
+ }, void 0);
2521
+ if (primary) {
2522
+ const list = treeChildren.get(primary.sourceStepId) ?? [];
2523
+ list.push({ id: step.id, output: primary.sourceHandle ?? primary.outcome ?? null });
2524
+ treeChildren.set(primary.sourceStepId, list);
2525
+ }
2526
+ }
2527
+ for (const [parentId, list] of treeChildren) {
2528
+ const rank = new Map((outgoing.get(parentId) ?? []).map((c, i) => [c.targetStepId, i]));
2529
+ list.sort((a, b) => (rank.get(a.id) ?? 0) - (rank.get(b.id) ?? 0));
2530
+ }
2531
+ const offset = /* @__PURE__ */ new Map();
2532
+ const shiftBoxes = (boxes2, dx) => boxes2.map((b) => ({ ...b, x0: b.x0 + dx, x1: b.x1 + dx }));
2533
+ const measure = (id) => {
2534
+ const box = boxes.get(id);
2535
+ const nodeTop = top.get(id);
2536
+ const own = { x0: -box.width / 2, x1: box.width / 2, y0: nodeTop, y1: nodeTop + box.height + ADD_BUTTON_ROOM };
2537
+ const children = treeChildren.get(id) ?? [];
2538
+ if (!children.length) return [own];
2539
+ const childBoxes = children.map((c) => measure(c.id));
2540
+ let centres;
2541
+ if (children.length === 1 && !box.isSwitch) {
2542
+ centres = [box.outputX(children[0].output) - box.width / 2];
2543
+ } else {
2544
+ centres = [0];
2545
+ let placed = childBoxes[0];
2546
+ for (let i = 1; i < children.length; i++) {
2547
+ const previous = boxes.get(children[i - 1].id).width;
2548
+ let centre2 = centres[i - 1] + (previous + boxes.get(children[i].id).width) / 2 + HORIZONTAL_GAP;
2549
+ for (const a of placed) {
2550
+ for (const b of childBoxes[i]) {
2551
+ if (a.y0 < b.y1 && b.y0 < a.y1) centre2 = Math.max(centre2, a.x1 + HORIZONTAL_GAP - b.x0);
2552
+ }
2553
+ }
2554
+ centres.push(centre2);
2555
+ placed = placed.concat(shiftBoxes(childBoxes[i], centre2));
2556
+ }
2557
+ const shift = box.isSwitch ? box.width / 2 + SWITCH_CHILD_OFFSET - centres[0] : -(centres[0] + centres[centres.length - 1]) / 2;
2558
+ centres = centres.map((x) => x + shift);
2559
+ }
2560
+ children.forEach((c, i) => offset.set(c.id, centres[i]));
2561
+ const handles = children.map((c) => box.outputX(c.output) - box.width / 2);
2562
+ const corridor = {
2563
+ x0: Math.min(...centres, ...handles),
2564
+ x1: Math.max(...centres, ...handles),
2565
+ y0: nodeTop + (box.isSwitch ? SWITCH_FIRST_HANDLE_Y : box.height),
2566
+ y1: Math.min(...children.map((c) => top.get(c.id)))
2567
+ };
2568
+ return [own, corridor, ...childBoxes.flatMap((b, i) => shiftBoxes(b, centres[i]))];
2569
+ };
2570
+ const treeBoxes = measure(TRIGGER_STEP_ID);
2571
+ const treeExtent = { left: Math.min(...treeBoxes.map((b) => b.x0)) };
2572
+ const centre = /* @__PURE__ */ new Map([[TRIGGER_STEP_ID, 0]]);
2573
+ const place = (id) => {
2574
+ for (const c of treeChildren.get(id) ?? []) {
2575
+ centre.set(c.id, centre.get(id) + offset.get(c.id));
2576
+ place(c.id);
2577
+ }
2578
+ };
2579
+ place(TRIGGER_STEP_ID);
2580
+ const stepPositions = {};
2581
+ let lowest = HEIGHTS.trigger;
2582
+ for (const [id, x] of centre) {
2583
+ if (id === TRIGGER_STEP_ID) continue;
2584
+ const box = boxes.get(id);
2585
+ stepPositions[id] = { x: Math.round(x - box.width / 2), y: Math.round(top.get(id)) };
2586
+ lowest = Math.max(lowest, top.get(id) + box.height);
2587
+ }
2588
+ const loose = steps.filter((s) => !centre.has(s.id));
2589
+ let cursor = Math.min(treeExtent.left, -boxes.get(TRIGGER_STEP_ID).width / 2);
2590
+ for (const step of loose) {
2591
+ stepPositions[step.id] = { x: Math.round(cursor), y: Math.round(lowest + VERTICAL_GAP * 2) };
2592
+ cursor += boxes.get(step.id).width + HORIZONTAL_GAP;
2593
+ }
2594
+ const trigger = boxes.get(TRIGGER_STEP_ID);
2595
+ return { stepPositions, triggerPosition: { x: Math.round(-trigger.width / 2), y: 0 } };
2596
+ }
2597
+
2598
+ // src/umbraco-api/tools/automations/_shared/automation-graph.ts
2599
+ async function fetchAutomation(id) {
2600
+ const client = getApiClient();
2601
+ const response = await client.getAutomationsById(
2602
+ id,
2603
+ CAPTURE_RAW_HTTP_RESPONSE
2604
+ );
2605
+ if (response.status < 200 || response.status >= 300) {
2606
+ throw new UmbracoApiError(
2607
+ response.data ?? {
2608
+ status: response.status,
2609
+ detail: response.statusText
2610
+ }
2611
+ );
2612
+ }
2613
+ return response.data;
2614
+ }
2615
+ function toPutBody(automation, overrides = {}) {
2616
+ return {
2617
+ alias: automation.alias,
2618
+ name: automation.name,
2619
+ description: automation.description ?? null,
2620
+ groupId: automation.groupId ?? null,
2621
+ trigger: automation.trigger ?? null,
2622
+ steps: automation.steps.map(stripStepReadOnlyFields),
2623
+ connections: automation.connections,
2624
+ canvasState: automation.canvasState ?? null,
2625
+ notificationSettings: automation.notificationSettings ?? null,
2626
+ version: automation.version,
2627
+ ...overrides
2628
+ };
2629
+ }
2630
+ function stripStepReadOnlyFields(step) {
2631
+ const { connectionId: _connectionId, ...rest } = step;
2632
+ return rest;
2633
+ }
2634
+ async function saveAutomation(id, body) {
2635
+ const client = getApiClient();
2636
+ const response = await client.putAutomationsById(
2637
+ id,
2638
+ body,
2639
+ CAPTURE_RAW_HTTP_RESPONSE
2640
+ );
2641
+ if (response.status === 409 || response.status === 412) {
2642
+ throw new ToolValidationError({
2643
+ title: "Automation changed since it was read",
2644
+ status: response.status,
2645
+ detail: "This automation was modified by someone else between reading it and saving this change (optimistic concurrency conflict). Call this tool again with the same arguments - it will re-read the current definition and retry automatically."
2646
+ });
2647
+ }
2648
+ if (response.status < 200 || response.status >= 300) {
2649
+ throw new UmbracoApiError(
2650
+ response.data ?? {
2651
+ status: response.status,
2652
+ detail: response.statusText
2653
+ }
2654
+ );
2655
+ }
2656
+ }
2657
+ function resolveStep(automation, ref) {
2658
+ const byAlias = automation.steps.find((s) => s.alias === ref);
2659
+ if (byAlias) return byAlias;
2660
+ const byId = automation.steps.find((s) => s.id === ref);
2661
+ if (byId) return byId;
2662
+ const known = automation.steps.map((s) => s.alias ?? s.id).join(", ") || "(no steps yet)";
2663
+ throw new ToolValidationError({
2664
+ title: "Step not found",
2665
+ detail: `No step with alias or id "${ref}" exists on this automation. Known steps: ${known}. Call get-automation to see the current step list.`
2666
+ });
2667
+ }
2668
+ var TRIGGER_STEP_ID2 = "00000000-0000-0000-0000-000000000000";
2669
+ function resolveConnectionSource(automation, ref) {
2670
+ if (ref === TRIGGER_STEP_ID2 || ref.trim().toLowerCase() === "trigger") {
2671
+ if (!automation.trigger) {
2672
+ throw new ToolValidationError({
2673
+ title: "No trigger configured",
2674
+ detail: `"${ref}" refers to the automation's trigger, but this automation has no trigger set yet. Call set-automation-trigger first.`
2675
+ });
2676
+ }
2677
+ return { id: TRIGGER_STEP_ID2 };
2678
+ }
2679
+ return resolveStep(automation, ref);
2680
+ }
2681
+ var triggerLabels = /* @__PURE__ */ new Map();
2682
+ async function getTriggerLabel(alias) {
2683
+ if (!triggerLabels.has(alias)) {
2684
+ try {
2685
+ const client = getApiClient();
2686
+ const response = await client.getCatalogueTriggers(
2687
+ void 0,
2688
+ CAPTURE_RAW_HTTP_RESPONSE
2689
+ );
2690
+ if (response.status === 200) {
2691
+ for (const t of response.data ?? []) {
2692
+ triggerLabels.set(t.alias, { name: t.name, hasSettings: (t.settingsSchema?.fields?.length ?? 0) > 0 });
2693
+ }
2694
+ }
2695
+ } catch {
2696
+ }
2697
+ }
2698
+ return triggerLabels.get(alias) ?? { name: alias, hasSettings: true };
2699
+ }
2700
+ function computeAutoLayout(steps, connections, triggerLabel = { name: "", hasSettings: true }, options = {}) {
2701
+ return computeCanvasLayout(steps, connections, triggerLabel, options);
2702
+ }
2703
+ async function applyAutoLayout(automation, connections, steps = automation.steps) {
2704
+ const triggerLabel = automation.trigger ? await getTriggerLabel(automation.trigger.triggerAlias) : { name: "", hasSettings: true };
2705
+ const approvalOutcomes = steps.some((s) => s.actionAlias === APPROVAL_ALIAS) ? automateVersionSupports("approvalOutcomes", await getAutomateVersion()) : true;
2706
+ const { stepPositions, triggerPosition } = computeAutoLayout(steps, connections, triggerLabel, { approvalOutcomes });
2707
+ const laidOut = steps.map((s) => ({
2708
+ ...stripStepReadOnlyFields(s),
2709
+ position: stepPositions[s.id] ?? s.position
2710
+ }));
2711
+ let canvas = {};
2712
+ if (automation.canvasState) {
2713
+ try {
2714
+ canvas = JSON.parse(automation.canvasState);
2715
+ } catch {
2716
+ canvas = {};
2717
+ }
2718
+ }
2719
+ canvas.triggerPosition = triggerPosition;
2720
+ return { steps: laidOut, canvasState: JSON.stringify(canvas) };
2721
+ }
2722
+
2723
+ // src/umbraco-api/tools/automations/_shared/step-settings.ts
2724
+ var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
2725
+ var getKey = (obj, key) => obj[key] ?? obj[key.charAt(0).toUpperCase() + key.slice(1)];
2726
+ var isConditionSet = (value) => {
2727
+ if (!isObject(value)) return false;
2728
+ const groups = getKey(value, "groups");
2729
+ return Array.isArray(groups) && groups.every((group) => isObject(group) && Array.isArray(getKey(group, "conditions")));
2730
+ };
2731
+ var isSwitchCaseList = (value) => Array.isArray(value) && value.length > 0 && value.every((item) => isObject(item) && isConditionSet(getKey(item, "conditions")));
2732
+ function pascalKeys(value) {
2733
+ if (Array.isArray(value)) return value.map(pascalKeys);
2734
+ if (!isObject(value)) return value;
2735
+ return Object.fromEntries(
2736
+ Object.entries(value).map(([key, inner]) => [
2737
+ key.charAt(0).toUpperCase() + key.slice(1),
2738
+ pascalKeys(inner)
2739
+ ])
2740
+ );
2741
+ }
2742
+ function normalizeStepSettings(settings) {
2743
+ return Object.fromEntries(
2744
+ Object.entries(settings).map(([key, value]) => [
2745
+ key,
2746
+ isConditionSet(value) || isSwitchCaseList(value) ? pascalKeys(value) : value
2747
+ ])
2748
+ );
2749
+ }
2750
+ var SETTINGS_KEYS_HELP = "Use each settingsSchema field's `key` exactly - a key the step type doesn't declare is refused, because Automate would save it without using it.";
2751
+ var STEP_VALUES_HELP = "Fields with supportsBindings: true accept binding expressions: `${trigger.<field>}` for the trigger's output and `${steps.<stepAlias>.<field>}` for an earlier step's output, with field names taken from that trigger's or step's outputSchema (for one with hasDynamicOutputSchema, from resolve-step-type-output-schema). Values reach the step as given, so a value written to a content property must be in that property's stored form - e.g. a Toggle (true/false) property takes 1 or 0, not \"true\".";
2752
+ var CONDITION_SETTINGS_HELP = 'Condition-based steps take a condition set: { groups: [{ conditions: [{ leftOperand, operator, rightOperand }] }] } - conditions within a group are ANDed, groups are ORed (there is no combinator field). If/While put it under `conditions`; Switch takes `cases`: [{ name, conditions: <condition set> }], evaluated in order, first match wins. Connect each Switch case with connect-automation-steps using outcome = the case name, plus outcome "default" for no match; an If connects with outcome "true"/"false", a While/ForEach/Parallel with "body"/"done". Operators: Equals, NotEquals, Contains, NotContains, StartsWith, EndsWith, GreaterThan, LessThan, GreaterThanOrEquals, LessThanOrEquals, IsEmpty, IsNotEmpty. Keys may be camelCase; they are saved in the PascalCase form the backoffice editor reads.';
2753
+ function findUnknownSettingKeys(fields, settings) {
2754
+ const declared = (fields ?? []).map((field) => field.key);
2755
+ return Object.keys(settings).filter((key) => !declared.some((d) => d.toLowerCase() === key.toLowerCase())).map((key) => {
2756
+ const lower = key.toLowerCase();
2757
+ const suggestion = declared.find((d) => d.toLowerCase().startsWith(lower) || lower.startsWith(d.toLowerCase()));
2758
+ return suggestion ? { key, suggestion } : { key };
2759
+ });
2760
+ }
2761
+ async function fetchSettingsFields(alias) {
2762
+ try {
2763
+ const client = getApiClient();
2764
+ const response = await client.getCatalogueStepTypes({}, CAPTURE_RAW_HTTP_RESPONSE);
2765
+ if (response.status < 200 || response.status >= 300 || !Array.isArray(response.data)) return void 0;
2766
+ const stepType = response.data.find((item) => item.alias === alias);
2767
+ const fields = stepType?.settingsSchema?.fields;
2768
+ return fields && fields.length > 0 ? fields : void 0;
2769
+ } catch {
2770
+ return void 0;
2771
+ }
2772
+ }
2773
+ async function assertKnownSettingKeys(alias, settings) {
2774
+ if (!settings || Object.keys(settings).length === 0) return;
2775
+ const fields = await fetchSettingsFields(alias);
2776
+ if (fields === void 0) return;
2777
+ const unknown2 = findUnknownSettingKeys(fields, settings);
2778
+ if (unknown2.length === 0) return;
2779
+ const listed = unknown2.map(({ key, suggestion }) => suggestion ? `"${key}" (did you mean "${suggestion}"?)` : `"${key}"`).join(", ");
2780
+ const declared = fields.map((field) => `"${field.key}"`).join(", ");
2781
+ throw new ToolValidationError({
2782
+ title: "Unknown settings",
2783
+ status: 400,
2784
+ detail: `"${alias}" has no setting ${listed}. Its settings are: ${declared}. Automate would save an unknown key without using it, so the step would silently behave as if it were not set. Use the \`key\` values from the step type's settingsSchema in the catalogue.`
2785
+ });
2786
+ }
2787
+
2788
+ // src/umbraco-api/tools/automations/post/add-automation-step.ts
2789
+ var errorBehaviors = ["Retry", "Suspend", "Terminate", "Compensate"];
2790
+ var inputSchema16 = {
2791
+ automationId: z.string().uuid().describe("Id of the automation to add the step to."),
2792
+ actionAlias: z.string().min(1).describe(
2793
+ "Alias of the action or control-flow step type to use, as returned by list-catalogue-actions or list-catalogue-control-flows."
2794
+ ),
2795
+ alias: z.string().min(1).describe(
2796
+ "Unique name for this step within the automation. Letters and digits only, starting with a letter - no hyphens, underscores or spaces (e.g. 'sendWelcomeEmail'). Use this to refer to the step later in connect-automation-steps, update-automation-step, and remove-automation-step."
2797
+ ),
2798
+ name: z.string().min(1).describe("Human-readable display name for this step."),
2799
+ settings: z.record(z.string(), z.unknown()).optional().describe(
2800
+ `The step's configuration, matching the shape described by that step type's settingsSchema (see list-catalogue-actions/list-catalogue-control-flows). Defaults to an empty object if omitted. ${SETTINGS_KEYS_HELP} ${STEP_VALUES_HELP} ${CONDITION_SETTINGS_HELP}`
2801
+ ),
2802
+ inputMappings: z.record(z.string(), z.string()).optional().describe(
2803
+ "Maps this step's input fields to expressions referencing earlier steps' output (e.g. trigger data or a prior step's result). Defaults to none if omitted - configure later with update-automation-step once you know what's available."
2804
+ ),
2805
+ errorBehavior: z.enum(errorBehaviors).optional().describe(
2806
+ "What happens if this step fails at runtime: Retry (per retryInterval/maxRetries), Suspend (pause the run for manual resume-run), Terminate (fail the run), or Compensate (run a compensating step). Defaults to Terminate."
2807
+ ),
2808
+ retryInterval: z.string().regex(/^-?(\d+\.)?\d{2}:\d{2}:\d{2}(\.\d{1,7})?$/).optional().describe(
2809
+ "Delay before retrying, as a d.hh:mm:ss duration string (e.g. '00:05:00' for 5 minutes). Only meaningful when errorBehavior is Retry."
2810
+ ),
2811
+ maxRetries: z.number().int().optional().describe("Maximum retry attempts before giving up. Only meaningful when errorBehavior is Retry.")
2812
+ };
2813
+ var outputSchema5 = z.object({
2814
+ message: z.string(),
2815
+ stepId: z.string().uuid(),
2816
+ alias: z.string()
2817
+ });
2818
+ var addAutomationStepTool = {
2819
+ name: "add-automation-step",
2820
+ description: "Adds a new step to an automation's graph. You only need to describe the new step - this tool reads the automation's current definition, appends the step, and saves it back, so nothing else is affected. If the automation has a trigger and no steps yet, the new step is connected to the trigger, so a one-step automation needs no connect-automation-steps call. Later steps are added unconnected: use connect-automation-steps to make each one run after another step (an unconnected step still runs directly off the trigger, but the backoffice canvas shows it detached). Canvas positions are assigned automatically (an unconnected step waits in a row below the graph until it is connected); use the Umbraco backoffice canvas to rearrange steps visually if needed.",
2821
+ inputSchema: inputSchema16,
2822
+ outputSchema: outputSchema5,
2823
+ slices: ["update"],
2824
+ annotations: {
2825
+ idempotentHint: false
2826
+ },
2827
+ handler: async (params) => {
2828
+ await assertKnownSettingKeys(params.actionAlias, params.settings);
2829
+ const automation = await fetchAutomation(params.automationId);
2830
+ if (automation.steps.some((s) => s.alias === params.alias)) {
2831
+ throw new Error(
2832
+ `A step with alias "${params.alias}" already exists on this automation - step aliases must be unique. Choose a different alias, or use update-automation-step to modify the existing one.`
2833
+ );
2834
+ }
2835
+ const stepId = randomUUID();
2836
+ const newStep = {
2837
+ id: stepId,
2838
+ actionAlias: params.actionAlias,
2839
+ name: params.name,
2840
+ alias: params.alias,
2841
+ settings: normalizeStepSettings(params.settings ?? {}),
2842
+ inputMappings: params.inputMappings ?? {},
2843
+ position: { x: 0, y: 0 },
2844
+ errorBehavior: params.errorBehavior ?? "Terminate",
2845
+ retryInterval: params.retryInterval ?? null,
2846
+ maxRetries: params.maxRetries ?? null
2847
+ };
2848
+ const connectToTrigger = automation.trigger != null && automation.steps.length === 0;
2849
+ const connections = connectToTrigger ? [
2850
+ ...automation.connections,
2851
+ {
2852
+ sourceStepId: TRIGGER_STEP_ID2,
2853
+ sourceHandle: null,
2854
+ targetStepId: stepId,
2855
+ targetHandle: null,
2856
+ outcome: null,
2857
+ filter: null
2858
+ }
2859
+ ] : automation.connections;
2860
+ const { steps, canvasState } = await applyAutoLayout(automation, connections, [
2861
+ ...automation.steps.map(stripStepReadOnlyFields),
2862
+ newStep
2863
+ ]);
2864
+ const body = toPutBody(automation, { steps, connections, canvasState });
2865
+ await saveAutomation(params.automationId, body);
2866
+ return createToolResult({
2867
+ message: connectToTrigger ? `Step "${params.alias}" added and connected to the trigger.` : `Step "${params.alias}" added.`,
2868
+ stepId,
2869
+ alias: params.alias
2870
+ });
2871
+ }
2872
+ };
2873
+ var add_automation_step_default = withStandardDecorators(addAutomationStepTool);
2874
+ var operators = [
2875
+ "Equals",
2876
+ "NotEquals",
2877
+ "Contains",
2878
+ "NotContains",
2879
+ "StartsWith",
2880
+ "EndsWith",
2881
+ "GreaterThan",
2882
+ "LessThan",
2883
+ "GreaterThanOrEquals",
2884
+ "LessThanOrEquals",
2885
+ "IsEmpty",
2886
+ "IsNotEmpty"
2887
+ ];
2888
+ var conditionSchema = z.object({
2889
+ leftOperand: z.string().describe("Expression to test, e.g. a reference to the source step's output or trigger data."),
2890
+ operator: z.enum(operators),
2891
+ rightOperand: z.string().describe("Value to compare against. Ignored for IsEmpty/IsNotEmpty but still required by the API - pass an empty string.")
2892
+ });
2893
+ var inputSchema17 = {
2894
+ automationId: z.string().uuid().describe("Id of the automation to connect steps within."),
2895
+ sourceStep: z.string().min(1).describe(
2896
+ `The step this connection runs from, by alias (preferred) or step id. Pass the literal "trigger" to run this step directly off the automation's trigger instead of another step.`
2897
+ ),
2898
+ targetStep: z.string().min(1).describe("The step this connection runs to, by alias (preferred) or step id."),
2899
+ outcome: z.string().optional().describe(OUTCOME_HELP),
2900
+ conditions: z.array(conditionSchema).optional().describe(
2901
+ "Optional list of conditions that must ALL be true (AND) for this connection to be followed - use this for a conditional path off a branching step. Omit for an unconditional connection. This tool only supports a single AND-group; for the rarer OR-of-AND case, build the connection through the Umbraco backoffice canvas instead."
2902
+ )
2903
+ };
2904
+ var outputSchema6 = z.object({ message: z.string() });
2905
+ async function resolveApprovalOutput(step, outcome) {
2906
+ const automateVersion = await getAutomateVersion();
2907
+ if (automateVersionSupports("approvalOutcomes", automateVersion)) {
2908
+ return resolveConnectionOutput(step, outcome);
2909
+ }
2910
+ if (outcome === void 0 || outcome.trim().toLowerCase() === "approved") {
2911
+ return { sourceHandle: null, outcome: null };
2912
+ }
2913
+ throw new ToolValidationError({
2914
+ title: "Not supported by this Automate version",
2915
+ detail: `This Umbraco Automate version (${automateVersion}) has no "${outcome}" output on Request Approval steps: its single output runs when the step is approved, and a rejection fails the run. Connect without an outcome (or with "approved") to run a step after approval, or upgrade Umbraco Automate to ${minimumAutomateVersion("approvalOutcomes", automateVersion) ?? describeMinimumAutomateVersion("approvalOutcomes")} or later to branch on the decision.`
2916
+ });
2917
+ }
2918
+ var connectAutomationStepsTool = {
2919
+ name: "connect-automation-steps",
2920
+ description: "Connects one step's output to another step's input, so the target step runs after the source step (optionally only for a specific outcome, and/or only when conditions are met). The target step must already exist on the automation - use add-automation-step first. Connections from a branching step (If, Switch, Request Approval, While, ForEach, Parallel) must name the output via `outcome`. Pass sourceStep: \"trigger\" to run the target step directly off the automation's trigger instead of another step. Adding a connection does not remove any existing connections between other steps. Also re-lays out every step's canvas position top-down by distance from the trigger, so the graph reads as a flow instead of piling up wherever add-automation-step happened to place it.",
2921
+ inputSchema: inputSchema17,
2922
+ outputSchema: outputSchema6,
2923
+ slices: ["update"],
2924
+ annotations: {
2925
+ idempotentHint: false
2926
+ },
2927
+ handler: async (params) => {
2928
+ const automation = await fetchAutomation(params.automationId);
2929
+ const source = resolveConnectionSource(automation, params.sourceStep);
2930
+ const target = resolveStep(automation, params.targetStep);
2931
+ const sourceStep = source.id === TRIGGER_STEP_ID2 ? void 0 : resolveStep(automation, source.id);
2932
+ const output = sourceStep?.actionAlias === APPROVAL_ALIAS ? await resolveApprovalOutput(sourceStep, params.outcome) : resolveConnectionOutput(sourceStep, params.outcome);
2933
+ if (sourceStep && output.sourceHandle === DONE_HANDLE) {
2934
+ const automateVersion = await getAutomateVersion();
2935
+ if (!automateVersionSupports("containerDone", automateVersion)) {
2936
+ throw new ToolValidationError({
2937
+ title: "Not supported by this Automate version",
2938
+ detail: `This Umbraco Automate version (${automateVersion}) has no "done" output on ${sourceStep.actionAlias} steps - every connection from it runs inside the loop. Connect the step with outcome "body" to run it on each iteration, or upgrade Umbraco Automate to ${minimumAutomateVersion("containerDone", automateVersion) ?? describeMinimumAutomateVersion("containerDone")} or later to run steps after the loop.`
2939
+ });
2940
+ }
2941
+ }
2942
+ if (sourceStep && output.sourceHandle && isSingleConnectionOutput(sourceStep, output.sourceHandle) && automation.connections.some((c) => c.sourceStepId === source.id && c.sourceHandle === output.sourceHandle)) {
2943
+ throw new ToolValidationError({
2944
+ title: "Output already connected",
2945
+ detail: `"${params.sourceStep}" already has a step on its "${output.sourceHandle}" output, and only the first one would ever run. Chain further steps after that step instead, or disconnect-automation-steps it first.`
2946
+ });
2947
+ }
2948
+ const alreadyConnected = automation.connections.some(
2949
+ (c) => c.sourceStepId === source.id && c.targetStepId === target.id && (c.outcome ?? null) === output.outcome && (c.sourceHandle ?? null) === output.sourceHandle
2950
+ );
2951
+ if (alreadyConnected) {
2952
+ throw new Error(
2953
+ `A connection from "${params.sourceStep}" to "${params.targetStep}"${output.outcome ? ` for outcome "${output.outcome}"` : ""} already exists - use disconnect-automation-steps first if you need to replace it (e.g. with different conditions).`
2954
+ );
2955
+ }
2956
+ const newConnection = {
2957
+ sourceStepId: source.id,
2958
+ sourceHandle: output.sourceHandle,
2959
+ targetStepId: target.id,
2960
+ targetHandle: null,
2961
+ outcome: output.outcome,
2962
+ filter: params.conditions?.length ? { groups: [{ conditions: params.conditions }] } : null
2963
+ };
2964
+ const newConnections = [...automation.connections, newConnection];
2965
+ const { steps, canvasState } = await applyAutoLayout(automation, newConnections);
2966
+ const body = toPutBody(automation, {
2967
+ connections: newConnections,
2968
+ steps,
2969
+ canvasState
2970
+ });
2971
+ await saveAutomation(params.automationId, body);
2972
+ return createToolResult({
2973
+ message: `Connected "${params.sourceStep}"${output.outcome ? ` (${output.outcome})` : ""} -> "${params.targetStep}".`
2974
+ });
2975
+ }
2976
+ };
2977
+ var connect_automation_steps_default = withStandardDecorators(connectAutomationStepsTool);
2978
+ var inputSchema18 = {
2979
+ automationId: z.string().uuid().describe("Id of the automation to update."),
2980
+ alias: z.string().min(1).optional().describe("New unique, code-friendly alias. Omit to leave unchanged."),
2981
+ name: z.string().min(1).optional().describe("New display name. Omit to leave unchanged."),
2982
+ description: z.string().nullish().describe("New description. Pass null to clear it. Omit to leave unchanged."),
2983
+ groupId: z.string().uuid().nullish().describe(
2984
+ "New workspace group (folder) id, from get-automation-group / list-workspace-groups. Pass null to move it to the workspace root. Omit to leave unchanged."
2985
+ )
2986
+ };
2987
+ var outputSchema7 = z.object({ message: z.string() });
2988
+ var updateAutomationTool = {
2989
+ name: "update-automation",
2990
+ description: "Renames an automation, edits its description, or moves it to a different workspace group. Only the fields you provide are changed; the trigger, steps, connections and notification settings are read from the automation's current definition and saved back unmodified. Use the dedicated graph tools (add-automation-step, connect-automation-steps, set-automation-trigger, etc.) to change those instead.",
2991
+ inputSchema: inputSchema18,
2992
+ outputSchema: outputSchema7,
2993
+ slices: ["update"],
2994
+ annotations: {
2995
+ idempotentHint: true
2996
+ },
2997
+ handler: async (params) => {
2998
+ const automation = await fetchAutomation(params.automationId);
2999
+ const body = toPutBody(automation, {
3000
+ alias: params.alias ?? automation.alias,
3001
+ name: params.name ?? automation.name,
3002
+ description: params.description !== void 0 ? params.description : automation.description,
3003
+ groupId: params.groupId !== void 0 ? params.groupId : automation.groupId
3004
+ });
3005
+ await saveAutomation(params.automationId, body);
3006
+ return createToolResult({ message: `Automation "${body.name}" updated.` });
3007
+ }
3008
+ };
3009
+ var update_automation_default = withStandardDecorators(updateAutomationTool);
3010
+ var inputSchema19 = {
3011
+ id: putAutomationsByIdImportParams.shape.id.describe(
3012
+ "Id of the existing automation to overwrite."
3013
+ ),
3014
+ exportModel: z.object(putAutomationsByIdImportBody.shape).describe(
3015
+ "The exact object returned by export-automation, passed through unmodified. Not meant to be written by hand."
3016
+ )
3017
+ };
3018
+ var importAutomationIntoExistingTool = {
3019
+ name: "import-automation-into-existing",
3020
+ description: "Overwrites the trigger, steps, connections, canvas state and notification settings of an existing automation (identified by id) with a previously exported definition (see export-automation for the exportModel shape). `exportModel` should be the exact object returned by export-automation, passed through unmodified - it is not meant to be hand-authored; to make a targeted change to an existing automation's graph, use update-automation-step/add-automation-step/connect-automation-steps/set-automation-trigger instead. This replaces content in place rather than creating a new automation - use import-automation instead if you want a brand new automation. Consider validate-automation-import first to check the export is compatible with this workspace.",
3021
+ inputSchema: inputSchema19,
3022
+ outputSchema: putAutomationsByIdImportResponse,
3023
+ slices: ["import"],
3024
+ annotations: {
3025
+ idempotentHint: true
3026
+ },
3027
+ handler: async (model) => {
3028
+ return executeGetApiCall(
3029
+ (client) => client.putAutomationsByIdImport(
3030
+ model.id,
3031
+ model.exportModel,
3032
+ CAPTURE_RAW_HTTP_RESPONSE
3033
+ )
3034
+ );
3035
+ }
3036
+ };
3037
+ var import_automation_into_existing_default = withStandardDecorators(importAutomationIntoExistingTool);
3038
+ var errorBehaviors2 = ["Retry", "Suspend", "Terminate", "Compensate"];
3039
+ var inputSchema20 = {
3040
+ automationId: z.string().uuid().describe("Id of the automation the step belongs to."),
3041
+ step: z.string().min(1).describe("The step to update, by its alias (preferred) or its step id, as seen in get-automation."),
3042
+ name: z.string().min(1).optional().describe("New display name, if changing it."),
3043
+ settings: z.record(z.string(), z.unknown()).optional().describe(
3044
+ `New configuration for the step, replacing its current settings entirely (not merged field-by-field). Match the shape from that step type's settingsSchema. Omit to leave settings unchanged. ${SETTINGS_KEYS_HELP} ${STEP_VALUES_HELP} ${CONDITION_SETTINGS_HELP}`
3045
+ ),
3046
+ inputMappings: z.record(z.string(), z.string()).optional().describe(
3047
+ "New input mappings, replacing the current set entirely (not merged). Omit to leave mappings unchanged."
3048
+ ),
3049
+ errorBehavior: z.enum(errorBehaviors2).optional().describe("New failure-handling behavior. Omit to leave unchanged."),
3050
+ retryInterval: z.string().regex(/^-?(\d+\.)?\d{2}:\d{2}:\d{2}(\.\d{1,7})?$/).nullish().describe(
3051
+ "New retry delay as a d.hh:mm:ss duration string, only meaningful with errorBehavior Retry. Pass null to clear it. Omit to leave unchanged."
3052
+ ),
3053
+ maxRetries: z.number().int().nullish().describe("New max retry count. Pass null to clear it. Omit to leave unchanged.")
3054
+ };
3055
+ var outputSchema8 = z.object({ message: z.string() });
3056
+ var updateAutomationStepTool = {
3057
+ name: "update-automation-step",
3058
+ description: "Updates one step's own configuration (name, settings, input mappings, error handling) by alias or id. Only the fields you provide are changed; everything else about the step, and the rest of the automation's steps/connections/trigger, is left as-is. `settings` and `inputMappings`, if provided, fully replace the step's current value for that field rather than merging - read get-automation first if you need to preserve part of an existing settings object while changing another part.",
3059
+ inputSchema: inputSchema20,
3060
+ outputSchema: outputSchema8,
3061
+ slices: ["update"],
3062
+ annotations: {
3063
+ idempotentHint: true
3064
+ },
3065
+ handler: async (params) => {
3066
+ const automation = await fetchAutomation(params.automationId);
3067
+ const target = resolveStep(automation, params.step);
3068
+ await assertKnownSettingKeys(target.actionAlias, params.settings);
3069
+ const updatedSteps = automation.steps.map((step) => {
3070
+ const s = stripStepReadOnlyFields(step);
3071
+ if (s.id !== target.id) return s;
3072
+ return {
3073
+ ...s,
3074
+ name: params.name ?? s.name,
3075
+ settings: params.settings ? normalizeStepSettings(params.settings) : s.settings,
3076
+ inputMappings: params.inputMappings ?? s.inputMappings,
3077
+ errorBehavior: params.errorBehavior ?? s.errorBehavior,
3078
+ retryInterval: params.retryInterval !== void 0 ? params.retryInterval : s.retryInterval,
3079
+ maxRetries: params.maxRetries !== void 0 ? params.maxRetries : s.maxRetries
3080
+ };
3081
+ });
3082
+ const relayout = params.name !== void 0 || params.settings !== void 0;
3083
+ const body = relayout ? toPutBody(automation, await applyAutoLayout(automation, automation.connections, updatedSteps)) : toPutBody(automation, { steps: updatedSteps });
3084
+ await saveAutomation(params.automationId, body);
3085
+ return createToolResult({ message: `Step "${params.step}" updated.` });
3086
+ }
3087
+ };
3088
+ var update_automation_step_default = withStandardDecorators(updateAutomationStepTool);
3089
+ var inputSchema21 = {
3090
+ automationId: z.string().uuid().describe("Id of the automation to set the trigger for."),
3091
+ triggerAlias: z.string().min(1).optional().describe(
3092
+ "Alias of the trigger type to use, as returned by list-catalogue-triggers. Omit (leave unset) to clear the automation's trigger entirely."
3093
+ ),
3094
+ settings: z.record(z.string(), z.unknown()).optional().describe(
3095
+ `The trigger's configuration, matching the shape described by that trigger type's settingsSchema (see list-catalogue-triggers), e.g. Form Submitted takes \`formIds\` (an array of form ids). ${SETTINGS_KEYS_HELP} Required when setting a triggerAlias; ignored when clearing the trigger.`
3096
+ )
3097
+ };
3098
+ var outputSchema9 = z.object({ message: z.string() });
3099
+ var setAutomationTriggerTool = {
3100
+ name: "set-automation-trigger",
3101
+ description: "Sets what starts the automation: a trigger type (from list-catalogue-triggers) and its settings. Replaces any existing trigger entirely, and re-lays out the canvas around it. Omit triggerAlias to remove the trigger - a Draft automation with no trigger can still be edited, but publish-automation will fail until one is set. Steps and connections are left unchanged.",
3102
+ inputSchema: inputSchema21,
3103
+ outputSchema: outputSchema9,
3104
+ slices: ["update"],
3105
+ annotations: {
3106
+ idempotentHint: true
3107
+ },
3108
+ handler: async (params) => {
3109
+ if (params.triggerAlias) await assertKnownSettingKeys(params.triggerAlias, params.settings);
3110
+ const automation = await fetchAutomation(params.automationId);
3111
+ const trigger = params.triggerAlias ? { triggerAlias: params.triggerAlias, settings: params.settings ?? {} } : null;
3112
+ const { steps, canvasState } = await applyAutoLayout({ ...automation, trigger }, automation.connections);
3113
+ const body = toPutBody(automation, { trigger, steps, canvasState });
3114
+ await saveAutomation(params.automationId, body);
3115
+ return createToolResult({
3116
+ message: params.triggerAlias ? `Trigger set to "${params.triggerAlias}".` : "Trigger cleared."
3117
+ });
3118
+ }
3119
+ };
3120
+ var set_automation_trigger_default = withStandardDecorators(setAutomationTriggerTool);
3121
+ var inputSchema22 = {
3122
+ ...deleteAutomationsByIdParams.shape,
3123
+ id: deleteAutomationsByIdParams.shape.id.describe(
3124
+ "Id of the automation to delete permanently."
3125
+ )
3126
+ };
3127
+ var deleteAutomationTool = {
3128
+ name: "delete-automation",
3129
+ description: "Permanently deletes an automation by id, including its run history. This cannot be undone. Use export-automation first if you might want to restore it later, or unpublish-automation instead if you only want to stop it from running.",
3130
+ inputSchema: inputSchema22,
3131
+ annotations: {
3132
+ destructiveHint: true
3133
+ },
3134
+ slices: ["delete"],
3135
+ handler: async ({ id }) => {
3136
+ return executeVoidApiCall(
3137
+ (client) => client.deleteAutomationsById(id, CAPTURE_RAW_HTTP_RESPONSE)
3138
+ );
3139
+ }
3140
+ };
3141
+ var delete_automation_default = withStandardDecorators(deleteAutomationTool);
3142
+ var inputSchema23 = {
3143
+ automationId: z.string().uuid().describe("Id of the automation the step belongs to."),
3144
+ step: z.string().min(1).describe("The step to remove, by its alias (preferred) or its step id, as seen in get-automation.")
3145
+ };
3146
+ var outputSchema10 = z.object({
3147
+ message: z.string(),
3148
+ removedConnectionCount: z.number().int()
3149
+ });
3150
+ var removeAutomationStepTool = {
3151
+ name: "remove-automation-step",
3152
+ description: "Removes a step from an automation's graph, along with any connections that reference it (incoming or outgoing) so the graph stays consistent. This cannot be undone except by re-adding the step and its connections. Not valid to leave the trigger's first step disconnected - check the resulting graph with get-automation if this step was a hub other steps only reached through it.",
3153
+ inputSchema: inputSchema23,
3154
+ outputSchema: outputSchema10,
3155
+ slices: ["delete"],
3156
+ annotations: {
3157
+ destructiveHint: true
3158
+ },
3159
+ handler: async (params) => {
3160
+ const automation = await fetchAutomation(params.automationId);
3161
+ const target = resolveStep(automation, params.step);
3162
+ const remainingConnections = automation.connections.filter(
3163
+ (c) => c.sourceStepId !== target.id && c.targetStepId !== target.id
3164
+ );
3165
+ const removedConnectionCount = automation.connections.length - remainingConnections.length;
3166
+ const { steps, canvasState } = await applyAutoLayout(
3167
+ automation,
3168
+ remainingConnections,
3169
+ automation.steps.filter((s) => s.id !== target.id)
3170
+ );
3171
+ const body = toPutBody(automation, {
3172
+ steps,
3173
+ connections: remainingConnections,
3174
+ canvasState
3175
+ });
3176
+ await saveAutomation(params.automationId, body);
3177
+ return createToolResult({
3178
+ message: `Step "${params.step}" removed.`,
3179
+ removedConnectionCount
3180
+ });
3181
+ }
3182
+ };
3183
+ var remove_automation_step_default = withStandardDecorators(removeAutomationStepTool);
3184
+ var inputSchema24 = {
3185
+ automationId: z.string().uuid().describe("Id of the automation to disconnect steps within."),
3186
+ sourceStep: z.string().min(1).describe(
3187
+ `The connection's source step, by alias (preferred) or step id. Pass "trigger" to remove a connection that runs directly off the automation's trigger.`
3188
+ ),
3189
+ targetStep: z.string().min(1).describe("The connection's target step, by alias (preferred) or step id."),
3190
+ outcome: z.string().optional().describe(
3191
+ "If there are multiple connections between the same two steps for different outcomes (e.g. a branching step's 'true' and 'false' paths both pointing at the same target), narrow to the one for this outcome. Omit to remove all connections between the two steps."
3192
+ )
3193
+ };
3194
+ var outputSchema11 = z.object({
3195
+ message: z.string(),
3196
+ removedCount: z.number().int()
3197
+ });
3198
+ var disconnectAutomationStepsTool = {
3199
+ name: "disconnect-automation-steps",
3200
+ description: "Removes the connection(s) between two steps, identified by alias or step id, without deleting either step. If the two steps have more than one connection between them (distinguished by outcome), pass `outcome` to remove only that one - otherwise all connections between them are removed. Use get-automation first if you need to see the exact current connections.",
3201
+ inputSchema: inputSchema24,
3202
+ outputSchema: outputSchema11,
3203
+ slices: ["delete"],
3204
+ annotations: {
3205
+ destructiveHint: true
3206
+ },
3207
+ handler: async (params) => {
3208
+ const automation = await fetchAutomation(params.automationId);
3209
+ const source = resolveConnectionSource(automation, params.sourceStep);
3210
+ const target = resolveStep(automation, params.targetStep);
3211
+ const wanted = /* @__PURE__ */ new Set();
3212
+ if (params.outcome !== void 0) {
3213
+ wanted.add(params.outcome.trim().toLowerCase());
3214
+ const sourceStep = source.id === TRIGGER_STEP_ID2 ? void 0 : resolveStep(automation, source.id);
3215
+ try {
3216
+ const resolved = resolveConnectionOutput(sourceStep, params.outcome).outcome;
3217
+ if (resolved) wanted.add(resolved.toLowerCase());
3218
+ } catch {
3219
+ }
3220
+ }
3221
+ const matchesOutcome = (value) => !!value && wanted.has(value.toLowerCase());
3222
+ const remaining = automation.connections.filter((c) => {
3223
+ const matches = c.sourceStepId === source.id && c.targetStepId === target.id && (params.outcome === void 0 || matchesOutcome(c.outcome) || matchesOutcome(c.sourceHandle));
3224
+ return !matches;
3225
+ });
3226
+ const removedCount = automation.connections.length - remaining.length;
3227
+ if (removedCount === 0) {
3228
+ throw new Error(
3229
+ `No connection found from "${params.sourceStep}" to "${params.targetStep}"${params.outcome ? ` for outcome "${params.outcome}"` : ""}. Call get-automation to see the current connections.`
3230
+ );
3231
+ }
3232
+ const { steps, canvasState } = await applyAutoLayout(automation, remaining);
3233
+ const body = toPutBody(automation, { connections: remaining, steps, canvasState });
3234
+ await saveAutomation(params.automationId, body);
3235
+ return createToolResult({
3236
+ message: `Disconnected "${params.sourceStep}" -> "${params.targetStep}".`,
3237
+ removedCount
3238
+ });
3239
+ }
3240
+ };
3241
+ var disconnect_automation_steps_default = withStandardDecorators(disconnectAutomationStepsTool);
3242
+
3243
+ // src/umbraco-api/tools/automations/index.ts
3244
+ var collection3 = {
3245
+ metadata: {
3246
+ name: "automations",
3247
+ displayName: "Automations",
3248
+ description: "Manage Umbraco Automate automations: create/read/update/delete automation definitions, build out their trigger/step/connection graph one piece at a time, publish/unpublish/re-enable/trigger their lifecycle, inspect run history, look up webhook URLs and workspace groups, and import/export portable automation definitions."
3249
+ },
3250
+ tools: () => [
3251
+ list_automations_default,
3252
+ get_automation_default,
3253
+ get_automation_ancestors_default,
3254
+ export_automation_default,
3255
+ list_automation_runs_default,
3256
+ get_automation_webhook_url_default,
3257
+ get_automation_group_default,
3258
+ create_automation_default,
3259
+ publish_automation_default,
3260
+ unpublish_automation_default,
3261
+ re_enable_automation_default,
3262
+ trigger_automation_default,
3263
+ import_automation_default,
3264
+ validate_automation_import_default,
3265
+ update_automation_default,
3266
+ import_automation_into_existing_default,
3267
+ delete_automation_default,
3268
+ add_automation_step_default,
3269
+ update_automation_step_default,
3270
+ remove_automation_step_default,
3271
+ connect_automation_steps_default,
3272
+ disconnect_automation_steps_default,
3273
+ set_automation_trigger_default
3274
+ ]
3275
+ };
3276
+ var automations_default = collection3;
3277
+ var outputSchema12 = z.object({ items: getCatalogueActionsResponse });
3278
+ var inputSchema25 = {
3279
+ ...getCatalogueActionsQueryParams.shape,
3280
+ workspaceId: getCatalogueActionsQueryParams.shape.workspaceId.describe(
3281
+ "Optional. Only return items usable with connections configured in this workspace (id from list-workspaces)."
3282
+ )
3283
+ };
3284
+ var listCatalogueActionsTool = {
3285
+ name: "list-catalogue-actions",
3286
+ description: "Lists the available action step definitions that can be added to an automation. Each item's `alias` is the identifier used to reference that action when adding a step to an automation in the automations collection, and `connectionTypeAlias` (when present) identifies which connection type a step of this action requires. Optionally pass a `workspaceId` to only return actions usable with connections configured in that workspace. Call this before adding an action step to discover valid aliases and their settings schema. When an item's `hasDynamicOutputSchema` is true, its `outputSchema` here is only a generic placeholder and may not match the real shape - call resolve-step-type-output-schema with the configured settings to get the fields later steps can bind to.",
3287
+ inputSchema: inputSchema25,
3288
+ outputSchema: outputSchema12,
3289
+ slices: ["read"],
3290
+ annotations: {
3291
+ readOnlyHint: true
3292
+ },
3293
+ handler: async (params) => {
3294
+ return executeGetItemsApiCall(
3295
+ (client) => client.getCatalogueActions(params, CAPTURE_RAW_HTTP_RESPONSE)
3296
+ );
3297
+ }
3298
+ };
3299
+ var list_actions_default = withStandardDecorators(listCatalogueActionsTool);
3300
+ var outputSchema13 = z.object({ items: getCatalogueConnectionTypesResponse });
3301
+ var listCatalogueConnectionTypesTool = {
3302
+ name: "list-catalogue-connection-types",
3303
+ description: "Lists the available connection type definitions (e.g. HTTP, SMTP, Slack). Each item's `alias` identifies the connection type to use when creating a connection in the connections collection, and `settingsSchema` describes the fields required to configure that connection. Call this before creating a connection, or to check which connection type an action/trigger's `connectionTypeAlias` refers to.",
3304
+ outputSchema: outputSchema13,
3305
+ slices: ["read"],
3306
+ annotations: {
3307
+ readOnlyHint: true
3308
+ },
3309
+ handler: async () => {
3310
+ return executeGetItemsApiCall(
3311
+ (client) => client.getCatalogueConnectionTypes(CAPTURE_RAW_HTTP_RESPONSE)
3312
+ );
3313
+ }
3314
+ };
3315
+ var list_connection_types_default = withStandardDecorators(listCatalogueConnectionTypesTool);
3316
+ var outputSchema14 = z.object({ items: getCatalogueControlFlowsResponse });
3317
+ var listCatalogueControlFlowsTool = {
3318
+ name: "list-catalogue-control-flows",
3319
+ description: "Lists the available control-flow step definitions (e.g. branch/condition, loop) that can be added to an automation to direct or repeat execution. Each item's `alias` is the identifier used to reference that control-flow construct when adding a step to an automation in the automations collection, and `settingsSchema` describes the fields needed to configure it. Call this before adding a control-flow step to discover valid aliases.",
3320
+ outputSchema: outputSchema14,
3321
+ slices: ["read"],
3322
+ annotations: {
3323
+ readOnlyHint: true
3324
+ },
3325
+ handler: async () => {
3326
+ return executeGetItemsApiCall(
3327
+ (client) => client.getCatalogueControlFlows(CAPTURE_RAW_HTTP_RESPONSE)
3328
+ );
3329
+ }
3330
+ };
3331
+ var list_control_flows_default = withStandardDecorators(listCatalogueControlFlowsTool);
3332
+ var outputSchema15 = z.object({ items: getCatalogueNotificationChannelsResponse });
3333
+ var listCatalogueNotificationChannelsTool = {
3334
+ name: "list-catalogue-notification-channels",
3335
+ description: "Lists the available notification channel definitions (e.g. email, Slack, Teams) that an automation can use to notify people. Each item's `alias` is the identifier used to reference that channel when configuring a notification step, and `settingsSchema` describes the fields required to configure it. Call this before adding a notification step to discover valid channel aliases.",
3336
+ outputSchema: outputSchema15,
3337
+ slices: ["read"],
3338
+ annotations: {
3339
+ readOnlyHint: true
3340
+ },
3341
+ handler: async () => {
3342
+ return executeGetItemsApiCall(
3343
+ (client) => client.getCatalogueNotificationChannels(CAPTURE_RAW_HTTP_RESPONSE)
3344
+ );
3345
+ }
3346
+ };
3347
+ var list_notification_channels_default = withStandardDecorators(listCatalogueNotificationChannelsTool);
3348
+ var outputSchema16 = z.object({ items: getCatalogueStepTypesResponse });
3349
+ var inputSchema26 = {
3350
+ ...getCatalogueStepTypesQueryParams.shape,
3351
+ type: getCatalogueStepTypesQueryParams.shape.type.describe(
3352
+ "Optional category filter, using a `type` value as returned by this tool when called without it. Omit to list every category."
3353
+ )
3354
+ };
3355
+ var listCatalogueStepTypesTool = {
3356
+ name: "list-catalogue-step-types",
3357
+ description: "Lists all step type definitions available for building an automation, across every category (actions, control-flows, triggers, and more) in one flat list. Each item's `alias` is the identifier used when adding a step to an automation, and `type` identifies which category it belongs to. Optionally pass `type` to filter to a single category. Prefer the category-specific tools (list-catalogue-actions, list-catalogue-control-flows, list-catalogue-triggers) when you already know the category you need; use this tool when you need an overview across all categories or don't know which category a step belongs to. When an item's `hasDynamicOutputSchema` is true, its `outputSchema` here is only a generic placeholder and may not match the real shape - call resolve-step-type-output-schema with the configured settings to get the fields later steps can bind to.",
3358
+ inputSchema: inputSchema26,
3359
+ outputSchema: outputSchema16,
3360
+ slices: ["read"],
3361
+ annotations: {
3362
+ readOnlyHint: true
3363
+ },
3364
+ handler: async (params) => {
3365
+ return executeGetItemsApiCall(
3366
+ (client) => client.getCatalogueStepTypes(params, CAPTURE_RAW_HTTP_RESPONSE)
3367
+ );
3368
+ }
3369
+ };
3370
+ var list_step_types_default = withStandardDecorators(listCatalogueStepTypesTool);
3371
+ var triggerItemSchema = getCatalogueTriggersResponseItem.extend({
3372
+ supportsManualRun: getCatalogueTriggersResponseItem.shape.supportsManualRun.optional()
3373
+ });
3374
+ var outputSchema17 = z.object({ items: z.array(triggerItemSchema) });
3375
+ var inputSchema27 = {
3376
+ ...getCatalogueTriggersQueryParams.shape,
3377
+ workspaceId: getCatalogueTriggersQueryParams.shape.workspaceId.describe(
3378
+ "Optional. Only return items usable with connections configured in this workspace (id from list-workspaces)."
3379
+ )
3380
+ };
3381
+ var listCatalogueTriggersTool = {
3382
+ name: "list-catalogue-triggers",
3383
+ description: "Lists the available trigger definitions that can start an automation (e.g. content published, schedule, webhook received). Each item's `alias` is the identifier used to reference that trigger when configuring an automation's trigger step, `supportsManualRun` (when present) indicates whether the trigger can also be fired manually, and `connectionTypeAlias` (when present) identifies which connection type it requires. Optionally pass a `workspaceId` to only return triggers usable with connections configured in that workspace. Call this before configuring an automation's trigger to discover valid aliases and their settings schema. When an item's `hasDynamicOutputSchema` is true, its `outputSchema` here is only a generic placeholder and may not match the real shape - call resolve-step-type-output-schema with the configured settings to get the fields later steps can bind to.",
3384
+ inputSchema: inputSchema27,
3385
+ outputSchema: outputSchema17,
3386
+ slices: ["read"],
3387
+ annotations: {
3388
+ readOnlyHint: true
3389
+ },
3390
+ handler: async (params) => {
3391
+ return executeGetItemsApiCall(
3392
+ (client) => client.getCatalogueTriggers(params, CAPTURE_RAW_HTTP_RESPONSE)
3393
+ );
3394
+ }
3395
+ };
3396
+ var list_triggers_default = withStandardDecorators(listCatalogueTriggersTool);
3397
+ var outputSchema18 = z.object({ items: getCatalogueWebhookAuthenticatorsResponse });
3398
+ var listCatalogueWebhookAuthenticatorsTool = {
3399
+ name: "list-catalogue-webhook-authenticators",
3400
+ description: "Lists the available webhook authenticator definitions (e.g. shared secret, signature verification) that can secure an inbound webhook trigger. Each item's `alias` is the identifier used to reference that authenticator when configuring a webhook trigger, and `settingsSchema` describes the fields required to configure it. Call this before configuring a webhook-triggered automation to discover valid authenticator aliases.",
3401
+ outputSchema: outputSchema18,
3402
+ slices: ["read"],
3403
+ annotations: {
3404
+ readOnlyHint: true
3405
+ },
3406
+ handler: async () => {
3407
+ return executeGetItemsApiCall(
3408
+ (client) => client.getCatalogueWebhookAuthenticators(CAPTURE_RAW_HTTP_RESPONSE)
3409
+ );
3410
+ }
3411
+ };
3412
+ var list_webhook_authenticators_default = withStandardDecorators(listCatalogueWebhookAuthenticatorsTool);
3413
+ var inputSchema28 = z.object({
3414
+ alias: z.string().describe(
3415
+ "The step type alias to resolve, as returned by list-catalogue-actions, list-catalogue-control-flows, list-catalogue-triggers, or list-catalogue-step-types."
3416
+ ),
3417
+ settings: z.record(z.string(), z.unknown()).describe(
3418
+ `The step's configured settings, matching the shape described by that step type's settingsSchema, e.g. Form Submitted takes \`formIds\` (an array of form ids). ${SETTINGS_KEYS_HELP} Used to resolve a dynamic output schema when hasDynamicOutputSchema is true. An id that doesn't exist is not reported - it just adds nothing (a form that doesn't exist adds no fields), so check ids before relying on the result.`
3419
+ )
3420
+ });
3421
+ var outputSchema19 = z.looseObject({});
3422
+ var resolveStepTypeOutputSchemaTool = {
3423
+ name: "resolve-step-type-output-schema",
3424
+ description: "Computes the JSON schema of the data a configured step would output at runtime, for a given step type alias and settings. Use this when a catalogue entry has hasDynamicOutputSchema set to true, meaning its static outputSchema is not enough \u2014 the real output shape depends on how the step is configured (e.g. the columns returned by a database query action depend on the query itself). The resolved schema tells you what fields will be available for later steps in the automation to reference. If the step has no output for these settings, the result is { hasOutput: false, message } instead of a schema: control-flow steps like If and Parallel never output data, and a dynamic step returns this until it is configured enough to resolve (e.g. Run AI Agent before an agent is chosen). Read-only: no data is created or changed.",
3425
+ inputSchema: inputSchema28.shape,
3426
+ outputSchema: outputSchema19,
3427
+ slices: ["read"],
3428
+ annotations: {
3429
+ readOnlyHint: true
3430
+ },
3431
+ handler: async ({ alias, settings }) => {
3432
+ await assertKnownSettingKeys(alias, settings);
3433
+ const client = getApiClient();
3434
+ const response = await client.postCatalogueStepTypesByAliasOutputSchema(
3435
+ alias,
3436
+ { settings },
3437
+ CAPTURE_RAW_HTTP_RESPONSE
3438
+ );
3439
+ if (response.status >= 200 && response.status < 300) {
3440
+ if (response.data == null) {
3441
+ return createToolResult({
3442
+ hasOutput: false,
3443
+ message: `Step type "${alias}" has no output for these settings, so later steps have nothing from it to reference. Control-flow steps like If and Parallel never output data; a step whose output depends on its settings (e.g. Run AI Agent without an agent chosen) resolves once it is configured.`
3444
+ });
3445
+ }
3446
+ return createToolResult(response.data);
3447
+ }
3448
+ const errorData = response.data || {
3449
+ status: response.status,
3450
+ detail: response.statusText
3451
+ };
3452
+ return createToolResultError(errorData);
3453
+ }
3454
+ };
3455
+ var resolve_step_type_output_schema_default = withStandardDecorators(resolveStepTypeOutputSchemaTool);
3456
+
3457
+ // src/umbraco-api/tools/catalogue/index.ts
3458
+ var collection4 = {
3459
+ metadata: {
3460
+ name: "catalogue",
3461
+ displayName: "Catalogue",
3462
+ description: "Reference catalogue of everything available for building automations: actions, connection types, control-flow constructs, notification channels, step types, triggers, and webhook authenticators."
3463
+ },
3464
+ tools: () => [
3465
+ list_actions_default,
3466
+ list_connection_types_default,
3467
+ list_control_flows_default,
3468
+ list_notification_channels_default,
3469
+ list_step_types_default,
3470
+ list_triggers_default,
3471
+ list_webhook_authenticators_default,
3472
+ resolve_step_type_output_schema_default
3473
+ ]
3474
+ };
3475
+ var catalogue_default = collection4;
3476
+ var inputSchema29 = {
3477
+ ...getConnectionsQueryParams.shape,
3478
+ filter: getConnectionsQueryParams.shape.filter.describe(
3479
+ "Optional text matched against connection name and alias."
3480
+ )
3481
+ };
3482
+ var listConnectionsTool = {
3483
+ name: "list-connections",
3484
+ description: "Lists connections configured for this Umbraco instance \u2014 the credentials/endpoints automation steps use to talk to third-party services (e.g. an email provider, a REST API, a Slack workspace). Each item includes id, alias, name, type and version, but not the connection's settings/secrets \u2014 use get-connection for the full detail on a single connection. Supports an optional text filter and cursor paging (pass nextCursor from the previous response). A connection's `type` must match one of the aliases returned by the catalogue's connection-types listing.",
3485
+ inputSchema: inputSchema29,
3486
+ outputSchema: getConnectionsResponse,
3487
+ slices: ["list"],
3488
+ annotations: {
3489
+ readOnlyHint: true
3490
+ },
3491
+ handler: async ({ filter, skip, take }) => {
3492
+ return executeGetApiCall(
3493
+ (client) => client.getConnections({ filter, skip, take }, CAPTURE_RAW_HTTP_RESPONSE)
3494
+ );
3495
+ }
3496
+ };
3497
+ var list_connections_default = withStandardDecorators(listConnectionsTool);
3498
+ var SECRET_KEY_PATTERN = /secret|password|token|api[-_]?key|access[-_]?key|client[-_]?secret|private[-_]?key|credential|auth/i;
3499
+ var REDACTED_PLACEHOLDER = "***REDACTED***";
3500
+ function redactSecrets(value) {
3501
+ if (Array.isArray(value)) {
3502
+ return value.map(redactSecrets);
3503
+ }
3504
+ if (value && typeof value === "object") {
3505
+ return Object.fromEntries(
3506
+ Object.entries(value).map(([key, val]) => [
3507
+ key,
3508
+ SECRET_KEY_PATTERN.test(key) && typeof val === "string" ? REDACTED_PLACEHOLDER : redactSecrets(val)
3509
+ ])
3510
+ );
3511
+ }
3512
+ return value;
3513
+ }
3514
+ var inputSchema30 = {
3515
+ ...getConnectionsByIdParams.shape,
3516
+ id: getConnectionsByIdParams.shape.id.describe(
3517
+ "Id of the connection (from list-connections or create-connection)."
3518
+ )
3519
+ };
3520
+ var getConnectionTool = {
3521
+ name: "get-connection",
3522
+ description: `Gets a single connection by id, including its alias, name, type, version and settings. The settings object is whatever the connection's type requires (e.g. base URL, API key, account id) \u2014 check the catalogue's connection-types listing for the settingsSchema of a given type. Fields whose name looks like a credential (secret, password, token, api key, etc.) are redacted server-side and returned as "***REDACTED***" \u2014 this tool cannot be used to read back a connection's raw secret values. Use test-connection to validate credentials without needing to inspect them.`,
3523
+ inputSchema: inputSchema30,
3524
+ outputSchema: getConnectionsByIdResponse,
3525
+ slices: ["read"],
3526
+ annotations: {
3527
+ readOnlyHint: true
3528
+ },
3529
+ handler: async ({ id }) => {
3530
+ const client = getApiClient();
3531
+ const response = await client.getConnectionsById(
3532
+ id,
3533
+ CAPTURE_RAW_HTTP_RESPONSE
3534
+ );
3535
+ if (response.status >= 200 && response.status < 300) {
3536
+ const data = response.data;
3537
+ return createToolResult({
3538
+ ...data,
3539
+ settings: redactSecrets(data.settings)
3540
+ });
3541
+ }
3542
+ const errorData = response.data || {
3543
+ status: response.status,
3544
+ detail: response.statusText
3545
+ };
3546
+ return createToolResultError(errorData);
3547
+ }
3548
+ };
3549
+ var get_connection_default = withStandardDecorators(getConnectionTool);
3550
+ var outputSchema20 = z.object({
3551
+ message: z.string(),
3552
+ id: z.string()
3553
+ });
3554
+ var inputSchema31 = {
3555
+ ...postConnectionsBody.shape,
3556
+ alias: postConnectionsBody.shape.alias.describe(
3557
+ "Unique, code-friendly alias that automation steps use to reference this connection."
3558
+ ),
3559
+ name: postConnectionsBody.shape.name.describe(
3560
+ "Human-readable display name."
3561
+ ),
3562
+ type: postConnectionsBody.shape.type.describe(
3563
+ "Connection type alias, from list-catalogue-connection-types (e.g. 'http')."
3564
+ ),
3565
+ settings: postConnectionsBody.shape.settings.describe(
3566
+ "Settings object matching that connection type's settingsSchema from list-catalogue-connection-types."
3567
+ )
3568
+ };
3569
+ var createConnectionTool = {
3570
+ name: "create-connection",
3571
+ description: "Creates a new connection \u2014 a named set of credentials/endpoint settings (e.g. an API key and base URL) that automation steps can reference by alias. `type` must match one of the aliases returned by the catalogue's connection-types listing, and `settings` must satisfy that type's settingsSchema. The new connection's id is generated by the server and returned here \u2014 use test-connection afterwards to confirm the credentials actually work.",
3572
+ inputSchema: inputSchema31,
3573
+ outputSchema: outputSchema20.shape,
3574
+ slices: ["create"],
3575
+ annotations: {},
3576
+ handler: async ({ alias, name, type, settings }) => {
3577
+ const client = getApiClient();
3578
+ const response = await client.postConnections(
3579
+ { alias, name, type, settings },
3580
+ CAPTURE_RAW_HTTP_RESPONSE
3581
+ );
3582
+ if (response.status === 201) {
3583
+ const locationHeader = response.headers?.["location"] || response.headers?.["Location"];
3584
+ let createdId = "";
3585
+ if (locationHeader) {
3586
+ const idMatch = locationHeader.match(/connections\/([a-f0-9-]+)$/i);
3587
+ if (idMatch) {
3588
+ createdId = idMatch[1];
3589
+ }
3590
+ }
3591
+ return createToolResult({
3592
+ message: "Connection created successfully",
3593
+ id: createdId
3594
+ });
3595
+ }
3596
+ const errorData = response.data || {
3597
+ status: response.status,
3598
+ detail: response.statusText
3599
+ };
3600
+ return createToolResultError(errorData);
3601
+ }
3602
+ };
3603
+ var create_connection_default = withStandardDecorators(createConnectionTool);
3604
+ var inputSchema32 = {
3605
+ ...postConnectionsByIdTestParams.shape,
3606
+ id: postConnectionsByIdTestParams.shape.id.describe(
3607
+ "Id of the saved connection to test."
3608
+ )
3609
+ };
3610
+ var testConnectionTool = {
3611
+ name: "test-connection",
3612
+ description: "Tests an already-saved connection by id \u2014 attempts to reach the third-party service with its stored settings and reports whether the credentials/endpoint are valid. Read-only: it does not change the connection or create/consume any resource on the third-party side. Returns a status of Success, Warning or Failure plus human-readable details explaining the result. Use this after create-connection or update-connection to confirm the credentials actually work.",
3613
+ inputSchema: inputSchema32,
3614
+ outputSchema: postConnectionsByIdTestResponse,
3615
+ slices: ["action"],
3616
+ annotations: {
3617
+ readOnlyHint: true
3618
+ },
3619
+ handler: async ({ id }) => {
3620
+ return executeGetApiCall((client) => client.postConnectionsByIdTest(id, CAPTURE_RAW_HTTP_RESPONSE));
3621
+ }
3622
+ };
3623
+ var test_connection_default = withStandardDecorators(testConnectionTool);
3624
+ var inputSchema33 = z.object({
3625
+ ...putConnectionsByIdParams.shape,
3626
+ ...putConnectionsByIdBody.shape,
3627
+ id: putConnectionsByIdParams.shape.id.describe(
3628
+ "Id of the connection to update."
3629
+ ),
3630
+ alias: putConnectionsByIdBody.shape.alias.describe(
3631
+ "Connection alias. Pass the current value to keep it."
3632
+ ),
3633
+ name: putConnectionsByIdBody.shape.name.describe(
3634
+ "Display name. Pass the current value to keep it."
3635
+ ),
3636
+ type: putConnectionsByIdBody.shape.type.describe(
3637
+ "Connection type alias from list-catalogue-connection-types. Pass the current value to keep it."
3638
+ ),
3639
+ settings: putConnectionsByIdBody.shape.settings.describe(
3640
+ "The complete settings object for the connection type. Replaces the stored settings - include every field you want to keep."
3641
+ ),
3642
+ version: putConnectionsByIdBody.shape.version.describe(
3643
+ "The connection's current version from get-connection. A stale value is rejected as a conflict."
3644
+ )
3645
+ });
3646
+ var updateConnectionTool = {
3647
+ name: "update-connection",
3648
+ description: "Replaces a connection's alias, name, type and settings by id. This is a full replace, not a partial patch \u2014 provide all fields, including any settings you want to keep. Requires the connection's current `version` (from get-connection or list-connections) to detect conflicting edits from someone else; a mismatched version returns a conflict error, so re-fetch and retry. A connection's `type` must match one of the aliases returned by the catalogue's connection-types listing, and its settings must satisfy that type's settingsSchema.",
3649
+ inputSchema: inputSchema33.shape,
3650
+ slices: ["update"],
3651
+ annotations: {
3652
+ idempotentHint: true
3653
+ },
3654
+ handler: async ({ id, alias, name, type, settings, version }) => {
3655
+ return executeVoidApiCall(
3656
+ (client) => client.putConnectionsById(
3657
+ id,
3658
+ { alias, name, type, settings, version },
3659
+ CAPTURE_RAW_HTTP_RESPONSE
3660
+ )
3661
+ );
3662
+ }
3663
+ };
3664
+ var update_connection_default = withStandardDecorators(updateConnectionTool);
3665
+ var inputSchema34 = {
3666
+ ...deleteConnectionsByIdParams.shape,
3667
+ id: deleteConnectionsByIdParams.shape.id.describe(
3668
+ "Id of the connection to delete permanently."
3669
+ )
3670
+ };
3671
+ var deleteConnectionTool = {
3672
+ name: "delete-connection",
3673
+ description: "Permanently deletes a connection by id. This is not reversible and is not idempotent \u2014 calling it again on an already-deleted connection returns a not-found error. Any automation step still referencing this connection will fail the next time it runs, so check for references before deleting.",
3674
+ inputSchema: inputSchema34,
3675
+ slices: ["delete"],
3676
+ annotations: {
3677
+ destructiveHint: true
3678
+ },
3679
+ handler: async ({ id }) => {
3680
+ return executeVoidApiCall(
3681
+ (client) => client.deleteConnectionsById(id, CAPTURE_RAW_HTTP_RESPONSE)
3682
+ );
3683
+ }
3684
+ };
3685
+ var delete_connection_default = withStandardDecorators(deleteConnectionTool);
3686
+
3687
+ // src/umbraco-api/tools/connections/index.ts
3688
+ var collection5 = {
3689
+ metadata: {
3690
+ name: "connections",
3691
+ displayName: "Connections",
3692
+ description: "Manage connections \u2014 configured credentials/endpoints to third-party services that automation steps can reference by alias"
3693
+ },
3694
+ tools: () => [
3695
+ list_connections_default,
3696
+ get_connection_default,
3697
+ create_connection_default,
3698
+ test_connection_default,
3699
+ update_connection_default,
3700
+ delete_connection_default
3701
+ ]
3702
+ };
3703
+ var connections_default = collection5;
3704
+ var outputSchema21 = getMetricsResponse.extend({
3705
+ byStatus: z.record(z.string(), z.int())
3706
+ });
3707
+ var inputSchema35 = {
3708
+ ...getMetricsQueryParams.shape,
3709
+ workspaceId: getMetricsQueryParams.shape.workspaceId.describe(
3710
+ "Optional. Only count runs of automations in this workspace (id from list-workspaces)."
3711
+ ),
3712
+ from: getMetricsQueryParams.shape.from.describe(
3713
+ "Optional start of the time window, as an ISO 8601 date-time (e.g. '2026-09-01T00:00:00Z'). Omit for no lower bound."
3714
+ ),
3715
+ to: getMetricsQueryParams.shape.to.describe(
3716
+ "Optional end of the time window, as an ISO 8601 date-time (e.g. '2026-09-30T23:59:59Z'). Omit for no upper bound."
3717
+ )
3718
+ };
3719
+ var getMetricsTool = {
3720
+ name: "get-metrics",
3721
+ description: "Gets overall automation run metrics: totalRuns, a byStatus breakdown (e.g. how many runs are Completed, Failed, Running), and successRate (successful runs / total runs). Optionally scope to a single workspace with workspaceId, and/or restrict to runs started within [from, to] (ISO 8601 date-times). If from/to are omitted, the metrics cover all recorded runs with no time restriction. Use get-metrics-by-automation instead when you need the breakdown per individual automation rather than one aggregate total.",
3722
+ inputSchema: inputSchema35,
3723
+ outputSchema: outputSchema21,
3724
+ slices: ["read"],
3725
+ annotations: {
3726
+ readOnlyHint: true
3727
+ },
3728
+ handler: async ({ workspaceId, from, to }) => {
3729
+ return executeGetApiCall(
3730
+ (client) => client.getMetrics(
3731
+ { workspaceId, from, to },
3732
+ CAPTURE_RAW_HTTP_RESPONSE
3733
+ )
3734
+ );
3735
+ }
3736
+ };
3737
+ var get_metrics_default = withStandardDecorators(getMetricsTool);
3738
+ var outputSchema22 = z.object({
3739
+ items: z.array(getMetricsByAutomationResponseItem)
3740
+ });
3741
+ var inputSchema36 = {
3742
+ ...getMetricsByAutomationQueryParams.shape,
3743
+ workspaceId: getMetricsByAutomationQueryParams.shape.workspaceId.describe(
3744
+ "Optional. Only count runs of automations in this workspace (id from list-workspaces)."
3745
+ ),
3746
+ from: getMetricsByAutomationQueryParams.shape.from.describe(
3747
+ "Optional start of the time window, as an ISO 8601 date-time (e.g. '2026-09-01T00:00:00Z'). Omit for no lower bound."
3748
+ ),
3749
+ to: getMetricsByAutomationQueryParams.shape.to.describe(
3750
+ "Optional end of the time window, as an ISO 8601 date-time (e.g. '2026-09-30T23:59:59Z'). Omit for no upper bound."
3751
+ ),
3752
+ take: getMetricsByAutomationQueryParams.shape.take.describe(
3753
+ "Maximum number of automations to return (default 10)."
3754
+ )
3755
+ };
3756
+ var getMetricsByAutomationTool = {
3757
+ name: "get-metrics-by-automation",
3758
+ description: "Gets automation run metrics broken down per individual automation. Each item has automationId, automationName, totalRuns, successCount, and failCount, so you can compare automations or spot which ones fail most. Optionally scope to a single workspace with workspaceId, and/or restrict to runs started within [from, to] (ISO 8601 date-times) \u2014 if omitted, all recorded runs are considered. `take` limits how many automations are returned (defaults to 10) \u2014 the ordering of results is determined by the API and not otherwise documented here, so raise `take` if you need to confirm whether an automation you're looking for is included; there is no `skip`/total-count for this endpoint, so a full response cannot be distinguished from a truncated one. Use get-metrics instead when you only need one overall total rather than a per-automation list.",
3759
+ inputSchema: inputSchema36,
3760
+ outputSchema: outputSchema22,
3761
+ slices: ["list"],
3762
+ annotations: {
3763
+ readOnlyHint: true
3764
+ },
3765
+ handler: async ({ workspaceId, from, to, take }) => {
3766
+ return executeGetItemsApiCall(
3767
+ (client) => client.getMetricsByAutomation(
3768
+ { workspaceId, from, to, take },
3769
+ CAPTURE_RAW_HTTP_RESPONSE
3770
+ )
3771
+ );
3772
+ }
3773
+ };
3774
+ var get_metrics_by_automation_default = withStandardDecorators(getMetricsByAutomationTool);
3775
+
3776
+ // src/umbraco-api/tools/metrics/index.ts
3777
+ var collection6 = {
3778
+ metadata: {
3779
+ name: "metrics",
3780
+ displayName: "Metrics",
3781
+ description: "Analytics and reporting over automation run history: overall run totals/success rate, and per-automation run counts."
3782
+ },
3783
+ tools: () => [get_metrics_default, get_metrics_by_automation_default]
3784
+ };
3785
+ var metrics_default = collection6;
3786
+ var listRunsTool = {
3787
+ name: "list-runs",
3788
+ description: "Lists workflow run instances across all automations, most recent first, with cursor paging (pass nextCursor from the previous response). Each item reports its lifecycle status (Pending, Running, Completed, Failed, Suspended, Cancelled, Rejected) plus the automation it belongs to. Use get-run-by-id for full step-by-step detail on a specific run, and list-pending-approvals (approvals collection) to see which runs are currently blocked waiting on a human decision.",
3789
+ inputSchema: getRunsQueryParams.shape,
3790
+ outputSchema: getRunsResponse,
3791
+ slices: ["list"],
3792
+ annotations: {
3793
+ readOnlyHint: true
3794
+ },
3795
+ handler: async ({ skip, take }) => {
3796
+ return executeGetApiCall(
3797
+ (client) => client.getRuns({ skip, take }, CAPTURE_RAW_HTTP_RESPONSE)
3798
+ );
3799
+ }
3800
+ };
3801
+ var list_runs_default = withStandardDecorators(listRunsTool);
3802
+ var inputSchema37 = {
3803
+ ...getRunsByIdParams.shape,
3804
+ id: getRunsByIdParams.shape.id.describe(
3805
+ "Id of the run (from list-runs or list-automation-runs)."
3806
+ )
3807
+ };
3808
+ var getRunByIdTool = {
3809
+ name: "get-run-by-id",
3810
+ description: "Gets the full detail of a single workflow run by id, including the automation it belongs to, its overall status (Pending, Running, Completed, Failed, Suspended, Cancelled, Rejected), and the step-by-step execution state (stepRuns) with each step's own status, timing, and error if any. A step in status WaitingForInput is blocked on a human decision \u2014 check list-pending-approvals (approvals collection) for the matching approval.",
3811
+ inputSchema: inputSchema37,
3812
+ outputSchema: getRunsByIdResponse,
3813
+ slices: ["read"],
3814
+ annotations: {
3815
+ readOnlyHint: true
3816
+ },
3817
+ handler: async ({ id }) => {
3818
+ return executeGetApiCall(
3819
+ (client) => client.getRunsById(id, CAPTURE_RAW_HTTP_RESPONSE)
3820
+ );
3821
+ }
3822
+ };
3823
+ var get_run_by_id_default = withStandardDecorators(getRunByIdTool);
3824
+ var inputSchema38 = {
3825
+ ...postRunsByIdReplayParams.shape,
3826
+ id: postRunsByIdReplayParams.shape.id.describe(
3827
+ "Id of the finished run to replay."
3828
+ )
3829
+ };
3830
+ var replayRunTool = {
3831
+ name: "replay-run",
3832
+ description: "Re-executes a finished workflow run from the start, creating a new run against the same automation. Only valid once the run has reached a terminal status (Completed, Failed, Cancelled, or Rejected) \u2014 check status via get-run-by-id first. For a run that is Suspended, use resume-run instead.",
3833
+ inputSchema: inputSchema38,
3834
+ slices: ["action"],
3835
+ annotations: {},
3836
+ handler: async ({ id }) => {
3837
+ return executeVoidApiCall(
3838
+ (client) => client.postRunsByIdReplay(id, CAPTURE_RAW_HTTP_RESPONSE)
3839
+ );
3840
+ }
3841
+ };
3842
+ var replay_run_default = withStandardDecorators(replayRunTool);
3843
+ var inputSchema39 = {
3844
+ ...postRunsByIdResumeParams.shape,
3845
+ id: postRunsByIdResumeParams.shape.id.describe(
3846
+ "Id of the Suspended run to continue."
3847
+ )
3848
+ };
3849
+ var resumeRunTool = {
3850
+ name: "resume-run",
3851
+ description: "Resumes a workflow run that is currently Suspended, continuing execution from where it was paused. Only valid when the run's status is Suspended \u2014 check status via get-run-by-id first. Not the same as replay-run, which starts a finished run over from the beginning.",
3852
+ inputSchema: inputSchema39,
3853
+ slices: ["action"],
3854
+ annotations: {},
3855
+ handler: async ({ id }) => {
3856
+ return executeVoidApiCall(
3857
+ (client) => client.postRunsByIdResume(id, CAPTURE_RAW_HTTP_RESPONSE)
3858
+ );
3859
+ }
3860
+ };
3861
+ var resume_run_default = withStandardDecorators(resumeRunTool);
3862
+ var inputSchema40 = {
3863
+ ...postRunsByIdSuspendParams.shape,
3864
+ id: postRunsByIdSuspendParams.shape.id.describe(
3865
+ "Id of the Pending or Running run to pause."
3866
+ )
3867
+ };
3868
+ var suspendRunTool = {
3869
+ name: "suspend-run",
3870
+ description: "Pauses a workflow run that is currently in progress (status Pending or Running), leaving it Suspended so it can be continued later with resume-run instead of running to completion. Not valid for a run that has already finished or been terminated \u2014 check status via get-run-by-id first.",
3871
+ inputSchema: inputSchema40,
3872
+ slices: ["action"],
3873
+ annotations: {},
3874
+ handler: async ({ id }) => {
3875
+ return executeVoidApiCall(
3876
+ (client) => client.postRunsByIdSuspend(id, CAPTURE_RAW_HTTP_RESPONSE)
3877
+ );
3878
+ }
3879
+ };
3880
+ var suspend_run_default = withStandardDecorators(suspendRunTool);
3881
+ var inputSchema41 = {
3882
+ ...postRunsByIdTerminateParams.shape,
3883
+ id: postRunsByIdTerminateParams.shape.id.describe(
3884
+ "Id of the Pending, Running or Suspended run to stop."
3885
+ )
3886
+ };
3887
+ var terminateRunTool = {
3888
+ name: "terminate-run",
3889
+ description: "Force-stops a workflow run that is Pending, Running, or Suspended, cancelling it immediately. This is irreversible \u2014 a terminated run cannot be resumed or replayed; the automation must be triggered again to start a new run. Use suspend-run instead if you only want to pause the run temporarily.",
3890
+ inputSchema: inputSchema41,
3891
+ slices: ["action"],
3892
+ annotations: {
3893
+ destructiveHint: true
3894
+ },
3895
+ handler: async ({ id }) => {
3896
+ return executeVoidApiCall(
3897
+ (client) => client.postRunsByIdTerminate(id, CAPTURE_RAW_HTTP_RESPONSE)
3898
+ );
3899
+ }
3900
+ };
3901
+ var terminate_run_default = withStandardDecorators(terminateRunTool);
3902
+
3903
+ // src/umbraco-api/tools/runs/index.ts
3904
+ var collection7 = {
3905
+ metadata: {
3906
+ name: "runs",
3907
+ displayName: "Runs",
3908
+ description: "Inspect and control workflow run instances \u2014 list runs, view step-by-step execution detail, and replay, resume, suspend, or terminate a run."
3909
+ },
3910
+ tools: () => [
3911
+ list_runs_default,
3912
+ get_run_by_id_default,
3913
+ replay_run_default,
3914
+ resume_run_default,
3915
+ suspend_run_default,
3916
+ terminate_run_default
3917
+ ]
3918
+ };
3919
+ var runs_default = collection7;
3920
+ var outputSchema23 = z.object({
3921
+ items: z.array(getVersionHistorySupportedTypesResponseItem)
3922
+ });
3923
+ var getVersionHistorySupportedTypesTool = {
3924
+ name: "list-version-history-supported-types",
3925
+ description: "Lists the entityType strings (PascalCase, e.g. 'Automation') that the version-history tools accept. Version history is a generic versioning/audit-trail feature over entities such as automations, letting you view past versions, compare them, and roll back. Call this before list-version-history, get-version-history-entry, compare-version-history, or rollback-version-history to confirm which entityType value to pass for the entity you are inspecting.",
3926
+ slices: ["list"],
3927
+ annotations: {
3928
+ readOnlyHint: true
3929
+ },
3930
+ outputSchema: outputSchema23,
3931
+ handler: async () => {
3932
+ return executeGetItemsApiCall(
3933
+ (client) => client.getVersionHistorySupportedTypes(CAPTURE_RAW_HTTP_RESPONSE)
3934
+ );
3935
+ }
3936
+ };
3937
+ var list_version_history_supported_types_default = withStandardDecorators(getVersionHistorySupportedTypesTool);
3938
+ var inputSchema42 = getVersionHistoryByEntityTypeByEntityIdParams.extend({
3939
+ ...getVersionHistoryByEntityTypeByEntityIdQueryParams.shape,
3940
+ entityType: getVersionHistoryByEntityTypeByEntityIdParams.shape.entityType.describe(
3941
+ "Entity type in PascalCase, e.g. 'Automation'. See list-version-history-supported-types for the accepted values."
3942
+ ),
3943
+ entityId: getVersionHistoryByEntityTypeByEntityIdParams.shape.entityId.describe(
3944
+ "Id of the entity whose history to list, e.g. an automation id."
3945
+ )
3946
+ });
3947
+ var listVersionHistoryTool = {
3948
+ name: "list-version-history",
3949
+ description: "Lists the version history for a single entity, given its entityType and entityId. Returns currentVersion, totalVersions, publishedVersion (if any version is currently published), and a page of version entries (id, version number, dateCreated, createdByUserId, changeDescription, isPublished) ordered newest first. Use list-version-history-supported-types to confirm a valid entityType (PascalCase, e.g. 'Automation'). For entities with many versions, page through the history by passing nextCursor from the previous response. Use the version numbers returned here with get-version-history-entry, compare-version-history, or rollback-version-history.",
3950
+ inputSchema: inputSchema42.shape,
3951
+ outputSchema: getVersionHistoryByEntityTypeByEntityIdResponse,
3952
+ slices: ["list"],
3953
+ annotations: {
3954
+ readOnlyHint: true
3955
+ },
3956
+ handler: async ({ entityType, entityId, skip, take }) => {
3957
+ return executeGetApiCall(
3958
+ (client) => client.getVersionHistoryByEntityTypeByEntityId(
3959
+ entityType,
3960
+ entityId,
3961
+ { skip, take },
3962
+ CAPTURE_RAW_HTTP_RESPONSE
3963
+ )
3964
+ );
3965
+ }
3966
+ };
3967
+ var list_version_history_default = withStandardDecorators(listVersionHistoryTool);
3968
+ var inputSchema43 = {
3969
+ ...getVersionHistoryByEntityTypeByEntityIdByEntityVersionParams.shape,
3970
+ entityType: getVersionHistoryByEntityTypeByEntityIdByEntityVersionParams.shape.entityType.describe(
3971
+ "Entity type in PascalCase, e.g. 'Automation'. See list-version-history-supported-types for the accepted values."
3972
+ ),
3973
+ entityId: getVersionHistoryByEntityTypeByEntityIdByEntityVersionParams.shape.entityId.describe(
3974
+ "Id of the entity whose history to read, e.g. an automation id."
3975
+ ),
3976
+ entityVersion: getVersionHistoryByEntityTypeByEntityIdByEntityVersionParams.shape.entityVersion.describe(
3977
+ "Version number to read, from list-version-history (1 is the original creation)."
3978
+ )
3979
+ };
3980
+ var getVersionHistoryEntryTool = {
3981
+ name: "get-version-history-entry",
3982
+ description: "Gets one specific past version of an entity, identified by entityType, entityId, and entityVersion. Returns that version's id, version number, dateCreated, createdByUserId, changeDescription, and whether it isPublished. Use list-version-history first to find valid entityVersion numbers for the entity. Use list-version-history-supported-types to confirm a valid entityType (PascalCase, e.g. 'Automation').",
3983
+ inputSchema: inputSchema43,
3984
+ outputSchema: getVersionHistoryByEntityTypeByEntityIdByEntityVersionResponse,
3985
+ slices: ["read"],
3986
+ annotations: {
3987
+ readOnlyHint: true
3988
+ },
3989
+ handler: async ({ entityType, entityId, entityVersion }) => {
3990
+ return executeGetApiCall(
3991
+ (client) => client.getVersionHistoryByEntityTypeByEntityIdByEntityVersion(
3992
+ entityType,
3993
+ entityId,
3994
+ entityVersion,
3995
+ CAPTURE_RAW_HTTP_RESPONSE
3996
+ )
3997
+ );
3998
+ }
3999
+ };
4000
+ var get_version_history_entry_default = withStandardDecorators(getVersionHistoryEntryTool);
4001
+ var inputSchema44 = {
4002
+ ...getVersionHistoryByEntityTypeByEntityIdByFromEntityVersionCompareByToEntityVersionParams.shape,
4003
+ entityType: getVersionHistoryByEntityTypeByEntityIdByFromEntityVersionCompareByToEntityVersionParams.shape.entityType.describe(
4004
+ "Entity type in PascalCase, e.g. 'Automation'. See list-version-history-supported-types for the accepted values."
4005
+ ),
4006
+ entityId: getVersionHistoryByEntityTypeByEntityIdByFromEntityVersionCompareByToEntityVersionParams.shape.entityId.describe(
4007
+ "Id of the entity whose history to read, e.g. an automation id."
4008
+ ),
4009
+ fromEntityVersion: getVersionHistoryByEntityTypeByEntityIdByFromEntityVersionCompareByToEntityVersionParams.shape.fromEntityVersion.describe(
4010
+ "The older version number to compare from, from list-version-history."
4011
+ ),
4012
+ toEntityVersion: getVersionHistoryByEntityTypeByEntityIdByFromEntityVersionCompareByToEntityVersionParams.shape.toEntityVersion.describe(
4013
+ "The newer version number to compare to, from list-version-history."
4014
+ )
4015
+ };
4016
+ var compareVersionHistoryTool = {
4017
+ name: "compare-version-history",
4018
+ description: "Compares two versions of an entity (fromEntityVersion vs toEntityVersion) and returns the list of field-level changes between them, each with the field path, oldValue, and newValue. Use list-version-history first to find valid version numbers for the entity. Use list-version-history-supported-types to confirm a valid entityType (PascalCase, e.g. 'Automation'). Review the diff here before deciding whether to call rollback-version-history.",
4019
+ inputSchema: inputSchema44,
4020
+ outputSchema: getVersionHistoryByEntityTypeByEntityIdByFromEntityVersionCompareByToEntityVersionResponse,
4021
+ slices: ["read"],
4022
+ annotations: {
4023
+ readOnlyHint: true
4024
+ },
4025
+ handler: async ({
4026
+ entityType,
4027
+ entityId,
4028
+ fromEntityVersion,
4029
+ toEntityVersion
4030
+ }) => {
4031
+ return executeGetApiCall(
4032
+ (client) => client.getVersionHistoryByEntityTypeByEntityIdByFromEntityVersionCompareByToEntityVersion(
4033
+ entityType,
4034
+ entityId,
4035
+ fromEntityVersion,
4036
+ toEntityVersion,
4037
+ CAPTURE_RAW_HTTP_RESPONSE
4038
+ )
4039
+ );
4040
+ }
4041
+ };
4042
+ var compare_version_history_default = withStandardDecorators(compareVersionHistoryTool);
4043
+ var inputSchema45 = {
4044
+ ...postVersionHistoryByEntityTypeByEntityIdByEntityVersionRollbackParams.shape,
4045
+ entityType: postVersionHistoryByEntityTypeByEntityIdByEntityVersionRollbackParams.shape.entityType.describe(
4046
+ "Entity type in PascalCase, e.g. 'Automation'. See list-version-history-supported-types for the accepted values."
4047
+ ),
4048
+ entityId: postVersionHistoryByEntityTypeByEntityIdByEntityVersionRollbackParams.shape.entityId.describe(
4049
+ "Id of the entity whose history to read, e.g. an automation id."
4050
+ ),
4051
+ entityVersion: postVersionHistoryByEntityTypeByEntityIdByEntityVersionRollbackParams.shape.entityVersion.describe(
4052
+ "Version number to restore, from list-version-history."
4053
+ )
4054
+ };
4055
+ var rollbackVersionHistoryTool = {
4056
+ name: "rollback-version-history",
4057
+ description: "Rolls an entity back to a specific past version, identified by entityType, entityId, and entityVersion. This overwrites the entity's current state with that version's snapshot and has a real, immediate side effect \u2014 it is not reversible except by rolling back again to another version. Use list-version-history to find valid version numbers and compare-version-history to review what will change before calling this. Use list-version-history-supported-types to confirm a valid entityType (PascalCase, e.g. 'Automation').",
4058
+ inputSchema: inputSchema45,
4059
+ slices: ["action"],
4060
+ annotations: {
4061
+ destructiveHint: true
4062
+ },
4063
+ handler: async ({ entityType, entityId, entityVersion }) => {
4064
+ return executeVoidApiCall(
4065
+ (client) => client.postVersionHistoryByEntityTypeByEntityIdByEntityVersionRollback(
4066
+ entityType,
4067
+ entityId,
4068
+ entityVersion,
4069
+ CAPTURE_RAW_HTTP_RESPONSE
4070
+ )
4071
+ );
4072
+ }
4073
+ };
4074
+ var rollback_version_history_default = withStandardDecorators(rollbackVersionHistoryTool);
4075
+
4076
+ // src/umbraco-api/tools/version-history/index.ts
4077
+ var collection8 = {
4078
+ metadata: {
4079
+ name: "version-history",
4080
+ displayName: "Version History",
4081
+ description: "View, compare, and roll back past versions of versioned entities (e.g. automations)."
4082
+ },
4083
+ tools: () => [
4084
+ list_version_history_supported_types_default,
4085
+ list_version_history_default,
4086
+ get_version_history_entry_default,
4087
+ compare_version_history_default,
4088
+ rollback_version_history_default
4089
+ ]
4090
+ };
4091
+ var version_history_default = collection8;
4092
+ var inputSchema46 = {
4093
+ ...getWorkspacesQueryParams.shape,
4094
+ filter: getWorkspacesQueryParams.shape.filter.describe(
4095
+ "Optional text matched against workspace name and alias."
4096
+ )
4097
+ };
4098
+ var outputSchema24 = getWorkspacesResponse;
4099
+ var listWorkspacesTool = {
4100
+ name: "list-workspaces",
4101
+ description: "Lists workspaces, optionally filtered by name/alias, with cursor paging (pass nextCursor from the previous response). Each result includes the workspace id, alias, name, and version needed to fetch, update, or list groups within it. Use list-workspace-groups afterwards to see how a specific workspace organizes its automations into groups.",
4102
+ inputSchema: inputSchema46,
4103
+ outputSchema: outputSchema24,
4104
+ slices: ["list"],
4105
+ annotations: {
4106
+ readOnlyHint: true
4107
+ },
4108
+ handler: async ({ filter, skip, take }) => {
4109
+ return executeGetApiCall(
4110
+ (client) => client.getWorkspaces({ filter, skip, take }, CAPTURE_RAW_HTTP_RESPONSE)
4111
+ );
4112
+ }
4113
+ };
4114
+ var list_workspaces_default = withStandardDecorators(listWorkspacesTool);
4115
+ var inputSchema47 = {
4116
+ workspaceId: z.string().describe("The id of the workspace to fetch.")
4117
+ };
4118
+ var outputSchema25 = getWorkspacesByIdResponse;
4119
+ var getWorkspaceTool = {
4120
+ name: "get-workspace",
4121
+ description: "Gets a single workspace by id. Returns its alias, name, service account key, allowed user groups and connections, and the optimistic-concurrency `version` needed for update-workspace. Use list-workspaces to find a workspace id first.",
4122
+ inputSchema: inputSchema47,
4123
+ outputSchema: outputSchema25,
4124
+ slices: ["read"],
4125
+ annotations: {
4126
+ readOnlyHint: true
4127
+ },
4128
+ handler: async ({ workspaceId }) => {
4129
+ return executeGetApiCall(
4130
+ (client) => client.getWorkspacesById(workspaceId, CAPTURE_RAW_HTTP_RESPONSE)
4131
+ );
4132
+ }
4133
+ };
4134
+ var get_workspace_default = withStandardDecorators(getWorkspaceTool);
4135
+ var inputSchema48 = {
4136
+ workspaceId: z.string().describe("The id of the workspace whose groups to list."),
4137
+ parentGroupId: z.string().optional().describe(
4138
+ "Optional parent group id. When set, returns only that group's direct children. When omitted, returns only the workspace's top-level groups (those with no parent) - not every group in the workspace. To see all groups, walk the tree: list top-level groups, then call this again with each group's id to list its children, recursively."
4139
+ )
4140
+ };
4141
+ var outputSchema26 = z.object({ items: getWorkspacesByIdGroupsResponse });
4142
+ var listWorkspaceGroupsTool = {
4143
+ name: "list-workspace-groups",
4144
+ description: "Lists one level of the groups a workspace uses to organize its automations: either the top-level groups (parentGroupId omitted) or the direct children of one group (parentGroupId set). This does not recursively return nested groups in a single call - call it again with a child group's id to go one level deeper. Each item includes the group id, name, parentId (for nesting) and workspaceId. Use get-workspace-group for a single group, or automations tools to see the automations filed under a group.",
4145
+ inputSchema: inputSchema48,
4146
+ outputSchema: outputSchema26,
4147
+ slices: ["list"],
4148
+ annotations: {
4149
+ readOnlyHint: true
4150
+ },
4151
+ handler: async ({ workspaceId, parentGroupId }) => {
4152
+ return executeGetItemsApiCall(
4153
+ (client) => client.getWorkspacesByIdGroups(
4154
+ workspaceId,
4155
+ { parentGroupId },
4156
+ CAPTURE_RAW_HTTP_RESPONSE
4157
+ )
4158
+ );
4159
+ }
4160
+ };
4161
+ var list_workspace_groups_default = withStandardDecorators(listWorkspaceGroupsTool);
4162
+ var inputSchema49 = {
4163
+ workspaceId: z.string().describe("The id of the workspace the group belongs to."),
4164
+ groupId: z.string().describe("The id of the group to fetch.")
4165
+ };
4166
+ var outputSchema27 = getWorkspacesByIdGroupsByGroupIdResponse;
4167
+ var getWorkspaceGroupTool = {
4168
+ name: "get-workspace-group",
4169
+ description: "Gets a single group within a workspace by id, including its name and optional parentId for nesting. Use list-workspace-groups to find a group id first, and automations tools to see the automations filed under it.",
4170
+ inputSchema: inputSchema49,
4171
+ outputSchema: outputSchema27,
4172
+ slices: ["read"],
4173
+ annotations: {
4174
+ readOnlyHint: true
4175
+ },
4176
+ handler: async ({ workspaceId, groupId }) => {
4177
+ return executeGetApiCall(
4178
+ (client) => client.getWorkspacesByIdGroupsByGroupId(
4179
+ workspaceId,
4180
+ groupId,
4181
+ CAPTURE_RAW_HTTP_RESPONSE
4182
+ )
4183
+ );
4184
+ }
4185
+ };
4186
+ var get_workspace_group_default = withStandardDecorators(getWorkspaceGroupTool);
4187
+ var inputSchema50 = {
4188
+ alias: z.string().min(1).describe("Unique machine alias for the workspace."),
4189
+ name: z.string().min(1).describe("Human-friendly display name for the workspace."),
4190
+ serviceAccountKey: z.string().describe("Id of the Umbraco service account the workspace's automations run as."),
4191
+ userGroups: z.array(z.string()).optional().default([]).describe("Ids of the Umbraco user groups allowed to manage this workspace."),
4192
+ allowedConnections: z.array(z.string()).optional().default([]).describe("Ids of the connections that automations in this workspace are allowed to use.")
4193
+ };
4194
+ var outputSchema28 = z.object({
4195
+ success: z.boolean(),
4196
+ id: z.string().optional(),
4197
+ location: z.string().optional()
4198
+ });
4199
+ var createWorkspaceTool = {
4200
+ name: "create-workspace",
4201
+ description: "Creates a new workspace to hold automations. A workspace is the top-level container that scopes automations, the groups (folders) used to organize them, the connections its automations may use, and which Umbraco user groups can manage it. Follow up with create-workspace-group to add folders, or automations tools to add automations to it.",
4202
+ inputSchema: inputSchema50,
4203
+ outputSchema: outputSchema28,
4204
+ slices: ["create"],
4205
+ annotations: {
4206
+ destructiveHint: false,
4207
+ idempotentHint: false
4208
+ },
4209
+ handler: async ({ alias, name, serviceAccountKey, userGroups, allowedConnections }) => {
4210
+ const client = getApiClient();
4211
+ const response = await client.postWorkspaces(
4212
+ { alias, name, serviceAccountKey, userGroups, allowedConnections },
4213
+ CAPTURE_RAW_HTTP_RESPONSE
4214
+ );
4215
+ if (response.status !== 201) {
4216
+ const errorData = response.data;
4217
+ throw new UmbracoApiError(
4218
+ errorData || {
4219
+ status: response.status,
4220
+ detail: response.statusText
4221
+ }
4222
+ );
4223
+ }
4224
+ const location = response.headers?.Location || response.headers?.location;
4225
+ const id = location?.split("/").pop();
4226
+ return createToolResult({
4227
+ success: true,
4228
+ id,
4229
+ location
4230
+ });
4231
+ }
4232
+ };
4233
+ var create_workspace_default = withStandardDecorators(createWorkspaceTool);
4234
+ var inputSchema51 = {
4235
+ workspaceId: z.string().describe("The id of the workspace to create the group in."),
4236
+ name: z.string().min(1).describe("Display name for the group."),
4237
+ parentId: z.string().nullish().describe("Optional id of a parent group, to nest this group underneath it. Omit for a top-level group.")
4238
+ };
4239
+ var outputSchema29 = z.object({
4240
+ success: z.boolean(),
4241
+ id: z.string().optional(),
4242
+ location: z.string().optional()
4243
+ });
4244
+ var createWorkspaceGroupTool = {
4245
+ name: "create-workspace-group",
4246
+ description: "Creates a new group (folder) within a workspace to organize its automations. Pass parentId to nest it under an existing group, or omit it to create a top-level group. Use list-workspace-groups to find existing groups, and automations tools to file automations under the new group.",
4247
+ inputSchema: inputSchema51,
4248
+ outputSchema: outputSchema29,
4249
+ slices: ["create"],
4250
+ annotations: {
4251
+ destructiveHint: false,
4252
+ idempotentHint: false
4253
+ },
4254
+ handler: async ({ workspaceId, name, parentId }) => {
4255
+ const client = getApiClient();
4256
+ const response = await client.postWorkspacesByIdGroups(
4257
+ workspaceId,
4258
+ { name, parentId },
4259
+ CAPTURE_RAW_HTTP_RESPONSE
4260
+ );
4261
+ if (response.status !== 201) {
4262
+ const errorData = response.data;
4263
+ throw new UmbracoApiError(
4264
+ errorData || {
4265
+ status: response.status,
4266
+ detail: response.statusText
4267
+ }
4268
+ );
4269
+ }
4270
+ const location = response.headers?.Location || response.headers?.location;
4271
+ const id = location?.split("/").pop();
4272
+ return createToolResult({
4273
+ success: true,
4274
+ id,
4275
+ location
4276
+ });
4277
+ }
4278
+ };
4279
+ var create_workspace_group_default = withStandardDecorators(createWorkspaceGroupTool);
4280
+ var inputSchema52 = {
4281
+ workspaceId: z.string().describe("The id of the workspace to update."),
4282
+ ...putWorkspacesByIdBody.shape,
4283
+ alias: putWorkspacesByIdBody.shape.alias.describe(
4284
+ "Unique machine alias for the workspace. Pass the current value to keep it."
4285
+ ),
4286
+ name: putWorkspacesByIdBody.shape.name.describe(
4287
+ "Display name for the workspace. Pass the current value to keep it."
4288
+ ),
4289
+ serviceAccountKey: putWorkspacesByIdBody.shape.serviceAccountKey.describe(
4290
+ "Id of the Umbraco user the workspace's automations run as. Pass the current value from get-workspace to keep it."
4291
+ ),
4292
+ userGroups: putWorkspacesByIdBody.shape.userGroups.describe(
4293
+ "Ids of the Umbraco user groups allowed to manage this workspace. Replaces the whole list - pass the current list from get-workspace to keep it, or [] for none."
4294
+ ),
4295
+ allowedConnections: putWorkspacesByIdBody.shape.allowedConnections.describe(
4296
+ "Ids of the connections this workspace's automations may use. Replaces the whole list - pass the current list from get-workspace to keep it, or [] for none."
4297
+ ),
4298
+ version: putWorkspacesByIdBody.shape.version.describe(
4299
+ "The workspace's current version from get-workspace. A stale value is rejected as a conflict."
4300
+ )
4301
+ };
4302
+ var updateWorkspaceTool = {
4303
+ name: "update-workspace",
4304
+ description: "Updates an existing workspace's alias, name, service account, allowed user groups, and allowed connections. Requires the current `version` returned by get-workspace or list-workspaces \u2014 the call fails if the workspace has been modified since, so fetch it fresh right before updating.",
4305
+ inputSchema: inputSchema52,
4306
+ slices: ["update"],
4307
+ annotations: {
4308
+ destructiveHint: false,
4309
+ idempotentHint: true
4310
+ },
4311
+ handler: async ({
4312
+ workspaceId,
4313
+ alias,
4314
+ name,
4315
+ serviceAccountKey,
4316
+ userGroups,
4317
+ allowedConnections,
4318
+ version
4319
+ }) => {
4320
+ return executeVoidApiCall(
4321
+ (client) => client.putWorkspacesById(
4322
+ workspaceId,
4323
+ { alias, name, serviceAccountKey, userGroups, allowedConnections, version },
4324
+ CAPTURE_RAW_HTTP_RESPONSE
4325
+ )
4326
+ );
4327
+ }
4328
+ };
4329
+ var update_workspace_default = withStandardDecorators(updateWorkspaceTool);
4330
+ var inputSchema53 = {
4331
+ workspaceId: z.string().describe("The id of the workspace the group belongs to."),
4332
+ groupId: z.string().describe("The id of the group to update."),
4333
+ ...putWorkspacesByIdGroupsByGroupIdBody.shape,
4334
+ name: putWorkspacesByIdGroupsByGroupIdBody.shape.name.describe(
4335
+ "Display name for the group. Pass the current name to keep it."
4336
+ ),
4337
+ parentId: putWorkspacesByIdGroupsByGroupIdBody.shape.parentId.describe(
4338
+ "Optional id of the parent group to nest under. Omit or pass null to make it a top-level group."
4339
+ )
4340
+ };
4341
+ var updateWorkspaceGroupTool = {
4342
+ name: "update-workspace-group",
4343
+ description: "Renames a group within a workspace and/or moves it under a different parent group. Pass parentId to re-nest the group, or omit it to make/keep it a top-level group. Use list-workspace-groups or get-workspace-group to find the current name and parentId first.",
4344
+ inputSchema: inputSchema53,
4345
+ slices: ["update"],
4346
+ annotations: {
4347
+ destructiveHint: false,
4348
+ idempotentHint: true
4349
+ },
4350
+ handler: async ({ workspaceId, groupId, name, parentId }) => {
4351
+ return executeVoidApiCall(
4352
+ (client) => client.putWorkspacesByIdGroupsByGroupId(
4353
+ workspaceId,
4354
+ groupId,
4355
+ { name, parentId },
4356
+ CAPTURE_RAW_HTTP_RESPONSE
4357
+ )
4358
+ );
4359
+ }
4360
+ };
4361
+ var update_workspace_group_default = withStandardDecorators(updateWorkspaceGroupTool);
4362
+ var inputSchema54 = {
4363
+ workspaceId: z.string().describe("The id of the workspace to delete.")
4364
+ };
4365
+ var deleteWorkspaceTool = {
4366
+ name: "delete-workspace",
4367
+ description: "Permanently deletes a workspace and its groups. This is not idempotent \u2014 calling it again on an already-deleted workspace returns an error. Automations that belonged to this workspace are not deleted automatically, so confirm none remain assigned to it first.",
4368
+ inputSchema: inputSchema54,
4369
+ slices: ["delete"],
4370
+ annotations: {
4371
+ destructiveHint: true,
4372
+ idempotentHint: false
4373
+ },
4374
+ handler: async ({ workspaceId }) => {
4375
+ return executeVoidApiCall(
4376
+ (client) => client.deleteWorkspacesById(workspaceId, CAPTURE_RAW_HTTP_RESPONSE)
4377
+ );
4378
+ }
4379
+ };
4380
+ var delete_workspace_default = withStandardDecorators(deleteWorkspaceTool);
4381
+ var inputSchema55 = {
4382
+ workspaceId: z.string().describe("The id of the workspace the group belongs to."),
4383
+ groupId: z.string().describe("The id of the group to delete.")
4384
+ };
4385
+ var deleteWorkspaceGroupTool = {
4386
+ name: "delete-workspace-group",
4387
+ description: "Permanently deletes a group within a workspace. This is not idempotent \u2014 calling it again on an already-deleted group returns an error. Automations and child groups filed under it are not moved or deleted automatically, so use list-workspace-groups to check for children first.",
4388
+ inputSchema: inputSchema55,
4389
+ slices: ["delete"],
4390
+ annotations: {
4391
+ destructiveHint: true,
4392
+ idempotentHint: false
4393
+ },
4394
+ handler: async ({ workspaceId, groupId }) => {
4395
+ return executeVoidApiCall(
4396
+ (client) => client.deleteWorkspacesByIdGroupsByGroupId(
4397
+ workspaceId,
4398
+ groupId,
4399
+ CAPTURE_RAW_HTTP_RESPONSE
4400
+ )
4401
+ );
4402
+ }
4403
+ };
4404
+ var delete_workspace_group_default = withStandardDecorators(deleteWorkspaceGroupTool);
4405
+
4406
+ // src/umbraco-api/tools/workspaces/index.ts
4407
+ var collection9 = {
4408
+ metadata: {
4409
+ name: "workspaces",
4410
+ displayName: "Workspaces",
4411
+ description: "Manage workspaces (the top-level containers that scope automations, their allowed connections, and permitted user groups) and the groups used to organize automations within them."
4412
+ },
4413
+ tools: () => [
4414
+ // Read operations
4415
+ list_workspaces_default,
4416
+ get_workspace_default,
4417
+ list_workspace_groups_default,
4418
+ get_workspace_group_default,
4419
+ // Create operations
4420
+ create_workspace_default,
4421
+ create_workspace_group_default,
4422
+ // Update operations
4423
+ update_workspace_default,
4424
+ update_workspace_group_default,
4425
+ // Delete operations
4426
+ delete_workspace_default,
4427
+ delete_workspace_group_default
4428
+ ]
4429
+ };
4430
+ var workspaces_default = collection9;
4431
+ var lenient = /* @__PURE__ */ new WeakMap();
4432
+ var FIELDS_NEWER_AUTOMATE_ADDED = /* @__PURE__ */ new Set([
4433
+ // settings field descriptors (catalogue settingsSchema.fields[])
4434
+ "valueKind",
4435
+ // catalogue step/trigger items
4436
+ "outcomes",
4437
+ "hasDynamicOutcomes",
4438
+ // run step runs (stepRuns[])
4439
+ "logEntries"
4440
+ ]);
4441
+ function optionalIfAddedLater(key, schema) {
4442
+ return FIELDS_NEWER_AUTOMATE_ADDED.has(key) && schema._zod.optin !== "optional" ? z.optional(schema) : schema;
4443
+ }
4444
+ var SINGLE_CHILD_KEYS = ["element", "innerType", "keyType", "valueType", "left", "right", "in", "out"];
4445
+ var LIST_CHILD_KEYS = ["options", "items"];
4446
+ function rebuild(schema) {
4447
+ const def = schema._zod.def;
4448
+ const next = { ...def };
4449
+ if (def.type === "object") {
4450
+ next.shape = Object.fromEntries(
4451
+ Object.entries(def.shape).map(([key, value]) => [
4452
+ key,
4453
+ optionalIfAddedLater(key, loosen(value))
4454
+ ])
4455
+ );
4456
+ next.catchall = def.catchall ? loosen(def.catchall) : z.unknown();
4457
+ } else if (def.type === "lazy") {
4458
+ const getter = def.getter;
4459
+ next.getter = () => loosen(getter());
4460
+ }
4461
+ for (const key of SINGLE_CHILD_KEYS) {
4462
+ if (def[key]) next[key] = loosen(def[key]);
4463
+ }
4464
+ for (const key of LIST_CHILD_KEYS) {
4465
+ if (Array.isArray(def[key])) next[key] = def[key].map(loosen);
4466
+ }
4467
+ if (def.type === "tuple" && def.rest) next.rest = loosen(def.rest);
4468
+ return z.core.clone(schema, next, { parent: true });
4469
+ }
4470
+ function loosen(schema) {
4471
+ let result = lenient.get(schema);
4472
+ if (!result) {
4473
+ result = rebuild(schema);
4474
+ lenient.set(schema, result);
4475
+ }
4476
+ return result;
4477
+ }
4478
+ function withLenientOutputSchema(tool) {
4479
+ if (!tool.outputSchema) return tool;
4480
+ const outputSchema30 = tool.outputSchema instanceof z.ZodType ? loosen(tool.outputSchema) : loosen(z.object(tool.outputSchema));
4481
+ return { ...tool, outputSchema: outputSchema30 };
4482
+ }
4483
+ function withLenientOutputSchemas(collection10) {
4484
+ return {
4485
+ ...collection10,
4486
+ tools: (user) => collection10.tools(user).map(withLenientOutputSchema)
4487
+ };
4488
+ }
4489
+ var __filename$1 = fileURLToPath(import.meta.url);
4490
+ var __dirname$1 = path.dirname(__filename$1);
4491
+ var useMockChain = process.env.USE_MOCK_MCP_CHAIN === "true";
4492
+ var mockCmsServer = {
4493
+ name: "cms",
4494
+ command: "npx",
4495
+ args: [
4496
+ "tsx",
4497
+ // From dist/index.js, go to ../src/testing/
4498
+ path.resolve(__dirname$1, "../src/testing/mock-mcp-server.ts")
4499
+ ],
4500
+ proxyTools: true
4501
+ };
4502
+ var realCmsServer = {
4503
+ name: "cms",
4504
+ command: "npx",
4505
+ args: ["-y", "@umbraco-cms/mcp-dev@17"],
4506
+ env: {
4507
+ UMBRACO_BASE_URL: process.env.UMBRACO_BASE_URL || "https://localhost:44320",
4508
+ UMBRACO_CLIENT_ID: process.env.UMBRACO_CLIENT_ID || "",
4509
+ UMBRACO_CLIENT_SECRET: process.env.UMBRACO_CLIENT_SECRET || ""
4510
+ },
4511
+ proxyTools: true
4512
+ };
4513
+ var mcpServers = [
4514
+ // Use mock server for testing, real server otherwise
4515
+ useMockChain ? mockCmsServer : realCmsServer
4516
+ // Add more chained MCP servers here as needed
4517
+ // {
4518
+ // name: "another-mcp",
4519
+ // command: "npx",
4520
+ // args: ["-y", "@scope/another-mcp"],
4521
+ // env: { ... },
4522
+ // proxyTools: true,
4523
+ // },
4524
+ ];
4525
+
4526
+ // src/umbraco-api/mcp-client.ts
4527
+ var mcpClientManager = createMcpClientManager({
4528
+ // Pass through any filter configuration to chained servers
4529
+ // filterConfig: { tools: [], slices: [], modes: [] },
4530
+ });
4531
+ for (const config2 of mcpServers) {
4532
+ mcpClientManager.registerServer(config2);
4533
+ }
4534
+ var toolSliceNames = [
4535
+ // Base slices from toolkit (create, read, update, delete, list)
4536
+ ...baseSliceNames,
4537
+ // Query
4538
+ "search",
4539
+ // Automate-specific
4540
+ "action",
4541
+ // non-CRUD state-transition operations (trigger, suspend, replay, decision, test, etc.)
4542
+ "publish",
4543
+ // publish/unpublish operations
4544
+ "tree",
4545
+ // hierarchical/ancestor lookups
4546
+ "export",
4547
+ // export to portable format
4548
+ "import"
4549
+ // import from portable format
4550
+ ];
4551
+ var allSliceNames = [...toolSliceNames, "other"];
4552
+
4553
+ // src/config/mode-registry.ts
4554
+ var toolModes = [
4555
+ {
4556
+ name: "umbraco-server",
4557
+ displayName: "Umbraco Server",
4558
+ description: "Server information and status from the Umbraco Management API",
4559
+ collections: ["umbraco-server"]
4560
+ },
4561
+ {
4562
+ name: "automate",
4563
+ displayName: "Automate",
4564
+ description: "Umbraco Automate: workflows, approvals, connections, runs, and related management tools",
4565
+ collections: [
4566
+ "approvals",
4567
+ "automations",
4568
+ "catalogue",
4569
+ "connections",
4570
+ "metrics",
4571
+ "runs",
4572
+ "version-history",
4573
+ "workspaces"
4574
+ ]
4575
+ }
4576
+ // Add your modes here as you build out your MCP server
4577
+ // {
4578
+ // name: 'content',
4579
+ // displayName: 'Content Management',
4580
+ // description: 'Document creation, editing, and versioning',
4581
+ // collections: ['document', 'document-version', 'document-blueprint']
4582
+ // },
4583
+ // {
4584
+ // name: 'media',
4585
+ // displayName: 'Media Management',
4586
+ // description: 'Media library and file operations',
4587
+ // collections: ['media', 'imaging', 'temporary-file']
4588
+ // }
4589
+ ];
4590
+ var allModes = [...toolModes];
4591
+ var allModeNames = toolModes.map((m) => m.name);
4592
+ var customFields = [
4593
+ {
4594
+ name: "disableMcpChaining",
4595
+ envVar: "DISABLE_MCP_CHAINING",
4596
+ cliFlag: "disable-mcp-chaining",
4597
+ type: "boolean"
4598
+ },
4599
+ {
4600
+ name: "expectedUmbracoMajor",
4601
+ envVar: "UMBRACO_EXPECTED_MAJOR",
4602
+ cliFlag: "umbraco-expected-major",
4603
+ type: "string"
4604
+ }
4605
+ ];
4606
+ var cachedConfig = null;
4607
+ async function loadServerConfig(isStdioMode) {
4608
+ if (cachedConfig) {
4609
+ return cachedConfig;
4610
+ }
4611
+ const { config: config2, custom, cliFlags } = await getServerConfig(isStdioMode, {
4612
+ additionalFields: customFields
4613
+ });
4614
+ cachedConfig = {
4615
+ umbraco: config2,
4616
+ custom,
4617
+ cliFlags
4618
+ };
4619
+ return cachedConfig;
4620
+ }
4621
+ function clearConfigCache() {
4622
+ cachedConfig = null;
4623
+ }
4624
+
4625
+ // src/config/umbraco-target.generated.ts
4626
+ var UMBRACO_TARGET_MAJOR = "17";
4627
+
4628
+ // src/index.ts
4629
+ configureApiClient(() => getUmbracoAutomateManagementAPI());
4630
+ clearConfigCache();
4631
+ var startupAuth = {
4632
+ baseUrl: process.env.UMBRACO_BASE_URL,
4633
+ clientId: process.env.UMBRACO_CLIENT_ID,
4634
+ clientSecret: process.env.UMBRACO_CLIENT_SECRET
4635
+ };
4636
+ var serverConfig = await loadServerConfig(true);
4637
+ var { auth, configSources } = serverConfig.umbraco;
4638
+ var resolveAuth = (field) => configSources[field] === "cli" || configSources.envFile === "cli" ? auth[field] : startupAuth[field] || auth[field] || "";
4639
+ var baseUrl = resolveAuth("baseUrl") || "https://localhost:44320";
4640
+ var clientId = resolveAuth("clientId");
4641
+ var clientSecret = resolveAuth("clientSecret");
4642
+ if (clientId) {
4643
+ initializeUmbracoFetch({ baseUrl, clientId, clientSecret });
4644
+ setUmbracoBaseUrl(baseUrl);
4645
+ }
4646
+ var configLoader = createCollectionConfigLoader({
4647
+ modeRegistry: allModes,
4648
+ allModeNames,
4649
+ allSliceNames
4650
+ });
4651
+ var filterConfig = configLoader.loadFromConfig(serverConfig.umbraco);
4652
+ var collections = [
4653
+ umbraco_server_default,
4654
+ approvals_default,
4655
+ automations_default,
4656
+ catalogue_default,
4657
+ connections_default,
4658
+ metrics_default,
4659
+ runs_default,
4660
+ version_history_default,
4661
+ workspaces_default
4662
+ ].map(withLenientOutputSchemas);
4663
+ await handleCliCommands(collections, {
4664
+ cliFlags: serverConfig.cliFlags,
4665
+ serverName: "my-umbraco-mcp",
4666
+ serverVersion: package_default.version,
4667
+ filterConfig,
4668
+ serverConfig: serverConfig.umbraco
4669
+ });
4670
+ if (clientId) {
4671
+ await checkUmbracoVersion({
4672
+ mcpVersion: package_default.version,
4673
+ expectedUmbracoMajor: serverConfig.custom.expectedUmbracoMajor ?? UMBRACO_TARGET_MAJOR,
4674
+ client: {
4675
+ getServerInformation: async () => {
4676
+ const response = await UmbracoManagementClient(
4677
+ { url: SERVER_INFORMATION_PATH, method: "GET" },
4678
+ CAPTURE_RAW_HTTP_RESPONSE
4679
+ );
4680
+ return { version: response.data.version };
4681
+ }
4682
+ }
4683
+ });
4684
+ configureVersionCheckHook();
4685
+ }
4686
+ var versionCheckMessage = getVersionCheckMessage();
4687
+ var server = new McpServer(
4688
+ { name: "my-umbraco-mcp", version: package_default.version },
4689
+ versionCheckMessage ? { instructions: versionCheckMessage } : void 0
4690
+ );
4691
+ var registeredToolCount = 0;
4692
+ for (const collection10 of collections) {
4693
+ const collectionName = collection10.metadata.name;
4694
+ const tools = collection10.tools({});
4695
+ for (const tool of tools) {
4696
+ if (!shouldIncludeTool(tool, { collectionName, config: filterConfig })) {
4697
+ continue;
4698
+ }
4699
+ const annotations = createToolAnnotations(tool);
4700
+ registerToolCollection(tool.name, collectionName);
4701
+ server.registerTool(tool.name, {
4702
+ description: tool.description,
4703
+ inputSchema: tool.inputSchema,
4704
+ // In dry-run, a mutation tool returns a preview rather than its real
4705
+ // result, so its outputSchema must not be advertised (or enforced).
4706
+ outputSchema: getRegisteredOutputSchema(tool),
4707
+ annotations
4708
+ }, tool.handler);
4709
+ registeredToolCount++;
4710
+ }
4711
+ }
4712
+ async function main() {
4713
+ const chainingEnabled = mcpServers.length > 0 && !serverConfig.custom.disableMcpChaining;
4714
+ if (chainingEnabled) {
4715
+ try {
4716
+ const proxiedTools = await discoverProxiedTools(mcpClientManager);
4717
+ for (const pt of proxiedTools) {
4718
+ server.registerTool(
4719
+ pt.prefixedName,
4720
+ {
4721
+ description: `[Proxied from ${pt.serverName}] ${pt.originalTool.description || "No description"}`
4722
+ },
4723
+ async (args) => {
4724
+ const { serverName, toolName } = parseProxiedToolName(pt.prefixedName);
4725
+ const result = await mcpClientManager.callTool(serverName, toolName, args);
4726
+ return result;
4727
+ }
4728
+ );
4729
+ }
4730
+ if (proxiedTools.length > 0) {
4731
+ console.error(`Registered ${proxiedTools.length} proxied tool(s) from chained MCP servers`);
4732
+ }
4733
+ } catch (error) {
4734
+ console.error("Warning: Failed to discover proxied tools:", error);
4735
+ }
4736
+ }
4737
+ useDraft202012ToolSchemas(server);
4738
+ const transport = new StdioServerTransport();
4739
+ await server.connect(transport);
4740
+ console.error(`MCP Server started with ${registeredToolCount} tool(s) from ${collections.length} collection(s)`);
4741
+ }
4742
+ process.on("SIGINT", async () => {
4743
+ await mcpClientManager.disconnectAll();
4744
+ process.exit(0);
4745
+ });
4746
+ process.on("SIGTERM", async () => {
4747
+ await mcpClientManager.disconnectAll();
4748
+ process.exit(0);
4749
+ });
4750
+ main().catch((error) => {
4751
+ console.error("Failed to start MCP server:", error);
4752
+ process.exit(1);
4753
+ });
4754
+ //# sourceMappingURL=index.js.map
4755
+ //# sourceMappingURL=index.js.map