Skip to main content
Glama

Delete Rows

db_delete_many
Destructive

Deletes rows from a PostgreSQL table using a JSON filter. Supports dry-run to preview the deletion scope and requires explicit confirmation for full-table deletes.

Instructions

Deletes all rows matching the given filter. This is a destructive operation — deleted data cannot be recovered unless a backup exists. When the filter is empty ('{}'), ALL rows in the table would be deleted — 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 deletion scope before committing.

When to use:

  • "Delete all logs older than 2025"

  • "Remove user with email test@test.com"

  • "Purge expired sessions"

Parameter guidance:

  • table: the target table name (required)

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

  • dry_run: set to true to preview without deleting (default: false). STRONGLY recommended — always dry-run first to see how many rows would be affected.

  • confirmAll: REQUIRED when where='{}' to confirm deleting 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 delete runs in a transaction — all rows are deleted atomically.

  • Returns the count of deleted rows.

  • ALWAYS use dry_run=true first to verify the scope before committing.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tableYesName of the table to query
whereYesJSON filter selecting rows to delete
dryRunNoIf true, simulates without deleting
databaseNoName of the database to query (from pgautopilot.json). Omit to use the current default database.
confirmAllNoRequired to delete 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 though annotations already mark destructiveHint=true, the description adds crucial behavior: irreversibility without backup, the confirmAll safety gate, warning on >10 rows, atomic transaction behavior, returned deleted count, and the strong recommendation to dry-run first. This goes well beyond the annotations and gives an agent a full risk profile.

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?

The description is lengthy but organized into clear sections: overview, when to use, parameter guidance, and behavioral notes. Some safety guidance is repeated, but for a destructive tool that repetition reinforces the most critical behavior without becoming bloated.

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?

The description covers the full calling context: when to use, how to use safely, what counts as dangerous, the transaction guarantee, and the return value. Since there is no output schema, the statement that it returns the count of deleted rows is especially valuable and completes the picture.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, but the description adds important semantic weight: where is a JSON filter with a concrete example, '{}' is explicitly labeled dangerous and requires confirmAll=true, dryRun is strongly recommended as a preview mechanism, and confirmAll's purpose is explained. This materially helps an agent invoke parameters correctly.

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: 'Deletes all rows matching the given filter.' It clearly distinguishes this as a destructive bulk deletion tool, and the examples and safety gate make its scope unambiguous relative to siblings like db_update_many or db_find_many.

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 provides concrete, realistic scenarios and explicitly warns about the empty-filter case and the confirmAll requirement. It does not explicitly contrast with alternatives such as db_update_many, but the guidance is clear enough for an agent to decide when deletion is appropriate.

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