Skip to main content
Glama
pg-readonly-mcp

pg-readonly-mcp

by landaida

query

Executes a single read-only SELECT on allow-listed PostgreSQL tables and returns columns, rows, row count, truncation status, and duration. Use max_rows to lower the server row cap.

Instructions

Run ONE read-only SELECT against allow-listed tables.

Returns {columns, rows, row_count, truncated, duration_ms}. max_rows can only lower the server cap.

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
max_rowsNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.6/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 does disclose the key traits: read-only, single statement, allow-listed tables only, and that max_rows can only lower the server cap. It omits error behavior, what happens on truncation, and the actual default cap value, so it is helpful but not complete.

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?

Two short sentences, front-loaded with the hard constraint (ONE, read-only, allow-listed) before the return shape and the max_rows caveat. Nothing is wasted, though the phrasing is clipped enough to feel telegraphic.

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 two-parameter query tool with an output schema, this covers the essentials: what is permitted, what comes back, and the one parameter caveat. Remaining gaps (dialect, default row cap, error semantics) are modest, and the return shape is partly redundant with the output schema.

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 must compensate. It adds genuine meaning for max_rows ('can only lower the server cap' — a constraint absent from the bare 'Max Rows' title) and constrains the sql parameter to a single read-only SELECT over allow-listed tables, which the schema does not say at all.

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: 'Run ONE read-only SELECT against allow-listed tables'. The read-only + single-statement + allow-list constraints plus the sibling names (describe_table, list_tables) make it obvious this is the data-fetching tool, though it never explicitly frames itself against those siblings.

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 through constraints rather than stated: 'ONE' rules out multi-statement batches and 'read-only SELECT' rules out DDL/DML. However, it gives no guidance on when to prefer describe_table or list_tables first for schema discovery, nor what to do when a query is rejected.

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