Skip to main content
Glama
Frappe MCP Server

Frappe MCP Server

Delete a document (irreversible)

frappe_delete_doc
Destructive

Permanently deletes a Frappe document by DocType and exact name; use only for disposable or test records because deletion is irreversible and blocked by linked records.

Instructions

Permanently delete a document by its doctype and name. Use only for genuinely disposable records such as ToDo or Note, or for a test document created moments earlier — the deletion is irreversible, with no undo and no recycle bin. Prefer frappe_update_doc to set a status such as 'Cancelled' whenever an audit trail matters, which covers most transactional records (Sales Invoice, Sales Order, Payment Entry, Journal Entry). Behavior: writes to the site. Not idempotent from the caller's point of view — a second call for the same name raises a not-found error. Frappe refuses the delete while other documents link to this one, so a link-exists error means the dependants must be handled first. Deleting a parent removes its child-table rows with it. Submitted documents must be cancelled before they can be deleted. Requires delete permission on the DocType. Parameters: name is the exact name primary key, not a title, and a wrong value deletes the wrong record with no warning — confirm with frappe_get_doc first when there is any doubt. One document per call: there is no bulk mode and no dry-run, and the deletion is committed as soon as the call is accepted. Returns: {"message": "ok"} on success.

Input Schema

NameRequiredDescriptionDefault
nameYesThe exact `name` primary key of the document to permanently remove (e.g. 'TODO-00001', 'NOTE-00001'). This operation cannot be undone, so verify the value identifies the intended record before calling.
doctypeYesThe DocType of the document to delete (e.g. 'ToDo', 'Note', 'Contact', 'Address'). WARNING: deleting a transactional or parent document removes its child rows and may be blocked by, or orphan, linked records.

Output Schema

NameRequiredDescriptionDefault
dataNoPresent instead of `message` when the site answers 202 Accepted; the value is 'accepted'.
messageNoConfirmation string returned by Frappe, typically 'ok'.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv1.2.0
    • addedInput schema / additionalProperties
      Added value: +false
    • changedInput schema / properties / doctype / description
      Previous value: -"The DocType of the document to delete (e.g. 'ToDo', 'Note', 'Contact', 'Address'). WARNING: Deleting transactional or parent documents may affect or orphan linked child records."New value: +"The DocType of the document to delete (e.g. 'ToDo', 'Note', 'Contact', 'Address'). WARNING: deleting a transactional or parent document removes its child rows and may be blocked by, or orphan, linked records."
    • addedInput schema / properties / doctype / minLength
      Added value: +1
    • changedInput schema / properties / name / description
      Previous value: -"The unique document name or ID to permanently remove from the system (e.g. 'TODO-00001', 'NOTE-00001'). This operation cannot be undone."New value: +"The exact `name` primary key of the document to permanently remove (e.g. 'TODO-00001', 'NOTE-00001'). This operation cannot be undone, so verify the value identifies the intended record before calling."
    • addedInput schema / properties / name / minLength
      Added value: +1
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "properties": {
      +    "data": {
      +      "description": "Present instead of `message` when the site answers 202 Accepted; the value is 'accepted'.",
      +      "type": "string"
      +    },
      +    "message": {
      +      "description": "Confirmation string returned by Frappe, typically 'ok'.",
      +      "type": "string"
      +    }
      +  },
      +  "type": "object"
      +}
  2. Changed4 schema fields changedv1.1.0
    • changedInput schema / properties / doctype / description
      Previous value: -"The DocType of the document to delete."New value: +"The DocType of the document to delete (e.g. 'ToDo', 'Note', 'Contact', 'Address'). WARNING: Deleting transactional or parent documents may affect or orphan linked child records."
    • addedInput schema / properties / doctype / examples
      Added value: +[
      +  "ToDo",
      +  "Note",
      +  "Contact"
      +]
    • changedInput schema / properties / name / description
      Previous value: -"The document name/ID to delete."New value: +"The unique document name or ID to permanently remove from the system (e.g. 'TODO-00001', 'NOTE-00001'). This operation cannot be undone."
    • addedInput schema / properties / name / examples
      Added value: +[
      +  "TODO-00001",
      +  "NOTE-00001"
      +]
  3. First observedv1.0.0

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already flag destructiveHint=true and idempotentHint=false, but the description adds substantial context: no undo or recycle bin, link-exists errors from dependants, cascading child-row removal, the cancel-before-delete rule for submitted documents, and the delete-permission requirement. It also notes the non-idempotent caller experience (second call raises not-found), which is more precise than the annotation alone.

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 purpose and the cardinal warning, then cleanly segmented into usage, Behavior, Parameters, and Returns. Slightly long and the Parameters block partially restates schema text, but nearly every sentence carries operational weight.

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 prerequisites, failure modes, cascade behavior, permission requirements, and batching limits for a two-parameter destructive tool; the return value is briefly noted even though an output schema exists. An agent has everything needed to call this safely.

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 baseline would be 3, but the description adds real semantics: `name` is the primary key rather than a title, a wrong value silently deletes the wrong record, and frappe_get_doc should be used to confirm first. It also reinforces the one-document-per-call constraint, though the field enumerations themselves duplicate the schema.

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 ('Permanently delete a document by its doctype and name') plus the irreversible scope. It distinguishes itself from siblings by naming frappe_update_doc and frappe_get_doc with the conditions that select them.

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 explicit when-to-use (ToDo, Note, freshly created test records) and when-not-to-use with a concrete alternative ('Prefer frappe_update_doc to set a status such as Cancelled'), listing the transaction types where that applies. Nothing is left to inference.

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