Skip to main content
Glama
arthurxavier106

duckdb-analytics-mcp

query

Read-onlyIdempotent

Execute read-only SELECT statements against a DuckDB warehouse to fetch row results, with enforced limits and clear truncation notices.

Instructions

Run one read-only SELECT against the warehouse and return the rows.

Enforcement, in order: the statement is parsed and rejected unless it is a single SELECT; a LIMIT is injected if absent and lowered if it exceeds the server cap; execution is cancelled if it exceeds the time limit. When the result is truncated, the true total is counted and reported -- the output never implies it is complete when it is not.

Prefer aggregating in SQL over selecting raw rows. SELECT count(*), avg(x) costs a handful of tokens; SELECT * costs hundreds and usually answers less.

Args: sql (str): One SELECT statement in DuckDB SQL. max_rows (Optional[int]): Per-call row cap, clamped to the server cap (default 200). response_format (ResponseFormat): 'markdown' (default) or 'json'.

Returns: str: For 'markdown', an unpadded markdown table followed by a row-count footer that discloses truncation. For 'json', an object: { "columns": [str], "rows": [[Any]], "row_count": int, # rows returned "total_rows": int|null, # true total when truncated "truncated": bool, "elapsed_ms": float }

On failure: "Error: <message>" naming the recovery path.

Examples: - Use when: "What was revenue by month in 2025?" -> aggregate in SQL. - Use when: "Show me 10 example rows from orders." - Don't use when: you do not yet know the column names (call describe_table first -- it is cheaper than a failed query).

Error Handling: - Non-SELECT statements, multiple statements, and filesystem functions are rejected before execution. - Queries exceeding the time limit are cancelled, not left running. - Unknown columns return DuckDB's message, which names the candidates.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYesOne SELECT statement in DuckDB SQL. CTEs, joins, window functions and UNION are supported. Anything that writes (INSERT, UPDATE, DELETE, CREATE, DROP, COPY, ATTACH, PRAGMA) is rejected, as are multiple statements separated by semicolons.
max_rowsNoRow cap for this call. Defaults to the server cap (WAREHOUSE_MAX_ROWS, 200 by default) and can never exceed it.
response_formatNo'markdown' (default) is compact and cheap to read. 'json' returns columns and rows verbatim for programmatic use, at roughly 2-3x the token cost.markdown

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

Beyond the readOnlyHint and idempotentHint annotations, the description discloses important enforcement behaviors: non-SELECT statements are rejected, LIMIT is injected or clamped, time limits cancel execution, and truncation is explicitly reported with total_counts. This gives the agent a detailed model of what will happen and why.

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?

Although long, the description is dense and well-structured, with sections for enforcement, usage guidance, arguments, return values, examples, and error handling. Every section adds practical information and the key purpose and safety characteristics are front-loaded in the first sentence.

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?

The description fully covers the tool's complexity: it explains safety enforcement, truncation semantics, error recovery paths, concrete examples for appropriate use, and output formats. The presence of an output schema does not reduce the need for this behavioral context, and the description delivers it comprehensively.

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?

The input schema already has 100% parameter coverage with detailed descriptions, so the baseline is 3. The description adds extra meaning by explaining the enforcement behavior of max_rows (clamped and lowered), the token-cost tradeoff of response_format, and the concrete return shapes associated with each format, going beyond the schema's field-level definitions.

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 opening sentence clearly states the tool runs one read-only SELECT against the warehouse and returns rows, specifying both the verb and resource. It distinguishes itself from sibling metadata tools like describe_table and list_datasets by being the SQL query tool for actual data retrieval.

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 when-to-use and when-not-to-use guidance, including direct examples like aggregating in SQL versus selecting raw rows and calling describe_table first when column names are unknown. It also says what not to use the tool for, making it easy for an agent to choose among 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/arthurxavier106/duckdb-analytics-mcp'

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