Skip to main content
Glama

Update Rows

db_update_many
DestructiveIdempotent

Updates all rows matching a filter in PostgreSQL, with schema validation before execution and safety controls like dry-run and required confirmation for full-table updates.

Instructions

Updates all rows matching the given filter. Every column and value is validated against the live schema before execution. When the filter is empty ('{}'), ALL rows in the table would be updated — this requires confirmAll=true as a safety gate. A warning is issued when more than 10 rows are affected. Use dry_run=true to preview the update without actually writing.

When to use:

  • "Mark all pending orders as shipped"

  • "Update user 42's email to new@example.com"

  • "Set all products in category X as discontinued"

Parameter guidance:

  • table: the target table name (required)

  • where: JSON filter selecting rows to update (required). Example: {"status": "pending"} Use '{}' with confirmAll=true to update ALL rows (dangerous!).

  • data: JSON object of column-value pairs to set (required). Example: {"status": "shipped", "shipped_at": "2026-09-01"}

  • dry_run: set to true to preview without writing (default: false)

  • confirmAll: REQUIRED when where='{}' to confirm updating all rows

Behavioral notes:

  • A warning is emitted when more than 10 rows would be affected.

  • Empty filter with confirmAll=false returns an error requiring explicit confirmation.

  • The update runs in a transaction — all rows are updated atomically.

  • Returns the count of affected rows.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYesJSON object of column-value pairs to set
tableYesName of the table to query
whereYesJSON filter selecting rows to update
dryRunNoIf true, simulates without writing
databaseNoName of the database to query (from pgautopilot.json). Omit to use the current default database.
confirmAllNoRequired to update all rows when where is '{}'
Install Server

TDQS

A4.7/5.0
Behavior5/5

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

Even with annotations already marking destructiveHint=true and readOnlyHint=false, the description goes well beyond: it explains live-schema validation, the empty-filter safety gate requiring confirmAll, the >10-row warning, atomic transaction behavior, dry_run previewing, and the affected-row count. No contradiction with annotations.

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?

The description is structured into clear sections—overview, when to use, parameter guidance, and behavioral notes—and every sentence conveys necessary operational detail. For a dangerous data-mutating tool, the length is justified and well-organized.

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?

Despite no output schema, the description covers return value (affected row count), error behavior (empty filter without confirmAll), safety mechanisms, and transaction semantics. It gives an agent all the information needed to invoke the tool correctly, including the required safety flag for full-table updates.

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 concrete examples for 'where' and 'data', clarifies the dangerous '{}' case, and explains when confirmAll is required. The only drawback is the parameter naming discrepancy: description says 'dry_run' while the schema defines 'dryRun', which could mislead an agent.

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: 'Updates all rows matching the given filter.' It clearly distinguishes itself from siblings like db_delete_many, db_find_many, and db_create. The title 'Update Rows' is expanded meaningfully by the first sentence and the safety-focused details.

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

Usage Guidelines4/5

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

The 'When to use' section gives concrete, realistic examples ('Mark all pending orders as shipped', 'Update user 42's email...') that make selection intent clear. However, it does not explicitly mention when NOT to use this tool or contrast it with alternatives like db_upsert or db_create, so it misses the top tier.

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

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cyberreinxy/pgautopilot'

If you have feedback or need assistance with the MCP directory API, please join our Discord server