@onlyflows/servicenow-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.
- package/LICENSE +21 -0
- package/README.md +267 -0
- package/dist/client.d.ts +40 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +145 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +18 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +46 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +52 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/aggregate.d.ts +67 -0
- package/dist/tools/aggregate.d.ts.map +1 -0
- package/dist/tools/aggregate.js +77 -0
- package/dist/tools/aggregate.js.map +1 -0
- package/dist/tools/atf.d.ts +95 -0
- package/dist/tools/atf.d.ts.map +1 -0
- package/dist/tools/atf.js +357 -0
- package/dist/tools/atf.js.map +1 -0
- package/dist/tools/attach.d.ts +74 -0
- package/dist/tools/attach.d.ts.map +1 -0
- package/dist/tools/attach.js +156 -0
- package/dist/tools/attach.js.map +1 -0
- package/dist/tools/batch.d.ts +68 -0
- package/dist/tools/batch.d.ts.map +1 -0
- package/dist/tools/batch.js +120 -0
- package/dist/tools/batch.js.map +1 -0
- package/dist/tools/codesearch.d.ts +52 -0
- package/dist/tools/codesearch.d.ts.map +1 -0
- package/dist/tools/codesearch.js +87 -0
- package/dist/tools/codesearch.js.map +1 -0
- package/dist/tools/create.d.ts +39 -0
- package/dist/tools/create.d.ts.map +1 -0
- package/dist/tools/create.js +44 -0
- package/dist/tools/create.js.map +1 -0
- package/dist/tools/delete.d.ts +45 -0
- package/dist/tools/delete.d.ts.map +1 -0
- package/dist/tools/delete.js +53 -0
- package/dist/tools/delete.js.map +1 -0
- package/dist/tools/discover.d.ts +53 -0
- package/dist/tools/discover.d.ts.map +1 -0
- package/dist/tools/discover.js +137 -0
- package/dist/tools/discover.js.map +1 -0
- package/dist/tools/get.d.ts +52 -0
- package/dist/tools/get.d.ts.map +1 -0
- package/dist/tools/get.js +52 -0
- package/dist/tools/get.js.map +1 -0
- package/dist/tools/health.d.ts +32 -0
- package/dist/tools/health.d.ts.map +1 -0
- package/dist/tools/health.js +172 -0
- package/dist/tools/health.js.map +1 -0
- package/dist/tools/index.d.ts +43 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +110 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/nl.d.ts +52 -0
- package/dist/tools/nl.d.ts.map +1 -0
- package/dist/tools/nl.js +433 -0
- package/dist/tools/nl.js.map +1 -0
- package/dist/tools/query.d.ts +73 -0
- package/dist/tools/query.d.ts.map +1 -0
- package/dist/tools/query.js +75 -0
- package/dist/tools/query.js.map +1 -0
- package/dist/tools/relationships.d.ts +74 -0
- package/dist/tools/relationships.d.ts.map +1 -0
- package/dist/tools/relationships.js +228 -0
- package/dist/tools/relationships.js.map +1 -0
- package/dist/tools/schema.d.ts +38 -0
- package/dist/tools/schema.d.ts.map +1 -0
- package/dist/tools/schema.js +60 -0
- package/dist/tools/schema.js.map +1 -0
- package/dist/tools/script.d.ts +52 -0
- package/dist/tools/script.d.ts.map +1 -0
- package/dist/tools/script.js +51 -0
- package/dist/tools/script.js.map +1 -0
- package/dist/tools/syslog.d.ts +74 -0
- package/dist/tools/syslog.d.ts.map +1 -0
- package/dist/tools/syslog.js +93 -0
- package/dist/tools/syslog.js.map +1 -0
- package/dist/tools/update.d.ts +46 -0
- package/dist/tools/update.d.ts.map +1 -0
- package/dist/tools/update.js +44 -0
- package/dist/tools/update.js.map +1 -0
- package/dist/utils.d.ts +44 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +72 -0
- package/dist/utils.js.map +1 -0
- package/package.json +54 -0
package/dist/tools/nl.js
ADDED
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.schema = exports.definition = void 0;
|
|
4
|
+
exports.handler = handler;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const utils_js_1 = require("../utils.js");
|
|
7
|
+
exports.definition = {
|
|
8
|
+
name: "sn_nl",
|
|
9
|
+
description: "Natural language interface for ServiceNow. Translates plain English into ServiceNow API calls. Supports queries, aggregates, schema lookups, creates, updates, and batch operations. Read operations execute immediately; write operations require execute=true.",
|
|
10
|
+
inputSchema: {
|
|
11
|
+
type: "object",
|
|
12
|
+
properties: {
|
|
13
|
+
text: {
|
|
14
|
+
type: "string",
|
|
15
|
+
description: 'Natural language request (e.g. "show all P1 incidents", "how many open changes", "create incident for VPN outage")',
|
|
16
|
+
},
|
|
17
|
+
execute: {
|
|
18
|
+
type: "boolean",
|
|
19
|
+
description: "Execute write operations (reads always execute). Default false.",
|
|
20
|
+
},
|
|
21
|
+
confirm: {
|
|
22
|
+
type: "boolean",
|
|
23
|
+
description: "Required for batch/bulk operations",
|
|
24
|
+
},
|
|
25
|
+
force: {
|
|
26
|
+
type: "boolean",
|
|
27
|
+
description: "Required for bulk deletes (in addition to confirm)",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
required: ["text"],
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
exports.schema = zod_1.z.object({
|
|
34
|
+
text: zod_1.z.string(),
|
|
35
|
+
execute: zod_1.z.boolean().optional().default(false),
|
|
36
|
+
confirm: zod_1.z.boolean().optional().default(false),
|
|
37
|
+
force: zod_1.z.boolean().optional().default(false),
|
|
38
|
+
});
|
|
39
|
+
// ── Table aliases ──────────────────────────────────────────────────
|
|
40
|
+
const TABLE_ALIASES = {
|
|
41
|
+
// ITSM
|
|
42
|
+
incident: "incident", incidents: "incident", inc: "incident",
|
|
43
|
+
ticket: "incident", tickets: "incident",
|
|
44
|
+
change: "change_request", changes: "change_request",
|
|
45
|
+
"change request": "change_request", "change requests": "change_request",
|
|
46
|
+
problem: "problem", problems: "problem",
|
|
47
|
+
task: "task", tasks: "task",
|
|
48
|
+
// Users
|
|
49
|
+
user: "sys_user", users: "sys_user", people: "sys_user", person: "sys_user",
|
|
50
|
+
group: "sys_user_group", groups: "sys_user_group",
|
|
51
|
+
team: "sys_user_group", teams: "sys_user_group",
|
|
52
|
+
// CMDB
|
|
53
|
+
server: "cmdb_ci_server", servers: "cmdb_ci_server",
|
|
54
|
+
ci: "cmdb_ci", cis: "cmdb_ci", cmdb: "cmdb_ci",
|
|
55
|
+
"configuration item": "cmdb_ci", "configuration items": "cmdb_ci",
|
|
56
|
+
computer: "cmdb_ci_computer", computers: "cmdb_ci_computer",
|
|
57
|
+
laptop: "cmdb_ci_computer", laptops: "cmdb_ci_computer",
|
|
58
|
+
database: "cmdb_ci_database", databases: "cmdb_ci_database", db: "cmdb_ci_database",
|
|
59
|
+
application: "cmdb_ci_appl", applications: "cmdb_ci_appl",
|
|
60
|
+
app: "cmdb_ci_appl", apps: "cmdb_ci_appl",
|
|
61
|
+
service: "cmdb_ci_service", services: "cmdb_ci_service",
|
|
62
|
+
"business service": "cmdb_ci_service", "business services": "cmdb_ci_service",
|
|
63
|
+
"network gear": "cmdb_ci_netgear", router: "cmdb_ci_netgear", routers: "cmdb_ci_netgear",
|
|
64
|
+
switch: "cmdb_ci_netgear", switches: "cmdb_ci_netgear",
|
|
65
|
+
// Knowledge
|
|
66
|
+
knowledge: "kb_knowledge", "knowledge article": "kb_knowledge",
|
|
67
|
+
"knowledge articles": "kb_knowledge", article: "kb_knowledge",
|
|
68
|
+
articles: "kb_knowledge", kb: "kb_knowledge",
|
|
69
|
+
// Service Catalog
|
|
70
|
+
"catalog item": "sc_cat_item", "catalog items": "sc_cat_item",
|
|
71
|
+
request: "sc_request", requests: "sc_request",
|
|
72
|
+
"requested item": "sc_req_item", "requested items": "sc_req_item",
|
|
73
|
+
ritm: "sc_req_item", ritms: "sc_req_item",
|
|
74
|
+
// Other
|
|
75
|
+
"update set": "sys_update_set", "update sets": "sys_update_set",
|
|
76
|
+
flow: "sys_hub_flow", flows: "sys_hub_flow",
|
|
77
|
+
notification: "sysevent_email_action", notifications: "sysevent_email_action",
|
|
78
|
+
"business rule": "sys_script", "business rules": "sys_script",
|
|
79
|
+
alert: "em_alert", alerts: "em_alert",
|
|
80
|
+
sla: "task_sla", slas: "task_sla",
|
|
81
|
+
email: "sys_email", emails: "sys_email",
|
|
82
|
+
};
|
|
83
|
+
// Default fields by table
|
|
84
|
+
const DEFAULT_FIELDS = {
|
|
85
|
+
incident: "number,short_description,state,priority,assigned_to,assignment_group,opened_at",
|
|
86
|
+
change_request: "number,short_description,state,priority,assigned_to,start_date,end_date",
|
|
87
|
+
problem: "number,short_description,state,priority,assigned_to,opened_at",
|
|
88
|
+
sc_req_item: "number,short_description,state,assigned_to,request,opened_at",
|
|
89
|
+
sc_request: "number,short_description,state,requested_for,opened_at",
|
|
90
|
+
sys_user: "user_name,name,email,department,active",
|
|
91
|
+
sys_user_group: "name,description,manager,active",
|
|
92
|
+
cmdb_ci_server: "name,ip_address,os,classification,operational_status",
|
|
93
|
+
cmdb_ci: "name,sys_class_name,operational_status,owned_by",
|
|
94
|
+
kb_knowledge: "number,short_description,workflow_state,author,published",
|
|
95
|
+
task: "number,short_description,state,assigned_to,sys_class_name,opened_at",
|
|
96
|
+
};
|
|
97
|
+
async function handler(args, client, config) {
|
|
98
|
+
try {
|
|
99
|
+
const input = args.text;
|
|
100
|
+
const lower = input.toLowerCase();
|
|
101
|
+
// ── Resolve table ──
|
|
102
|
+
let table = "";
|
|
103
|
+
// Try longest alias first
|
|
104
|
+
const sortedAliases = Object.keys(TABLE_ALIASES).sort((a, b) => b.length - a.length);
|
|
105
|
+
for (const alias of sortedAliases) {
|
|
106
|
+
if (lower.includes(alias)) {
|
|
107
|
+
table = TABLE_ALIASES[alias];
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
// Try raw table name pattern
|
|
112
|
+
if (!table) {
|
|
113
|
+
const rawMatch = lower.match(/[a-z][a-z_]+_[a-z_]+/);
|
|
114
|
+
if (rawMatch)
|
|
115
|
+
table = rawMatch[0];
|
|
116
|
+
}
|
|
117
|
+
// ── Detect intent ──
|
|
118
|
+
let intent;
|
|
119
|
+
if (/schema|fields|columns|structure|what fields|describe table/.test(lower)) {
|
|
120
|
+
intent = "SCHEMA";
|
|
121
|
+
}
|
|
122
|
+
else if (/how many|count of|total number|number of|sum of|average|avg of|minimum|maximum/.test(lower)) {
|
|
123
|
+
intent = "AGGREGATE";
|
|
124
|
+
}
|
|
125
|
+
else if (/^(create|new|add|open|log|raise|submit|register)\b/.test(lower)) {
|
|
126
|
+
intent = "CREATE";
|
|
127
|
+
}
|
|
128
|
+
else if (/^(update|change|set|modify|edit|patch|reassign|escalate)\b/.test(lower)) {
|
|
129
|
+
intent = "UPDATE";
|
|
130
|
+
}
|
|
131
|
+
else if (/close all|update all|delete all|bulk|mass update|mass close|batch/.test(lower)) {
|
|
132
|
+
intent = "BATCH";
|
|
133
|
+
}
|
|
134
|
+
else if (/^(delete|remove|destroy|purge)\b/.test(lower)) {
|
|
135
|
+
intent = "DELETE";
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
intent = "QUERY";
|
|
139
|
+
}
|
|
140
|
+
// ── Build query parts ──
|
|
141
|
+
const queryParts = [];
|
|
142
|
+
// Priority
|
|
143
|
+
if (/\bp1\b|priority\s*1|critical priority/.test(lower))
|
|
144
|
+
queryParts.push("priority=1");
|
|
145
|
+
else if (/\bp2\b|priority\s*2|high priority/.test(lower))
|
|
146
|
+
queryParts.push("priority=2");
|
|
147
|
+
else if (/\bp3\b|priority\s*3|moderate priority|medium priority/.test(lower))
|
|
148
|
+
queryParts.push("priority=3");
|
|
149
|
+
else if (/\bp4\b|priority\s*4|low priority/.test(lower))
|
|
150
|
+
queryParts.push("priority=4");
|
|
151
|
+
// State
|
|
152
|
+
if (/\bopen\b|\bnew\b/.test(lower))
|
|
153
|
+
queryParts.push("active=true");
|
|
154
|
+
else if (/\bclosed\b|\bcomplete\b|\bcompleted\b/.test(lower))
|
|
155
|
+
queryParts.push("state=7");
|
|
156
|
+
else if (/\bresolved\b|\bfixed\b/.test(lower))
|
|
157
|
+
queryParts.push("state=6");
|
|
158
|
+
else if (/\bin progress\b|\bwip\b/.test(lower))
|
|
159
|
+
queryParts.push("state=2");
|
|
160
|
+
else if (/\bon hold\b|\bpending\b|\bwaiting\b/.test(lower))
|
|
161
|
+
queryParts.push("state=3");
|
|
162
|
+
else if (/\bactive\b/.test(lower))
|
|
163
|
+
queryParts.push("active=true");
|
|
164
|
+
else if (/\binactive\b|\barchived\b/.test(lower))
|
|
165
|
+
queryParts.push("active=false");
|
|
166
|
+
// Assignment group
|
|
167
|
+
const groupMatch = input.match(/[Aa]ssigned?\s+[Tt]o\s+([A-Za-z][\w\s]+?)(?:\s+(?:team|group|sorted|order|limit|since|from|with|and|or|in|on|by|the)(?:\s|$)|$)/);
|
|
168
|
+
if (groupMatch) {
|
|
169
|
+
queryParts.push(`assignment_group.name=${groupMatch[1].trim()}`);
|
|
170
|
+
}
|
|
171
|
+
// Record number reference
|
|
172
|
+
const refMatch = lower.match(/(inc|chg|prb|ritm|req|task|kb)\d{7,10}/);
|
|
173
|
+
if (refMatch) {
|
|
174
|
+
const refNum = refMatch[0].toUpperCase();
|
|
175
|
+
queryParts.push(`number=${refNum}`);
|
|
176
|
+
if (!table) {
|
|
177
|
+
const prefix = refNum.slice(0, 3);
|
|
178
|
+
const prefixMap = {
|
|
179
|
+
INC: "incident", CHG: "change_request", PRB: "problem",
|
|
180
|
+
RIT: "sc_req_item", REQ: "sc_request", TAS: "task", KB0: "kb_knowledge",
|
|
181
|
+
};
|
|
182
|
+
table = prefixMap[prefix] || table;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
// Time filters
|
|
186
|
+
if (/last\s+(24\s+hours?|day)/.test(lower))
|
|
187
|
+
queryParts.push("sys_created_on>=javascript:gs.hoursAgo(24)");
|
|
188
|
+
else if (/last\s+week|past\s+week/.test(lower))
|
|
189
|
+
queryParts.push("sys_created_on>=javascript:gs.daysAgo(7)");
|
|
190
|
+
else if (/last\s+month|past\s+month/.test(lower))
|
|
191
|
+
queryParts.push("sys_created_on>=javascript:gs.daysAgo(30)");
|
|
192
|
+
else if (/\btoday\b/.test(lower))
|
|
193
|
+
queryParts.push("sys_created_on>=javascript:gs.daysAgo(0)");
|
|
194
|
+
// Sort
|
|
195
|
+
let orderby = "";
|
|
196
|
+
if (/sort(ed)?\s+by\s+created|oldest\s+first/.test(lower))
|
|
197
|
+
orderby = "sys_created_on";
|
|
198
|
+
else if (/sort(ed)?\s+by\s+updated|recently\s+updated/.test(lower))
|
|
199
|
+
orderby = "-sys_updated_on";
|
|
200
|
+
else if (/newest\s+first|most\s+recent|latest/.test(lower))
|
|
201
|
+
orderby = "-sys_created_on";
|
|
202
|
+
else if (/sort(ed)?\s+by\s+priority|highest\s+priority/.test(lower))
|
|
203
|
+
orderby = "priority";
|
|
204
|
+
// Limit
|
|
205
|
+
let limit = 20;
|
|
206
|
+
const limitMatch = lower.match(/(top|first|limit|show)\s+(\d+)/);
|
|
207
|
+
if (limitMatch)
|
|
208
|
+
limit = parseInt(limitMatch[2], 10);
|
|
209
|
+
else if (/\ball\b/.test(lower))
|
|
210
|
+
limit = 100;
|
|
211
|
+
const encodedQuery = queryParts.join("^");
|
|
212
|
+
// Default table
|
|
213
|
+
if (!table) {
|
|
214
|
+
if (/ticket|issue|outage|down|broke|fix|urgent|critical/.test(lower)) {
|
|
215
|
+
table = "incident";
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
return (0, utils_js_1.ok)({
|
|
219
|
+
error: "Could not determine target table from input.",
|
|
220
|
+
hint: "Mention a table name like 'incidents', 'changes', 'users', 'servers', etc.",
|
|
221
|
+
available_aliases: [
|
|
222
|
+
"ITSM: incidents, changes, problems, tasks, requests, ritms",
|
|
223
|
+
"Users: users, groups, teams",
|
|
224
|
+
"CMDB: servers, computers, databases, applications, services, cis",
|
|
225
|
+
"Other: knowledge/articles, catalog items, alerts, slas, notifications",
|
|
226
|
+
],
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
// ── Execute based on intent ──
|
|
231
|
+
const result = {
|
|
232
|
+
intent,
|
|
233
|
+
table,
|
|
234
|
+
query: encodedQuery || undefined,
|
|
235
|
+
};
|
|
236
|
+
switch (intent) {
|
|
237
|
+
case "SCHEMA": {
|
|
238
|
+
result.action = "Fetching schema";
|
|
239
|
+
const resp = await client.get("/api/now/table/sys_dictionary", {
|
|
240
|
+
sysparm_query: `name=${table}^internal_type!=collection`,
|
|
241
|
+
sysparm_fields: "element,column_label,internal_type,max_length,mandatory,reference",
|
|
242
|
+
sysparm_limit: "500",
|
|
243
|
+
sysparm_display_value: "true",
|
|
244
|
+
});
|
|
245
|
+
const fields = (resp.result || [])
|
|
246
|
+
.filter((r) => r.element)
|
|
247
|
+
.map((r) => ({
|
|
248
|
+
field: r.element, label: r.column_label, type: r.internal_type,
|
|
249
|
+
max_length: r.max_length, mandatory: r.mandatory,
|
|
250
|
+
reference: r.reference || null,
|
|
251
|
+
}))
|
|
252
|
+
.sort((a, b) => a.field.localeCompare(b.field));
|
|
253
|
+
result.results = fields;
|
|
254
|
+
break;
|
|
255
|
+
}
|
|
256
|
+
case "AGGREGATE": {
|
|
257
|
+
let aggType = "COUNT";
|
|
258
|
+
let aggField = "";
|
|
259
|
+
if (/\b(average|avg)\b/.test(lower)) {
|
|
260
|
+
aggType = "AVG";
|
|
261
|
+
}
|
|
262
|
+
else if (/\bsum\b/.test(lower)) {
|
|
263
|
+
aggType = "SUM";
|
|
264
|
+
}
|
|
265
|
+
else if (/\bmin(imum)?\b/.test(lower)) {
|
|
266
|
+
aggType = "MIN";
|
|
267
|
+
}
|
|
268
|
+
else if (/\bmax(imum)?\b/.test(lower)) {
|
|
269
|
+
aggType = "MAX";
|
|
270
|
+
}
|
|
271
|
+
// Extract field for non-COUNT
|
|
272
|
+
if (aggType !== "COUNT") {
|
|
273
|
+
const fieldMatch = lower.match(new RegExp(`(?:${aggType.toLowerCase()}|average|avg|sum|min(?:imum)?|max(?:imum)?)\\s+(?:of\\s+)?(\\w+)`));
|
|
274
|
+
if (fieldMatch)
|
|
275
|
+
aggField = fieldMatch[1];
|
|
276
|
+
}
|
|
277
|
+
// Group by
|
|
278
|
+
let groupBy = "";
|
|
279
|
+
const groupMatch = lower.match(/(group(?:ed)?|by)\s+(priority|state|category|assigned_to|assignment_group|urgency|impact)/);
|
|
280
|
+
if (groupMatch)
|
|
281
|
+
groupBy = groupMatch[2];
|
|
282
|
+
const params = {};
|
|
283
|
+
if (aggType === "COUNT")
|
|
284
|
+
params.sysparm_count = "true";
|
|
285
|
+
else
|
|
286
|
+
params[`sysparm_${aggType.toLowerCase()}_fields`] = aggField;
|
|
287
|
+
if (encodedQuery)
|
|
288
|
+
params.sysparm_query = encodedQuery;
|
|
289
|
+
if (groupBy)
|
|
290
|
+
params.sysparm_group_by = groupBy;
|
|
291
|
+
const resp = await client.get(`/api/now/stats/${table}`, params);
|
|
292
|
+
result.aggregate_type = aggType;
|
|
293
|
+
if (groupBy)
|
|
294
|
+
result.group_by = groupBy;
|
|
295
|
+
result.results = resp.result;
|
|
296
|
+
break;
|
|
297
|
+
}
|
|
298
|
+
case "QUERY": {
|
|
299
|
+
const fields = DEFAULT_FIELDS[table] || "";
|
|
300
|
+
const params = (0, utils_js_1.buildTableParams)({
|
|
301
|
+
query: encodedQuery,
|
|
302
|
+
fields,
|
|
303
|
+
limit,
|
|
304
|
+
orderby,
|
|
305
|
+
displayValue: "true",
|
|
306
|
+
});
|
|
307
|
+
const resp = await client.get(`/api/now/table/${table}`, params);
|
|
308
|
+
const records = resp.result || [];
|
|
309
|
+
result.limit = limit;
|
|
310
|
+
if (orderby)
|
|
311
|
+
result.sort = orderby;
|
|
312
|
+
result.record_count = records.length;
|
|
313
|
+
result.results = records;
|
|
314
|
+
break;
|
|
315
|
+
}
|
|
316
|
+
case "CREATE": {
|
|
317
|
+
const payload = {};
|
|
318
|
+
// Extract short description
|
|
319
|
+
const descMatch = input.match(/(?:for|about|regarding)\s+([^,]+)/i);
|
|
320
|
+
if (descMatch) {
|
|
321
|
+
let desc = descMatch[1].replace(/\s*(,|assign|priority|p[1-5]|urgency|impact|category).*$/i, "").trim();
|
|
322
|
+
payload.short_description = desc;
|
|
323
|
+
}
|
|
324
|
+
// Priority from query parts
|
|
325
|
+
for (const part of queryParts) {
|
|
326
|
+
if (part.startsWith("priority="))
|
|
327
|
+
payload.priority = part.split("=")[1];
|
|
328
|
+
}
|
|
329
|
+
if (groupMatch)
|
|
330
|
+
payload.assignment_group = groupMatch[1].trim();
|
|
331
|
+
result.payload = payload;
|
|
332
|
+
if (args.execute) {
|
|
333
|
+
const resp = await client.post(`/api/now/table/${table}`, payload);
|
|
334
|
+
result.executed = true;
|
|
335
|
+
result.created = resp.result;
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
result.executed = false;
|
|
339
|
+
result.message = "Write operation — set execute=true to create the record.";
|
|
340
|
+
}
|
|
341
|
+
break;
|
|
342
|
+
}
|
|
343
|
+
case "UPDATE": {
|
|
344
|
+
const updatePayload = {};
|
|
345
|
+
if (/\bclose\b/.test(lower))
|
|
346
|
+
updatePayload.state = "7";
|
|
347
|
+
else if (/\bresolve\b/.test(lower))
|
|
348
|
+
updatePayload.state = "6";
|
|
349
|
+
for (const part of queryParts) {
|
|
350
|
+
if (part.startsWith("priority="))
|
|
351
|
+
updatePayload.priority = part.split("=")[1];
|
|
352
|
+
}
|
|
353
|
+
result.payload = updatePayload;
|
|
354
|
+
result.executed = false;
|
|
355
|
+
result.message =
|
|
356
|
+
"Update requires a sys_id. Use sn_query to find the record, then sn_update to modify it.";
|
|
357
|
+
break;
|
|
358
|
+
}
|
|
359
|
+
case "BATCH": {
|
|
360
|
+
const batchAction = /\bdelete\b|\bremove\b/.test(lower) ? "delete" : "update";
|
|
361
|
+
let batchFields;
|
|
362
|
+
if (batchAction === "update") {
|
|
363
|
+
if (/\bclose\b/.test(lower))
|
|
364
|
+
batchFields = { state: "7", close_code: "Solved (Permanently)", close_notes: "Bulk closed via sn_nl" };
|
|
365
|
+
else if (/\bresolve\b/.test(lower))
|
|
366
|
+
batchFields = { state: "6" };
|
|
367
|
+
}
|
|
368
|
+
result.batch_action = batchAction;
|
|
369
|
+
result.batch_fields = batchFields;
|
|
370
|
+
result.limit = limit;
|
|
371
|
+
if (args.execute && args.confirm) {
|
|
372
|
+
if (batchAction === "delete" && !args.force) {
|
|
373
|
+
result.executed = false;
|
|
374
|
+
result.message = "Bulk DELETE requires force=true. This is a safety measure.";
|
|
375
|
+
}
|
|
376
|
+
else {
|
|
377
|
+
// Actually execute the batch
|
|
378
|
+
const matchResp = await client.get(`/api/now/table/${table}`, {
|
|
379
|
+
sysparm_fields: "sys_id",
|
|
380
|
+
sysparm_limit: String(limit),
|
|
381
|
+
sysparm_query: encodedQuery,
|
|
382
|
+
});
|
|
383
|
+
const records = matchResp.result || [];
|
|
384
|
+
let processed = 0;
|
|
385
|
+
let failed = 0;
|
|
386
|
+
for (const rec of records) {
|
|
387
|
+
try {
|
|
388
|
+
if (batchAction === "update" && batchFields) {
|
|
389
|
+
await client.patch(`/api/now/table/${table}/${rec.sys_id}`, batchFields);
|
|
390
|
+
processed++;
|
|
391
|
+
}
|
|
392
|
+
else if (batchAction === "delete") {
|
|
393
|
+
await client.delete(`/api/now/table/${table}/${rec.sys_id}`);
|
|
394
|
+
processed++;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
catch {
|
|
398
|
+
failed++;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
result.executed = true;
|
|
402
|
+
result.matched = records.length;
|
|
403
|
+
result.processed = processed;
|
|
404
|
+
result.failed = failed;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
else {
|
|
408
|
+
// Dry run
|
|
409
|
+
const matchResp = await client.get(`/api/now/table/${table}`, {
|
|
410
|
+
sysparm_fields: "sys_id",
|
|
411
|
+
sysparm_limit: String(limit),
|
|
412
|
+
sysparm_query: encodedQuery,
|
|
413
|
+
});
|
|
414
|
+
result.executed = false;
|
|
415
|
+
result.matched = (matchResp.result || []).length;
|
|
416
|
+
result.message = `Dry run — ${(matchResp.result || []).length} records would be affected. Set execute=true and confirm=true to proceed.`;
|
|
417
|
+
}
|
|
418
|
+
break;
|
|
419
|
+
}
|
|
420
|
+
case "DELETE": {
|
|
421
|
+
result.executed = false;
|
|
422
|
+
result.message =
|
|
423
|
+
"Delete requires a specific sys_id. Use sn_query to find the record, then sn_delete to remove it.";
|
|
424
|
+
break;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
return (0, utils_js_1.ok)(result);
|
|
428
|
+
}
|
|
429
|
+
catch (error) {
|
|
430
|
+
return (0, utils_js_1.err)((0, utils_js_1.formatError)(error));
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
//# sourceMappingURL=nl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nl.js","sourceRoot":"","sources":["../../src/tools/nl.ts"],"names":[],"mappings":";;;AAqGA,0BAyTC;AA9ZD,6BAAwB;AAGxB,0CAAqE;AAExD,QAAA,UAAU,GAAG;IACxB,IAAI,EAAE,OAAO;IACb,WAAW,EACT,kQAAkQ;IACpQ,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,oHAAoH;aACvH;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,iEAAiE;aAC/E;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,oCAAoC;aAClD;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,oDAAoD;aAClE;SACF;QACD,QAAQ,E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
3
|
+
import { ServiceNowConfig } from "../config.js";
|
|
4
|
+
export declare const definition: {
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
inputSchema: {
|
|
8
|
+
type: "object";
|
|
9
|
+
properties: {
|
|
10
|
+
table: {
|
|
11
|
+
type: string;
|
|
12
|
+
description: string;
|
|
13
|
+
};
|
|
14
|
+
query: {
|
|
15
|
+
type: string;
|
|
16
|
+
description: string;
|
|
17
|
+
};
|
|
18
|
+
fields: {
|
|
19
|
+
type: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
limit: {
|
|
23
|
+
type: string;
|
|
24
|
+
description: string;
|
|
25
|
+
};
|
|
26
|
+
offset: {
|
|
27
|
+
type: string;
|
|
28
|
+
description: string;
|
|
29
|
+
};
|
|
30
|
+
orderby: {
|
|
31
|
+
type: string;
|
|
32
|
+
description: string;
|
|
33
|
+
};
|
|
34
|
+
display_value: {
|
|
35
|
+
type: string;
|
|
36
|
+
description: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
required: string[];
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export declare const schema: z.ZodObject<{
|
|
43
|
+
table: z.ZodString;
|
|
44
|
+
query: z.ZodOptional<z.ZodString>;
|
|
45
|
+
fields: z.ZodOptional<z.ZodString>;
|
|
46
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
47
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
48
|
+
orderby: z.ZodOptional<z.ZodString>;
|
|
49
|
+
display_value: z.ZodOptional<z.ZodString>;
|
|
50
|
+
}, "strip", z.ZodTypeAny, {
|
|
51
|
+
table: string;
|
|
52
|
+
limit: number;
|
|
53
|
+
query?: string | undefined;
|
|
54
|
+
fields?: string | undefined;
|
|
55
|
+
offset?: number | undefined;
|
|
56
|
+
orderby?: string | undefined;
|
|
57
|
+
display_value?: string | undefined;
|
|
58
|
+
}, {
|
|
59
|
+
table: string;
|
|
60
|
+
query?: string | undefined;
|
|
61
|
+
fields?: string | undefined;
|
|
62
|
+
limit?: number | undefined;
|
|
63
|
+
offset?: number | undefined;
|
|
64
|
+
orderby?: string | undefined;
|
|
65
|
+
display_value?: string | undefined;
|
|
66
|
+
}>;
|
|
67
|
+
export declare function handler(args: z.infer<typeof schema>, client: ServiceNowClient, config: ServiceNowConfig): Promise<{
|
|
68
|
+
content: Array<{
|
|
69
|
+
type: "text";
|
|
70
|
+
text: string;
|
|
71
|
+
}>;
|
|
72
|
+
}>;
|
|
73
|
+
//# sourceMappingURL=query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/tools/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGhD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCtB,CAAC;AAEF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;EAQjB,CAAC;AAEH,wBAAsB,OAAO,CAC3B,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,EAC5B,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,gBAAgB;;;;;GAqBzB"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.schema = exports.definition = void 0;
|
|
4
|
+
exports.handler = handler;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const utils_js_1 = require("../utils.js");
|
|
7
|
+
exports.definition = {
|
|
8
|
+
name: "sn_query",
|
|
9
|
+
description: "Query any ServiceNow table. Returns records matching the encoded query with support for field selection, pagination, sorting, and display values.",
|
|
10
|
+
inputSchema: {
|
|
11
|
+
type: "object",
|
|
12
|
+
properties: {
|
|
13
|
+
table: {
|
|
14
|
+
type: "string",
|
|
15
|
+
description: "ServiceNow table name (e.g. incident, change_request, sys_user)",
|
|
16
|
+
},
|
|
17
|
+
query: {
|
|
18
|
+
type: "string",
|
|
19
|
+
description: "ServiceNow encoded query (e.g. active=true^priority=1). Use ^ for AND, ^OR for OR.",
|
|
20
|
+
},
|
|
21
|
+
fields: {
|
|
22
|
+
type: "string",
|
|
23
|
+
description: "Comma-separated list of fields to return",
|
|
24
|
+
},
|
|
25
|
+
limit: {
|
|
26
|
+
type: "number",
|
|
27
|
+
description: "Maximum records to return (default 20)",
|
|
28
|
+
},
|
|
29
|
+
offset: {
|
|
30
|
+
type: "number",
|
|
31
|
+
description: "Pagination offset",
|
|
32
|
+
},
|
|
33
|
+
orderby: {
|
|
34
|
+
type: "string",
|
|
35
|
+
description: "Sort field. Prefix with - for descending (e.g. -sys_created_on)",
|
|
36
|
+
},
|
|
37
|
+
display_value: {
|
|
38
|
+
type: "string",
|
|
39
|
+
description: "Display values mode: true, false, or all (default: true)",
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
required: ["table"],
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
exports.schema = zod_1.z.object({
|
|
46
|
+
table: zod_1.z.string(),
|
|
47
|
+
query: zod_1.z.string().optional(),
|
|
48
|
+
fields: zod_1.z.string().optional(),
|
|
49
|
+
limit: zod_1.z.number().optional().default(20),
|
|
50
|
+
offset: zod_1.z.number().optional(),
|
|
51
|
+
orderby: zod_1.z.string().optional(),
|
|
52
|
+
display_value: zod_1.z.string().optional(),
|
|
53
|
+
});
|
|
54
|
+
async function handler(args, client, config) {
|
|
55
|
+
try {
|
|
56
|
+
const params = (0, utils_js_1.buildTableParams)({
|
|
57
|
+
query: args.query,
|
|
58
|
+
fields: args.fields,
|
|
59
|
+
limit: args.limit,
|
|
60
|
+
offset: args.offset,
|
|
61
|
+
orderby: args.orderby,
|
|
62
|
+
displayValue: args.display_value ?? config.displayValue,
|
|
63
|
+
});
|
|
64
|
+
const resp = await client.get(`/api/now/table/${args.table}`, params);
|
|
65
|
+
const results = resp.result || [];
|
|
66
|
+
return (0, utils_js_1.ok)({
|
|
67
|
+
record_count: results.length,
|
|
68
|
+
results,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
return (0, utils_js_1.err)((0, utils_js_1.formatError)(error));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../src/tools/query.ts"],"names":[],"mappings":";;;AAwDA,0BAwBC;AAhFD,6BAAwB;AAGxB,0CAAqE;AAExD,QAAA,UAAU,GAAG;IACxB,IAAI,EAAE,UAAU;IAChB,WAAW,EACT,mJAAmJ;IACrJ,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,iEAAiE;aAC/E;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,oFAAoF;aACvF;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,0CAA0C;aACxD;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,wCAAwC;aACtD;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,mBAAmB;aACjC;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,iEAAiE;aAC/E;YACD,aAAa,EAAE;gBACb,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,0DAA0D;aACxE;SACF;QACD,QAAQ,EAAE,CAAC,OAAO,CAAC;KACpB;CACF,CAAC;A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