snow-flow 3.0.27 → 3.1.1

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/README.md CHANGED
@@ -100,28 +100,36 @@ snow-flow auth login
100
100
  The revolutionary `snow_query_table` replaces all table-specific query tools with intelligent performance optimization:
101
101
 
102
102
  ```javascript
103
- // Smart Performance Modes - LLM chooses the best approach:
103
+ // Smart Performance Modes - System auto-detects the best approach:
104
104
 
105
- // 1. Count-only (default) - 99.9% memory savings for ML training
106
- snow_query_table({ table: "incident", query: "state!=7", limit: 2000 })
107
- // Returns: {total_results: 2000} - Only 13 bytes!
105
+ // 1. Analytics mode - OMIT limit for ALL records with minimal fields
106
+ snow_query_table({
107
+ table: "incident",
108
+ query: "state!=7",
109
+ fields: ["sys_created_on", "priority"] // Get ALL records, minimal data
110
+ })
111
+ // Auto-detects analytics context and returns ALL records!
108
112
 
109
- // 2. Specific fields - Get exactly what you need
113
+ // 2. Count-only mode - Ultra efficient for large datasets
110
114
  snow_query_table({
111
115
  table: "sc_request",
112
- fields: ["number", "short_description", "requested_for"],
113
- include_display_values: true // Names instead of sys_ids
116
+ include_content: false // Just counts, no data
114
117
  })
118
+ // Returns: {total_results: 15234} - Maximum efficiency!
115
119
 
116
- // 3. Group by aggregation - Analytics and statistics
120
+ // 3. Display mode - Limited records with full details
117
121
  snow_query_table({
118
122
  table: "problem",
119
- group_by: "category",
120
- order_by: "-priority" // - means descending (highest first)
123
+ limit: 50, // Explicitly limit for display
124
+ include_display_values: true
121
125
  })
122
126
 
123
- // 4. Full content - When complete data is needed
124
- snow_query_table({ table: "change_request", include_content: true })
127
+ // 4. Group by aggregation - Server-side analytics
128
+ snow_query_table({
129
+ table: "change_request",
130
+ group_by: "risk",
131
+ order_by: "-count" // Sorted by frequency
132
+ })
125
133
  ```
126
134
 
127
135
  Works with ANY table: `incident`, `sc_request`, `problem`, `cmdb_ci`, even `u_custom_table`!
@@ -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. SMART ANALYTICS: For analysis use limit:99999 with minimal fields. For display use limit:50. For counting use include_content:false. See CLAUDE.md for query patterns.',
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 records. For analytics: 99999 (get ALL data with minimal fields). For display: 10-50. For ML: 5000+. NO DEFAULT - think about your use case!',
151
- examples: [99999, 50, 5000, 10]
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',
@@ -844,7 +844,7 @@ class ServiceNowOperationsMCP {
844
844
  (fields && fields.length <= 2); // Minimal fields = analytics
845
845
  if (isAnalyticsContext) {
846
846
  logger_js_1.logger.info(`📊 Analytics context detected - NO LIMIT applied for complete analysis`);
847
- return 99999; // Get ALL data for accurate analytics
847
+ return undefined; // No limit - get ALL records
848
848
  }
849
849
  // 🤖 ML Training context
850
850
  const isMLContext = query?.toLowerCase().includes('train') ||
@@ -871,6 +871,8 @@ class ServiceNowOperationsMCP {
871
871
  const { table, query, include_content = false, fields, include_display_values = false, group_by, order_by } = args;
872
872
  // Apply intelligent limit strategy
873
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 theoretical max (actual varies by instance)
874
876
  // 🚨 ML Training Warning for low limits
875
877
  const isMLTrainingContext = query?.toLowerCase().includes('train') ||
876
878
  query?.toLowerCase().includes('ml') ||
@@ -878,7 +880,7 @@ class ServiceNowOperationsMCP {
878
880
  if (isMLTrainingContext && limit < 1000) {
879
881
  logger_js_1.logger.warn(`⚠️ ML Training detected with low limit (${limit}). Consider setting limit=5000+ for better training data!`);
880
882
  }
881
- 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})`);
882
884
  try {
883
885
  // Convert natural language to ServiceNow query if needed
884
886
  const processedQuery = this.processNaturalLanguageQuery(query, table);
@@ -890,7 +892,7 @@ class ServiceNowOperationsMCP {
890
892
  finalQuery += `^ORDERBY${orderDirection}${orderField}`;
891
893
  }
892
894
  // Query the table
893
- const records = await this.client.searchRecords(table, finalQuery, limit);
895
+ const records = await this.client.searchRecords(table, finalQuery, effectiveLimit);
894
896
  let result = {
895
897
  table: table,
896
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.27",
3
+ "version": "3.1.1",
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",