Skip to main content
Glama
tushar3006

Snowflake MCP Server

by tushar3006

list_tables

Retrieve all tables within a specified database and schema to explore database structure and identify available data sources.

Instructions

List all tables in a specific database and schema

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
databaseYesDatabase name
schemaYesSchema name

Implementation Reference

  • The handler function that implements the list_tables tool logic: validates input, constructs SQL query to list tables from information_schema.tables in the given database.schema, applies table exclusion filters, formats output as YAML text and JSON embedded resource.
    async def handle_list_tables(arguments, db, *_, exclusion_config=None):
        if not arguments or "database" not in arguments or "schema" not in arguments:
            raise ValueError("Missing required 'database' and 'schema' parameters")
    
        database = arguments["database"]
        schema = arguments["schema"]
    
        query = f"""
            SELECT table_catalog, table_schema, table_name, comment 
            FROM {database}.information_schema.tables 
            WHERE table_schema = '{schema.upper()}'
        """
        data, data_id = await db.execute_query(query)
    
        # Filter out excluded tables
        if exclusion_config and "tables" in exclusion_config and exclusion_config["tables"]:
            filtered_data = []
            for item in data:
                table_name = item.get("TABLE_NAME", "")
                exclude = False
                for pattern in exclusion_config["tables"]:
                    if pattern.lower() in table_name.lower():
                        exclude = True
                        break
                if not exclude:
                    filtered_data.append(item)
            data = filtered_data
    
        output = {
            "type": "data",
            "data_id": data_id,
            "database": database,
            "schema": schema,
            "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 definition for list_tables tool specifying required 'database' and 'schema' string parameters.
        "type": "object",
        "properties": {
            "database": {"type": "string", "description": "Database name"},
            "schema": {"type": "string", "description": "Schema name"},
        },
        "required": ["database", "schema"],
    },
  • Tool registration object creation for list_tables, including name, description, input schema, and reference to the handler function. Added to the all_tools list used by list_tools and call_tool handlers.
    Tool(
        name="list_tables",
        description="List all tables in a specific database and schema",
        input_schema={
            "type": "object",
            "properties": {
                "database": {"type": "string", "description": "Database name"},
                "schema": {"type": "string", "description": "Schema name"},
            },
            "required": ["database", "schema"],
        },
        handler=handle_list_tables,
    ),
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool lists tables but doesn't describe behavioral traits such as whether this is a read-only operation, potential rate limits, authentication requirements, or what the output format looks like (e.g., pagination, error handling). This leaves significant gaps for a tool with no annotation coverage.

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 unnecessary words. It is appropriately sized and front-loaded, with every part of the sentence contributing essential information about what the tool does.

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 incomplete for a tool with two required parameters. It doesn't address behavioral aspects like safety, performance, or output format, which are critical for an AI agent to use the tool correctly. The description alone is insufficient to compensate for the missing structured data.

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?

The schema description coverage is 100%, with both parameters ('database' and 'schema') fully documented in the input schema. The description adds no additional meaning beyond what the schema provides (e.g., it doesn't explain parameter constraints or relationships). According to the rules, when schema coverage is high (>80%), the baseline score is 3 even with no param info in the description.

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 all tables') and the target resource ('in a specific database and schema'), providing a specific verb+resource combination. However, it doesn't explicitly distinguish this tool from sibling tools like 'list_databases' or 'list_schemas' which operate on different resource types, so it doesn't fully differentiate from siblings.

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. It doesn't mention sibling tools like 'list_databases' or 'list_schemas' that might be used in related contexts, nor does it specify prerequisites or exclusions for usage. The agent must infer usage from the tool name and parameters alone.

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