Skip to main content
Glama
fb0sh
by fb0sh

db_query

Run read-only SELECT, SHOW, EXPLAIN, or WITH statements against a configured database connection and return the resulting rows.

Instructions

Run a read-only SQL statement (SELECT/SHOW/EXPLAIN/read-only WITH) and return rows.

Input Schema

NameRequiredDescriptionDefault
sqlYes
limitNo
paramsNo
connection_idYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3/5.0
Behavior2/5

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

No annotations exist, so the description carries the full behavioral burden. It discloses the read-only enforcement and the allowed statement classes, but says nothing about what happens when a write statement is submitted (rejection vs. error message), whether a connection must be pre-opened, permission requirements, row-count limits, or what the returned rows look like.

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?

A single front-loaded sentence with zero filler; the read-only constraint and accepted statement types come first. Nothing is redundant or padded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a four-parameter query tool with no annotations and no output schema, the description leaves too much unstated: parameter roles, connection lifecycle, and result/pagination behavior. It is a good one-line summary but not a complete operating contract.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% across four parameters, and the description compensates only for 'sql' by naming statement types. It never explains connection_id (is it from list_connections/open_connection?), limit (row cap? default?), or params (bind-variable array vs. positional placeholders) — exactly the fields an agent is most likely to misuse.

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?

States a specific verb and resource ('Run a read-only SQL statement') and enumerates the accepted statement forms (SELECT/SHOW/EXPLAIN/read-only WITH), which sharply bounds what the tool does. It does not name or differentiate against the sibling db_execute, so an agent must infer the read/write split from the read-only qualifier alone.

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?

The read-only framing implies when to reach for this tool versus a mutating one, but no alternative is named. With db_execute sitting in the sibling list, the agent is left to guess whether db_execute handles writes or is a different execution mode entirely.

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