Skip to main content
Glama
chdb-io

chdb-mcp

Official
by chdb-io

query_file

Execute SQL queries on local Parquet, CSV, or JSON files by treating them as tables, enabling instant data analysis without a separate database.

Instructions

Query a local file (Parquet/CSV/JSON/…) as if it were a table.

The literal token {file} in sql is substituted with a file('path', 'format') table-function call before execution.

Example::

query_file(
    path="/data/sales.parquet",
    sql="SELECT region, sum(revenue) FROM {file} GROUP BY region",
    format="Parquet",
)

Args: path: Filesystem path. If CHDB_MCP_FILE_ALLOWLIST is set, the resolved path must sit under one of its prefixes. sql: Query body. Must contain the literal placeholder {file}. When CHDB_MCP_FILE_ALLOWLIST is set, the SQL is scanned before substitution; any extra table function call other than the placeholder (e.g. a UNION with file('/etc/passwd', ...) or a stray url()/executable()) is rejected. format: chDB file format hint. Common values: Parquet, CSV, CSVWithNames, JSONEachRow, Arrow.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
sqlYes
formatNoParquet

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

With no annotations, the description carries full burden. It discloses file format support, placeholder substitution behavior, and security scanning/rejection of malicious SQL when allowlist is set. 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 summary, example, and bulleted args. Slightly verbose (e.g., repeated allowlist explanations), but information density is high.

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 parameters, usage, and security comprehensively. Has output schema so return values are covered. Could mention error scenarios or performance implications, but given complexity it's fairly complete.

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%, but the description fully explains each parameter: path (with allowlist constraint), sql (must contain '{file}', scanning behavior), and format (hints with common values). This compensates for the bare schema.

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?

The description clearly states it queries local files (Parquet, CSV, JSON, etc.) as a table. It provides a concrete example with placeholders, distinguishing it from sibling tools like 'query' (which queries database tables) and 'describe_table'.

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?

It specifies when to use (querying local files) and explains the placeholder substitution and security allowlist. However, it does not explicitly contrast with alternatives or mention when not to use the tool.

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/chdb-io/chdb-mcp'

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