Skip to main content
Glama
Eszetael

postgres-mcp-hardened

Run SQL (read-only)

query
Read-onlyIdempotent

Run read-only SQL queries against PostgreSQL and retrieve result rows. Writes, DDL, and admin functions are blocked before execution. Supports pagination with limit and offset; returns up to 1000 rows by default (max 10000).

Instructions

Run a read-only SQL query and return rows. Writes, DDL and administrative functions are refused before the statement reaches the database. At most 1000 rows come back unless you pass limit (server maximum 10000); truncated: true in the response means there is more data — page through it with offset, and give the query an ORDER BY when you do, or the rows you get on page two depend on the planner's mood.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYesa single read-only statement: SELECT, WITH, VALUES, EXPLAIN or SHOW (write `SELECT * FROM t`, not `TABLE t`)
limitNomaximum rows to return; larger values are capped at 10000 and the response says so
offsetNorows to skip, for paging; pair it with ORDER BY for stable pages
databaseNowhich configured database to use; omit when only one is configured
Behavior5/5

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

The description goes well beyond the annotations by disclosing that writes/DDL/admin functions are refused, the default row limit of 1000, the maximum of 10000, the truncated flag, offset paging, and the need for ORDER BY to ensure stable pagination. This provides rich behavioral context beyond the readOnlyHint and destructiveHint annotations.

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 three sentences, front-loaded with the core purpose, then adding safety and pagination details. Every sentence carries useful information without redundancy or rambling.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Combined with comprehensive parameter descriptions and annotations, the description covers safety, row limits, truncation, paging, and ordering guidance. There is no output schema, but the description mentions the truncated flag, and the level of detail is sufficient for an AI agent to use the tool correctly.

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?

The input schema provides 100% description coverage for all four parameters, so the baseline is 3. The description adds operational context about truncation, paging, and ORDER BY best practices, but it does not significantly alter parameter meanings beyond what the schema already states.

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 clearly states 'Run a read-only SQL query and return rows', using a specific verb and resource. It distinguishes itself from specialized siblings by being the generic query runner, and the title reinforces the read-only scope.

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?

The description implies usage by focusing on read-only SQL and allowed statement types, but it does not explicitly tell when to use this tool versus alternatives like explain_query or list_schemas. There are no exclusions or alternative recommendations, leaving the choice somewhat inferred.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Eszetael/postgres-mcp-hardened'

If you have feedback or need assistance with the MCP directory API, please join our Discord server