# fs_delete

Remove a file or folder by moving it to the user's trash (macOS ~/.Trash, Linux the freedesktop trash), so the owner can put it back. A non-empty folder needs recursive=true. permanent=true removes for good and cannot be undone. The home folder, the file system root and the machine's allowed roots themselves are refused, as are paths holding keys and credentials.

**In short:** Risk class [`destructive`](https://docs.cmdop.ai/reference/tools.md#risk-classes). Over MCP call `fs_delete`; over HTTP send `"tool": "fs_delete"` to [`POST /api/v1/call`](https://docs.cmdop.ai/reference/http/post-call.md).

## Arguments

Over MCP every tool also takes `machine`: the machine's name or id, optional when only one machine is online.

| Name | Type | Required | Meaning |
| --- | --- | --- | --- |
| `path` | `string` | yes | File or folder on the machine. Absolute, or relative to the user's home folder. |
| `permanent` | `boolean` | no | Remove for good instead of moving to the trash. Only where the trash cannot take it. Default: `false`. |
| `recursive` | `boolean` | no | Allow a folder that is not empty. Default: `false`. |

## Result

| Name | Type | Required | Meaning |
| --- | --- | --- | --- |
| `path` | `string` | yes |  |
| `trashed_to` | `string` | no | Where it went in the trash; absent when removed for good. |

## Examples

**MCP**

```json
{
  "name": "fs_delete",
  "arguments": {
    "machine": "<machine>",
    "path": "<path>"
  }
}
```

**HTTP**

```bash
curl -sS -X POST "https://<contour>.cmdop.ai/api/v1/call" \
  -H "Authorization: Bearer $CMDOP_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"machine":"<machine>","tool":"fs_delete","args":{"path":"<path>"}}'
```

## Limits

The call times out after 120 s (`timed_out`). Available since version 0.0.1. A refused or failed call returns one of the [error codes](https://docs.cmdop.ai/reference/errors.md).
