Skip to main content
Glama
ncejda-g2

Snowflake MCP Server

by ncejda-g2

Execute Query

execute_query

Run read-only SQL queries against Snowflake to retrieve data, inspect schemas, and analyze results with optional database and schema context.

Instructions

Execute a read-only SQL query (SELECT, SHOW, DESCRIBE, WITH) and return results.

Requires a populated schema cache; auto-refreshes on first use if empty.

Parameters:
- sql: read-only SQL query
- database: optional database context
- schema: optional schema context

Returns a compact TEXT payload (not JSON): a `key: value` header
(status, rows, cols, execution_time, query_id), a `---` separator, then a
result block whose shape depends on row count:
- ONE row: aligned `NAME  value` lines (one column per line), any width.
- 2+ narrow rows: positional TSV (line 1 = tab-separated column names, one
  row per line after). Parse with awk/cut, e.g. `awk -F'\t' 'NR>1 && $3=="X"'`.
NULL = `\N`; tabs/newlines escaped so each field is one line.

Multi-row results that are wide, tall, or too large auto-spill the COMPLETE
result to a temp `.tsv` file; the payload then carries `results_file` and
`column_index` (name->position) and NO inline rows. Read/grep/awk the file
(it has its own header line); `rows:` is always the true total.

Example: execute_query("SELECT * FROM SALES_DB.PUBLIC.CUSTOMERS LIMIT 10")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYes
schemaNo
databaseNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv1.0.3
    • addedInput schema / additionalProperties
      Added value: +false
    • removedInput schema / properties / database / title
      Removed value: -"Database"
    • removedInput schema / properties / schema / title
      Removed value: -"Schema"
    • removedInput schema / properties / sql / title
      Removed value: -"Sql"
  2. Changed1 schema field changedv1.0.0
    • changedOutput schema / (root)
      Previous value: -{
      -  "additionalProperties": true,
      -  "type": "object"
      -}New value: +null
  3. First observedv0.2.3

TDQS

A4.1/5.0
Behavior5/5

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

There are no annotations, so the description carries the full behavioral burden. It thoroughly discloses the read-only safety profile, the TEXT payload format, header fields, row-count-dependent result shapes, NULL escaping, and the automatic spill to a .tsv file with results_file and column_index. This is exemplary transparency beyond the structured schema.

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 long but well-structured and information-dense. It front-loads the core purpose, then parameters, then a detailed return contract with examples. Every section earns its place, and the formatting makes the complexity navigable rather than overwhelming.

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

Completeness5/5

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

For a tool with no output schema and no annotations, the description is remarkably complete: it documents two result shapes, the compact header, the spill-to-file path, parsing guidance, NULL handling, and an example call. Missing error-case documentation and explicit sibling routing are minor relative to what is covered.

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 input schema has 0% description coverage, so the description must compensate. It lists all three parameters and assigns basic meaning: sql is a read-only SQL query, and database/schema are 'optional context.' This is helpful but thin—'database context' and 'schema context' are vague and do not explain how they affect query resolution or default behavior.

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 opens with a specific verb and resource: 'Execute a read-only SQL query' and lists allowed statement types (SELECT, SHOW, DESCRIBE, WITH) plus 'return results'. It is clear and actionable, but it does not explicitly contrast itself with the sibling execute_query_to_file, so sibling differentiation is only implicit.

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

Usage Guidelines3/5

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

The description gives useful operational context: read-only queries, schema cache requirements, auto-refresh behavior, and when results spill to a file. However, it never explicitly states when to prefer this tool over execute_query_to_file or other siblings; the file-spill behavior implies it but does not provide direct routing guidance.

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