Skip to main content
Glama
postgres-mcp-server

postgres-mcp-server

by RenzoReccio

run_query

Execute a read-only SQL SELECT query against a PostgreSQL database to retrieve data, with results capped at 100 rows for safe inspection.

Instructions

Execute a read-only SQL SELECT query against the database (results capped to 100 rows)

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

Input Schema

NameRequiredDescriptionDefault
queryYesThe SQL SELECT query to execute

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.5/5.0
Behavior3/5

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

With no annotations supplied, the description must carry the behavioral burden, and it does disclose two real traits beyond the schema: the operation is read-only and results are capped to 100 rows. It stops short of other behaviors an agent needs — whether non-SELECT statements are rejected or silently trimmed, query timeout, SQL dialect, and how truncation is signalled.

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?

One sentence, front-loaded with the action and the key constraint in a parenthetical. Nothing is redundant, though the parenthetical could be hoisted into its own clause for slightly better scannability.

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, single-purpose query tool this is largely sufficient. With no output schema, the description does not describe the result shape or how the 100-row cap is surfaced, which is the main remaining gap.

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 description coverage is 100%, so the single query parameter is already documented as 'The SQL SELECT query to execute'. The description adds only the SELECT-only constraint and the row cap, which restate and qualify rather than add new syntax or format detail; baseline 3 applies.

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 (Execute) plus the resource (a read-only SQL SELECT against the database), so the agent knows this is query execution rather than introspection. Siblings describe_table and list_tables are schema-listing tools, and the verb+resource here is distinct enough to separate them, though no sibling is named.

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 by the phrase 'read-only SQL SELECT query' — the agent can infer this is for retrieving rows, not for schema discovery. There is no explicit when-to-use vs when-not guidance, no statement about what happens with non-SELECT statements, and no pointer to describe_table/list_tables for schema discovery.

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