Skip to main content
Glama

Run SQL

sql_execute
Destructive

Run SQL on a branch as the project's database role. Read-only by default; pass read_only: false to write (database:write). DROP, TRUNCATE and DELETE/UPDATE without WHERE need confirm: true and the destructive scope (production:destructive on production). Use migrations_apply for schema changes. Scope: database:read.

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": {
      "query": "<query>"
    },
    "name": "sql_execute"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNoMaximum rows to return (default 100)
queryYesSQL, e.g. `select * from todos limit 10`. One statement when read-only; a script in one transaction when writing.
branchNoBranch id, e.g. `pr-42`. Default `production`.
confirmNotrue only after the user approved the destructive operation
read_onlyNoDefault true. Set false to write (needs database:write).
project_idNoProject id, e.g. `todo-app`. Default: the last one used, or your only one.
organization_idNoOrganization id, e.g. `acme`. Default: the token's.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.6/5.0
Behavior4/5

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

Annotations declare destructiveHint=true and readOnlyHint=false, but the description adds real context beyond them: the default is read-only, writing needs database:write, destructive statements need confirm:true and production:destructive on production, and a write executes as a script in one transaction. The only gap is error/rollback behavior when confirmation is missing. 'Read-only by default' does not contradict readOnlyHint=false, since the tool is still capable of writing.

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?

Three tightly packed sentences plus a scope line, with the default mode and the escalation path front-loaded before the destructive-statement caveat. No sentence is filler; each carries a distinct rule.

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?

For a 7-parameter tool with no output schema, the definition covers the defaults, permission model, confirmation gate, and the migration alternative. What an agent gets back (rows, affected count) and pagination/limit behavior are not described, but nothing essential to invoking it safely is missing.

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 100%, so the baseline is 3, but the description adds meaning the schema lacks: read_only is tied to the database:write scope, and confirm is tied to user approval plus the destructive scope requirement. branch is only implicitly covered (target of execution) and limit/default-row behavior is left to the schema.

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 opens with a specific verb and resource ('Run SQL on a branch as the project's database role'), stating both the operation and the execution identity. It explicitly routes schema work to migrations_apply, so an agent can separate it from that sibling without inspecting 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?

It states the default mode (read-only), the exact condition to write (read_only: false plus database:write), the confirm requirement for DROP/TRUNCATE/UPDATE-without-WHERE plus the production:destructive scope, and names migrations_apply as the alternative for schema changes. When-to-use, when-not-to-use, and prerequisites are all present.

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