Skip to main content
Glama
ncejda-g2

Snowflake MCP Server

by ncejda-g2

execute_big_query_to_disk

Execute large read-only SQL queries and stream results directly to a CSV file, avoiding token limit issues by saving to disk. Returns execution status and file details.

Instructions

Execute a large read-only SQL query and save results directly to a CSV file.

This tool is designed for queries that return large result sets that would exceed
token limits. It streams results directly to disk without returning the data in
the response, avoiding token limit issues.

Features:
- Streams results directly to disk (doesn't return data in response)
- Handles arbitrarily large result sets using streaming
- Returns only execution status, row count, and file size
- Exports SQL query to a .sql file alongside the CSV
- Configurable timeout for long-running queries

Parameters:
- sql: The SQL query to execute (must be read-only)
- file_path: Path where the CSV file should be saved (absolute paths recommended)
             Note: Relative paths are resolved from the MCP server's working directory
- database: Optional database context
- schema: Optional schema context
- timeout_seconds: Query timeout in seconds (default: 300, max: 3600)

Requirements:
- Schema cache must be populated (run refresh_catalog first)
- Query must be read-only (SELECT, SHOW, DESCRIBE, WITH)
- Files must not already exist (will not overwrite)

Examples:
- execute_big_query_to_disk("SELECT * FROM large_table", "~/Downloads/large_data.csv")
- execute_big_query_to_disk("SELECT * FROM sales_data", "/tmp/sales.csv", timeout_seconds=600)

Notes:
- CSV file uses comma delimiter, includes headers, empty string for NULLs
- SQL file is created only after successful CSV export
- Partial files are cleaned up on error

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYes
file_pathYes
databaseNo
schemaNo
timeout_secondsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

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

No annotations provided, so description fully carries the burden. Details streaming to disk, no data returned, status/row count/file size output, SQL file export, configurable timeout, CSV format, and cleanup on error.

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?

Well-structured with clear sections and front-loaded key info. Slightly verbose but appropriate for complexity. Could tighten examples or notes, but still efficient.

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?

Comprehensive coverage of behavior, edge cases (partial cleanup, no overwrite), prerequisites (catalog refresh), and output format descriptions. Output schema exists, so return value details are unnecessary.

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?

Schema description coverage is 0%, but description adds rich meaning for all 5 parameters: sql must be read-only, file_path absolute/relative explanation, database/schema as optional context, timeout_seconds with defaults and max.

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?

Clearly states 'Execute a large read-only SQL query and save results directly to a CSV file.' Identifies specific verb+resource and distinguishes from siblings like execute_query by emphasizing large result sets and streaming to disk.

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: 'for queries that return large result sets that would exceed token limits.' Lists requirements (schema cache populated, read-only queries, no overwrite) and implies alternative tools for smaller queries.

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/ncejda-g2/snowflake_mcp_server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server