Skip to main content
Glama
db-conn-mcp

db-conn-mcp

execute_read_query

Run read-only SELECT queries in a read-only transaction with safe bind parameters and an optional timeout to retrieve data without modifying the database.

Instructions

Run a read-only SELECT query (enforced as a read-only transaction).

Know the schema before you query: if the exact table and column names are not already in this conversation, call get_table_schema (or list_tables / find_columns) first instead of guessing — a wrong name costs a failed round-trip. Don't re-fetch a schema you already have.

ALWAYS pass user-supplied values via params with $1/$2/... placeholders in the SQL (real driver bind parameters — no quoting/injection pitfalls), not by pasting them into the SQL string. Optional timeout_ms cancels an overrunning query.

Rows arrive on the text channel only, inside the untrusted-data banner: this tool emits no structuredContent.

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": {
      "database": "<database>",
      "sql": "<sql>"
    },
    "name": "execute_read_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlYes
paramsNo
databaseYes
timeout_msNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

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 behavioral burden and does substantial work: read-only transaction enforcement, bind-parameter semantics with injection rationale, timeout cancellation, and the fact that rows return only on the text channel inside an untrusted-data banner with no structuredContent. The notable omission is result-set size behavior — nothing says whether large results are truncated or whether the agent should switch to open_query_cursor/fetch_rows.

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?

Content is front-loaded with the action, then prerequisites, then parameter convention, then output-channel note — a sensible ordering. It is slightly verbose in the schema-discovery paragraph, but every line carries operative information rather than filler.

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?

For a tool with no annotations and no output schema, the description covers safety posture, invocation convention, and return channel well. It falls just short on two things an agent needs for correct use: the meaning of the required `database` argument and how to handle oversized result sets given the cursor-based siblings.

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 description coverage is 0%, so the description must compensate, and it explains three of four parameters well: `sql` (SELECT-only), `params` (positional $1/$2 driver bind placeholders), and `timeout_ms` (cancels an overrunning query). The required `database` parameter is never mentioned, leaving one required input with no semantic guidance beyond its name.

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 opening sentence names a specific verb and resource ('Run a read-only SELECT query') and immediately constrains scope with 'enforced as a read-only transaction', which cleanly separates it from the sibling execute_write_query. An agent can identify the tool's job without opening the schema.

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 prerequisites (call get_table_schema / list_tables / find_columns when names are unknown), an explicit negative case ('Don't re-fetch a schema you already have'), and names the concrete alternatives rather than leaving routing to inference. It also states the required calling convention for user-supplied values via `params`.

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