Skip to main content
Glama

query

Read-onlyIdempotent

Run read-only DuckDB SQL across one or many Excel/CSV files to join, aggregate, and analyze data, list available tables, and save results to a new file or sheet.

Instructions

Answer questions with SQL across one or MANY spreadsheet files at once (joins, aggregates, window functions, CTEs, PIVOT) using DuckDB. Read-only SELECT. Call without sql to see which tables exist. Use output (+ output_sheet) to save results to a new file or a new sheet.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "query"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlNoOne DuckDB SELECT (leave empty to list every table name and its columns). Tables: files in the root by name (sales.csv -> sales; book.xlsx -> book / book__sheetname), tables= aliases, or FROM 'dir/file.xlsx#Sheet'.
limitNoMax rows to return (default from server config, usually 100).
folderNoAuto-register every file in this folder by name (default: the root).
formatNojson = rows as arrays, records = list of objects, markdown = a table.json
offsetNoRow offset for paging.
outputNoSave the FULL result to this file (.xlsx/.csv/.parquet/.json/.md) instead of returning rows.
tablesNoOptional aliases: {'s': 'data/sales.xlsx#2024', 'c': 'crm/customers.csv'}. A list auto-names by file.
output_sheetNoWhen output is an existing .xlsx: write into this sheet (replaced if it exists), keeping other sheets.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.0

TDQS

A4.2/5.0
Behavior3/5

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

Annotations already declare readOnly, idempotent, non-destructive, and closed-world, so safety is covered structurally. The description adds real value beyond that: `output` redirects the full result away from the returned rows, and `output_sheet` replaces an existing sheet while preserving others. These are disclosed partly in the schema field descriptions rather than the main description, keeping this at solid-but-not-rich.

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?

Three sentences, front-loaded with capability and constraint, then the discovery mode, then the output mode. No filler or restatement of the tool name.

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?

For an 8-parameter query tool with no output schema, the description covers the main invocation modes (query, discovery, export) adequately. Minor gaps remain around paging behavior and default row limits, though those are delegated to schema field descriptions.

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 coverage is 100%, so the baseline is 3, but the description adds cross-parameter meaning the schema does not: omitting `sql` is the discovery mode, and `output` and `output_sheet` must be combined to write into an existing workbook sheet. That interaction guidance is genuinely additive.

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?

States a specific verb and resource ('Answer questions with SQL across one or MANY spreadsheet files') plus the execution engine (DuckDB) and supported SQL features (joins, aggregates, window functions, CTEs, PIVOT). The read-only SELECT constraint and multi-file scope clearly separate it from single-range or single-file siblings such as read_range or describe.

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?

Gives two concrete conditional behaviors: call without sql to enumerate tables, and use `output` with `output_sheet` to persist results. It implies the write operations belong elsewhere by restricting itself to read-only SELECT, but it never names an alternative sibling or states explicit when-not-to-use conditions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.