Skip to main content
Glama
tushar3006

Snowflake MCP Server

by tushar3006

list_schemas

Retrieve all schema names from a specified Snowflake database to explore database structure and organize data objects.

Instructions

List all schemas in a database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
databaseYesDatabase name to list schemas from

Implementation Reference

  • Core handler function that executes the logic to list schemas from a specified Snowflake database. It runs a SQL query, applies exclusion filters if configured, formats results as YAML and JSON, and returns them as TextContent and EmbeddedResource.
    async def handle_list_schemas(arguments, db, *_, exclusion_config=None):
        if not arguments or "database" not in arguments:
            raise ValueError("Missing required 'database' parameter")
    
        database = arguments["database"]
        query = f"SELECT SCHEMA_NAME FROM {database.upper()}.INFORMATION_SCHEMA.SCHEMATA"
        data, data_id = await db.execute_query(query)
    
        # Filter out excluded schemas
        if exclusion_config and "schemas" in exclusion_config and exclusion_config["schemas"]:
            filtered_data = []
            for item in data:
                schema_name = item.get("SCHEMA_NAME", "")
                exclude = False
                for pattern in exclusion_config["schemas"]:
                    if pattern.lower() in schema_name.lower():
                        exclude = True
                        break
                if not exclude:
                    filtered_data.append(item)
            data = filtered_data
    
        output = {
            "type": "data",
            "data_id": data_id,
            "database": database,
            "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"),
            ),
        ]
  • Input schema validation for the tool, requiring a single 'database' string parameter.
    input_schema={
        "type": "object",
        "properties": {
            "database": {
                "type": "string",
                "description": "Database name to list schemas from",
            },
        },
        "required": ["database"],
    },
  • Registers the 'list_schemas' tool in the all_tools list, which is used by handle_list_tools() to expose the tool to MCP clients and by handle_call_tool() to dispatch calls to the handler.
    Tool(
        name="list_schemas",
        description="List all schemas in a database",
        input_schema={
            "type": "object",
            "properties": {
                "database": {
                    "type": "string",
                    "description": "Database name to list schemas from",
                },
            },
            "required": ["database"],
        },
        handler=handle_list_schemas,
    ),

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.2/5.0
Behavior2/5

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

No annotations provided; description only states the action without disclosing any behavioral traits like authentication, side effects, or return format.

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

Conciseness4/5

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

Single sentence, front-loaded and concise without wasted words.

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?

For a simple list tool, the description and schema together provide adequate information, though no output schema exists to explain return values.

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

Parameters3/5

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

Schema coverage is 100% and parameter description in schema is clear; description adds no extra semantic value beyond the schema.

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

Purpose5/5

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

The description uses a specific verb 'List' and resource 'schemas', clearly distinguishing from siblings like list_databases and list_tables.

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 on when to use this tool vs alternatives; no context about prerequisites or exclusions.

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