Skip to main content
Glama

read_query

Read-onlyIdempotent

Execute a read-only SQL query with row, time, and byte limits to retrieve CSV results, controlling context usage.

Instructions

Run one read-only SQL statement and get CSV back: a header row, data rows, then a '# N rows' trailer that says whether the result was truncated. Time-limited and capped in rows and bytes. Select only the columns you need and keep limit small: results cost context.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoRows to return, 1 to 1000.
queryYesOne SELECT statement (WITH ... SELECT, EXPLAIN and PRAGMA table_info(x) also work).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already cover the safety profile (readOnly, idempotent, non-destructive), yet the description adds substantial operational context: results are time-limited and capped in rows and bytes, and truncation is signaled by the '# N rows' trailer. These are behavior traits the agent cannot derive from the structured fields.

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?

Front-loaded with the action and return shape, then constraints, then a usage tip. Three sentences, no filler; every clause carries information the agent needs.

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?

With no output schema, the description fully compensates by describing the CSV structure (header row, data rows, trailer) and truncation semantics. Combined with annotations covering safety and the schema covering parameters, nothing required to call it correctly is missing.

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 baseline is 3, but the description adds a rationale beyond the schema by explaining that large limits cost context, giving the agent a reason to tune the limit parameter rather than just its bounds. Query format nuances (WITH/EXPLAIN/PRAGMA) live in the schema description.

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 ('Run one read-only SQL statement') and immediately discloses the return format ('get CSV back'). The 'read-only' qualifier distinguishes it from siblings write_query and destructive_query without the agent needing to inspect either schema.

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?

Provides practical operating guidance ('Select only the columns you need and keep limit small: results cost context') which tells the agent how to use it well. It never explicitly names an alternative tool or states when-not-to-use, but the read-only framing implicitly routes writes elsewhere.

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