Skip to main content
Glama
Rheopyrin

db-access-mcp

query_to_file

Export SQL query results directly to CSV or JSONL files, handling large datasets without loading into context.

Instructions

Execute a SQL query and write the full result to a file (csv or jsonl) instead of returning rows — use this for large exports that must not go through the model context. Relative file_path resolves under the export dir (default /tmp/db-access-mcp/exports); absolute or ~-prefixed paths must fall under the export dir or a configured allow_export_paths root. Parent directories are created. Existing files are not overwritten unless overwrite=true. postgres/mysql stream rows (no row limit by default); redshift/mssql buffer in memory and are capped at 100000 rows.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSQL text to execute (single statement for streamed dialects)
formatNoOutput format; default inferred from the file extension
databaseNoDatabase to export from; required when the connection declares multiple databases
max_rowsNoOptional row cap for the export
file_pathYesTarget file path: relative to the export dir, or absolute/~ under an allowed export root
overwriteNoReplace the file if it already exists (default false)
connectionYesConnection key from connection_list
timeout_msNoQuery timeout (default from config)
Behavior5/5

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

No annotations provided, but description fully discloses file path resolution (relative, absolute, ~), parent directory creation, overwrite behavior, and dialect-specific streaming vs buffering with row caps (redshift/mssql 100k). 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.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, no wasted words. Front-loaded with purpose and use case, followed by key behavioral details in a single compact sentence. Very efficient.

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

Completeness4/5

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

Covers main behavioral aspects for a file-export tool: use case, path handling, dialect differences. However, it does not specify what the tool returns (e.g., success message or file path) despite no output schema. For a write command, the outcome is the file itself, so this is a minor gap.

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

Parameters4/5

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

Schema has 100% coverage, so baseline is 3. Description adds value by explaining file_path resolution rules, format default from extension, and overwrite default false. Also mentions dialect-specific row caps which relate to max_rows parameter.

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 executes a SQL query and writes result to CSV/JSONL file, distinguishing from the sibling 'query' tool by explicitly mentioning 'instead of returning rows'. The use case for large exports is specified.

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?

Description explicitly says to use for large exports not going through model context, implying alternatives. It details file path rules, overwrite behavior, and dialect-specific row limits. No explicit when-not-to-use but the context is sufficient.

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/Rheopyrin/db-access-mcp'

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