Skip to main content
Glama
eklemen
by eklemen

run_readonly_query

Execute read-only SQL queries like SELECT, EXPLAIN, and SHOW on PostgreSQL, with automatic validation to block any write or DDL operations.

Instructions

Execute a single read-only SQL query (SELECT / EXPLAIN-without-ANALYZE / SHOW). The query is validated with a real PostgreSQL parser and rejected if it contains any write, DDL, data-modifying CTE, multiple statements, or other side effect. Results are capped at the server row maximum. Returns columns, rows, row count, execution time, and a truncation flag.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYesThe read-only SQL query to execute.
limitNoMaximum rows to return. Capped at the server row maximum.
Behavior5/5

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

With no annotations, the description fully covers behavior: query validation, rejection of side effects, result capping, and return fields (columns, rows, count, time, truncation). No contradictions.

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?

Two sentences, front-loaded with the core action, followed by necessary detail. Every sentence adds value without redundancy.

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?

Despite no output schema, the description enumerates return fields. It covers all user needs for a read-only query tool: allowed queries, validation behavior, result limits, and output structure.

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%, baseline 3. The description repeats the schema's explanation for limit but adds context about validation for the sql parameter. It does not significantly enhance understanding beyond the schema.

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 description clearly states 'Execute a single read-only SQL query' and specifies allowed types: SELECT, EXPLAIN-without-ANALYZE, SHOW. This distinguishes it from sibling tools like describe_table or list_tables, which are specific operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit validation rules and rejection conditions, but does not explicitly contrast with sibling tools or state when to prefer this tool over them. The context is implied but not spelled out.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/eklemen/db-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server