Skip to main content
Glama

db_query

Execute read-only SQL queries against the app-under-test database to inspect its data; returns columns, rows, and total row count (capped at 200).

Instructions

Executes a read-only query (SELECT/WITH/EXPLAIN/PRAGMA) against the app-under-test database. Pass the connection in db (SQLite path or "file:" / postgres:// URL); otherwise the engine-side YATT_APP_DB/--app-db configuration applies. Returns {columns, rows, totalRows}; rows are capped at 200.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dbNoConnection: SQLite path or "file:" / postgres:// URL (overrides the global configuration)
sqlYesRead-only SQL query (SELECT, WITH, EXPLAIN or PRAGMA)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and delivers: it explicitly states the operation is read-only, caps rows at 200, and defines the return shape {columns, rows, totalRows}. It also discloses the connection fallback behavior. This goes beyond a simple action statement.

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 sentences with zero redundancy. The first sentence states the action and scope; the second covers connection override, return shape, and row cap. All information is front-loaded and essential.

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?

For a two-parameter read-only query tool, the description covers everything needed: supported SQL verbs, connection handling, return format, and row limit. No gaps remain for an agent to call it 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?

Schema coverage is 100%, so the schema documents both parameters. The description adds meaningful context: it clarifies that 'db' is a connection string (SQLite path or URL) that overrides the global config, and that 'sql' must be a read-only query. This adds value beyond the schema's brief descriptions.

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?

The description uses a specific verb ('Executes') with a clear resource ('read-only query... against the app-under-test database'), and explicitly enumerates the supported SQL verbs (SELECT/WITH/EXPLAIN/PRAGMA). This clearly distinguishes it from sibling tools, none of which handle raw database access.

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?

The description provides clear context: it explains the db parameter overrides the global configuration, and notes the fallback to YATT_APP_DB/--app-db. It also limits usage to read-only queries. While it doesn't name an alternative (none exists among siblings), the guidance is sufficient for correct usage.

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