Skip to main content
Glama
sparta2025

Postgres MCP Pro

by sparta2025

execute_sql

Run SQL queries on PostgreSQL databases, optionally specifying a database URL. Protects against accidental changes with read-only and production protection modes.

Instructions

Execute a SQL query.

Args:
    sql: SQL statement to execute.
    database_url: Database URL (optional, uses DATABASE_URL from .env if omitted).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYes
database_urlNo

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observedv0.4.2

TDQS

B3.1/5.0
Behavior2/5

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

There are no annotations to communicate safety or side effects, and the description does not compensate. It simply says 'Execute a SQL query' without disclosing that the tool can potentially modify or destroy data, how it behaves with transactions, or what the response looks like.

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 extremely compact and front-loaded with the core action followed by a minimal parameter list. Every sentence adds value and there is no filler.

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

Completeness2/5

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

For a raw SQL execution tool with no annotations and no output schema, the description is under-specified. It lacks essential context about destructive potential, return format, error behavior, and execution constraints. Agents need more guidance before safely invoking it.

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?

Although schema description coverage is 0%, the docstring explains both parameters: 'sql' is the statement to execute and 'database_url' is optional with fallback to DATABASE_URL from .env. This adds meaningful context, especially the default behavior for database_url.

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 states the primary action clearly: 'Execute a SQL query.' This distinguishes it from sibling analysis tools like explain_query and list_schemas, though it does not explicitly clarify that it can run arbitrary read/write/DDL SQL rather than only read-only queries.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives such as explain_query or get_table_sizes. There are no exclusions, prerequisites, or warnings about when direct SQL execution is or is not appropriate.

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

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/sparta2025/postgres-mcp'

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