diff --git a/README.md b/README.md index 8ce8a28..59a743e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Snowflake Cortex AI Model Context Protocol (MCP) Server +statement_type# Snowflake Cortex AI Model Context Protocol (MCP) Server image @@ -86,6 +86,7 @@ sql_statement_permissions: # List SQL statements to explicitly allow (True) or d - Merge: True - Rollback: True - Select: True + - Show: True - Transaction: True - TruncateTable: True - Unknown: False # To allow unknown or unmapped statement types, set Unknown: True. diff --git a/mcp_server_snowflake/query_manager/tools.py b/mcp_server_snowflake/query_manager/tools.py index c7e18a7..3a490eb 100644 --- a/mcp_server_snowflake/query_manager/tools.py +++ b/mcp_server_snowflake/query_manager/tools.py @@ -74,6 +74,9 @@ def get_statement_type(sql_string): # The expression type is the class of the root node. statement_type = type(expression_tree).__name__ + # Treat SHOW ... command as a separate type, to allow SHOW [AGENT] as an example + if statement_type == "Command" and sql_string.strip().upper().startswith("SHOW"): + return "Show" return statement_type except ( diff --git a/mcp_server_snowflake/tests/test_query_manager_tools.py b/mcp_server_snowflake/tests/test_query_manager_tools.py index d74bb1b..6611398 100644 --- a/mcp_server_snowflake/tests/test_query_manager_tools.py +++ b/mcp_server_snowflake/tests/test_query_manager_tools.py @@ -54,6 +54,8 @@ def test_parse_json_colon_path_with_cast(self): def test_column_colon_path_with_cast(self): assert get_statement_type("SELECT v:city::string FROM t") == "Select" + def test_show_agent(self): + assert get_statement_type("SHOW AGENTS IN SCHEMA ABC") == "Show" class TestSnowflakeSpecificSyntax: """Additional Snowflake dialect coverage: COPY INTO, LATERAL FLATTEN, etc."""