You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix token limit enforcement in context_get to prevent MCP protocol errors
- Added calculateSafeItemCount() helper function to determine safe result size
- Implemented automatic response truncation when approaching 25,000 token limit
- Enhanced pagination metadata with truncated/truncatedCount fields
- Improved warning messages with specific pagination instructions
- Added comprehensive unit tests for token limit enforcement
- Bumped version to 0.10.1
- Updated CHANGELOG.md with fix details
This prevents "response exceeds maximum allowed tokens" errors that users
were experiencing with large result sets like "*test*" pattern queries.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
'Large result set. Consider using smaller limit or more specific filters.';
842
+
if(wasTruncated){
843
+
response.pagination.warning=`Response truncated due to token limits. ${truncatedCount} items omitted. Use pagination with offset=${nextOffset} to retrieve remaining items.`;
844
+
}else{
845
+
response.pagination.warning=
846
+
'Large result set. Consider using smaller limit or more specific filters.';
'Large result set. Consider using smaller limit or more specific filters.';
877
+
if(wasTruncated){
878
+
response.pagination.warning=`Response truncated due to token limits. ${truncatedCount} items omitted. Use pagination with offset=${nextOffset} to retrieve remaining items.`;
879
+
}else{
880
+
response.pagination.warning=
881
+
'Large result set. Consider using smaller limit or more specific filters.';
0 commit comments