Skip to main content
Glama
mcp-postgres

mcp-postgres

by gbfeliped

query

Run read-only SELECT statements against PostgreSQL to retrieve data, with writes, system functions, and multiple statements blocked.

Instructions

Execute a read-only SELECT query against PostgreSQL. Only SELECT (and CTEs starting with WITH) are permitted. Write operations, system functions, DoS constructs, and multiple statements are all blocked.

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
sqlYesThe SELECT query to execute

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.9/5.0
Behavior4/5

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

With no annotations supplied, the description carries the full disclosure burden and does well: it states the access mode (read-only), the permitted statement forms (SELECT and WITH CTEs), and enumerates blocked classes (writes, system functions, DoS constructs, multiple statements). It omits operational behavior such as row limits, timeouts, permissions, or error/return behavior, keeping it from 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?

Three short sentences, front-loaded with the purpose and then the permission rules. No filler or redundancy; every clause adds a constraint the agent needs.

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, no-output-schema tool, the definition covers the essential calling contract: what the statement must be and what is rejected. It could add a note on result shape or limits, but nothing critical is missing for correct invocation.

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 100%, so the single 'sql' parameter is already documented; the description still adds value by constraining the accepted syntax (SELECT or WITH-prefixed CTE, single statement only), which meaningfully guides how to construct the value. Baseline for full coverage would be 3, and this adds a bit beyond that.

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+resource ('Execute a read-only SELECT query against PostgreSQL'), which is clearly distinct from the metadata siblings (describe_table, list_schemas, list_tables). It does not explicitly name or route away from any sibling, so it falls just short of a 5.

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 read-only SELECT framing, but there is no explicit when-to-use/when-not guidance or reference to alternatives such as the schema-introspection siblings. The agent must infer that this is the tool for running queries rather than inspecting structure.

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