Skip to main content
Glama

delete_file

Delete a single file or empty directory, with options to allow directory deletion and bypass dirty git checks. Notifies LSP to update indexes immediately.

Instructions

Delete a single file or empty directory. 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). For a directory tree, delete files individually with repeated delete_file calls, then remove each now-empty directory with allow_dir: true. 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
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.
Behavior5/5

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

With no annotations provided, the description takes full responsibility for disclosing behavioral traits. It details the directory refusal logic, empty-directory requirement, LSP notification (FileDeleted), per-path locking against concurrent write/edit, and the response format (line/byte count). This is comprehensive and goes well beyond minimal expectations 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.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is four sentences, each with a distinct purpose: main action, directory constraint, tree workflow, and behavioral side effects/response. It is dense without redundancy and front-loads the primary function. Every sentence earns 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?

Despite lacking an output schema and annotations, the description covers the essential context: what can be deleted, safety constraints, concurrent behavior, LSP updates, and response contents. It gives enough guidance for an agent to use the tool correctly in most scenarios, including the non-trivial directory tree case.

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 coverage is 100% (all three parameters are described in the schema), so the baseline is 3. The description adds marginal context for allow_dir (directory tree workflow) and mentions the response count, but it does not significantly enhance the parameter meanings already present in 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?

The description opens with 'Delete a single file or empty directory,' which is a specific verb+resource statement that clearly distinguishes this from sibling file operations like write_file, edit_file, rename_file, and copy_file. It further clarifies the scope and constraints, leaving no ambiguity about what the tool does.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear usage guidance for deleting directory trees ('delete files individually with repeated delete_file calls, then remove each now-empty directory with allow_dir: true'), and explains when deletion will be refused (non-empty directories, dirty files by default). However, it does not explicitly cite alternative tools or state 'when not to use' beyond the inherent constraints, so it falls just short of a 5.

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

Install Server

Other Tools

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