Skip to main content
Glama

executeSql

Destructive

Run SQL statements on a selected database connection with explicit desktop approval before execution; returns bounded results (default 100 rows, max 1,000).

Instructions

Execute SQL after explicit approval in the desktop. Runs on the active connection unless connectionId suggests another one; the user can change the connection when approving, and the result's connectionId is the one actually used. Defaults to 100 rows, at most 1000. Results are also byte-limited. May modify data or schema.

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": {
      "sql": "<sql>"
    },
    "name": "executeSql"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlYes
limitNo
connectionIdNoSuggested connection id from listConnections. Omit to use the active connection; the user may pick another one when approving.

Output Schema

NameRequiredDescriptionDefault
rowsYes
columnsYes
elapsedMsYes
truncatedYes
connectionIdYes
rowsAffectedNo
rowsMoreAvailableYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.24.0

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true and readOnlyHint=false, and the description reinforces this with 'May modify data or schema' plus the approval requirement and the fact that the user can silently change the connection. It adds the row cap (default 100, max 1000) and a byte limit, which are useful operational constraints. It stops short of describing error behavior or what happens on rejection, so it is strong but not exhaustive.

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 tight sentences, front-loaded with the approval gate, then connection semantics, then limits and mutation risk. No filler and no repetition of the schema.

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?

An output schema exists, so return values need not be explained, and the description covers approval, connection resolution, and result caps. The main remaining gap is failure/rejection behavior, which is partly covered by the sibling getLatestSqlExecutionError but not referenced here.

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 only 33% (only connectionId is documented), so the description must compensate, and it does: it clarifies connectionId's advisory nature and the actual-used-connection return value, and supplies the limit default and ceiling that the schema only bounds. The sql parameter is self-evident and needs no elaboration.

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 ('Execute SQL') plus the defining constraint that it runs only after explicit desktop approval. That approval gate is what separates it from siblings like explainSql and proposeSqlEdit, so an agent can pick it without opening the schema.

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?

Explains the connection-selection behavior (active connection by default, connectionId as a suggestion, user may override at approval), which is real usage context. It never states when to prefer this over explainSql or proposeSqlEdit, so the when-to-use guidance is only implied.

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