Skip to main content
Glama
pg-readonly-mcp

pg-readonly-mcp

by vinit1009

run_query

Read-onlyIdempotent

Execute a read-only PostgreSQL SELECT and return columns and rows, capped by a row limit with truncation status; writes, multiple statements, and non-allow-listed tables are refused.

Instructions

Run one read-only SQL SELECT (PostgreSQL dialect) and return columns and rows. At most limit rows come back (capped by the server's row limit); truncated says whether more rows matched. Writes, multiple statements and non-allow-listed tables are refused.

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": "run_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlYes
limitNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.4/5.0
Behavior5/5

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

Beyond the annotations, the description discloses important behavior: PostgreSQL dialect, single-statement enforcement, allow-listed table restrictions, server row-limit capping, and the truncated indicator. These details materially help an agent predict what will happen when invoking the tool.

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?

The description is compact and front-loaded with the core action, followed by return and restriction details. Every sentence adds useful information without repetition.

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?

Given that an output schema exists, the description need not explain return values in detail. It covers the critical safety and execution constraints well, though it could be slightly more complete about the default limit behavior and allowed-table scope.

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%, so the description must compensate for missing parameter documentation. It explains the limit/truncated behavior and the SQL dialect, but it does not state what happens when limit is null or fully describe the sql parameter's expected shape beyond being a SELECT.

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 states a specific verb and resource: run one read-only SQL SELECT in PostgreSQL and return columns and rows. This clearly distinguishes it from sibling tools such as explain_query, describe_table, and list_tables.

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?

It clearly establishes the context for use as read-only SELECT querying and lists refused cases such as writes, multiple statements, and non-allow-listed tables. It does not explicitly name alternatives, but the usage boundary is still clear.

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