Skip to main content
Glama
ncejda-g2

Snowflake MCP Server

by ncejda-g2

save_last_query_to_csv

Exports the complete results of the most recently executed query to a CSV file. Includes column headers and handles null values.

Instructions

Save the last executed query results to a CSV file.

This tool exports the complete results from the most recently executed query
to a CSV file at the specified path. The query must have been executed
successfully and its results must be within the 5GB cache size limit.

Features:
- Exports ALL rows from the last query
- Includes column headers
- Uses comma delimiter
- Handles NULL values as empty strings
- Formats datetime values in ISO format
- Optionally exports the SQL query to a .sql file (enabled by default)

Parameters:
- 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
- export_sql: Whether to also export the SQL query to a .sql file (default: true)

Requirements:
- A query must have been executed successfully using execute_query
- Query results must be under 5GB (cache limit)

Examples:
- save_last_query_to_csv("~/Downloads/customers.csv")
- save_last_query_to_csv("/tmp/query_results.csv")
- save_last_query_to_csv("./data/export.csv", export_sql=false)

Notes:
- When export_sql is true, the SQL file will be saved with the same name as the CSV file
  but with a .sql extension (e.g., customers.csv → customers.sql)
- The SQL file will be formatted for readability with proper indentation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes
export_sqlNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

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

With no annotations, description carries full burden. Discloses all relevant behaviors: exports all rows, headers, delimiter, NULL handling, datetime format, optional SQL export, file path resolution, cache limit. No contradictions.

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 sections and bullet points, front-loads main purpose. Each sentence adds value; could be slightly trimmed 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?

Covers all aspects given complexity: purpose, requirements, parameters, behavior, examples. Output schema exists but description does not need to explain return values. Complete for a file-export tool.

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 coverage is 0%; description adds complete meaning. Explains file_path absolute vs relative, export_sql default and behavior (saves .sql with same name). Examples clarify usage.

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?

Description clearly states it saves last executed query results to a CSV file. Uses specific verbs and resource, distinguishes from siblings like execute_big_query_to_disk by specifying the trigger condition (last executed query).

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

Usage Guidelines4/5

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

Explicitly states requirements (query must have been executed successfully, results under 5GB). Provides examples of typical usage. Does not explicitly compare with sibling tools but implies context.

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