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
| Name | Required | Description | Default |
|---|---|---|---|
| dirty_ok | No | Allow 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_dir | No | Allow 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_path | No | Absolute path, file:// URI, or workspace-relative path of the file or empty directory to delete. |