Skip to main content
Glama

Write to the workspace database

execute_sql
Destructive

Modify a workspace's SQLite database with CREATE, ALTER, INSERT, UPDATE, DELETE, or CREATE INDEX statements. Preview first, then pass confirm:true to execute, since dropped or deleted rows cannot be restored.

Instructions

Changes the workspace's own SQLite database: CREATE TABLE, ALTER, INSERT, UPDATE, DELETE, CREATE INDEX. Use query_database for anything that only reads.

There is no undo. A restore point reverts blocks, links and files — never rows — so a DROP or a DELETE here is permanent. Requires confirm:true; call without it first to preview.

Schema meant for a block should be idempotent, because the block runs before anybody has set anything up and a FORK of the workspace starts with an EMPTY database (the code is copied, the rows never are): CREATE TABLE IF NOT EXISTS tasks (id INTEGER PRIMARY KEY, title TEXT NOT NULL).

LOADING MANY ROWS: one statement per batch, the rows passed as ONE JSON parameter and unpacked by json_each — never one INSERT per row. Measured 2026-10-24: 36 262 rows in batches of 4 000 at ~2 s a batch. sql: INSERT INTO place (code, name, lat, lon) SELECT j.value->>'$.code', j.value->>'$.name', j.value->>'$.lat', j.value->>'$.lon' FROM json_each(@rows) AS j params: { rows: "[{"code":"75056","name":"Paris","lat":48.86,"lon":2.35}, …]" } (a JSON STRING) Make a reload idempotent (INSERT OR REPLACE, or DELETE then INSERT) so a batch that failed can simply be sent again.

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

Input Schema

NameRequiredDescriptionDefault
sqlYesOne statement to run. Many rows: INSERT … SELECT … FROM json_each(@rows).
paramsNoValues for the @name placeholders.
confirmNoMust be true to run it. Omit/false returns a preview only.
workspaceIdYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.53.0

TDQS

A4.8/5.0
Behavior5/5

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

Annotations only supply destructiveHint=true; the description goes far beyond that by disclosing that restore points revert blocks, links and files but never rows, so a DELETE or DROP is permanent. It also discloses the dry-run preview behavior and the non-obvious fact that a FORK starts with an empty database, which changes how an agent must author schema.

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

Conciseness4/5

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

Front-loaded with purpose and the permanence warning, then progressively deeper detail, which is the right ordering for a destructive tool. It is dense with real decisions, though the measured throughput benchmark and the full inline SQL example are more verbose than strictly needed to call the tool correctly.

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?

For a destructive, non-reversible mutation with no output schema, the description covers the safety profile, the confirm/preview handshake, idempotency requirements, and the bulk-insert performance model. An agent has everything needed to invoke it without producing data loss or a broken fork.

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 75% and the description meaningfully extends the remaining part: it spells out that bulk rows are passed as ONE JSON parameter that is a JSON STRING (not an array), unpacked via json_each(@rows), with a worked sql/params example. That encoding detail is not in the schema. The workspaceId parameter is never discussed, so the compensation is not complete.

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?

"Changes the workspace's own SQLite database" states a specific verb and resource, and the description enumerates exactly which statement classes are in scope (CREATE TABLE, ALTER, INSERT, UPDATE, DELETE, CREATE INDEX). It explicitly names query_database as the read-only sibling, so the boundary is unmistakable.

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 gives an explicit when-not ("anything that only reads" → query_database), a prerequisite workflow ("Requires confirm:true; call without it first to preview"), and prescriptive guidance for the two hard cases: idempotent schema for block-hosted code and one-statement batches with json_each for bulk rows. Nothing here is left to inference.

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