Skip to main content
Glama

Undo Item Batch

item.undo_batch
DestructiveIdempotent

Undo a whole batch written by item.create_many, item.update_many or item.update_where, in one step, naming the batchId it returned and the sheetId it wrote: a create batch deletes the rows it created that still exist; an update batch restores each field's previous value unless it was changed since (those are reported as conflicts and kept). Only the user who ran the batch (or the org owner) can undo it, once, within 7 days. Use it when the user asks to undo a bulk change. Effects workflows already had (emails, external calls) are not reverted. When the agent this app signs in as has Ask first on for this, the call waits for its manager's approval and returns status: "pending_approval"; nothing changes until they approve. Pass reason (and targetNotes per target) so the approver sees why.

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": {
      "batchId": "<batchId>",
      "sheetId": "<sheetId>"
    },
    "name": "item.undo_batch"
  }
}

Input Schema

NameRequiredDescriptionDefault
reasonNoWhy you are doing this, in one sentence the approver reads if Ask first holds the call
batchIdYesThe batchId item.create_many or item.update_many returned
sheetIdYesThe sheet the batch wrote, as that call returned it
targetNotesNoA short note per target, keyed by the id or Index you pass

Output Schema

NameRequiredDescriptionDefault
noteNoWhat undo does not revert; tell the user
statusNo
messageNo
approverNoWho decides it
revertedNoRows deleted (create batch) or restored (update batch)
conflictsNoRows with fields changed since the batch; those fields were kept, not restored
approvalIdNoThe approval the call waits on
alreadyGoneNoRows of the batch deleted since; nothing to undo for them

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedInput schema / properties / reason
      Added value: +{
      +  "description": "Why you are doing this, in one sentence the approver reads if Ask first holds the call",
      +  "type": "string"
      +}
    • addedInput schema / properties / targetNotes
      Added value: +{
      +  "additionalProperties": {
      +    "type": "string"
      +  },
      +  "description": "A short note per target, keyed by the id or Index you pass",
      +  "propertyNames": {
      +    "type": "string"
      +  },
      +  "type": "object"
      +}
  2. Changed8 schema fields changed
    • addedOutput schema / properties / approvalId
      Added value: +{
      +  "description": "The approval the call waits on",
      +  "type": "string"
      +}
    • addedOutput schema / properties / approver
      Added value: +{
      +  "description": "Who decides it",
      +  "type": "string"
      +}
    • addedOutput schema / properties / message
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / status / anyOf
      Added value: +[
      +  {
      +    "description": "undone, or why nothing was changed",
      +    "enum": [
      +      "undone",
      +      "forbidden",
      +      "not_found",
      +      "expired",
      +      "already_undone"
      +    ],
      +    "type": "string"
      +  },
      +  {
      +    "const": "pending_approval",
      +    "description": "The call waits for a person's approval; nothing has changed",
      +    "type": "string"
      +  }
      +]
    • removedOutput schema / properties / status / description
      Removed value: -"undone, or why nothing was changed"
    • removedOutput schema / properties / status / enum
      Removed value: -[
      -  "undone",
      -  "forbidden",
      -  "not_found",
      -  "expired",
      -  "already_undone"
      -]
    • removedOutput schema / properties / status / type
      Removed value: -"string"
    • removedOutput schema / required
      Removed value: -[
      -  "status",
      -  "reverted",
      -  "alreadyGone",
      -  "conflicts",
      -  "note"
      -]
  3. Changed2 schema fields changed
    • addedInput schema / properties / sheetId
      Added value: +{
      +  "description": "The sheet the batch wrote, as that call returned it",
      +  "exclusiveMinimum": 0,
      +  "maximum": 9007199254740991,
      +  "type": "integer"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "batchId"
      -]New value: +[
      +  "batchId",
      +  "sheetId"
      +]
  4. First observed

TDQS

A4.6/5.0
Behavior4/5

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

Goes well past the annotations (destructiveHint, idempotentHint) by disclosing conflict handling — fields changed since the batch are kept and reported as conflicts — plus the one-time/7-day authorization window and the Ask-first approval interception returning `status: "pending_approval"` with no changes until approved. That is exactly the pre-destructive context an agent needs. The only gap is no note on what a failed/expired undo returns, but the output schema likely covers that.

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 core action, then layered semicolon clauses for batch-type behavior, limits, and the approval path — no filler sentences. The middle clauses are dense and multi-conditional, which makes for slower parsing, but essentially every clause carries operational information.

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?

Covers all four parameters' origins, the authorization/expiry constraints, the conflict-handling semantics, non-reverted workflow side effects, and the approval branch that changes the call's outcome. With an output schema present, nothing an agent needs to decide and execute correctly is missing.

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 provenance the schema cannot: batchId is 'the batchId it returned' from the named tools, sheetId is 'the sheet it wrote, as that call returned it', and reason/targetNotes are described as text the approver reads when Ask first holds the call. That framing tells the agent where these values come from, not just their types.

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 specific verb ('Undo') and a specific resource ('a whole batch'), and immediately names the exact sibling tools whose batches it targets (item.create_many, item.update_many, item.update_where). The two batch semantics — create batch deletes rows, update batch restores prior values — make it unmistakable what the tool acts on versus a generic item mutation.

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?

Explicit when-to-use ('when the user asks to undo a bulk change') plus hard prerequisites: only the batch runner or org owner, only once, within 7 days. It also carves out scope by naming the batch-producing tools, so the agent knows a non-batch change is out of reach, and flags that downstream workflow effects are not reverted.

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