delete_item
Remove a Claude Code configuration item like memory, skill, or MCP server entry. Use scan_inventory first to identify items and their scope IDs for deletion.
Instructions
Delete a Claude Code configuration item (memory, skill, MCP server entry). Run scan_inventory first to see available items and scope IDs.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category | Yes | Category of item to delete | |
| name | Yes | Name of the item (as shown in scan_inventory results) | |
| scopeId | Yes | Scope ID where the item lives |
Implementation Reference
- src/ui/app.js:1413-1496 (handler)The doDelete function acts as the handler for the delete_item action, responsible for preparing a backup of the item before calling the /api/delete endpoint and managing the undo logic for restoring the item if needed.
async function doDelete(itemRef, skipRefresh = false) { const item = resolveItem(itemRef); if (!item) return { ok: false, error: "Item not found" }; let backupContent = null; let mcpBackup = null; try { if (item.category === "mcp") { mcpBackup = { name: item.name, config: item.mcpConfig, mcpJsonPath: item.path }; } else { let readPath = item.path; if (item.category === "skill") readPath = `${item.path}/SKILL.md`; const backup = await fetchJson(`/api/file-content?path=${encodeURIComponent(readPath)}`); if (backup.ok) backupContent = backup.content; } } catch { // best effort backup only } const response = await fetch("/api/delete", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ itemPath: item.path, category: item.category, name: item.name, }), }); const result = await response.json(); if (skipRefresh) return result; if (result.ok) { if (selectedItem && itemKey(selectedItem) === itemKey(item)) { selectedItem = null; detailPreviewKey = null; } let undoFn = null; if (mcpBackup) { undoFn = async () => { const restoreResult = await fetch("/api/restore-mcp", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(mcpBackup), }).then((res) => res.json()); if (restoreResult.ok) { toast("Delete undone"); await refreshUI(); } else { toast(restoreResult.error, true); } }; } else if (backupContent) { undoFn = async () => { const restoreResult = await fetch("/api/restore", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ filePath: item.path, content: backupContent, isDir: item.category === "skill", }), }).then((res) => res.json()); if (restoreResult.ok) { toast("Delete undone"); await refreshUI(); } else { toast(restoreResult.error, true); } }; } toast(result.message, false, undoFn); await refreshUI(); } else { toast(result.error, true); } return result; }