Skip to main content
Glama

Query database (read-only)

query_sql
Read-onlyIdempotent

Run ONE read-only SQL statement against the project's managed PostgreSQL database and return its rows — the same path as the dashboard DB console's read mode. Accepts a single statement starting with SELECT, WITH, EXPLAIN, SHOW, TABLE or VALUES; any ';' other than a trailing one is refused, even inside a string literal. Runs inside a PostgreSQL READ ONLY transaction, so a statement that tries to write fails in the database. Limits: 500 rows (truncated=true past that) and a 5-second statement timeout. Uses the project's own tenant credentials. Use execute_sql for INSERT, UPDATE, DELETE or schema changes.

Input Schema

NameRequiredDescriptionDefault
sqlYesONE read-only PostgreSQL statement starting with SELECT, WITH, EXPLAIN, SHOW, TABLE or VALUES. No ';' except a trailing one
project_idYesthe project id (from list_projects)

Output Schema

NameRequiredDescriptionDefault
rowsYes
columnsYes
truncatedNo
project_idYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.9/5.0
Behavior5/5

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

Although annotations already declare readOnlyHint=true and destructiveHint=false, the description adds substantial behavioral detail: READ ONLY transaction enforcement, a 500-row truncation limit, a 5-second statement timeout, tenant credentials, and the semicolon restriction even inside string literals. These are meaningful operational traits beyond the annotations.

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 and front-loaded: purpose first, then statement restrictions, then execution limits, then the execute_sql alternative. Every sentence adds operational value and there is no filler.

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?

Given that an output schema exists, the description need not explain return values. It covers the critical invocation constraints, safety behavior, limits, credentials, and alternative tool, so an agent has everything needed 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 baseline is 3, but the description adds useful semantics for the sql parameter: exactly one statement, allowed starting keywords, trailing-semicolon-only rule, and the fact that semicolons inside string literals are also refused. It does not elaborate on project_id beyond what the schema already says.

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 states a specific verb and resource: run one read-only SQL statement against the project's managed PostgreSQL database and return rows. It also explicitly distinguishes itself from execute_sql, making sibling selection clear without opening schemas.

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

Usage Guidelines5/5

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

It gives explicit when-to-use guidance and names the alternative: use execute_sql for INSERT, UPDATE, DELETE, or schema changes. The read-only scope and allowed statement prefixes further clarify appropriate use.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources