fix: handle result sets for SHOW, CREATE TABLE, and DESCRIBE commands#37
Merged
designcomputer merged 1 commit intomainfrom Apr 18, 2025
Merged
Conversation
hyemin916
pushed a commit
to hyemin916/mysql_mcp_server
that referenced
this pull request
Aug 29, 2025
- Add support for Unix socket connections via MYSQL_SOCKET_PATH env var - Automatically detect and use socket connection when MYSQL_SOCKET_PATH is set - Fix TypeScript build errors caused by duplicate variable declarations in evals.ts - Update documentation with Unix socket example - Add integration tests for Unix socket connections - Update Smithery configuration to support socket connections - Maintain backward compatibility with existing TCP/IP connections Handles designcomputer#37, Fixes designcomputer#46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: Handle Result Sets for SHOW, CREATE TABLE, and DESCRIBE Commands
Problem
When executing
SHOW INDEX FROM table_name,SHOW CREATE TABLE table_name, orDESCRIBE table_namethrough the MCP tool, it returns an error: "Error executing query: Unread result found". This happens because the code was specifically checking for queries that start with "SELECT" rather than checking if the query returns a result set.Solution
This PR changes the condition from checking the query syntax (
query.strip().upper().startswith("SELECT")) to checking the existence of a result set (cursor.description is not None). This makes the code more robust and allows it to handle all types of queries that return result sets, not just SELECT queries.Additionally, it adds more robust error handling for result fetching operations and improves debug output.
Changes Made
To:
Testing
I've tested this change with various command types:
Related Issues
This PR addresses PR #7 which introduced a similar fix but didn't include the additional error handling.