Skip to main content
Glama

Query a data file with SQL

sql_query
Read-only

Run read-only SQL SELECT queries on local CSV, Parquet, Excel, or JSON files, returning results as a Markdown table while ensuring the file is never modified.

Instructions

Run a read-only SQL SELECT over a local data file and get a Markdown table back. Supports: SELECT * | | aggregates COUNT/SUM/AVG/MIN/MAX, WHERE (=, !=, >, >=, <, <=, LIKE, IN) with AND, GROUP BY, ORDER BY [ASC|DESC], LIMIT, OFFSET. The table name in FROM is ignored (single-table). No writes, no arbitrary SQL execution — the query string is compiled to a safe read-only plan (no eval), and the file is never modified.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYesA single SELECT statement, e.g. `SELECT species, AVG(body_mass_g) AS avg_mass FROM t GROUP BY species ORDER BY avg_mass DESC LIMIT 5`. Column names must match the file's headers.
pathYesPath to the data file.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.15.0

TDQS

A4.2/5.0
Behavior5/5

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

Beyond the readOnlyHint annotation, the description discloses that the query is compiled to a safe read-only plan, uses no eval, never modifies the file, and ignores the table name in FROM. This gives the agent a strong, accurate model of the tool's execution behavior and safety guarantees.

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 dense but efficient: it front-loads the core purpose, then lists the supported SQL dialect, then clarifies the important table-name caveat and safety behavior. Every sentence adds value, and the length is appropriate for a tool with a non-trivial query grammar.

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 purpose, input semantics, supported operations, safety, and return format. There is no output schema, but the description explicitly states the output is a Markdown table. No critical gap remains for an agent to select and invoke this tool correctly.

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 covers both parameters with 100% description coverage, including a SQL example for the sql parameter. The description adds meaningful non-obvious semantics by stating that the table name in FROM is ignored, clarifying the single-table constraint beyond what the schema provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb ('Run'), resource ('a local data file'), and mechanism ('SQL SELECT'), and confirms the output is a Markdown table. However, it does not explicitly distinguish itself from the sibling 'query_data' tool, so it is clear but lacks explicit sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Use is implied: this is the tool for read-only SQL SELECT queries over a data file. The description also lists the supported SQL subset, which helps an agent know what queries are possible, but it never names alternatives or states when NOT to use this tool in favor of a sibling such as query_data or preview_data.

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