Skip to main content
Glama
Teja-sudo

postgres-mcp-server

by Teja-sudo

dry_run_sql_file

Test SQL migrations safely by executing all statements in a transaction, capturing real results and errors, then rolling back to prevent changes.

Instructions

Execute a SQL file in dry-run mode - actually runs ALL statements within a transaction, captures REAL results for each (row counts, errors with line numbers, constraint violations), then ROLLBACK so nothing persists. Perfect for testing migrations before deploying. Returns detailed error info including PostgreSQL error codes, constraint names, and hints to help quickly fix issues. Warns about non-rollbackable operations (sequences, VACUUM, etc.). Optionally use server/database/schema params for one-time execution on a different server.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesAbsolute or relative path to the .sql file to dry-run
stripPatternsNoPatterns to strip from SQL before execution (e.g., ['/'] for Liquibase)
stripAsRegexNoIf true, stripPatterns are treated as regex patterns
maxStatementsNoMaximum statements to include in results (default: 50, max: 200)
stopOnErrorNoStop on first error (default: false - continues to show ALL errors)
serverNoOne-time server override. Execute on this server without changing main connection.
databaseNoOne-time database override. Uses this database for execution.
schemaNoOne-time schema override. Sets search_path for this execution only.
Behavior4/5

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

No annotations provided, so description carries full burden. It discloses transaction rollback, real result capture, and warnings about non-rollbackable operations. Does not mention behavior on connection loss or transaction abort, but covers key behavioral aspects.

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?

Description is well-structured with front-loaded action and behavior. Slightly long but each sentence adds value; no redundancy.

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?

No output schema, so description explains return values (row counts, errors with line numbers) and warns about non-rollbackable operations. Comprehensive for a dry-run testing tool.

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 description coverage is 100%; description adds some context (e.g., example for stripPatterns, one-time execution for server/database/schema). Adds value beyond schema but not extensively.

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 it executes a SQL file in dry-run mode, runs statements within a transaction, captures real results, then rolls back. It distinguishes from siblings like execute_sql_file (which commits) and preview_sql_file (likely just shows statements).

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?

Explicitly says 'Perfect for testing migrations before deploying' and mentions optional server/database/schema overrides. Does not explicitly state when not to use it, but context implies it's for testing; alternatives like execute_sql_file are implied but not named.

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/Teja-sudo/postgres-mcp-server'

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