fix(mcp): improve execute_sql response-too-large error to suggest limit parameter#39003
Conversation
…it parameter When execute_sql responses exceed the token limit, the error message now suggests both adding a SQL LIMIT clause and using the tool's limit parameter. Previously only the SQL LIMIT was mentioned, and the general "add a limit" suggestion was skipped for execute_sql entirely.
Code Review Agent Run #0b2e76Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #39003 +/- ##
==========================================
- Coverage 64.42% 64.42% -0.01%
==========================================
Files 2536 2536
Lines 131103 131107 +4
Branches 30434 30436 +2
==========================================
Hits 84467 84467
- Misses 45173 45177 +4
Partials 1463 1463
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
User description
SUMMARY
When
execute_sqlresponses exceed the token limit, the error message now provides more actionable suggestions:LIMITto the querylimitparameter — suggests using the execute_sqllimitparameter to cap rows (only when not already specified)limitparameter is set, the general "add a limit" suggestion now fires for execute_sql (previously only fired forlist_*tools)Before:
The error only showed a generic SQL LIMIT suggestion. The tool's own
limitparameter was never mentioned, and the general "add a limit" suggestion was skipped entirely for execute_sql.After:
TESTING
test_execute_sql_with_limit_param_no_duplicate_suggestiontesttest_tool_specific_suggestions_execute_sqlto verify both SQL LIMIT and parameter suggestionstest_token_utils.pypassBEFORE/AFTER SCREENSHOTS OR COVERAGE URL
N/A — backend-only change, no UI impact.
CodeAnt-AI Description
Make oversized SQL results point users to the right limit option
What Changed
execute_sqlreturns too much data, the error now suggests both adding a SQLLIMITclause and using the tool’slimitparameter.limitis already set, the message avoids repeating that suggestion and keeps the guidance focused on reducing the result size.Impact
✅ Fewer oversized SQL responses✅ Clearer limit guidance for query errors✅ Less trial and error when trimming result sets💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.