Skip to main content
Glama
tushar3006

Snowflake MCP Server

by tushar3006

list_databases

Retrieve all available databases in Snowflake to explore and manage database structures for efficient data operations and analysis.

Instructions

List all available databases in Snowflake

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'list_databases' tool. It queries Snowflake's INFORMATION_SCHEMA.DATABASES to list databases, applies exclusion filters if provided, formats the output as YAML and JSON, and returns text content and an embedded JSON resource.
    async def handle_list_databases(arguments, db, *_, exclusion_config=None):
        query = "SELECT DATABASE_NAME FROM INFORMATION_SCHEMA.DATABASES"
        data, data_id = await db.execute_query(query)
    
        # Filter out excluded databases
        if exclusion_config and "databases" in exclusion_config and exclusion_config["databases"]:
            filtered_data = []
            for item in data:
                db_name = item.get("DATABASE_NAME", "")
                exclude = False
                for pattern in exclusion_config["databases"]:
                    if pattern.lower() in db_name.lower():
                        exclude = True
                        break
                if not exclude:
                    filtered_data.append(item)
            data = filtered_data
    
        output = {
            "type": "data",
            "data_id": data_id,
            "data": data,
        }
        yaml_output = data_to_yaml(output)
        json_output = json.dumps(output)
        return [
            types.TextContent(type="text", text=yaml_output),
            types.EmbeddedResource(
                type="resource",
                resource=types.TextResourceContents(uri=f"data://{data_id}", text=json_output, mimeType="application/json"),
            ),
        ]
  • Registration of the 'list_databases' tool in the all_tools list, including name, description, empty input schema (no arguments required), and reference to the handler function. This tool object is later filtered and exposed via handle_list_tools().
    Tool(
        name="list_databases",
        description="List all available databases in Snowflake",
        input_schema={
            "type": "object",
            "properties": {},
        },
        handler=handle_list_databases,
    ),
  • Input schema definition for the 'list_databases' tool, specifying an empty object (no required parameters).
    input_schema={
        "type": "object",
        "properties": {},
    },
  • The general call_tool handler includes special logic for 'list_databases' (and similar tools) to pass the exclusion_config parameter to enable filtering.
    @server.call_tool()
    @handle_tool_errors
    async def handle_call_tool(
        name: str, arguments: dict[str, Any] | None
    ) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]:
        if name in exclude_tools:
            return [types.TextContent(type="text", text=f"Tool {name} is excluded from this data connection")]
    
        handler = next((tool.handler for tool in allowed_tools if tool.name == name), None)
        if not handler:
            raise ValueError(f"Unknown tool: {name}")
    
        # Pass exclusion_config to the handler if it's a listing function
        if name in ["list_databases", "list_schemas", "list_tables"]:
            return await handler(
                arguments,
                db,
                write_detector,
                allow_write,
                server,
                exclusion_config=exclusion_config,
            )
        else:
            return await handler(arguments, db, write_detector, allow_write, server)
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 listing databases but doesn't specify whether this is a read-only operation, if it requires permissions, what the output format is, or any rate limits. This leaves significant gaps for an agent to understand the tool's behavior.

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, clear sentence that directly states the tool's purpose without any fluff or redundant information. It's front-loaded and appropriately sized for a simple tool with no parameters.

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

Completeness2/5

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

Given the lack of annotations and output schema, the description is insufficient for a complete understanding. It doesn't explain what 'list' entails (e.g., format, pagination, or metadata included), which is critical for an agent to use the tool effectively in context with its siblings.

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 input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, which is efficient and aligns with the schema's completeness, earning a high score for not adding unnecessary information.

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 available databases in Snowflake'), making the tool's purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'list_schemas' or 'list_tables' beyond the resource type, which keeps it from a perfect score.

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?

The description provides no guidance on when to use this tool versus alternatives like 'list_schemas' or 'list_tables', nor does it mention any prerequisites or exclusions. It simply states what the tool does without context for selection.

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

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/tushar3006/MCP'

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