Skip to main content
Glama
chdb-io

chdb-mcp

Official
by chdb-io

query

Execute SQL queries against the in-process chDB OLAP engine to analyze data from Parquet, CSV, JSON, and pandas DataFrames. Returns results in multiple formats with configurable limits.

Instructions

Execute an arbitrary SQL statement against the chDB session.

Use ClickHouse SQL dialect. Common formats: JSONCompact (default), CSVWithNames, TabSeparatedWithNames, Pretty. The result is truncated at CHDB_MCP_MAX_RESULT_BYTES (default 1 MiB) and the query is aborted after CHDB_MCP_QUERY_TIMEOUT_SEC seconds (default 30).

Args: sql: Any read-only SQL (SELECT/SHOW/DESCRIBE/EXPLAIN). Writes require CHDB_MCP_WRITE=1. When CHDB_MCP_FILE_ALLOWLIST is set, any table function that isn't on the safe-by-construction list (numbers/values/view/merge/dictionary/etc.) is rejected — that includes file/url/s3/remote/executable/python and every other external-reach function chDB exposes. Use query_file() for files instead. format: Output format passed to chDB. Defaults to JSONCompact.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYes
formatNoJSONCompact

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

With no annotations provided, the description fully discloses behavioral traits: result truncation limit (CHDB_MCP_MAX_RESULT_BYTES), query timeout (CHDB_MCP_QUERY_TIMEOUT_SEC), write permission requirement (CHDB_MCP_WRITE=1), and safety restrictions for external functions under CHDB_MCP_FILE_ALLOWLIST.

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 well-structured and concise, using a paragraph for core usage and bullet points for details. Every sentence provides necessary information without redundancy, making it efficient for an agent to parse.

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?

Given the complexity of executing arbitrary SQL with security constraints, the description is remarkably complete. It covers execution limits, write permissions, file allowlist restrictions, format options, and the existence of an output schema reduces the need to explain return values.

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 the description compensates thoroughly. The sql parameter is explained with read-only vs write usage, and the format parameter is described with default value and common formats list. This adds significant meaning beyond 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 'Execute an arbitrary SQL statement against the chDB session' which is a specific verb+resource. It distinguishes from sibling tools like query_file by explicitly directing users to that tool for file operations.

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?

The description provides explicit guidance on when to use this tool: for read-only SQL by default, with writes requiring a specific environment variable. It also notes that many table functions are rejected when a file allowlist is set, and directs users to query_file() for files, effectively differentiating from siblings.

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