Skip to main content
Glama

Run a read-only SQL query

db_query
Read-only

Run a read-only SQL query (SELECT, SHOW, DESCRIBE, EXPLAIN, WITH) against the project's database to inspect tables and data, with results capped at 50 rows.

Instructions

Run one SELECT/SHOW/DESCRIBE/EXPLAIN/WITH query against the project's database inside a read-only transaction. Results are capped at 50 rows; use LIMIT.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYesA single read-only SQL statement

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.4.1

TDQS

A4.6/5.0
Behavior5/5

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

Annotations only declare readOnlyHint=true; the description adds substantial behavior the annotation grid cannot express: execution inside a read-only transaction, exactly one statement, an enumerated allowlist of statement types, and a hard 50-row result cap with the LIMIT workaround. The row cap is the kind of silent-truncation trait an agent must know before calling.

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?

Two tight sentences: the first front-loads the operation and its constraints, the second front-loads the operational gotcha (row cap) with the remedy. No filler or restatement of the title.

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?

With one parameter and no output schema, the description covers the essentials: allowed statements, single-statement limit, read-only scope, and result cap. It omits error/timeout behavior and the result's column shape, which are minor gaps for a tool this simple.

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% and the single parameter is already documented as a read-only SQL statement, so the baseline is 3. The description adds genuine meaning by enumerating the accepted statement prefixes (SELECT/SHOW/DESCRIBE/EXPLAIN/WITH) and the one-statement constraint, going beyond the schema's generic phrasing.

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 (run) and resource (SQL query against the project's database) and enumerates exactly which statement classes are accepted. An agent can immediately distinguish this data-query tool from the sibling db_schema introspection tool.

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 clear operating context: one statement per call, read-only only, and 'use LIMIT' because output is capped. It does not, however, explicitly route the agent to db_schema when it needs to discover tables/columns rather than query data, so the when-not guidance is incomplete.

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