Skip to main content
Glama
tushar3006

Snowflake MCP Server

by tushar3006

read_query

Execute SELECT queries on Snowflake databases to retrieve and analyze data for reporting and insights.

Instructions

Execute a SELECT query.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSELECT SQL query to execute

Implementation Reference

  • The handler function that implements the logic for the read_query tool. It validates the input, checks for write operations using write_detector, executes the query on the Snowflake database, formats the output as YAML and JSON, and returns it as TextContent and EmbeddedResource.
    async def handle_read_query(arguments, db, write_detector, *_):
        if not arguments or "query" not in arguments:
            raise ValueError("Missing query argument")
    
        if write_detector.analyze_query(arguments["query"])["contains_write"]:
            raise ValueError("Calls to read_query should not contain write operations")
    
        data, data_id = await db.execute_query(arguments["query"])
    
        output = {
            "type": "data",
            "data_id": data_id,
            "data": data,
        }
        yaml_output = data_to_yaml(output)
        json_output = json.dumps(output, default=data_json_serializer)
        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"),
            ),
        ]
  • The input schema for the read_query tool, defining it as an object with a required 'query' property of type string describing the SELECT SQL query.
    input_schema={
        "type": "object",
        "properties": {"query": {"type": "string", "description": "SELECT SQL query to execute"}},
        "required": ["query"],
    },
  • The registration of the read_query tool in the all_tools list, specifying its name, description, input schema, and handler function.
    Tool(
        name="read_query",
        description="Execute a SELECT query.",
        input_schema={
            "type": "object",
            "properties": {"query": {"type": "string", "description": "SELECT SQL query to execute"}},
            "required": ["query"],
        },
        handler=handle_read_query,
    ),
Behavior2/5

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

With no annotations, the description carries full burden but only states the action without behavioral details. It doesn't disclose permissions needed, rate limits, whether it's read-only (implied by SELECT but not explicit), output format, or error handling. This is inadequate for a tool with mutation potential in SQL execution.

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 with zero waste. It's appropriately sized and front-loaded, clearly stating the core purpose without unnecessary elaboration.

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 no annotations, no output schema, and a single parameter with full schema coverage, the description is incomplete. It lacks context on behavioral traits, usage scenarios, and output expectations, making it insufficient for safe and effective tool invocation in a complex environment with siblings.

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 description coverage is 100%, so the schema already documents the 'query' parameter as a SELECT SQL query. The description adds no additional meaning beyond this, such as syntax examples or constraints. Baseline 3 is appropriate when schema does the heavy lifting.

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

Purpose3/5

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

The description 'Execute a SELECT query' clearly states the action (execute) and resource (SELECT query), but it's vague about scope and doesn't distinguish from siblings like 'describe_table' or 'list_tables' which might also involve querying. It specifies SELECT but doesn't clarify if it's for any table or specific databases.

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 versus alternatives is provided. It doesn't mention prerequisites (e.g., database selection), exclusions (e.g., non-SELECT queries), or compare to siblings like 'list_tables' for metadata queries. The description implies usage for SELECT queries but lacks context for decision-making.

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