Skip to main content
Glama
ncejda-g2

Snowflake MCP Server

by ncejda-g2

Execute Query To File

execute_query_to_file

Run read-only SQL and write results to a CSV or TSV file at your chosen path, allowing you to share or persist query output.

Instructions

Writes read-only query results to a file at a path you choose.

Use when the result needs to land at a specific path -- to share or persist.
Format follows the extension: `.csv` writes CSV (NULL = empty field);
anything else writes TSV (same as execute_query: tab-delimited, NULL = `\N`).

Parameters:
- sql: read-only SQL (SELECT, SHOW, DESCRIBE, WITH)
- file_path: output path (absolute recommended; end with `.csv` for CSV,
  else `.tsv` is used/appended)
- database: optional database context
- schema: optional schema context
- timeout_seconds: query timeout (default 300, max 3600)

Requires a populated schema cache. Will not overwrite an existing file.

Example: execute_query_to_file("SELECT * FROM t", "/tmp/export.csv")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYes
schemaNo
databaseNo
file_pathYes
timeout_secondsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv1.0.3
    • addedInput schema / additionalProperties
      Added value: +false
    • removedInput schema / properties / database / title
      Removed value: -"Database"
    • removedInput schema / properties / file_path / title
      Removed value: -"File Path"
    • removedInput schema / properties / schema / title
      Removed value: -"Schema"
    • removedInput schema / properties / sql / title
      Removed value: -"Sql"
    • removedInput schema / properties / timeout_seconds / title
      Removed value: -"Timeout Seconds"
  2. Addedv1.0.0

TDQS

A5/5.0
Behavior5/5

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

With no annotations provided, the description carries the full behavioral burden and does so well. It discloses that the SQL must be read-only, that a populated schema cache is required, and that existing files will not be overwritten. It also explains extension-dependent formatting and NULL representation, which are non-obvious behaviors.

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 front-loaded with the core action, followed by targeted when-to-use guidance, format rules, parameter details, and a concrete example. Every sentence contributes information, and the parameter list is compact without unnecessary filler.

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 five-parameter tool with no annotations and no output schema, the description covers prerequisites, formatting, side-effect safety (no overwrite), supported SQL types, timeout limits, and an example call. This is sufficient for an agent to invoke the tool correctly and anticipate its behavior.

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

Parameters5/5

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

The input schema provides no textual descriptions, but the description documents all five parameters: sql's allowed statement types, file_path's output semantics and extension-based format selection, optional database/schema context, and timeout_seconds defaults and maximum. This goes well beyond the schema's raw types.

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?

Opens with a concrete verb and resource: 'Writes read-only query results to a file at a path you choose.' It clearly distinguishes itself from execute_query by focusing on the file-output behavior, and it is not merely a restatement of the tool name.

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

Usage Guidelines5/5

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

Explicitly states when to use it: 'Use when the result needs to land at a specific path -- to share or persist.' It also references execute_query as the format baseline, giving agents a clear sibling comparison and an implied alternative when file output is not needed.

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