Skip to main content
Glama
postgres-readonly-mcp

postgres-readonly-mcp

by lmartin712

query

Run validated read-only SELECT statements against allow-listed PostgreSQL tables, rejecting unsafe or non-approved access and capping returned rows.

Instructions

Run one read-only SELECT (WITH ... SELECT is fine) against allow-listed tables.

Results are capped at the configured row limit; the response says if it was cut off.

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

Input Schema

NameRequiredDescriptionDefault
sqlYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.8/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 a lot of that work: it discloses that execution is read-only, limited to a single statement, restricted to allow-listed tables, and that output is truncated at a configured row limit with a truncation signal in the response. It does not cover error behavior (e.g., what happens on a disallowed table or syntax error) or auth/rate-limit requirements, which keeps it below a 5.

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 short sentences, both front-loaded with the most decision-relevant facts (read-only single SELECT, then the row cap and truncation signal). No filler wording.

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 one-parameter tool with no output schema and no annotations, the description covers the essentials an agent needs before calling: statement type, statement count, table restrictions, and result-size behavior. Remaining gaps are error semantics and dialect specifics, which are secondary.

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 0% for the sole 'sql' parameter, so the description must supply the semantics — and it partially does, clarifying that SELECT and WITH...SELECT constructs are acceptable and that only one statement is permitted. It does not address quoting, parameter binding/placeholders, or how the allow-listed table set is discovered, leaving real gaps for a query-string parameter.

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?

The description gives a specific verb and resource: 'Run one read-only SELECT ... against allow-listed tables', and adds that 'WITH ... SELECT is fine'. This makes clear it is the single data-fetching tool among siblings like list_tables and describe_table, though it never names a sibling explicitly.

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?

Usage is implied rather than stated: 'one read-only SELECT' sets the boundary of what to submit, and 'allow-listed tables' implies a constraint the agent must work within. There is no explicit when-to-use-this-vs-alternatives guidance (e.g., use describe_table first to discover table names or columns), so the agent must infer the workflow.

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