Skip to main content
Glama
adaptive-pg-mcp (PostgreSQL)

adaptive-pg-mcp (PostgreSQL)

execute_sql

Destructive

Execute one row-level SQL statement such as INSERT, UPDATE, DELETE, MERGE, CALL, or DO on PostgreSQL, with multi-statement requests refused and safety limits for DDL and large changes.

Instructions

Runs one SQL statement that works on rows, such as INSERT, UPDATE, DELETE, MERGE, CALL or DO. Rolls back TRUNCATE and changes of structure, which need execute_ddl, and a statement that changes more than 100 rows across all tables. Returns at most 1,000 rows. Times out after 30s.

Input Schema

NameRequiredDescriptionDefault
sqlYesOne SQL statement, sent to Postgres unchanged. More than one statement is refused.
databaseYesThe database to run on.

Output Schema

NameRequiredDescriptionDefault
rowsYesThe result rows, each an array in column order.
columnsYesThe result columns, in order.
rowsAffectedYesThe number of rows changed.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.3/5.0
Behavior5/5

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

Annotations already declare destructive/not-readonly, so the description's job is to add operational detail, and it does: statements over 100 affected rows across all tables are rejected, results are capped at 1,000 rows, and execution times out at 30s. Those are exactly the constraints an agent needs before composing a statement, and none of them are in the annotations or schema.

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?

Four short sentences, front-loaded with the core action, then constraints in descending order of importance (DDL exclusion, row-impact cap, result cap, timeout). No filler and nothing repeated.

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?

With an output schema present, return-value documentation is unnecessary, and the description still supplies limits, timeouts, and rejection behavior, so it is nearly complete for a single-parameter mutation tool. The one residual gap is that 'Rolls back TRUNCATE...' does not explicitly say the statement is refused/aborted rather than silently attempting and reverting, which could be read either way.

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% and both parameters are already documented ('One SQL statement, sent to Postgres unchanged'; the database enum). The description reinforces the single-statement constraint ('Runs one SQL statement') but adds no new syntax, dialect, or format guidance beyond the schema.

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 opens with a specific verb and resource ('Runs one SQL statement that works on rows') and enumerates the statement families it accepts (INSERT, UPDATE, DELETE, MERGE, CALL, DO), which is far more than a restatement of the name. It cleanly distinguishes itself from execute_ddl. It does not, however, distinguish itself from query_sql for reads or from insert_rows/update_rows/delete_rows for single-row work, leaving some sibling ambiguity.

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?

It gives one explicit routing rule: TRUNCATE and structure changes 'need execute_ddl', which tells the agent precisely when to pick a different tool. It also implies a row-count boundary (>100 rows across all tables is refused) as a reason to fall back to other tools. It stops short of naming query_sql as the read alternative or the row-level CRUD siblings as safer options.

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