snow-flow 3.0.26 → 3.1.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.
|
@@ -132,7 +132,7 @@ class ServiceNowOperationsMCP {
|
|
|
132
132
|
// 🎯 UNIVERSAL TABLE QUERY - Works for ANY ServiceNow table!
|
|
133
133
|
{
|
|
134
134
|
name: 'snow_query_table',
|
|
135
|
-
description: 'Universal query tool for any ServiceNow table.
|
|
135
|
+
description: 'Universal query tool for any ServiceNow table. SMART ANALYTICS: OMIT limit for ALL records with minimal fields. For display use limit:50. For counting use include_content:false. See CLAUDE.md for optimal query patterns.',
|
|
136
136
|
inputSchema: {
|
|
137
137
|
type: 'object',
|
|
138
138
|
properties: {
|
|
@@ -147,8 +147,8 @@ class ServiceNowOperationsMCP {
|
|
|
147
147
|
},
|
|
148
148
|
limit: {
|
|
149
149
|
type: 'number',
|
|
150
|
-
description: 'Maximum
|
|
151
|
-
|
|
150
|
+
description: 'Maximum records to return. OMIT for analytics (gets ALL records). Use 10-50 for display, 5000+ for ML training. No default - system auto-detects best approach.',
|
|
151
|
+
examples: [50, 1000, 5000]
|
|
152
152
|
},
|
|
153
153
|
include_content: {
|
|
154
154
|
type: 'boolean',
|
|
@@ -829,29 +829,50 @@ class ServiceNowOperationsMCP {
|
|
|
829
829
|
});
|
|
830
830
|
}
|
|
831
831
|
async handleUniversalQuery(args) {
|
|
832
|
-
//
|
|
833
|
-
const determineSmartLimit = (providedLimit, table, query, includeContent) => {
|
|
832
|
+
// 🧠 INTELLIGENT LIMIT STRATEGY - Think about the use case!
|
|
833
|
+
const determineSmartLimit = (providedLimit, table, query, includeContent, fields) => {
|
|
834
|
+
// User explicitly set limit - respect it
|
|
834
835
|
if (providedLimit !== undefined)
|
|
835
|
-
return providedLimit;
|
|
836
|
-
//
|
|
836
|
+
return providedLimit;
|
|
837
|
+
// 📊 ANALYTICS DETECTION - Need ALL data
|
|
838
|
+
const isAnalyticsContext = query?.toLowerCase().includes('analyz') ||
|
|
839
|
+
query?.toLowerCase().includes('trend') ||
|
|
840
|
+
query?.toLowerCase().includes('when') ||
|
|
841
|
+
query?.toLowerCase().includes('pattern') ||
|
|
842
|
+
query?.toLowerCase().includes('all') ||
|
|
843
|
+
query?.toLowerCase().includes('onboard') ||
|
|
844
|
+
(fields && fields.length <= 2); // Minimal fields = analytics
|
|
845
|
+
if (isAnalyticsContext) {
|
|
846
|
+
logger_js_1.logger.info(`📊 Analytics context detected - NO LIMIT applied for complete analysis`);
|
|
847
|
+
return undefined; // No limit - get ALL records
|
|
848
|
+
}
|
|
849
|
+
// 🤖 ML Training context
|
|
837
850
|
const isMLContext = query?.toLowerCase().includes('train') ||
|
|
838
851
|
query?.toLowerCase().includes('ml') ||
|
|
839
|
-
table?.toLowerCase().includes('train')
|
|
840
|
-
(includeContent && table === 'incident'); // ML often needs incident content
|
|
852
|
+
table?.toLowerCase().includes('train');
|
|
841
853
|
if (isMLContext) {
|
|
842
854
|
logger_js_1.logger.info(`🧠 ML context detected - using ML-optimized limit: 5000`);
|
|
843
|
-
return 5000; // ML training needs
|
|
855
|
+
return 5000; // ML training needs substantial data
|
|
844
856
|
}
|
|
845
|
-
// Count-only queries
|
|
857
|
+
// 📈 Count-only queries - efficient
|
|
846
858
|
if (!includeContent) {
|
|
847
|
-
|
|
859
|
+
logger_js_1.logger.info(`📈 Count-only query - can handle large datasets efficiently`);
|
|
860
|
+
return 10000; // Count queries are very memory-efficient
|
|
848
861
|
}
|
|
849
|
-
//
|
|
850
|
-
|
|
862
|
+
// 🖥️ Display context - limited data needed
|
|
863
|
+
if (includeContent && fields && fields.length > 5) {
|
|
864
|
+
logger_js_1.logger.info(`🖥️ Display context detected - limiting to viewable records`);
|
|
865
|
+
return 100; // Display queries need less data
|
|
866
|
+
}
|
|
867
|
+
// Default: moderate limit
|
|
868
|
+
logger_js_1.logger.info(`⚠️ No specific context detected - using conservative limit. Consider specifying limit for your use case!`);
|
|
869
|
+
return 500; // Conservative default
|
|
851
870
|
};
|
|
852
871
|
const { table, query, include_content = false, fields, include_display_values = false, group_by, order_by } = args;
|
|
853
|
-
// Apply
|
|
854
|
-
const limit = determineSmartLimit(args.limit, table, query, include_content || !!fields);
|
|
872
|
+
// Apply intelligent limit strategy
|
|
873
|
+
const limit = determineSmartLimit(args.limit, table, query, include_content || !!fields, fields);
|
|
874
|
+
// For analytics, we want NO limit at all
|
|
875
|
+
const effectiveLimit = limit === undefined ? 999999 : limit; // ServiceNow max is usually 10000 per call
|
|
855
876
|
// 🚨 ML Training Warning for low limits
|
|
856
877
|
const isMLTrainingContext = query?.toLowerCase().includes('train') ||
|
|
857
878
|
query?.toLowerCase().includes('ml') ||
|
|
@@ -859,7 +880,7 @@ class ServiceNowOperationsMCP {
|
|
|
859
880
|
if (isMLTrainingContext && limit < 1000) {
|
|
860
881
|
logger_js_1.logger.warn(`⚠️ ML Training detected with low limit (${limit}). Consider setting limit=5000+ for better training data!`);
|
|
861
882
|
}
|
|
862
|
-
logger_js_1.logger.info(`Universal query on table '${table}' with: ${query} (limit: ${limit}, include_content: ${include_content})`);
|
|
883
|
+
logger_js_1.logger.info(`Universal query on table '${table}' with: ${query} (limit: ${limit === undefined ? 'UNLIMITED' : limit}, include_content: ${include_content})`);
|
|
863
884
|
try {
|
|
864
885
|
// Convert natural language to ServiceNow query if needed
|
|
865
886
|
const processedQuery = this.processNaturalLanguageQuery(query, table);
|
|
@@ -871,7 +892,7 @@ class ServiceNowOperationsMCP {
|
|
|
871
892
|
finalQuery += `^ORDERBY${orderDirection}${orderField}`;
|
|
872
893
|
}
|
|
873
894
|
// Query the table
|
|
874
|
-
const records = await this.client.searchRecords(table, finalQuery,
|
|
895
|
+
const records = await this.client.searchRecords(table, finalQuery, effectiveLimit);
|
|
875
896
|
let result = {
|
|
876
897
|
table: table,
|
|
877
898
|
total_results: records.success ? records.data.result.length : 0,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "snow-flow",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Snow-Flow v3.0.18: DIRECT API VERIFICATION! 🚀 Replaced unreliable searchRecords with direct API calls (snow_query_table style) for widget verification. All null/403 error recovery now uses GET /api/now/table/sp_widget with precise queries. NO MORE FALSE NEGATIVES - verification works consistently every time!",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "commonjs",
|