Skip to main content
Glama
milad-codes

pg-readonly-mcp

by milad-codes

Run a read-only query

run_query
Read-onlyIdempotent

Run a single parameterized SELECT in a read-only PostgreSQL transaction with timeouts and row caps; unsafe writes, DDL, and side-effecting functions are refused.

Instructions

Runs one SELECT (WITH, VALUES, UNION allowed) in a read-only transaction with a time limit and returns at most 200 rows. Writes, DDL, locking clauses, system catalogs and side-effecting functions are refused with an explanation.

Input Schema

NameRequiredDescriptionDefault
sqlYesA single SELECT statement; use $1, $2 … for values
limitNoMaximum rows to return (≤ 200)
paramsNoValues for $1, $2 …

Output Schema

NameRequiredDescriptionDefault
rowsYes
columnsYes
rowCountYes
truncatedYes
durationMsYes
redactedColumnsYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.1

TDQS

A4.3/5.0
Behavior5/5

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

Adds substantial behavior beyond the annotations: a time limit, a hard 200-row ceiling, the allowed clause forms (WITH, VALUES, UNION), and that rejected statements come back with an explanation rather than a bare error. That tells the agent both the guardrails and how failures surface.

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 tight sentences, no filler, and the core capability and row cap are front-loaded ahead of the refusal list. Every clause carries information an agent needs.

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?

The tool is simple, all parameters are schema-described, an output schema exists, and the description still covers the important constraints (single statement, row cap, refused constructs). Nothing needed to call it correctly is missing.

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%, so sql, limit and params are already documented in the schema, giving a baseline of 3. The description's 'at most 200 rows' corroborates the limit maximum but adds no syntax or usage detail the schema lacks.

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?

States a specific verb and resource ('Runs one SELECT ... returns at most 200 rows') and pins the accepted statement forms, so the agent knows exactly what it does. It does not name any sibling, so the boundary with explain_query (for plans rather than results) is left for the agent to infer.

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?

Explicitly enumerates what is refused (writes, DDL, locking clauses, system catalogs, side-effecting functions), which is effectively a when-not-to-use list. It never points at an alternative such as explain_query or describe_table for schema inspection, so routing between siblings is inferred.

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