Skip to main content
Glama

run-sql-write

Destructive

Execute write SQL on SQL Server, Oracle, PostgreSQL, or MySQL; changes commit only when requested, otherwise roll back.

Instructions

dbabrain common.cli run-sql (writing): A statement to run on one target, and how. The SQL is the target engine's: SQL Server T-SQL https://learn.microsoft.com/sql/t-sql/language-reference, PostgreSQL https://www.postgresql.org/docs/current/sql-commands.html, Oracle https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/, MySQL https://dev.mysql.com/doc/refman/8.4/en/sql-statements.html. server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password. Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line. Request fields (pass them as request):

  • target: A label for the answer - the server_id. Nothing is looked up by it: common.cli reads no configuration (rules R09).

  • sql_text: The SQL.

  • sql_file: Or a file of it.

  • database_name: One database.

  • sql_access: How to reach the SQL engine, overriding the connection's own sql_access block (an 8i bridge on this machine).

  • secrets: {ref: value} for exactly the secret refs the connection's sql_access names (an 8i bridge's signing secret) - never the whole store. The app that calls fills it from its own data/ (dbabrain.lib.data_sources.request_fil...

  • connection: The database login, complete: db_type, host, port, username, password - and, where they apply, database, instance_name, service_name, sqlserver_driver, sqlserver_tls_verify and sql_access (the 8i bridge); server_id an...

  • profile: What the target is.

  • driver: Which driver.

  • oracle_client_mode: thin | thick.

  • params: Bound parameters.

  • define: Oracle substitution variables.

  • defines: The same, plural.

  • prelude: SQL text prepended to each batch.

  • named_params: Values by name, bound where an Oracle or PostgreSQL statement says :name.

  • autocommit: Commit each statement.

  • commit: Commit at the end.

  • capture: Which result sets to keep: first (the default) or all.

  • max_rows: At most this many rows.

  • max_result_sets: At most this many result sets.

  • connect_timeout_seconds: How long connecting may take.

  • timeout_seconds: How long to wait.

  • output_path: Write the rows to a file.

  • format: json (default) | txt. Runs SQL that changes data; what it changed is kept only when the request says commit (or autocommit) true - otherwise rolled back. The SQL is the target engine's: SQL Server T-SQL https://learn.microsoft.com/sql/t-sql/language-reference, PostgreSQL https://www.postgresql.org/docs/current/sql-commands.html, Oracle https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/, MySQL https://dev.mysql.com/doc/refman/8.4/en/sql-statements.html.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "run-sql-write"
  }
}

Input Schema

NameRequiredDescriptionDefault
requestNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.5/5.0
Behavior4/5

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

The annotations already mark the tool destructive, open-world, and not read-only. The description adds valuable behavior: changes persist only with commit/autocommit, otherwise they roll back; secrets are supplied by ref and no password is carried; emergency operations require confirm "yes" plus a reason.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The purpose is front-loaded, but the description repeats the same SQL dialect reference block twice verbatim and then dumps a long field list with truncated text. It is noticeably wasteful and harder to scan than necessary.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex destructive SQL tool with an opaque request schema and an output schema, the description covers most request fields, safety behavior, and confirmation requirements. It remains incomplete on required fields, clear read/write routing to the sibling, and the confusing target/server_id explanation.

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 coverage is 0% and the schema exposes only an opaque request object, so the description must carry parameter meaning. It enumerates most request fields with brief semantics, including connection, secrets, transaction controls, capture, limits, timeouts, and output format; some entries are terse or truncated, but it substantially compensates.

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 identifies the tool as run-sql in writing mode and states it runs a statement on one target that changes or removes data. This distinguishes it from a read-oriented run-sql sibling, though the phrase "and how" is vague.

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

Usage Guidelines3/5

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

Usage is implied through "writing" and "Changes or removes something," and the description gives important transaction and emergency-confirm guidance. However, it never explicitly says to use run-sql for read-only statements or lays out clear when-not-to-use conditions.

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

Deploy Server

Other Tools