Skip to main content
Glama
azmym

postgres-mcp

by azmym

execute_sql

Run SQL queries against a configured PostgreSQL database and get results as CSV, with configurable row limits and read-only enforcement.

Instructions

Run SQL against a configured database and return the rows as CSV.

database is a name from list_databases. Whether writes are permitted is fixed by configuration and cannot be changed per call: against a read-only database, only read queries run.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
databaseYes
max_rowsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations provided, the description carries the behavioral disclosure burden and does it well: it reveals CSV output, that write permissions are configuration-fixed, and that read-only databases only run read queries. This is meaningful context beyond the schema, though it does not explicitly warn that writable databases may be modified.

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 two tight sentences with the core action and output front-loaded. Every sentence earns its place: the first defines what the tool does, the second adds the database-source and write-permission constraints.

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?

The description covers the key facts an agent needs: what SQL is run, where database names come from, whether writes are allowed, and what the return format is. Missing details like `max_rows` semantics and error behavior are present, but the output schema and otherwise solid context keep this from being incomplete.

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 0%, so the description must compensate. It adds meaning for `database` by tying it to list_databases and implies `query` is the SQL to run, but it leaves `max_rows` entirely unexplained, which is a gap for an optional limit parameter.

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?

"Run SQL against a configured database and return the rows as CSV" states a specific verb, resource, and output format. This clearly distinguishes execute_sql from siblings like list_databases, test_connection, and describe_schema, which do not execute queries.

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?

The description gives concrete usage context by noting that `database` is a name from list_databases and that write behavior is fixed by configuration. It does not explicitly name alternative tools for when not to use it, but the prerequisite and permission constraints provide clear operational guidance.

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