Skip to main content
Glama

execute_readonly_query

Run SELECT or WITH SQL statements against a named database connection to return query rows, with row limits and positional parameters. Rejects non-read statements.

Instructions

Execute a read-only SQL query.

Args: datasource: Database connection name. query: SELECT/WITH statement. params: Positional parameters. max_rows: Maximum rows to request.

Returns: Query rows or a rejection payload for non-read statements.

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": {
      "datasource": "<datasource>",
      "query": "<query>"
    },
    "name": "execute_readonly_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryYes
paramsNo
max_rowsNo
datasourceYes

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.5/5.0
Behavior3/5

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

With no annotations, the description carries the full burden, and it does disclose the key safety behavior: non-read statements are rejected with a payload rather than executed. It says nothing about required permissions, execution timeouts, whether max_rows is enforced server-side, or whether the rejection is an error or a returned value.

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?

The purpose sentence is front-loaded and the Args block is scannable. The 'Returns:' line is largely redundant with the output schema, and the Args block restates parameter names verbatim, but nothing is padded beyond what a docstring convention requires.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Return values are covered by the output schema, so the description needn't explain them, and the read-only boundary is stated. For a database-executing tool with no annotations, however, it omits operating constraints an agent needs: permissions, timeout/cancellation behavior, and whether max_rows is a hint or a hard cap.

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 0%, so the description is the only source of parameter docs, and it glosses all four: datasource as a connection name, query restricted to SELECT/WITH, params as positional, max_rows as a row request cap. The weak point is 'Positional parameters,' which gives no placeholder syntax (e.g. %s vs ?) for actually binding values.

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?

Specific verb plus resource: 'Execute a read-only SQL query,' with an explicit constraint (SELECT/WITH only) that the name alone would not convey. It is distinct from the named-query siblings (create/read/write_named_query) because it takes a datasource and an ad-hoc query, though it never names those alternatives.

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?

The read-only restriction and the 'rejection payload for non-read statements' imply when the tool applies and when a call will fail, which is implicit usage guidance. There is no statement about when to prefer this over the named-query tools or what to do when the query needs parameters versus literal values.

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

Deploy Server

Other Tools