Skip to main content
Glama
Postgres MCP Server

Postgres MCP Server

by Zotriq

run_query

Execute read-only SELECT queries against PostgreSQL to retrieve data and explore schemas without allowing writes, DDL, or unsafe functions; returned rows are capped.

Instructions

Run a single read-only SELECT. Writes, DDL and unsafe functions are rejected; rows are capped.

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
databaseNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.6/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 burden and does real work: it discloses that writes, DDL and unsafe functions are rejected and that rows are capped. Missing details are the cap magnitude, timeouts, and permission requirements, but the safety profile is genuinely conveyed.

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 with zero waste; the operation is front-loaded and the constraints follow immediately after.

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?

An output schema exists so return values need not be explained, and the description covers the critical safety envelope for a query tool. The uncovered gap is the 'database' parameter's semantics, which matters for correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate for both parameters. It adds meaning for 'sql' (single statement, SELECT only), but says nothing about the optional 'database' parameter — which database is targeted by default, and what passing a name does.

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 a single read-only SELECT'. The 'single' and 'read-only' qualifiers distinguish it from a plan-explaining or multi-statement tool, though no sibling is named 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?

Implied usage is clear (you have SQL you want executed), and the write/DDL rejection tells the agent what will not work. However, it never says when to prefer explain_query or ask instead, so routing between siblings is left to inference.

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