Skip to main content
Glama

Run write SQL

execute_sql
Destructive

Run write SQL (INSERT, UPDATE, DELETE, DDL) against the project's managed PostgreSQL database — the same path as the dashboard DB console's write mode, with the same limits (row/byte caps, per-statement timeout, 25 statements max, one transaction: all commit or all roll back). Executes with the project's own tenant credentials, never an admin connection. Row-producing statements return columns+rows; others return rows_affected. DROP, DELETE, TRUNCATE and ALTER are irreversible. For reads, use query_sql. If the tool reports lost credentials, provision_postgres repairs them. Requires a read-write token.

Input Schema

NameRequiredDescriptionDefault
sqlYesthe SQL to run against the project's managed PostgreSQL database: write-capable, up to 25 ;-separated statements executed in ONE transaction (all commit or all roll back). DROP, DELETE, TRUNCATE and ALTER are irreversible
project_idYesthe project id (from list_projects)

Output Schema

NameRequiredDescriptionDefault
statusNopresent, and always "pending_approval", only when this call was parked instead of run immediately because the project's (or kad-back's own) plan-mode setting requires a human to approve it first
messageYes
plan_idNopoll get_plan_status with this id for the eventual outcome
approve_atNothe kad.dev dashboard URL a human approves or rejects this plan from
project_idYes
statementsYes
expires_in_sNothe plan can no longer be approved after this many seconds

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Goes well beyond the annotations: row/byte caps, per-statement timeout, 25-statement limit, single-transaction all-or-nothing semantics, tenant credentials rather than admin, return shapes, and which statements are irreversible. Annotations already flag destructiveHint, and the description reinforces rather than contradicts that.

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?

Front-loads the core action and scope, then layers limits, credential behavior, return values, and routing in dense, waste-free sentences. No sentence is filler given the safety-critical nature of the tool.

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?

Covers everything an agent needs for a destructive write tool: limits, transactional semantics, execution identity, return shape, irreversibility, and credentials recovery. The output schema exists, yet the description's brief return-value note still adds useful confirmation.

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 coverage is 100%, so both parameters are already documented, and the description mostly restates the same transaction/irreversibility notes found in the sql field description. It adds no new parameter-level detail such as SQL dialect caveats or size limits per parameter, so baseline 3 applies.

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?

States a specific verb and resource (write SQL against the project's managed PostgreSQL database) and enumerates the statement classes covered (INSERT, UPDATE, DELETE, DDL). It explicitly distinguishes itself from the read sibling query_sql, so an agent can choose without opening either schema.

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

Usage Guidelines5/5

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

Gives an explicit alternative for the opposite case ('For reads, use query_sql') and a recovery path ('If the tool reports lost credentials, provision_postgres repairs them'). It also names a prerequisite (requires a read-write token), so both routing and gating are covered.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources