Skip to main content
Glama

Delete document derived records

well_delete_document_derived_records
Destructive

Delete the transactions and payslips a deleted document created (soft delete). A statement's import creates transactions; a payslip file creates its payslip.

Use this tool only as the next_step of well_delete_document, once the person said yes to deleting those rows too, in their request or after Well asked. Never call it unasked.

REQUIRED: document_id, the id of the deleted document.

A row stays when it falls in a closed period or has no date, a connected tool also synced it, a ledger entry books it, it is matched to an invoice, a receipt or a payslip, or an expense note or a shared-expense repayment points at it. The call fails and deletes nothing when the document is still in Well or none of its rows can go. The person confirms on a card before anything is removed.

Returns { success: true, document_id, removed: { transactions, payslips }, kept: { transactions, payslips } }, where kept counts the rows that stayed per reason, or { success: false, error } on failure.

Input Schema

NameRequiredDescriptionDefault
document_idYesThe deleted document whose transactions and payslips to delete.
workspace_idNoTarget workspace. Omit when the token authorizes one workspace. Required when it authorizes several — a write lands in exactly one workspace and this call would not say which.
conversation_idNoThe conversation id returned by the previous Well result, in its meta under well/conversation_id, in its structuredContent, or in its JSON text block. Pass it back on every call in the same conversation, including a call a card makes, so the chosen workspace and the earlier answers still apply. It decides the conversation on its own: nothing the host states about the session replaces it. Omit it only on the first call of a conversation.
idempotency_keyNoOptional client-supplied key. A retried write with the same key returns the original result instead of re-applying the operation.
workspace_scopeNoRestrict this call to the family: the token's primary workspace plus the company workspaces under it that you are a member of. Unrelated authorized workspaces drop out of the read; row reads merge across the family, while a per-workspace figure still reports exactly one workspace.

Output Schema

NameRequiredDescriptionDefault
codeNo
keptNo
errorNo
removedNo
successYes
document_idNo
reply_linesNo
conversation_idNoThe conversation this result belongs to. Pass it back as the conversation_id argument on every later Well call in the same conversation.
near_candidatesNo
newly_connectedNoTools that connected to this workspace since the last result and that no session was told about yet, oldest first. Present only when at least one tool is new. The connected-line rule says when to tell an entry; when it does, one line per entry, in the person's language: "<name> is connected.". Never fold several entries into one sentence. Each entry comes back once, on one result only: never repeat its line later.
conversation_id_noteNoPresent only when the server opened a fresh lane, stating that no choice recorded earlier was read.
conversation_id_sourceNoWhere the conversation id came from: the host's own request meta, the caller's argument, or a fresh lane the server opened.
near_candidates_truncatedNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • addedOutput schema / properties / code
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / near_candidates
      Added value: +{
      +  "items": {
      +    "additionalProperties": false,
      +    "properties": {
      +      "company_id": {
      +        "type": "string"
      +      },
      +      "name": {
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "company_id",
      +      "name"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • addedOutput schema / properties / near_candidates_truncated
      Added value: +{
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / reply_lines
      Added value: +{
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
  2. Added

TDQS

A4.6/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 adds substantial context beyond them: the exact criteria for rows that survive (closed period, no date, synced by a connector, ledger booked, matched, referenced), the two failure modes that delete nothing (document still in Well, no eligible rows), and the confirmation card before removal. This is exactly the kind of blast-radius detail an agent needs before a destructive call.

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 and dense: purpose, then the hard usage gate, then the required parameter, then keep/fail rules. The final sentence spelling out the return shape largely duplicates the existing output schema, which is the one stretch of text that does not earn its place.

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, consent-gated follow-up operation, it covers the prerequisite tool, the consent requirement, the eligibility rules that determine partial success, the failure conditions, and the confirmation step. Nothing an agent needs in order to decide whether to call it is missing.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents every parameter, including workspace_id, conversation_id, and idempotency_key semantics. The description only restates document_id as REQUIRED, adding nothing beyond the schema's own required array and description. Baseline 3 is appropriate when the schema does the heavy lifting.

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?

States a specific verb and resource pair ('Delete the transactions and payslips a deleted document created') and immediately clarifies the mechanism (soft delete) plus the concrete chain (statement import → transactions, payslip file → payslip). It is clearly distinguishable from the sibling well_delete_document, which it explicitly builds on.

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?

Gives an explicit gating condition: 'Use this tool only as the next_step of well_delete_document, once the person said yes to deleting those rows too... Never call it unasked.' It names the predecessor tool, the consent precondition, and an explicit prohibition, which is about as strong as usage guidance gets.

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