Skip to main content
Glama

delete_file

Delete files and empty directories, singly or in batches up to 100, with validation before removal. Non-empty directories are rejected and dirty git files require confirmation.

Instructions

Delete files and empty directories. Pass file_path for one, or paths for several in a single call (max 100). Refuses to delete directories unless allow_dir: true is set — and even then only an EMPTY directory is accepted (non-empty directories are always rejected; there is no recursive delete). To remove a whole tree, list its files with find_files and pass them plus their directories in one paths batch with allow_dir: true — every path is validated before anything is removed, and directories go last, deepest first, so they are empty by the time their turn comes. The LSP server is notified with FileDeleted so symbol indexes and diagnostics update immediately. Per-path locking serialises against any concurrent write_file/edit_file targeting the same path. The response reports the line and byte count removed (bytes only for a binary or oversized file).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathsNoSeveral files and/or empty directories to delete in one call (max 100). Same per-path rules as file_path — this batches round-trips, it does NOT delete recursively. Every path is validated before any is removed, and directories are removed after files, deepest first, so naming a tree's files and its directories together works in one call.
dirty_okNoAllow deleting a file that has uncommitted changes in its git repository. Default false — deletion is refused if the file is dirty. Pass true to proceed anyway.
allow_dirNoAllow deleting an empty directory. Default false — deletion is refused for any directory. The directory must be empty; non-empty directories are rejected even with allow_dir: true.
file_pathNoAbsolute path, file:// URI, or workspace-relative path of the file or empty directory to delete. Use paths instead to delete several in one call.

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Changed2 schema fields changedv0.17.0
    • changedInput schema / properties / file_path / description
      Previous value: -"Absolute path, file:// URI, or workspace-relative path of the file or empty directory to delete."New value: +"Absolute path, file:// URI, or workspace-relative path of the file or empty directory to delete. Use paths instead to delete several in one call."
    • addedInput schema / properties / paths
      Added value: +{
      +  "description": "Several files and/or empty directories to delete in one call (max 100). Same per-path rules as file_path — this batches round-trips, it does NOT delete recursively. Every path is validated before any is removed, and directories are removed after files, deepest first, so naming a tree's files and its directories together works in one call.",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
  2. First observedv0.16.6

TDQS

A4.8/5.0
Behavior5/5

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

With no annotations provided, the description carries full behavioral disclosure. It details the non-recursive delete restriction, the refusal of non-empty directories, validation before any removal, the order of directory deletion, LSP notification, per-path locking against concurrent writes, and the response report format. This is exhaustive for a complex mutation 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 long, but every sentence delivers new information—no filler. It front-loads the core action and follows with restrictions, deletion strategy, side effects, and response format. The structure is logical, though slightly dense; a compact breakdown of the tree-deletion workflow would improve scanability.

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 tool with no annotations and no output schema, the description covers all necessary operational aspects: path types, batching limits, rejection rules, tree deletion method, concurrency behavior, side effects, and response contents. An agent has sufficient information to call this tool correctly without further inference.

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%, giving a baseline of 3. The description adds meaningful semantics beyond the schema: it clarifies that paths batches round-trips, enforces a max of 100, explains validation and ordering, and explicitly contrasts file_path with paths ('Use paths instead to delete several in one call'). This extra context moves it above baseline.

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 opens with 'Delete files and empty directories,' giving a specific verb, resource, and scope. It clearly distinguishes from siblings like write_file, edit_file, rename_file, and copy_file by focusing purely on deletion and adding the nuance that non-empty directories are rejected.

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?

Explicitly clarifies when to use this tool and how to handle tree deletion: 'To remove a whole tree, list its files with find_files and pass them plus their directories in one paths batch with allow_dir: true.' It also notes the batching alternative to file_path and warns against recursive deletion, giving the agent precise routing guidance.

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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/plumbkit/plumb'

If you have feedback or need assistance with the MCP directory API, please join our Discord server