Skip to main content
Glama
igorolv

jdbc-mcp-server

executeQuery

executeQuery
Read-onlyIdempotent

Run read-only SQL SELECT, WITH, or EXPLAIN queries to retrieve actual result rows, with safe parameter binding and row limits.

Instructions

Run a read-only SQL SELECT / WITH / EXPLAIN when actual result rows are needed. Use timedQuery for one timed execution or benchmarkQuery for repeated latency measurements. Bind '?'->params, ':name'->namedParams; never mix. E.g. :status -> namedParams={status:'PAID'} — key is the bare name. Sets 'truncated' when the row cap is hit.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYes
limitNoRow limit (default: the connection's maxRows).
paramsNoValues for '?' placeholders, in order.
connectionYesDatabase to run against. Call listConnections for valid names; do not guess.
namedParamsNoValues for ':name' placeholders, keyed by name.
timeoutSecondsNoTimeout in seconds (default: the connection's queryTimeoutSeconds).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
rowsNoRows.
columnsNoColumns.
rowCountYesRow Count.
truncatedYesTruncated.
columnTypesNoColumn Types.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.2.0
    • changedInput schema / properties / limit / description
      Previous value: -"Row limit (default JDBC_MAX_ROWS)."New value: +"Row limit (default: the connection's maxRows)."
    • changedInput schema / properties / timeoutSeconds / description
      Previous value: -"Timeout in seconds (default JDBC_QUERY_TIMEOUT_SECONDS)."New value: +"Timeout in seconds (default: the connection's queryTimeoutSeconds)."
  2. First observedv0.1.0

TDQS

A4.7/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false and openWorldHint. The description goes beyond them by explaining the truncation behavior ('Sets truncated when the row cap is hit') and the placeholder-binding contract, which annotations cannot convey.

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?

Every sentence earns its place: capability, alternatives, binding rules with example, and truncation note. It is front-loaded with the core purpose before the routing and parameter detail.

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?

With an output schema present, return values need not be described, yet the description still flags the truncated field. Combined with the binding semantics and alternative routing, an agent has everything needed to invoke it correctly against a 6-parameter, nested-object tool.

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 83% (baseline 3), but the description adds real meaning: it maps '?' to params and ':name' to namedParams, warns never to mix them, and gives a concrete example showing the key is the bare name rather than the ':name' token. That resolves genuine ambiguity the schema leaves open.

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 (Run) plus the exact resource/scope (read-only SQL SELECT / WITH / EXPLAIN) and the condition (when actual result rows are needed). It also explicitly distinguishes itself from the sibling alternatives timedQuery and benchmarkQuery.

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?

Names two alternatives and the condition that selects each: timedQuery for a single timed execution, benchmarkQuery for repeated latency measurement. The agent is told when to use this tool versus those siblings without inference.

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