Skip to main content
Glama
YannBrrd

Simple Snowflake MCP

by YannBrrd

list-databases

Retrieve a comprehensive list of all accessible Snowflake databases to streamline database management and access control behind a corporate proxy.

Instructions

List all accessible Snowflake databases.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The execution handler for the 'list-databases' tool. Constructs and executes a SHOW DATABASES SQL query with optional pattern filter, handles output formatting based on 'include_details' parameter, and returns results as text content.
    elif name == "list-databases":
        pattern = args.get("pattern")
        include_details = args.get("include_details", False)
        
        query = "SHOW DATABASES"
        if pattern:
            query += f" LIKE '{pattern}'"
        
        result = _safe_snowflake_execute(query, "List databases")
        if result["success"]:
            if include_details:
                output = json.dumps(result["data"], indent=2, default=str)
            else:
                databases = [row.get("name", "") for row in result["data"]]
                output = "\n".join(databases)
            return [types.TextContent(type="text", text=output)]
        else:
            return [types.TextContent(type="text", text=f"Snowflake error: {result['error']}")]
  • Registers the 'list-databases' tool in the list_tools() handler, defining its description and input schema for validation of 'pattern' (string with wildcards) and 'include_details' (boolean) parameters.
    types.Tool(
        name="list-databases",
        description="List all accessible Snowflake databases with optional filtering",
        inputSchema={
            "type": "object",
            "properties": {
                "pattern": {
                    "type": "string",
                    "description": "Filter databases by name pattern (supports wildcards)",
                    "examples": ["PROD_%", "%_DEV"]
                },
                "include_details": {
                    "type": "boolean", 
                    "default": False,
                    "description": "Include database details and metadata"
                }
            },
            "additionalProperties": False
        },
    ),
  • JSON schema definition for the 'list-databases' tool inputs, specifying properties for filtering and details inclusion.
    inputSchema={
        "type": "object",
        "properties": {
            "pattern": {
                "type": "string",
                "description": "Filter databases by name pattern (supports wildcards)",
                "examples": ["PROD_%", "%_DEV"]
            },
            "include_details": {
                "type": "boolean", 
                "default": False,
                "description": "Include database details and metadata"
            }
        },
        "additionalProperties": False
    },
  • Helper function that performs safe Snowflake query execution with connection management, result parsing, and error handling, directly called by the list-databases handler.
    def _safe_snowflake_execute(query: str, description: str = "Query") -> Dict[str, Any]:
        """
        Safely execute a Snowflake query with proper error handling and logging.
        """
        try:
            logger.info(f"Executing {description}: {query[:100]}...")
            ctx = snowflake.connector.connect(**SNOWFLAKE_CONFIG)
            cur = ctx.cursor()
            cur.execute(query)
            
            # Handle different query types
            if cur.description:
                rows = cur.fetchall()
                columns = [desc[0] for desc in cur.description]
                result = [dict(zip(columns, row)) for row in rows]
            else:
                result = {"status": "success", "rowcount": cur.rowcount}
                
            cur.close()
            ctx.close()
            logger.info(f"{description} completed successfully")
            return {"success": True, "data": result}
            
        except Exception as e:
            logger.error(f"{description} failed: {str(e)}")
            return {"success": False, "error": str(e), "data": None}
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'accessible' databases, hinting at permission-based filtering, but lacks details on output format, pagination, error handling, or any constraints like rate limits or authentication needs.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core functionality ('List all accessible Snowflake databases'). There is no wasted verbiage or redundancy, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (0 parameters, no output schema, no annotations), the description is adequate but has gaps. It lacks details on behavioral aspects like output format or error conditions, which are important for a list operation even without complex inputs.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters, and schema description coverage is 100%, so there are no parameters to document. The description appropriately doesn't add unnecessary param details, earning a baseline score of 4 for zero-parameter tools.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('List') and resource ('all accessible Snowflake databases'), making the tool's purpose immediately understandable. It doesn't differentiate from sibling tools like 'list-views' or 'list-snowflake-warehouses', but the scope is well-defined.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'list-views' or 'list-snowflake-warehouses'. The description only states what it does without indicating context or prerequisites for usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/YannBrrd/simple_snowflake_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server