Skip to main content
Glama

update_rows_where

Destructive

Run one UPDATE <table> SET <col> = <expr>, … WHERE <predicate>, no row-id lookup needed. DataFusion SQL, with the quoted ids run_sql takes; SET takes any expression, evaluated per row. Deleted rows never match. No WHERE updates every live row.

ONE statement, ONE table: no FROM, joins, RETURNING or second statement; SET and WHERE reference only that table. An attachment column cannot be SET. A categorical column is SET to a label (= 'Done'), make_array('Open', 'Urgent'), or NULL; never ids or another categorical column. In WHERE it is filtered by id with array_has. Cross-table: read with run_sql, then edit_rows by row id.

max_affected_rows is REQUIRED unless expect is "exactly_one". If more rows match, nothing is written and both numbers come back. At most 1000 rows per call: above that, narrow the WHERE and call again. A value that does not fit its column is refused, so integer division into a float can fail: CAST explicitly. A write landing between the read and this one is a version_conflict: call again.

For different values per row, or deletes and restores, use edit_rows.

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

Input Schema

NameRequiredDescriptionDefault
sqlYesOne `UPDATE … SET … WHERE …` statement (see the tool description).
expectNo`"any"` (default) or `"exactly_one"`. `exactly_one` refuses unless the filter matches exactly one row.
dry_runNoCount and preview up to 20 rows; write nothing.
model_idYes
expected_versionNoOptional optimistic-concurrency guard: the table version you read at.
max_affected_rowsNoRefuse if more than this many rows match. Required unless `expect` is `"exactly_one"`, which implies 1.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already flag destructiveHint=true, but the description goes well past them: the `max_affected_rows` requirement, the all-or-nothing refusal when the match count is exceeded ("nothing is written and both numbers come back"), the 1000-row ceiling, type-mismatch refusal with a CAST remedy, and the version-conflict retry loop. It also discloses scope rules an agent could not infer, such as deleted rows never matching, attachment columns being non-settable, and the categorical label/`array_has` id asymmetry between SET and WHERE.

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 the operation and the sibling distinction, then layered constraints — nothing is filler. The categorical-column sentence packs three cases into one long clause chain, which costs some readability, but every statement carries operational consequence.

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 describing what returns (matching and allowed counts, dry-run preview of 20 rows). For a destructive, predicate-driven write tool, the failure modes, limits, and retry path an agent needs to call it safely are all present.

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 schema already documents `expect`, `dry_run`, `expected_version`, and `max_affected_rows` individually, and the description partly repeats the "required unless exactly_one" rule. It still adds real meaning: the 1000-row cap, the version-conflict behavior tied to `expected_version`, and the dry-run preview bound that the schema does not state.

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?

Opens with a concrete verb and resource ("Run one `UPDATE <table> SET <col> = <expr> … WHERE <predicate>`") and immediately scopes it against the row-id path ("no row-id lookup needed"). An agent can distinguish this from `edit_rows` (row-id based) and `run_sql` (read path) without opening 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?

Explicitly routes to alternatives with conditions: cross-table work goes "read with `run_sql`, then `edit_rows` by row id", and "For different values per row, or deletes and restores, use `edit_rows`." It also states the hard when-not case (more than 1000 matching rows → narrow the WHERE and call again) and the retry condition on `version_conflict`.

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