- Notifications
You must be signed in to change notification settings - Fork 12
feat: fix CTE query and new features #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request fixes CTE (Common Table Expression) query support and adds several new features to the GreptimeDB MCP server. The main changes include fixing a spelling error ("Forbided" → "Forbidden"), adding support for WITH clauses in SQL queries, implementing new database tools (describe_table, health_check, execute_tql, query_range, explain_query), adding connection pooling, and enhancing the execute_sql tool with multiple output formats (CSV, JSON, Markdown) and row limiting.
Key changes:
- Fixed CTE queries: Added "WITH" to allowed SQL statement prefixes to enable Common Table Expressions
- New database tools: Added 5 new tools for table inspection, health checking, TQL queries, range queries, and query explanation
- Enhanced output formats: Added JSON and Markdown formatting options with proper datetime handling
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/greptimedb_mcp_server/utils.py | Fixed spelling error: "Forbided" → "Forbidden" in security gate error messages |
| src/greptimedb_mcp_server/server.py | Added connection pooling, new format_results function, 5 new tool implementations (_health_check, _describe_table, _execute_tql, _query_range, _explain_query), enhanced execute_sql with format/limit options, and refactored resource methods to use async patterns |
| tests/test_utils.py | Updated tests for spelling fixes, added comprehensive tests for format_value and format_results functions, added security gate tests for newly allowed operations (EXPLAIN, WITH, TQL, SHOW, DESC) |
| tests/test_server.py | Updated expected tool count to 6, adjusted test assertions for new CSV quoting behavior, added tests for all new tools and their parameter validation |
| conftest.py | Enhanced mocks to support fetchmany/fetchone, added MockConnectionPool for testing connection pooling, added mock responses for DESCRIBE, VERSION, TQL, EXPLAIN, and ALIGN queries |
| README.md | Updated documentation to describe new tools, features, security controls, and usage examples |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 9 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
| All set. Most of the code is just templates and tests, so no worries. 😄 |
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
d883e1f to c376273 Compare
Main changes:
execute_sqldescribe_tablehealth_checkexecute_tqlquery_rangeexplain_query