Skip to main content
Glama

Read a database with SQL

query_database
Read-onlyIdempotent

A read-only SQL query on one of the project's PostgreSQL databases; format short (default; a cut response says how to read the rest), detailed (wider limits) or csv (an export).

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "sql": "<sql>"
    },
    "name": "query_database"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlYesA read statement.
limitNoRow cap: short 200, detailed 400 (2,000 at most); csv 10,000 (50,000).
trialNoThe key returned by the call that created the trial (deploy_app, upload_source or write_files: trial_key), passed again on each call.
formatNoThe response format.short
projectNoThe project.
databaseNoName of the database (databases[].name); the first declared by default.
max_bytesNoByte limit: short 40 KB, detailed and csv 200 KB.
environmentNoProduction or a preview.production
timeout_secondsNoQuery timeout.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / trial / description
      Previous value: -"The key returned by the first deploy_app (trial_key), passed again on each call."New value: +"The key returned by the call that created the trial (deploy_app, upload_source or write_files: trial_key), passed again on each call."
  2. First observed

TDQS

A3.5/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint and destructiveHint=false, so the safety profile is covered. The description adds genuine value by explaining that truncated responses self-document how to read the remainder and that each format carries different limits. It omits error behavior, whether the query is validated/rejected for writes, and the trial-key gate needed on each call.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single tight sentence with the core purpose front-loaded and the format detail relegated to a parenthetical. Every clause carries information, though the nested parentheses make it slightly denser than necessary.

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?

Nine parameters with 9 fields documented, but 100% schema coverage and clear annotations mean the description needn't restate them. It covers the essential shape (read-only, formats, truncation) for a query tool with no output schema; the format/enum discrepancy is the main completeness defect.

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

Parameters3/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. The description adds meaning to the format parameter (short default, per-format row/byte ceilings, truncation handling), but it lists 'csv' as a third format while the schema enum only permits ['short','detailed'] – a conflict that could mislead the agent into sending an invalid value.

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+resource: a read-only SQL query against one of the project's PostgreSQL databases. That distinguishes it well from siblings like backup_database or read_source, though it never names an alternative explicitly.

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?

Usage is implied rather than stated: 'read-only' tells the agent writes are out of scope, and the format list implies choosing based on output needs. There is no explicit guidance on when to prefer this over backup_database or explain_access, nor on prerequisites such as a trial key.

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