Skip to main content
Glama

Delete document

well_delete_document
Destructive

Delete a document (a file: an invoice PDF, a receipt, a statement, a payslip) from the current workspace (soft delete).

Use this tool when the user asks to delete or remove a file ("Delete the Uber receipt I sent this morning"). Find the document_id first with well_query_records or well_get_entity. When more than one document could be the one meant, ask which one and delete nothing.

REQUIRED: document_id.

A document that a connected tool synced in (a drive, an accounting tool) is not deleted: the next sync would bring it back. The copy of an issued invoice is not deleted either: it is kept as issued. The call then fails and nothing is deleted. The person confirms the delete on a card before anything is removed.

The transactions a statement created and the payslips read from the file stay in Well after the delete. derived_records counts them: total, removable, and kept per reason (closed period, no date, connected tool, ledger entry, invoice match, expense note or shared-expense repayment, receipt or payslip match); null when Well could not count them. When next_step is present, tell the person how many transactions and payslips the file created and ask whether to delete them too, unless their request already asked for that. Call next_step.tool with next_step.input only once they said yes, in that request or after the question. Without next_step, say the rows stay and why.

Returns { success: true, document_id, filename, derived_records, next_step? } on success, or { success: false, error } on failure.

Input Schema

NameRequiredDescriptionDefault
document_idYesThe document 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
errorNo
successYes
filenameNo
next_stepNo
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.
derived_recordsNo
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. Changed2 schema fields changed
    • addedOutput schema / properties / derived_records
      Added value: +{
      +  "anyOf": [
      +    {
      +      "additionalProperties": false,
      +      "properties": {
      +        "document_id": {
      +          "type": "string"
      +        },
      +        "over_limit": {
      +          "type": "boolean"
      +        },
      +        "payslips": {
      +          "additionalProperties": false,
      +          "properties": {
      +            "kept": {
      +              "additionalProperties": false,
      +              "properties": {
      +                "booked_in_ledger": {
      +                  "maximum": 9007199254740991,
      +                  "minimum": 0,
      +                  "type": "integer"
      +                },
      +                "linked_to_expense": {
      +                  "maximum": 9007199254740991,
      +                  "minimum": 0,
      +                  "type": "integer"
      +                },
      +                "matched_to_invoice": {
      +                  "maximum": 9007199254740991,
      +                  "minimum": 0,
      +                  "type": "integer"
      +                },
      +                "period_closed": {
      +                  "maximum": 9007199254740991,
      +                  "minimum": 0,
      +                  "type": "integer"
      +                },
      +                "period_unknown": {
      +                  "maximum": 9007199254740991,
      +                  "minimum": 0,
      +                  "type": "integer"
      +                },
      +                "reconciled": {
      +                  "maximum": 9007199254740991,
      +                  "minimum": 0,
      +                  "type": "integer"
      +                },
      +                "synced_from_connector": {
      +                  "maximum": 9007199254740991,
      +                  "minimum": 0,
      +                  "type": "integer"
      +                }
      +              },
      +              "required": [
      +                "period_closed",
      +                "period_unknown",
      +                "synced_from_connector",
      +                "booked_in_ledger",
      +                "matched_to_invoice",
      +                "linked_to_expense",
      +                "reconciled"
      +              ],
      +              "type": "object"
      +            },
      +            "removable": {
      +              "maximum": 9007199254740991,
      +              "minimum": 0,
      +              "type": "integer"
      +            },
      +            "total": {
      +              "maximum": 9007199254740991,
      +              "minimum": 0,
      +              "type": "integer"
      +            }
      +          },
      +          "required": [
      +            "total",
      +            "removable",
      +            "kept"
      +          ],
      +          "type": "object"
      +        },
      +        "transactions": {
      +          "additionalProperties": false,
      +          "properties": {
      +            "kept": {
      +              "additionalProperties": false,
      +              "properties": {
      +                "booked_in_ledger": {
      +                  "maximum": 9007199254740991,
      +                  "minimum": 0,
      +                  "type": "integer"
      +                },
      +                "linked_to_expense": {
      +                  "maximum": 9007199254740991,
      +                  "minimum": 0,
      +                  "type": "integer"
      +                },
      +                "matched_to_invoice": {
      +                  "maximum": 9007199254740991,
      +                  "minimum": 0,
      +                  "type": "integer"
      +                },
      +                "period_closed": {
      +                  "maximum": 9007199254740991,
      +                  "minimum": 0,
      +                  "type": "integer"
      +                },
      +                "period_unknown": {
      +                  "maximum": 9007199254740991,
      +                  "minimum": 0,
      +                  "type": "integer"
      +                },
      +                "reconciled": {
      +                  "maximum": 9007199254740991,
      +                  "minimum": 0,
      +                  "type": "integer"
      +                },
      +                "synced_from_connector": {
      +                  "maximum": 9007199254740991,
      +                  "minimum": 0,
      +                  "type": "integer"
      +                }
      +              },
      +              "required": [
      +                "period_closed",
      +                "period_unknown",
      +                "synced_from_connector",
      +                "booked_in_ledger",
      +                "matched_to_invoice",
      +                "linked_to_expense",
      +                "reconciled"
      +              ],
      +              "type": "object"
      +            },
      +            "removable": {
      +              "maximum": 9007199254740991,
      +              "minimum": 0,
      +              "type": "integer"
      +            },
      +            "total": {
      +              "maximum": 9007199254740991,
      +              "minimum": 0,
      +              "type": "integer"
      +            }
      +          },
      +          "required": [
      +            "total",
      +            "removable",
      +            "kept"
      +          ],
      +          "type": "object"
      +        }
      +      },
      +      "required": [
      +        "document_id",
      +        "over_limit",
      +        "transactions",
      +        "payslips"
      +      ],
      +      "type": "object"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ]
      +}
    • addedOutput schema / properties / next_step
      Added value: +{
      +  "additionalProperties": false,
      +  "properties": {
      +    "action": {
      +      "const": "delete_derived_records",
      +      "type": "string"
      +    },
      +    "input": {
      +      "additionalProperties": false,
      +      "properties": {
      +        "document_id": {
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "document_id"
      +      ],
      +      "type": "object"
      +    },
      +    "tool": {
      +      "const": "well_delete_document_derived_records",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "action",
      +    "tool",
      +    "input"
      +  ],
      +  "type": "object"
      +}
  3. Added

TDQS

A4.6/5.0
Behavior5/5

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

Beyond the destructiveHint annotation, the description explains soft-delete semantics, confirmation-card behavior, the connected-tool and issued-invoice exceptions, what happens to derived transactions and payslips, the meaning of derived_records, and when to use next_step. This is substantial behavioral context for a destructive tool.

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 front-loaded with the core action and is well organized into action, usage, constraints, side effects, follow-up, and returns. It is long, but most of the length is earned by the complexity of the deletion behavior; a few sentences around derived_records and next_step are dense but purposeful.

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 document-deletion tool with side effects, the description covers the essential decision points: how to find the document, when not to delete, what survives the delete, how to handle derived records, and what the call returns. Although an output schema exists, the description still adds necessary interpretation.

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?

The description only highlights document_id as required and does not add meaning beyond the schema for workspace_id, conversation_id, idempotency_key, or workspace_scope. Since schema description coverage is 100%, the schema already carries parameter semantics and a baseline 3 is appropriate.

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 states a specific verb and resource — deleting a document — and immediately clarifies the file types covered (invoice PDF, receipt, statement, payslip) and that it is a soft delete. It also distinguishes this deletion from related cleanup handled by the derived-records follow-up.

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?

It gives explicit triggering language ('delete or remove a file'), tells the agent to resolve the document_id first via well_query_records or well_get_entity, and says to ask which document is meant when ambiguous. It also states when deletion will fail and delete nothing, which is clear when-not behavior.

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