@sonisoft/now-sdk-ext-mcp 1.0.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.
Files changed (102) hide show
  1. package/README.md +393 -0
  2. package/dist/common/connection.d.ts +42 -0
  3. package/dist/common/connection.d.ts.map +1 -0
  4. package/dist/common/connection.js +119 -0
  5. package/dist/common/connection.js.map +1 -0
  6. package/dist/index.d.ts +3 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +108 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/tools/aggregate.d.ts +20 -0
  11. package/dist/tools/aggregate.d.ts.map +1 -0
  12. package/dist/tools/aggregate.js +271 -0
  13. package/dist/tools/aggregate.js.map +1 -0
  14. package/dist/tools/app-manager.d.ts +50 -0
  15. package/dist/tools/app-manager.d.ts.map +1 -0
  16. package/dist/tools/app-manager.js +756 -0
  17. package/dist/tools/app-manager.js.map +1 -0
  18. package/dist/tools/atf.d.ts +16 -0
  19. package/dist/tools/atf.d.ts.map +1 -0
  20. package/dist/tools/atf.js +246 -0
  21. package/dist/tools/atf.js.map +1 -0
  22. package/dist/tools/attachment.d.ts +20 -0
  23. package/dist/tools/attachment.d.ts.map +1 -0
  24. package/dist/tools/attachment.js +223 -0
  25. package/dist/tools/attachment.js.map +1 -0
  26. package/dist/tools/batch.d.ts +15 -0
  27. package/dist/tools/batch.d.ts.map +1 -0
  28. package/dist/tools/batch.js +159 -0
  29. package/dist/tools/batch.js.map +1 -0
  30. package/dist/tools/cmdb.d.ts +14 -0
  31. package/dist/tools/cmdb.d.ts.map +1 -0
  32. package/dist/tools/cmdb.js +199 -0
  33. package/dist/tools/cmdb.js.map +1 -0
  34. package/dist/tools/codesearch.d.ts +31 -0
  35. package/dist/tools/codesearch.d.ts.map +1 -0
  36. package/dist/tools/codesearch.js +371 -0
  37. package/dist/tools/codesearch.js.map +1 -0
  38. package/dist/tools/discovery.d.ts +15 -0
  39. package/dist/tools/discovery.d.ts.map +1 -0
  40. package/dist/tools/discovery.js +204 -0
  41. package/dist/tools/discovery.js.map +1 -0
  42. package/dist/tools/execute-script.d.ts +9 -0
  43. package/dist/tools/execute-script.d.ts.map +1 -0
  44. package/dist/tools/execute-script.js +106 -0
  45. package/dist/tools/execute-script.js.map +1 -0
  46. package/dist/tools/find-atf-tests.d.ts +9 -0
  47. package/dist/tools/find-atf-tests.d.ts.map +1 -0
  48. package/dist/tools/find-atf-tests.js +152 -0
  49. package/dist/tools/find-atf-tests.js.map +1 -0
  50. package/dist/tools/health.d.ts +9 -0
  51. package/dist/tools/health.d.ts.map +1 -0
  52. package/dist/tools/health.js +137 -0
  53. package/dist/tools/health.js.map +1 -0
  54. package/dist/tools/lookup-app.d.ts +11 -0
  55. package/dist/tools/lookup-app.d.ts.map +1 -0
  56. package/dist/tools/lookup-app.js +242 -0
  57. package/dist/tools/lookup-app.js.map +1 -0
  58. package/dist/tools/lookup-columns.d.ts +10 -0
  59. package/dist/tools/lookup-columns.d.ts.map +1 -0
  60. package/dist/tools/lookup-columns.js +180 -0
  61. package/dist/tools/lookup-columns.js.map +1 -0
  62. package/dist/tools/lookup-table.d.ts +10 -0
  63. package/dist/tools/lookup-table.d.ts.map +1 -0
  64. package/dist/tools/lookup-table.js +150 -0
  65. package/dist/tools/lookup-table.js.map +1 -0
  66. package/dist/tools/query-batch.d.ts +16 -0
  67. package/dist/tools/query-batch.d.ts.map +1 -0
  68. package/dist/tools/query-batch.js +197 -0
  69. package/dist/tools/query-batch.js.map +1 -0
  70. package/dist/tools/query-syslog.d.ts +9 -0
  71. package/dist/tools/query-syslog.d.ts.map +1 -0
  72. package/dist/tools/query-syslog.js +127 -0
  73. package/dist/tools/query-syslog.js.map +1 -0
  74. package/dist/tools/query-table.d.ts +8 -0
  75. package/dist/tools/query-table.d.ts.map +1 -0
  76. package/dist/tools/query-table.js +137 -0
  77. package/dist/tools/query-table.js.map +1 -0
  78. package/dist/tools/schema.d.ts +24 -0
  79. package/dist/tools/schema.d.ts.map +1 -0
  80. package/dist/tools/schema.js +321 -0
  81. package/dist/tools/schema.js.map +1 -0
  82. package/dist/tools/scope.d.ts +25 -0
  83. package/dist/tools/scope.d.ts.map +1 -0
  84. package/dist/tools/scope.js +226 -0
  85. package/dist/tools/scope.js.map +1 -0
  86. package/dist/tools/scriptsync.d.ts +14 -0
  87. package/dist/tools/scriptsync.d.ts.map +1 -0
  88. package/dist/tools/scriptsync.js +167 -0
  89. package/dist/tools/scriptsync.js.map +1 -0
  90. package/dist/tools/task.d.ts +39 -0
  91. package/dist/tools/task.d.ts.map +1 -0
  92. package/dist/tools/task.js +390 -0
  93. package/dist/tools/task.js.map +1 -0
  94. package/dist/tools/updateset.d.ts +46 -0
  95. package/dist/tools/updateset.d.ts.map +1 -0
  96. package/dist/tools/updateset.js +475 -0
  97. package/dist/tools/updateset.js.map +1 -0
  98. package/dist/tools/workflow.d.ts +9 -0
  99. package/dist/tools/workflow.d.ts.map +1 -0
  100. package/dist/tools/workflow.js +164 -0
  101. package/dist/tools/workflow.js.map +1 -0
  102. package/package.json +68 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateset.d.ts","sourceRoot":"","sources":["../../src/tools/updateset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAKpE;;;;GAIG;AACH,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAqEvE;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA8FlE;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAuEnE;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAwDvE;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA0EpE;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA2DlE;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAiFxE"}
@@ -0,0 +1,475 @@
1
+ import { z } from "zod";
2
+ import { UpdateSetManager } from "@sonisoft/now-sdk-ext-core";
3
+ import { withConnectionRetry } from "../common/connection.js";
4
+ /**
5
+ * Registers the get_current_update_set tool on the MCP server.
6
+ *
7
+ * This tool retrieves the currently active update set for the session.
8
+ */
9
+ export function registerGetCurrentUpdateSetTool(server) {
10
+ server.registerTool("get_current_update_set", {
11
+ title: "Get Current Update Set",
12
+ description: "Get the currently active update set for the session.",
13
+ inputSchema: {
14
+ instance: z
15
+ .string()
16
+ .optional()
17
+ .describe("The ServiceNow instance auth alias to connect to. " +
18
+ "This is the alias configured via `snc configure` (e.g., " +
19
+ '"dev224436", "prod", "test"). The user will typically refer to ' +
20
+ "this by name when saying things like \"on my dev224436 instance\". " +
21
+ "If not provided, falls back to the SN_AUTH_ALIAS environment variable."),
22
+ },
23
+ }, async ({ instance }) => {
24
+ try {
25
+ const result = await withConnectionRetry(instance, async (snInstance) => {
26
+ const manager = new UpdateSetManager(snInstance);
27
+ return await manager.getCurrentUpdateSet();
28
+ });
29
+ if (!result) {
30
+ return {
31
+ content: [
32
+ {
33
+ type: "text",
34
+ text: "No current update set is set for this session.",
35
+ },
36
+ ],
37
+ };
38
+ }
39
+ const lines = [
40
+ `Name: ${result.name}`,
41
+ `sys_id: ${result.sys_id}`,
42
+ `State: ${result.state}`,
43
+ `Description: ${result.description || "(none)"}`,
44
+ `Application: ${result.application || "(none)"}`,
45
+ ];
46
+ return {
47
+ content: [
48
+ {
49
+ type: "text",
50
+ text: lines.join("\n"),
51
+ },
52
+ ],
53
+ };
54
+ }
55
+ catch (error) {
56
+ const message = error instanceof Error ? error.message : String(error);
57
+ return {
58
+ content: [
59
+ {
60
+ type: "text",
61
+ text: `Error getting current update set: ${message}`,
62
+ },
63
+ ],
64
+ isError: true,
65
+ };
66
+ }
67
+ });
68
+ }
69
+ /**
70
+ * Registers the list_update_sets tool on the MCP server.
71
+ *
72
+ * This tool lists update sets on the instance with optional filtering.
73
+ */
74
+ export function registerListUpdateSetsTool(server) {
75
+ server.registerTool("list_update_sets", {
76
+ title: "List Update Sets",
77
+ description: "List update sets on the instance with optional filtering.",
78
+ inputSchema: {
79
+ instance: z
80
+ .string()
81
+ .optional()
82
+ .describe("The ServiceNow instance auth alias to connect to. " +
83
+ "This is the alias configured via `snc configure` (e.g., " +
84
+ '"dev224436", "prod", "test"). The user will typically refer to ' +
85
+ "this by name when saying things like \"on my dev224436 instance\". " +
86
+ "If not provided, falls back to the SN_AUTH_ALIAS environment variable."),
87
+ query: z
88
+ .string()
89
+ .optional()
90
+ .describe('Encoded query for filtering update sets (e.g., "state=in progress").'),
91
+ limit: z
92
+ .number()
93
+ .min(1)
94
+ .max(500)
95
+ .default(50)
96
+ .describe("Maximum number of update sets to return. Defaults to 50, max 500."),
97
+ fields: z
98
+ .string()
99
+ .optional()
100
+ .describe("Comma-separated list of fields to return (e.g., " +
101
+ '"sys_id,name,state,description").'),
102
+ },
103
+ }, async ({ instance, query, limit, fields }) => {
104
+ try {
105
+ const results = await withConnectionRetry(instance, async (snInstance) => {
106
+ const manager = new UpdateSetManager(snInstance);
107
+ return await manager.listUpdateSets({ encodedQuery: query, limit, fields });
108
+ });
109
+ if (!results || results.length === 0) {
110
+ return {
111
+ content: [
112
+ {
113
+ type: "text",
114
+ text: "No update sets found matching the criteria.",
115
+ },
116
+ ],
117
+ };
118
+ }
119
+ const lines = results.map((us, index) => {
120
+ const parts = [
121
+ `${index + 1}. ${us.name}`,
122
+ ` sys_id: ${us.sys_id}`,
123
+ ` State: ${us.state}`,
124
+ ` Description: ${us.description || "(none)"}`,
125
+ ` Created: ${us.sys_created_on || "(unknown)"}`,
126
+ ` Created by: ${us.sys_created_by || "(unknown)"}`,
127
+ ];
128
+ return parts.join("\n");
129
+ });
130
+ return {
131
+ content: [
132
+ {
133
+ type: "text",
134
+ text: `Found ${results.length} update set(s):\n\n${lines.join("\n\n")}`,
135
+ },
136
+ ],
137
+ };
138
+ }
139
+ catch (error) {
140
+ const message = error instanceof Error ? error.message : String(error);
141
+ return {
142
+ content: [
143
+ {
144
+ type: "text",
145
+ text: `Error listing update sets: ${message}`,
146
+ },
147
+ ],
148
+ isError: true,
149
+ };
150
+ }
151
+ });
152
+ }
153
+ /**
154
+ * Registers the create_update_set tool on the MCP server.
155
+ *
156
+ * This tool creates a new update set on the ServiceNow instance.
157
+ */
158
+ export function registerCreateUpdateSetTool(server) {
159
+ server.registerTool("create_update_set", {
160
+ title: "Create Update Set",
161
+ description: "Create a new update set. IMPORTANT: This creates a new update set on the instance.",
162
+ inputSchema: {
163
+ instance: z
164
+ .string()
165
+ .optional()
166
+ .describe("The ServiceNow instance auth alias to connect to. " +
167
+ "This is the alias configured via `snc configure` (e.g., " +
168
+ '"dev224436", "prod", "test"). The user will typically refer to ' +
169
+ "this by name when saying things like \"on my dev224436 instance\". " +
170
+ "If not provided, falls back to the SN_AUTH_ALIAS environment variable."),
171
+ name: z
172
+ .string()
173
+ .describe("The name of the update set to create."),
174
+ description: z
175
+ .string()
176
+ .optional()
177
+ .describe("Optional description for the update set."),
178
+ application: z
179
+ .string()
180
+ .optional()
181
+ .describe("Optional application scope sys_id to associate with the update set."),
182
+ },
183
+ }, async ({ instance, name, description, application }) => {
184
+ try {
185
+ const result = await withConnectionRetry(instance, async (snInstance) => {
186
+ const manager = new UpdateSetManager(snInstance);
187
+ return await manager.createUpdateSet({ name, description, application });
188
+ });
189
+ const lines = [
190
+ `Update set created successfully.`,
191
+ ``,
192
+ `sys_id: ${result.sys_id}`,
193
+ `Name: ${result.name}`,
194
+ `State: ${result.state}`,
195
+ ];
196
+ return {
197
+ content: [
198
+ {
199
+ type: "text",
200
+ text: lines.join("\n"),
201
+ },
202
+ ],
203
+ };
204
+ }
205
+ catch (error) {
206
+ const message = error instanceof Error ? error.message : String(error);
207
+ return {
208
+ content: [
209
+ {
210
+ type: "text",
211
+ text: `Error creating update set: ${message}`,
212
+ },
213
+ ],
214
+ isError: true,
215
+ };
216
+ }
217
+ });
218
+ }
219
+ /**
220
+ * Registers the set_current_update_set tool on the MCP server.
221
+ *
222
+ * This tool sets the active update set for the session. All subsequent
223
+ * changes will be captured in the specified update set.
224
+ */
225
+ export function registerSetCurrentUpdateSetTool(server) {
226
+ server.registerTool("set_current_update_set", {
227
+ title: "Set Current Update Set",
228
+ description: "Set the active update set for the session. All changes will be captured in this update set.",
229
+ inputSchema: {
230
+ instance: z
231
+ .string()
232
+ .optional()
233
+ .describe("The ServiceNow instance auth alias to connect to. " +
234
+ "This is the alias configured via `snc configure` (e.g., " +
235
+ '"dev224436", "prod", "test"). The user will typically refer to ' +
236
+ "this by name when saying things like \"on my dev224436 instance\". " +
237
+ "If not provided, falls back to the SN_AUTH_ALIAS environment variable."),
238
+ name: z
239
+ .string()
240
+ .describe("The name of the update set to set as current."),
241
+ sys_id: z
242
+ .string()
243
+ .describe("The sys_id of the update set to set as current."),
244
+ },
245
+ }, async ({ instance, name, sys_id }) => {
246
+ try {
247
+ await withConnectionRetry(instance, async (snInstance) => {
248
+ const manager = new UpdateSetManager(snInstance);
249
+ return await manager.setCurrentUpdateSet({ name, sysId: sys_id });
250
+ });
251
+ return {
252
+ content: [
253
+ {
254
+ type: "text",
255
+ text: `Current update set changed to "${name}" (${sys_id}). All subsequent changes will be captured in this update set.`,
256
+ },
257
+ ],
258
+ };
259
+ }
260
+ catch (error) {
261
+ const message = error instanceof Error ? error.message : String(error);
262
+ return {
263
+ content: [
264
+ {
265
+ type: "text",
266
+ text: `Error setting current update set: ${message}`,
267
+ },
268
+ ],
269
+ isError: true,
270
+ };
271
+ }
272
+ });
273
+ }
274
+ /**
275
+ * Registers the inspect_update_set tool on the MCP server.
276
+ *
277
+ * This tool inspects an update set's contents, listing all components
278
+ * grouped by type (business rules, script includes, etc.).
279
+ */
280
+ export function registerInspectUpdateSetTool(server) {
281
+ server.registerTool("inspect_update_set", {
282
+ title: "Inspect Update Set",
283
+ description: "Inspect an update set's contents — lists all components grouped by type " +
284
+ "(business rules, script includes, etc.).",
285
+ inputSchema: {
286
+ instance: z
287
+ .string()
288
+ .optional()
289
+ .describe("The ServiceNow instance auth alias to connect to. " +
290
+ "This is the alias configured via `snc configure` (e.g., " +
291
+ '"dev224436", "prod", "test"). The user will typically refer to ' +
292
+ "this by name when saying things like \"on my dev224436 instance\". " +
293
+ "If not provided, falls back to the SN_AUTH_ALIAS environment variable."),
294
+ sys_id: z
295
+ .string()
296
+ .describe("The sys_id of the update set to inspect."),
297
+ },
298
+ }, async ({ instance, sys_id }) => {
299
+ try {
300
+ const result = await withConnectionRetry(instance, async (snInstance) => {
301
+ const manager = new UpdateSetManager(snInstance);
302
+ return await manager.inspectUpdateSet(sys_id);
303
+ });
304
+ const lines = [
305
+ `Update Set: ${result.updateSet.name}`,
306
+ `sys_id: ${result.updateSet.sys_id}`,
307
+ `State: ${result.updateSet.state}`,
308
+ `Description: ${result.updateSet.description || "(none)"}`,
309
+ `Total Records: ${result.totalRecords}`,
310
+ ];
311
+ if (result.components.length === 0) {
312
+ lines.push("", "No components found in this update set.");
313
+ }
314
+ else {
315
+ lines.push("", "Components:");
316
+ for (const component of result.components) {
317
+ lines.push(``, ` ${component.type} (${component.count}):`);
318
+ for (const item of component.items) {
319
+ lines.push(` - ${item}`);
320
+ }
321
+ }
322
+ }
323
+ return {
324
+ content: [
325
+ {
326
+ type: "text",
327
+ text: lines.join("\n"),
328
+ },
329
+ ],
330
+ };
331
+ }
332
+ catch (error) {
333
+ const message = error instanceof Error ? error.message : String(error);
334
+ return {
335
+ content: [
336
+ {
337
+ type: "text",
338
+ text: `Error inspecting update set: ${message}`,
339
+ },
340
+ ],
341
+ isError: true,
342
+ };
343
+ }
344
+ });
345
+ }
346
+ /**
347
+ * Registers the clone_update_set tool on the MCP server.
348
+ *
349
+ * Clones an update set by creating a new update set and copying all records from the source.
350
+ */
351
+ export function registerCloneUpdateSetTool(server) {
352
+ server.registerTool("clone_update_set", {
353
+ title: "Clone Update Set",
354
+ description: "Clone an existing update set by creating a new one and copying all its records. " +
355
+ "The new update set gets the specified name and starts in 'in progress' state.\n\n" +
356
+ "IMPORTANT: This creates a new update set and copies all records on the instance.",
357
+ inputSchema: {
358
+ instance: z
359
+ .string()
360
+ .optional()
361
+ .describe("The ServiceNow instance auth alias to connect to. " +
362
+ "This is the alias configured via `snc configure` (e.g., " +
363
+ '"dev224436", "prod", "test"). The user will typically refer to ' +
364
+ "this by name when saying things like \"on my dev224436 instance\". " +
365
+ "If not provided, falls back to the SN_AUTH_ALIAS environment variable."),
366
+ source_sys_id: z
367
+ .string()
368
+ .describe("The sys_id of the update set to clone."),
369
+ new_name: z
370
+ .string()
371
+ .describe("The name for the new cloned update set."),
372
+ },
373
+ }, async ({ instance, source_sys_id, new_name }) => {
374
+ try {
375
+ const result = await withConnectionRetry(instance, async (snInstance) => {
376
+ const manager = new UpdateSetManager(snInstance);
377
+ return await manager.cloneUpdateSet(source_sys_id, new_name);
378
+ });
379
+ const lines = [];
380
+ lines.push("=== Update Set Cloned ===");
381
+ lines.push(`Source: ${result.sourceUpdateSetName} (${result.sourceUpdateSetId})`);
382
+ lines.push(`New: ${result.newUpdateSetName} (${result.newUpdateSetId})`);
383
+ lines.push(`Records cloned: ${result.recordsCloned}/${result.totalSourceRecords}`);
384
+ return {
385
+ content: [{ type: "text", text: lines.join("\n") }],
386
+ };
387
+ }
388
+ catch (error) {
389
+ const message = error instanceof Error ? error.message : String(error);
390
+ return {
391
+ content: [
392
+ {
393
+ type: "text",
394
+ text: `Error cloning update set: ${message}`,
395
+ },
396
+ ],
397
+ isError: true,
398
+ };
399
+ }
400
+ });
401
+ }
402
+ /**
403
+ * Registers the move_update_set_records tool on the MCP server.
404
+ *
405
+ * Moves records from one update set to another.
406
+ */
407
+ export function registerMoveUpdateSetRecordsTool(server) {
408
+ server.registerTool("move_update_set_records", {
409
+ title: "Move Update Set Records",
410
+ description: "Move records from one update set to another. You can move specific records " +
411
+ "by sys_id, or move all records from a source update set.\n\n" +
412
+ "IMPORTANT: This modifies update set membership of records on the instance.",
413
+ inputSchema: {
414
+ instance: z
415
+ .string()
416
+ .optional()
417
+ .describe("The ServiceNow instance auth alias to connect to. " +
418
+ "This is the alias configured via `snc configure` (e.g., " +
419
+ '"dev224436", "prod", "test"). The user will typically refer to ' +
420
+ "this by name when saying things like \"on my dev224436 instance\". " +
421
+ "If not provided, falls back to the SN_AUTH_ALIAS environment variable."),
422
+ target_update_set_id: z
423
+ .string()
424
+ .describe("The sys_id of the update set to move records TO."),
425
+ record_sys_ids: z
426
+ .array(z.string())
427
+ .optional()
428
+ .describe("Specific sys_ids of sys_update_xml records to move. " +
429
+ "If omitted and source_update_set is provided, moves all records from the source."),
430
+ source_update_set: z
431
+ .string()
432
+ .optional()
433
+ .describe("The sys_id of the source update set to move all records FROM. " +
434
+ "Used when record_sys_ids is not specified."),
435
+ },
436
+ }, async ({ instance, target_update_set_id, record_sys_ids, source_update_set }) => {
437
+ try {
438
+ const result = await withConnectionRetry(instance, async (snInstance) => {
439
+ const manager = new UpdateSetManager(snInstance);
440
+ return await manager.moveRecordsToUpdateSet(target_update_set_id, {
441
+ recordSysIds: record_sys_ids,
442
+ sourceUpdateSet: source_update_set,
443
+ });
444
+ });
445
+ const lines = [];
446
+ lines.push("=== Move Update Set Records ===");
447
+ lines.push(`Target Update Set: ${target_update_set_id}`);
448
+ lines.push(`Moved: ${result.moved}`);
449
+ lines.push(`Failed: ${result.failed}`);
450
+ if (result.errors && result.errors.length > 0) {
451
+ lines.push("");
452
+ lines.push("Errors:");
453
+ for (const err of result.errors) {
454
+ lines.push(` ${JSON.stringify(err)}`);
455
+ }
456
+ }
457
+ return {
458
+ content: [{ type: "text", text: lines.join("\n") }],
459
+ };
460
+ }
461
+ catch (error) {
462
+ const message = error instanceof Error ? error.message : String(error);
463
+ return {
464
+ content: [
465
+ {
466
+ type: "text",
467
+ text: `Error moving update set records: ${message}`,
468
+ },
469
+ ],
470
+ isError: true,
471
+ };
472
+ }
473
+ });
474
+ }
475
+ //# sourceMappingURL=updateset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateset.js","sourceRoot":"","sources":["../../src/tools/updateset.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D;;;;GAIG;AACH,MAAM,UAAU,+BAA+B,CAAC,MAAiB;IAC/D,MAAM,CAAC,YAAY,CACjB,wBAAwB,EACxB;QACE,KAAK,EAAE,wBAAwB;QAC/B,WAAW,EACT,sDAAsD;QACxD,WAAW,EAAE;YACX,QAAQ,EAAE,CAAC;iBACR,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CACP,oDAAoD;gBACpD,0DAA0D;gBAC1D,iEAAiE;gBACjE,qEAAqE;gBACrE,wEAAwE,CACzE;SACJ;KACF,EACD,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;QACrB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE;gBACtE,MAAM,OAAO,GAAG,IAAI,gBAAgB,CAAC,UAAU,CAAC,CAAC;gBACjD,OAAO,MAAM,OAAO,CAAC,mBAAmB,EAAE,CAAC;YAC7C,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO;oBACL,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,MAAe;4BACrB,IAAI,EAAE,gDAAgD;yBACvD;qBACF;iBACF,CAAC;YACJ,CAAC;YAED,MAAM,KAAK,GAA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C9C,KAAK,CAAC,IAAI,CAAC,sBAAsB,oBAAoB,EAAE,CAAC,CAAC;YACzD,KAAK,CAAC,IAAI,CAAC,UAAU,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;YACrC,KAAK,CAAC,IAAI,CAAC,WAAW,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;YAEvC,IAAI,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC9C,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBACf,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;gBACtB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;oBAChC,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBACzC,CAAC;YACH,CAAC;YAED,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;aAC7D,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,OAAO,GACX,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACzD,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,oCAAoC,OAAO,EAAE;qBACpD;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ /**
3
+ * Registers the create_workflow tool on the MCP server.
4
+ *
5
+ * Creates a complete workflow from a single specification — workflow record,
6
+ * version, activities, transitions, and optionally publishes it.
7
+ */
8
+ export declare function registerCreateWorkflowTool(server: McpServer): void;
9
+ //# sourceMappingURL=workflow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/tools/workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAKpE;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAqMlE"}
@@ -0,0 +1,164 @@
1
+ import { z } from "zod";
2
+ import { WorkflowManager } from "@sonisoft/now-sdk-ext-core";
3
+ import { withConnectionRetry } from "../common/connection.js";
4
+ /**
5
+ * Registers the create_workflow tool on the MCP server.
6
+ *
7
+ * Creates a complete workflow from a single specification — workflow record,
8
+ * version, activities, transitions, and optionally publishes it.
9
+ */
10
+ export function registerCreateWorkflowTool(server) {
11
+ server.registerTool("create_workflow", {
12
+ title: "Create Workflow",
13
+ description: "Create a complete ServiceNow workflow from a single specification. " +
14
+ "Orchestrates: create workflow record -> create version -> create activities -> " +
15
+ "create transitions -> optionally publish.\n\n" +
16
+ "Activities are referenced in transitions by their `id` field (if set) or " +
17
+ "their array index (as a string like '0', '1', etc.).\n\n" +
18
+ "IMPORTANT: This creates multiple records on the ServiceNow instance " +
19
+ "(workflow, version, activities, transitions). Review the specification carefully.",
20
+ inputSchema: {
21
+ instance: z
22
+ .string()
23
+ .optional()
24
+ .describe("The ServiceNow instance auth alias (e.g., " +
25
+ '"dev224436", "prod"). If not provided, falls back ' +
26
+ "to the SN_AUTH_ALIAS environment variable."),
27
+ name: z.string().describe("Name of the workflow."),
28
+ table: z
29
+ .string()
30
+ .describe('Target table for the workflow (e.g., "incident", "change_request").'),
31
+ description: z
32
+ .string()
33
+ .optional()
34
+ .describe("Description of the workflow."),
35
+ activities: z
36
+ .array(z.object({
37
+ id: z
38
+ .string()
39
+ .optional()
40
+ .describe("Optional identifier for referencing this activity in transitions."),
41
+ name: z.string().describe("Activity name."),
42
+ activityType: z
43
+ .string()
44
+ .optional()
45
+ .describe("Activity definition sys_id."),
46
+ script: z
47
+ .string()
48
+ .optional()
49
+ .describe("Script content for the activity."),
50
+ vars: z
51
+ .string()
52
+ .optional()
53
+ .describe("Activity variables."),
54
+ x: z.number().optional().describe("X position in designer."),
55
+ y: z.number().optional().describe("Y position in designer."),
56
+ width: z.number().optional().describe("Width in designer."),
57
+ height: z.number().optional().describe("Height in designer."),
58
+ }))
59
+ .describe("List of workflow activities to create."),
60
+ transitions: z
61
+ .array(z.object({
62
+ from: z
63
+ .string()
64
+ .describe("Activity id or index (as string) for the source activity."),
65
+ to: z
66
+ .string()
67
+ .describe("Activity id or index (as string) for the target activity."),
68
+ conditionSysId: z
69
+ .string()
70
+ .optional()
71
+ .describe("Condition sys_id for the transition."),
72
+ order: z
73
+ .number()
74
+ .optional()
75
+ .describe("Transition order."),
76
+ }))
77
+ .optional()
78
+ .describe("Transitions between activities."),
79
+ publish: z
80
+ .boolean()
81
+ .default(false)
82
+ .describe("Whether to publish the workflow after creation. " +
83
+ "Requires start_activity to be specified."),
84
+ start_activity: z
85
+ .string()
86
+ .optional()
87
+ .describe("Activity id or index to use as the start activity. " +
88
+ "Required when publish is true."),
89
+ condition: z
90
+ .string()
91
+ .optional()
92
+ .describe("Workflow trigger condition."),
93
+ access: z
94
+ .string()
95
+ .optional()
96
+ .describe("Workflow access level."),
97
+ template: z
98
+ .boolean()
99
+ .optional()
100
+ .describe("Whether the workflow is a template."),
101
+ active: z
102
+ .boolean()
103
+ .optional()
104
+ .describe("Whether the workflow version is active."),
105
+ },
106
+ }, async ({ instance, name, table, description, activities, transitions, publish, start_activity, condition, access, template, active, }) => {
107
+ try {
108
+ const result = await withConnectionRetry(instance, async (snInstance) => {
109
+ const mgr = new WorkflowManager(snInstance);
110
+ return await mgr.createCompleteWorkflow({
111
+ name,
112
+ table,
113
+ description,
114
+ activities,
115
+ transitions,
116
+ publish,
117
+ startActivity: start_activity,
118
+ condition,
119
+ access,
120
+ template,
121
+ active,
122
+ });
123
+ });
124
+ const lines = [];
125
+ lines.push("=== Workflow Created ===");
126
+ lines.push(`Name: ${name}`);
127
+ lines.push(`Table: ${table}`);
128
+ lines.push(`Workflow sys_id: ${result.workflowSysId}`);
129
+ lines.push(`Version sys_id: ${result.versionSysId}`);
130
+ lines.push(`Published: ${result.published}`);
131
+ if (result.startActivity) {
132
+ lines.push(`Start Activity: ${result.startActivity}`);
133
+ }
134
+ lines.push("");
135
+ lines.push("Activity sys_ids:");
136
+ for (const [key, sysId] of Object.entries(result.activitySysIds)) {
137
+ lines.push(` ${key}: ${sysId}`);
138
+ }
139
+ if (result.transitionSysIds.length > 0) {
140
+ lines.push("");
141
+ lines.push("Transition sys_ids:");
142
+ for (let i = 0; i < result.transitionSysIds.length; i++) {
143
+ lines.push(` ${i}: ${result.transitionSysIds[i]}`);
144
+ }
145
+ }
146
+ return {
147
+ content: [{ type: "text", text: lines.join("\n") }],
148
+ };
149
+ }
150
+ catch (error) {
151
+ const message = error instanceof Error ? error.message : String(error);
152
+ return {
153
+ content: [
154
+ {
155
+ type: "text",
156
+ text: `Error creating workflow: ${message}`,
157
+ },
158
+ ],
159
+ isError: true,
160
+ };
161
+ }
162
+ });
163
+ }
164
+ //# sourceMappingURL=workflow.js.map