Skip to main content
Glama

database_execute

Destructive

Runs a SQL script (INSERT, UPDATE, DELETE, DDL, several statements) against a Product's database as the Product's own database role, in one transaction: if any statement fails nothing is kept. dry_run: true really runs the script and then rolls it back, so you learn whether it would succeed and, through a final SELECT or a RETURNING clause, what it would produce, without changing anything. Applying requires confirm: true because a bad UPDATE cannot be undone: take a database_backup first when the change is large. Row counts are not reported; end with a RETURNING clause or a SELECT count(*) when you need one. Transaction control (BEGIN, COMMIT, ROLLBACK, SAVEPOINT) is refused because the script already is one transaction. The first 500 characters of the SQL are kept in the audit trail, so keep secrets out of it; use secret_set for those.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "productId": "<productId>",
      "databaseId": "<databaseId>",
      "sql": "<sql>"
    },
    "name": "database_execute"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlYesOne or more statements separated by semicolons. If the last returns rows (SELECT, or anything with RETURNING) they come back in `rows`.
confirmNoRequired for destructive operations. Without it a destructive call returns its plan and refuses, exactly as dry_run would.
dry_runNoReturn the plan without applying it: the resources it would create, change or destroy, and an estimated monthly cost. Free, and has no side effects. Call this before any change you have not made before.
productIdYesProduct identifier, e.g. prd_7k2m9x4qw1nv8bz3ct6d.
databaseIdYes
idempotency_keyNoReplaying the same key returns the original result instead of acting twice. Strongly recommended for anything that creates a resource or spends money.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.9/5.0
Behavior5/5

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

Annotations only say destructive/not-idempotent; the description goes far beyond that with atomicity ('if any statement fails nothing is kept'), the true semantics of dry_run (executes then rolls back), the irreversibility of a bad UPDATE, the absence of row counts in the response, and a 500-character SQL audit-trail retention that affects how callers should handle secrets. This is exactly the operational context annotations cannot express.

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-loaded with the core verb and atomicity guarantee, then each subsequent sentence delivers a distinct, non-redundant fact: dry_run semantics, confirm gating, row-count limitation, transaction-control refusal, audit retention. No sentence restates the name or title, and nothing could be deleted without losing information an agent needs.

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 exists, and the description compensates by explaining how results come back (`rows` from a trailing SELECT or RETURNING) and what is not returned (row counts). For a destructive, non-idempotent tool it covers failure behavior, safety gates, and data-handling constraints, leaving nothing essential unstated.

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?

With 83% schema coverage the baseline is 3, and the description adds real meaning for dry_run and confirm beyond their field text. However, it conflicts with the schema's dry_run wording ('Return the plan without applying it... has no side effects') by stating the script is actually executed and rolled back, leaving the agent to reconcile two different accounts of side effects and cost. idempotency_key, a documented and consequential parameter, is not discussed at all.

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: runs a multi-statement SQL script against a Product's database under the Product's own role. It immediately scopes the tool to writes/DDL (INSERT, UPDATE, DELETE, DDL) and contrasts with read-only querying, so an agent can distinguish it from database_query and database_backup without opening a 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 conditional guidance at each decision point: dry_run first for unfamiliar changes, confirm: true to apply, database_backup first when the change is large, secret_set instead of inlining secrets, and a RETURNING/SELECT count(*) when row counts are needed. It also names an explicit refusal case (BEGIN/COMMIT/ROLLBACK/SAVEPOINT), which is a when-not rule rather than an inferred one.

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