Skip to main content
Glama
foxter-io

PostgreSQL MCP Server

by foxter-io

Execute SQL Statement (Write Operations)

pg_execute
Destructive

Execute non-SELECT SQL statements such as INSERT, UPDATE, DELETE, or DDL commands. Requires explicit confirmation for destructive operations like DROP or DELETE without WHERE.

Instructions

Execute a non-SELECT SQL statement: INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, TRUNCATE, etc.

For DROP, TRUNCATE, or DELETE without a WHERE clause, you must set confirm_destructive: true to confirm you understand these operations are irreversible.

Args:

  • sql: SQL statement to execute (required)

  • confirm_destructive: Required for DROP/TRUNCATE/DELETE without WHERE (default: false)

  • timeout_ms: Statement timeout in milliseconds (default: 30000)

Returns: JSON: { command, rows_affected, duration_ms } Markdown: summary of executed statement

Examples:

  • INSERT INTO users (name, email) VALUES ('Alice', 'alice@example.com')

  • UPDATE orders SET status = 'shipped' WHERE id = 42

  • CREATE INDEX idx_users_email ON users(email)

  • DROP TABLE temp_data (requires confirm_destructive: true)

Warning: Mutations are not automatically wrapped in a transaction. Use BEGIN/COMMIT explicitly for multi-statement transactions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYesSQL statement to execute
confirm_destructiveNoSet true to confirm DROP/TRUNCATE/DELETE-without-WHERE operations
timeout_msNoStatement timeout in milliseconds
Behavior5/5

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

Annotations declare destructiveHint=true and readOnlyHint=false. The description adds crucial context: irreversible operations require confirm_destructive, no auto-transaction, and the return format (JSON with command, rows_affected, duration_ms, plus Markdown). This goes beyond annotations to disclose important behavioral traits.

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 well-organized with clear sections: purpose, special conditions, Args, Returns, Examples, Warning. Each sentence serves a purpose without redundancy. It is concise yet comprehensive, fitting within a few lines.

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?

The description fully covers the tool's behavior: what it does (write operations), special confirm_destructive requirement, timeout parameter, return format, and transaction warning. Given the absence of output schema, the return description is sufficient. The sibling context further clarifies the tool's role.

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?

Input schema has 100% description coverage, so baseline is 3. The description adds value by explaining the role of confirm_destructive (required for certain operations) and providing examples that illustrate parameter usage. It does not repeat schema information unnecessarily.

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 'Execute a non-SELECT SQL statement' and lists specific operations (INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, TRUNCATE). This distinguishes it from sibling tools like pg_query (for SELECT) and other specialized tools. The verb 'Execute' and resource 'SQL Statement' are specific and unambiguous.

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 provides explicit guidance on when to use confirm_destructive for DROP/TRUNCATE/DELETE without WHERE. It warns about lack of automatic transaction wrapping. While it doesn't explicitly say 'use pg_query for SELECT', the phrase 'non-SELECT' strongly implies it. The examples cover common use cases.

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/foxter-io/mcp-postgresql'

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