snow-flow 1.1.74 → 1.1.75
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/mcp/servicenow-deployment-mcp.js +146 -6
- package/dist/mcp/servicenow-deployment-mcp.js.map +1 -1
- package/dist/mcp/servicenow-operations-mcp.js +104 -14
- package/dist/mcp/servicenow-operations-mcp.js.map +1 -1
- package/dist/version.d.ts +2 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +12 -1
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
|
@@ -2032,9 +2032,12 @@ class ServiceNowOperationsMCP {
|
|
|
2032
2032
|
let categoryFilter = '';
|
|
2033
2033
|
if (category_filter) {
|
|
2034
2034
|
// First try to find the category
|
|
2035
|
-
const categoryResult = await this.client.searchRecords('sc_category', `
|
|
2035
|
+
const categoryResult = await this.client.searchRecords('sc_category', `nameLIKE${category_filter}^ORtitle=${category_filter}^ORsys_id=${category_filter}`, 10);
|
|
2036
2036
|
if (categoryResult.success && categoryResult.data?.result?.length > 0) {
|
|
2037
|
-
|
|
2037
|
+
// Try to find the most relevant category
|
|
2038
|
+
const exactMatch = categoryResult.data.result.find((c) => c.name.toLowerCase() === category_filter.toLowerCase());
|
|
2039
|
+
const category = exactMatch || categoryResult.data.result[0];
|
|
2040
|
+
categoryFilter = `^sc_categoriesLIKE${category.sys_id}`;
|
|
2038
2041
|
}
|
|
2039
2042
|
}
|
|
2040
2043
|
// Execute searches
|
|
@@ -2045,6 +2048,13 @@ class ServiceNowOperationsMCP {
|
|
|
2045
2048
|
if (result.success && result.data?.result) {
|
|
2046
2049
|
result.data.result.forEach((item) => {
|
|
2047
2050
|
if (!allResults.has(item.sys_id)) {
|
|
2051
|
+
// Filter out items that don't make sense for the search
|
|
2052
|
+
const itemName = (item.name || '').toLowerCase();
|
|
2053
|
+
const itemDesc = (item.short_description || '').toLowerCase();
|
|
2054
|
+
// Skip items that are clearly not what the user is looking for
|
|
2055
|
+
if (this.shouldExcludeItem(query, itemName, itemDesc)) {
|
|
2056
|
+
return;
|
|
2057
|
+
}
|
|
2048
2058
|
allResults.set(item.sys_id, {
|
|
2049
2059
|
sys_id: item.sys_id,
|
|
2050
2060
|
name: item.name,
|
|
@@ -2143,8 +2153,9 @@ class ServiceNowOperationsMCP {
|
|
|
2143
2153
|
}
|
|
2144
2154
|
generateSearchVariations(query) {
|
|
2145
2155
|
const variations = [];
|
|
2156
|
+
const lowerQuery = query.toLowerCase();
|
|
2146
2157
|
// Handle common product variations
|
|
2147
|
-
if (
|
|
2158
|
+
if (lowerQuery.includes('iphone')) {
|
|
2148
2159
|
// Add variations without spaces, with different numbers
|
|
2149
2160
|
const baseModel = query.replace(/iphone\s*/i, 'iPhone ');
|
|
2150
2161
|
variations.push(baseModel);
|
|
@@ -2158,33 +2169,112 @@ class ServiceNowOperationsMCP {
|
|
|
2158
2169
|
}
|
|
2159
2170
|
}
|
|
2160
2171
|
// Handle laptop/computer variations
|
|
2161
|
-
if (
|
|
2172
|
+
if (lowerQuery.includes('laptop') || lowerQuery.includes('computer')) {
|
|
2162
2173
|
variations.push('notebook', 'macbook', 'thinkpad', 'dell', 'hp');
|
|
2163
2174
|
}
|
|
2164
2175
|
// Handle phone variations
|
|
2165
|
-
if (
|
|
2176
|
+
if (lowerQuery.includes('phone') || lowerQuery.includes('mobile')) {
|
|
2166
2177
|
variations.push('smartphone', 'android', 'samsung', 'pixel');
|
|
2167
2178
|
}
|
|
2168
|
-
|
|
2179
|
+
// Handle monitor/display variations
|
|
2180
|
+
if (lowerQuery.includes('monitor') || lowerQuery.includes('display') ||
|
|
2181
|
+
lowerQuery.includes('screen') || lowerQuery.includes('lcd')) {
|
|
2182
|
+
variations.push('monitor', 'display', 'screen', 'lcd', 'led', 'desktop monitor', 'computer monitor', 'external display', 'lcd monitor', 'led monitor', 'dell monitor', 'hp monitor', 'samsung monitor', 'lg monitor');
|
|
2183
|
+
}
|
|
2184
|
+
// Handle desktop/workstation variations
|
|
2185
|
+
if (lowerQuery.includes('desktop') || lowerQuery.includes('workstation')) {
|
|
2186
|
+
variations.push('desktop computer', 'workstation', 'pc', 'desktop pc', 'dell desktop', 'hp desktop', 'lenovo desktop');
|
|
2187
|
+
}
|
|
2188
|
+
// Handle specific hardware terms
|
|
2189
|
+
if (lowerQuery.includes('hardware') || lowerQuery.includes('equipment')) {
|
|
2190
|
+
// Extract specific items from the query
|
|
2191
|
+
const specificItems = [];
|
|
2192
|
+
if (lowerQuery.includes('monitor') || lowerQuery.includes('display') || lowerQuery.includes('screen')) {
|
|
2193
|
+
specificItems.push('monitor', 'display');
|
|
2194
|
+
}
|
|
2195
|
+
if (lowerQuery.includes('desktop')) {
|
|
2196
|
+
specificItems.push('desktop', 'computer');
|
|
2197
|
+
}
|
|
2198
|
+
if (lowerQuery.includes('laptop')) {
|
|
2199
|
+
specificItems.push('laptop', 'notebook');
|
|
2200
|
+
}
|
|
2201
|
+
// If we found specific items, use those instead of generic "hardware"
|
|
2202
|
+
if (specificItems.length > 0) {
|
|
2203
|
+
variations.push(...specificItems);
|
|
2204
|
+
}
|
|
2205
|
+
}
|
|
2206
|
+
// Remove duplicates and empty strings
|
|
2207
|
+
return [...new Set(variations)].filter(v => v && v.length > 0);
|
|
2169
2208
|
}
|
|
2170
2209
|
generateSearchSuggestions(query) {
|
|
2171
2210
|
const suggestions = [];
|
|
2172
|
-
|
|
2211
|
+
const lowerQuery = query.toLowerCase();
|
|
2212
|
+
if (lowerQuery.includes('iphone')) {
|
|
2173
2213
|
suggestions.push('iPhone', 'Apple iPhone', 'iOS device', 'Apple mobile');
|
|
2174
2214
|
}
|
|
2175
|
-
else if (
|
|
2215
|
+
else if (lowerQuery.includes('laptop')) {
|
|
2176
2216
|
suggestions.push('notebook', 'computer', 'workstation', 'MacBook', 'ThinkPad');
|
|
2177
2217
|
}
|
|
2178
|
-
else if (
|
|
2218
|
+
else if (lowerQuery.includes('software')) {
|
|
2179
2219
|
suggestions.push('license', 'application', 'subscription', 'SaaS');
|
|
2180
2220
|
}
|
|
2221
|
+
else if (lowerQuery.includes('monitor') || lowerQuery.includes('display') ||
|
|
2222
|
+
lowerQuery.includes('screen') || lowerQuery.includes('lcd')) {
|
|
2223
|
+
suggestions.push('monitor', 'display', 'external monitor', 'desktop monitor', 'Dell monitor', 'HP monitor', 'Samsung monitor');
|
|
2224
|
+
}
|
|
2225
|
+
else if (lowerQuery.includes('desktop')) {
|
|
2226
|
+
suggestions.push('desktop computer', 'workstation', 'PC', 'desktop PC', 'Dell desktop', 'HP desktop');
|
|
2227
|
+
}
|
|
2228
|
+
else if (lowerQuery.includes('hardware')) {
|
|
2229
|
+
// For hardware searches, suggest specific item types
|
|
2230
|
+
suggestions.push('monitor', 'keyboard', 'mouse', 'laptop', 'desktop', 'printer', 'scanner', 'docking station', 'headset');
|
|
2231
|
+
}
|
|
2181
2232
|
else {
|
|
2182
|
-
// Generic suggestions
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2233
|
+
// Generic suggestions based on the query
|
|
2234
|
+
const words = query.split(' ');
|
|
2235
|
+
if (words.length > 1) {
|
|
2236
|
+
// Try individual words
|
|
2237
|
+
suggestions.push(...words.filter(w => w.length > 3));
|
|
2238
|
+
// Try first and last word
|
|
2239
|
+
suggestions.push(words[0], words[words.length - 1]);
|
|
2240
|
+
}
|
|
2241
|
+
// Add generic category suggestions
|
|
2242
|
+
suggestions.push('hardware', 'software', 'equipment', 'device', 'accessory');
|
|
2186
2243
|
}
|
|
2187
|
-
return [...new Set(suggestions)].filter(s => s && s !== query);
|
|
2244
|
+
return [...new Set(suggestions)].filter(s => s && s !== query && s.length > 0);
|
|
2245
|
+
}
|
|
2246
|
+
shouldExcludeItem(query, itemName, itemDesc) {
|
|
2247
|
+
const lowerQuery = query.toLowerCase();
|
|
2248
|
+
// If searching for hardware/monitors/displays, exclude service/process items
|
|
2249
|
+
if ((lowerQuery.includes('hardware') || lowerQuery.includes('monitor') ||
|
|
2250
|
+
lowerQuery.includes('display') || lowerQuery.includes('screen') ||
|
|
2251
|
+
lowerQuery.includes('desktop') || lowerQuery.includes('equipment')) &&
|
|
2252
|
+
(itemName.includes('decommission') || itemName.includes('service') ||
|
|
2253
|
+
itemName.includes('process') || itemName.includes('request') ||
|
|
2254
|
+
itemName.includes('removal') || itemName.includes('decomm') ||
|
|
2255
|
+
itemDesc.includes('decommission') || itemDesc.includes('service process'))) {
|
|
2256
|
+
return true;
|
|
2257
|
+
}
|
|
2258
|
+
// If searching for specific hardware, exclude unrelated items
|
|
2259
|
+
if (lowerQuery.includes('monitor') || lowerQuery.includes('display') || lowerQuery.includes('screen')) {
|
|
2260
|
+
// Exclude items that are clearly not monitors
|
|
2261
|
+
if ((itemName.includes('server') || itemName.includes('controller') ||
|
|
2262
|
+
itemName.includes('software') || itemName.includes('license') ||
|
|
2263
|
+
itemName.includes('training') || itemName.includes('support')) &&
|
|
2264
|
+
!itemName.includes('monitor') && !itemName.includes('display') &&
|
|
2265
|
+
!itemName.includes('screen')) {
|
|
2266
|
+
return true;
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
// If searching for desktops, exclude non-desktop items
|
|
2270
|
+
if (lowerQuery.includes('desktop')) {
|
|
2271
|
+
if ((itemName.includes('mobile') || itemName.includes('phone') ||
|
|
2272
|
+
itemName.includes('tablet') || itemName.includes('service')) &&
|
|
2273
|
+
!itemName.includes('desktop')) {
|
|
2274
|
+
return true;
|
|
2275
|
+
}
|
|
2276
|
+
}
|
|
2277
|
+
return false;
|
|
2188
2278
|
}
|
|
2189
2279
|
async handleTestFlowWithMock(args) {
|
|
2190
2280
|
const { flow_id, create_test_user = true, test_user_data, mock_catalog_items = true, mock_catalog_data, test_inputs = {}, simulate_approvals = true, cleanup_after_test = true } = args;
|