delete-folder-by-id
Safely delete one exact, empty Apple Notes folder by ID using a dry-run plan, then apply with revision and identity guards; refuses non-empty and system folders.
Instructions
Use when: deleting one exact, empty, ordinary folder by id, with a plan-then-apply handshake. Returns: a plan (status planned, wouldDelete, identity fields, zero counts, revision) or, on apply, status deleted with verified readback. Do not use when: the folder holds notes or subfolders, or you only have a name or path (delete-folder). Safety: requires the exact id plus expectedName, expectedAccountId, and expectedParentId or expectedRoot. Call with dryRun true, then repeat the same guards with dryRun false and expectedRevision. Always refuses Recently Deleted, smart folders, the account's default and other system folders, shared folders, and non-empty folders; there is no override. Not atomic: the guard is a pre-check followed by an AppleScript delete. The Notes.app-visible checks repeat inside the delete script, but folder type is read from the local store just before it. Needs Full Disk Access and fails closed without it.
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": {
"id": "<id>",
"expectedName": "<expectedName>",
"expectedAccountId": "<expectedAccountId>",
"dryRun": "<dryRun>"
},
"name": "delete-folder-by-id"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Exact folder id (x-coredata://…/ICFolder/pN) from list-folders, or the folder's Notes UUID or numeric key | |
| dryRun | Yes | true plans and returns a revision; false applies with expectedRevision | |
| expectedName | Yes | Current folder name (not a path), matched case-sensitively | |
| expectedRoot | No | Pass true when the folder sits at the account root (no parent folder) | |
| expectedParentId | No | Current parent folder id; omit and pass expectedRoot for a top-level folder | |
| expectedRevision | No | The revision returned by the dry run; required when dryRun is false | |
| expectedAccountId | Yes | Owning account id, from get-folder-by-id or list-accounts |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | No |