Skip to main content
Glama

database_query

Read-only

Runs one read-only SQL statement (SELECT, WITH, VALUES or TABLE) against a Product's database and returns the rows as JSON. It runs as the Product's own database role inside a READ ONLY transaction with a 15 second timeout, so it cannot change anything and cannot see another Product's data. At most limit rows come back (default 100, maximum 1000); truncated says whether there were more. Use it to inspect schema (information_schema.columns) and data before deciding on a change, then database_execute to change it. Reads are not audited.

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": {
      "productId": "<productId>",
      "databaseId": "<databaseId>",
      "sql": "<sql>"
    },
    "name": "database_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlYesOne statement. A trailing semicolon is fine; a second statement is refused.
limitNoMost rows to return.
productIdYesProduct identifier, e.g. prd_7k2m9x4qw1nv8bz3ct6d.
databaseIdYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior4/5

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

Goes well past the readOnlyHint/destructiveHint annotations by disclosing execution context: the Product's own database role, a READ ONLY transaction, a 15 second timeout, tenant isolation, and that reads are not audited. The one gap is that idempotentHint=false is left unexplained and nothing is said about error/failure behavior on timeout or refused statements, so it falls short of a 5.

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?

Four tight sentences ordered from what it does, to safety constraints, to result shaping, to when to use it and what to use instead. No filler, and the most decision-relevant facts are front-loaded.

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 no output schema, the description correctly explains the return shape (JSON rows) and the truncation signal, plus timeout and isolation semantics an agent needs before calling. Minor omissions around failure modes on timeout or rejected SQL keep it from being complete.

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?

Adds meaning the schema lacks: what a trailing semicolon does versus a second statement being refused, that productId scopes access so no other Product's data is visible, and that `truncated` reports whether more rows existed beyond `limit`. It restates the default 100 / maximum 1000 already documented in the schema and says nothing about databaseId, so it is not fully additive.

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 and resource ('Runs one read-only SQL statement ... against a Product's database'), enumerates the accepted statement types, and implicitly separates itself from database_execute, which it names explicitly.

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?

Gives an explicit when-to-use recipe: inspect schema via information_schema.columns and data before deciding on a change, then use database_execute to change it. The alternative and the condition that selects it are both spelled out.

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