Skip to main content
Glama
mcpware

claude-code-organizer

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
NameRequiredDescriptionDefault
categoryYesCategory of item to delete
nameYesName of the item (as shown in scan_inventory results)
scopeIdYesScope ID where the item lives

Implementation Reference

  • 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;
    }

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/mcpware/claude-code-organizer'

If you have feedback or need assistance with the MCP directory API, please join our Discord server