snow-flow 3.4.33 → 3.4.34
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.
|
@@ -84,8 +84,9 @@ class BaseMCPServer {
|
|
|
84
84
|
const { limited, wasLimited, originalSize } = response_limiter_js_1.ResponseLimiter.limitResponse(result);
|
|
85
85
|
if (wasLimited) {
|
|
86
86
|
this.logger.warn(`Response limited for ${name}: ${originalSize} bytes -> ${JSON.stringify(limited).length} bytes`);
|
|
87
|
-
//
|
|
88
|
-
|
|
87
|
+
// Only create summary for EXTREMELY large responses (>2MB)
|
|
88
|
+
// Normal widgets/flows should pass through fine with 500KB limit
|
|
89
|
+
if (originalSize > 2000000) { // > 2MB - truly excessive
|
|
89
90
|
result = response_limiter_js_1.ResponseLimiter.createSummaryResponse(result, name);
|
|
90
91
|
}
|
|
91
92
|
else {
|
|
@@ -38,9 +38,9 @@ class ResponseLimiter {
|
|
|
38
38
|
}
|
|
39
39
|
// Handle primitives
|
|
40
40
|
if (typeof obj !== 'object') {
|
|
41
|
-
// Limit string length
|
|
42
|
-
if (typeof obj === 'string' && obj.length >
|
|
43
|
-
return obj.substring(0,
|
|
41
|
+
// Limit string length - 10KB per string field is reasonable
|
|
42
|
+
if (typeof obj === 'string' && obj.length > 10000) {
|
|
43
|
+
return obj.substring(0, 10000) + '... [TRUNCATED]';
|
|
44
44
|
}
|
|
45
45
|
return obj;
|
|
46
46
|
}
|
|
@@ -83,15 +83,19 @@ Operation: ${operation}
|
|
|
83
83
|
Status: Success (data limited to prevent timeout)
|
|
84
84
|
|
|
85
85
|
Summary:
|
|
86
|
-
- Original size: ${(originalSize / 1024).toFixed(
|
|
86
|
+
- Original size: ${(originalSize / 1024 / 1024).toFixed(2)}MB
|
|
87
87
|
- Token estimate: ${estimatedTokens}
|
|
88
|
-
-
|
|
88
|
+
- Response limit: ${(this.MAX_RESPONSE_SIZE / 1024).toFixed(0)}KB
|
|
89
89
|
|
|
90
90
|
💡 Tips to reduce response size:
|
|
91
91
|
1. Use specific field queries instead of '*'
|
|
92
92
|
2. Add pagination with smaller limits
|
|
93
93
|
3. Filter results more specifically
|
|
94
|
-
4. Use count operations instead of full data retrieval
|
|
94
|
+
4. Use count operations instead of full data retrieval
|
|
95
|
+
|
|
96
|
+
Note: You can increase limits via environment variables:
|
|
97
|
+
- MCP_MAX_RESPONSE_SIZE (default: 500000 bytes)
|
|
98
|
+
- MCP_MAX_ARRAY_ITEMS (default: 500 items)`
|
|
95
99
|
}],
|
|
96
100
|
_meta: {
|
|
97
101
|
limited: true,
|
|
@@ -102,7 +106,8 @@ Summary:
|
|
|
102
106
|
}
|
|
103
107
|
}
|
|
104
108
|
exports.ResponseLimiter = ResponseLimiter;
|
|
105
|
-
|
|
106
|
-
ResponseLimiter.
|
|
107
|
-
ResponseLimiter.
|
|
109
|
+
// Configurable via environment variable, default to 500KB (reasonable for widgets/flows)
|
|
110
|
+
ResponseLimiter.MAX_RESPONSE_SIZE = parseInt(process.env.MCP_MAX_RESPONSE_SIZE || '500000'); // 500KB default
|
|
111
|
+
ResponseLimiter.MAX_ARRAY_ITEMS = parseInt(process.env.MCP_MAX_ARRAY_ITEMS || '500'); // 500 items default
|
|
112
|
+
ResponseLimiter.MAX_TOKEN_ESTIMATE = 125000; // ~500KB / 4 chars per token
|
|
108
113
|
//# sourceMappingURL=response-limiter.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "snow-flow",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.34",
|
|
4
4
|
"description": "ServiceNow development framework with MCP server integration. Executes background scripts using ES5 JavaScript only (ServiceNow Rhino engine requirement). Provides 17 MCP servers for complete ServiceNow operations including widget deployment with coherence validation, table operations, script execution, machine learning, advanced features, and comprehensive platform management.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "commonjs",
|