Skip to main content
Glama

Delete Paths

delete
Destructive

Remove files, directories, and symlinks when a path should no longer exist; set recursive for non-empty folders and use the returned undo ID to restore.

Instructions

Delete files, directories, and symlinks. Use when a path should no longer exist. Do not use it to rename or relocate; use move instead, and undo to restore. A symlink is removed, never its target. A non-empty directory needs recursive: true; without it, that path fails INVALID_INPUT. With it, the user must confirm. Nothing is deleted until every prompt is answered. A client that cannot prompt fails the whole call INVALID_INPUT. Deleting a folder that holds protected files cannot be undone. Other failures hit only their own path: ACCESS_DENIED for a root, read-only, or outside path; CANCELLED when refused or changed; INVALID_INPUT for a nested pair. Returns per-path { deleted } or { error } (a skipped prompt gives deleted: false), a summary, and an undo id valid 30 minutes, or undoUnavailable with the reason.

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": {
      "paths": "<paths>"
    },
    "name": "delete"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathsYesExact paths (no globs): files, directories, or symlinks. Duplicates collapse
recursiveNoRequired for a non-empty directory, else INVALID_INPUT.
ignoreIfNotExistsNoTrue: a missing path returns deleted: true instead of failing NOT_FOUND

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv2.22.0
    • changedInput schema / properties / paths / items / description
      Previous value: -"File or directory path inside an allowed workspace root."New value: +"File or directory path inside a root, absolute or relative to it."
  2. Changed3 schema fields changedv2.20.0
    • changedInput schema / properties / ignoreIfNotExists / description
      Previous value: -"Silently succeed if a path does not exist instead of returning an error"New value: +"True: a missing path returns deleted: true instead of failing NOT_FOUND"
    • changedInput schema / properties / paths / description
      Previous value: -"Paths to delete (max 1000); accepts files, directories, or symlinks"New value: +"Exact paths (no globs): files, directories, or symlinks. Duplicates collapse"
    • changedInput schema / properties / recursive / description
      Previous value: -"Delete directory contents recursively (required for non-empty directories). A recursive delete of a non-empty directory asks the user to confirm; a client that cannot show a prompt fails with INVALID_INPUT and nothing in the call is deleted."New value: +"Required for a non-empty directory, else INVALID_INPUT."
  3. Changed1 schema field changedv2.18.2
    • changedInput schema / properties / recursive / description
      Previous value: -"Delete directory contents recursively (required for non-empty directories)"New value: +"Delete directory contents recursively (required for non-empty directories). A recursive delete of a non-empty directory asks the user to confirm; a client that cannot show a prompt fails with INVALID_INPUT and nothing in the call is deleted."
  4. Changed1 schema field changedv2.4.1
    • addedInput schema / $schema
      Added value: +"https://json-schema.org/draft/2020-12/schema"
  5. Changed1 schema field changedv2.1.5
    • changedOutput schema / (root)
      Previous value: -{
      -  "additionalProperties": false,
      -  "properties": {
      -    "results": {
      -      "description": "Per-path results ordered to match the input paths",
      -      "items": {
      -        "additionalProperties": false,
      -        "properties": {
      -          "error": {
      -            "additionalProperties": false,
      -            "description": "Error details; present on failure",
      -            "properties": {
      -              "code": {
      -                "type": "string"
      -              },
      -              "message": {
      -                "type": "string"
      -              },
      -              "path": {
      -                "type": "string"
      -              },
      -              "suggestion": {
      -                "type": "string"
      -              }
      -            },
      -            "required": [
      -              "code",
      -              "message"
      -            ],
      -            "type": "object"
      -          },
      -          "path": {
      -            "description": "Requested path",
      -            "type": "string"
      -          },
      -          "value": {
      -            "additionalProperties": false,
      -            "description": "Delete outcome; present on success",
      -            "properties": {
      -              "deleted": {
      -                "description": "True when the path was removed; false when the user chose Skip",
      -                "type": "boolean"
      -              }
      -            },
      -            "required": [
      -              "deleted"
      -            ],
      -            "type": "object"
      -          }
      -        },
      -        "required": [
      -          "path"
      -        ],
      -        "type": "object"
      -      },
      -      "type": "array"
      -    },
      -    "summary": {
      -      "additionalProperties": false,
      -      "properties": {
      -        "failed": {
      -          "minimum": 0,
      -          "type": "integer"
      -        },
      -        "succeeded": {
      -          "minimum": 0,
      -          "type": "integer"
      -        },
      -        "total": {
      -          "minimum": 0,
      -          "type": "integer"
      -        }
      -      },
      -      "required": [
      -        "total",
      -        "succeeded",
      -        "failed"
      -      ],
      -      "type": "object"
      -    }
      -  },
      -  "required": [
      -    "results",
      -    "summary"
      -  ],
      -  "type": "object"
      -}New value: +null
  6. Addedv2.0.0

TDQS

A4.6/5.0
Behavior4/5

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

The annotations already declare destructiveHint=true, but the description adds substantial behavior beyond them: symlinks are removed without touching targets, non-empty directories fail INVALID_INPUT without recursive, nothing is deleted until every prompt is answered, and a non-prompting client fails the whole call. It also discloses that deleting a folder with protected files is irreversible and that the undo id expires in 30 minutes. The only shortfall is that the confirmation flow's granularity (per path vs per call) is implied rather than spelled out.

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?

Purpose and the sibling routing come first, then behavior, then failure modes and return shape — a sound front-loaded order with essentially no filler. It is dense to the point of being run-on in the error-code sentence, but every clause carries operative 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?

With no output schema, the description carries the return contract itself and does so: per-path { deleted } or { error }, the deleted:false outcome for a skipped prompt, a summary, and an undo id with its 30-minute lifetime or an undoUnavailable reason. Combined with per-error-code semantics, this is sufficient for a destructive, multipath tool.

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 meaning beyond the schema for `recursive` by tying it to a user-confirmation requirement, not just the INVALID_INPUT outcome. It does not address `ignoreIfNotExists` at all, which keeps it from a 5.

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 plus the full resource set ('Delete files, directories, and symlinks') and immediately adds scope ('Use when a path should no longer exist'). It explicitly separates itself from 'move' for rename/relocate and 'undo' for restoration, so an agent can route correctly without opening any schema.

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 positive trigger ('when a path should no longer exist'), an explicit negative case ('Do not use it to rename or relocate'), and names the preferred alternative for each ('move', 'undo'). The recursive requirement and the confirmation precondition are also stated as usage conditions rather than left to inference.

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