Skip to main content
Glama

cleanup_data

Removes all NotebookLM MCP server data files across 8 categories including installations, caches, logs, and browser sessions. Shows preview before deletion and preserves library if specified.

Instructions

ULTRATHINK Deep Cleanup - Scans entire system for ALL NotebookLM MCP data files across 8 categories. Always runs in deep mode, shows categorized preview before deletion.

⚠️ CRITICAL: Close ALL Chrome/Chromium instances BEFORE running this tool! Open browsers can prevent cleanup and cause issues.

Categories scanned:

  1. Legacy Installation (notebooklm-mcp-nodejs) - Old paths with -nodejs suffix

  2. Current Installation (notebooklm-mcp) - Active data, browser profiles, library

  3. NPM/NPX Cache - Cached installations from npx

  4. Claude CLI MCP Logs - MCP server logs from Claude CLI

  5. Temporary Backups - Backup directories in system temp

  6. Claude Projects Cache - Project-specific cache (optional)

  7. Editor Logs (Cursor/VSCode) - MCP logs from code editors (optional)

  8. Trash Files - Deleted notebooklm files in system trash (optional)

Works cross-platform (Linux, Windows, macOS). Safe by design: shows detailed preview before deletion, requires explicit confirmation.

LIBRARY PRESERVATION: Set preserve_library=true to keep your notebook library.json file while cleaning everything else.

RECOMMENDED WORKFLOW for fresh start:

  1. Ask user to close ALL Chrome/Chromium instances

  2. Run cleanup_data(confirm=false, preserve_library=true) to preview

  3. Run cleanup_data(confirm=true, preserve_library=true) to execute

  4. Run setup_auth or re_auth for fresh browser session

Use cases: Clean reinstall, troubleshooting auth issues, removing all traces before uninstall, cleaning old browser sessions and installation data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
confirmYesConfirmation flag. Tool shows preview first, then user confirms deletion. Set to true only after user has reviewed the preview and explicitly confirmed.
preserve_libraryNoPreserve library.json file during cleanup. Default: false. Set to true to keep your notebook library while deleting everything else (browser data, caches, logs).

Implementation Reference

  • The primary handler function that executes the cleanup_data tool. It handles both preview (confirm=false) and deletion (confirm=true) modes, instantiates CleanupManager, logs progress, and returns structured ToolResult with preview data or deletion results.
    /**
     * Handle cleanup_data tool
     *
     * ULTRATHINK Deep Cleanup - scans entire system for ALL NotebookLM MCP files
     */
    async handleCleanupData(
      args: { confirm: boolean; preserve_library?: boolean }
    ): Promise<
      ToolResult<{
        status: string;
        mode: string;
        preview?: {
          categories: Array<{ name: string; description: string; paths: string[]; totalBytes: number; optional: boolean }>;
          totalPaths: number;
          totalSizeBytes: number;
        };
        result?: {
          deletedPaths: string[];
          failedPaths: string[];
          totalSizeBytes: number;
          categorySummary: Record<string, { count: number; bytes: number }>;
        };
      }> 
    > {
      const { confirm, preserve_library = false } = args;
    
      log.info(`🔧 [TOOL] cleanup_data called`);
      log.info(`  Confirm: ${confirm}`);
      log.info(`  Preserve Library: ${preserve_library}`);
    
      const cleanupManager = new CleanupManager();
    
      try {
        // Always run in deep mode
        const mode = "deep";
    
        if (!confirm) {
          // Preview mode - show what would be deleted
          log.info(`  📋 Generating cleanup preview (mode: ${mode})...`);
    
          const preview = await cleanupManager.getCleanupPaths(mode, preserve_library);
          const platformInfo = cleanupManager.getPlatformInfo();
    
          log.info(`  Found ${preview.totalPaths.length} items (${cleanupManager.formatBytes(preview.totalSizeBytes)})`);
          log.info(`  Platform: ${platformInfo.platform}`);
    
          return {
            success: true,
            data: {
              status: "preview",
              mode,
              preview: {
                categories: preview.categories,
                totalPaths: preview.totalPaths.length,
                totalSizeBytes: preview.totalSizeBytes,
              },
            },
          };
        } else {
          // Cleanup mode - actually delete files
          log.info(`  🗑️  Performing cleanup (mode: ${mode})...`);
    
          const result = await cleanupManager.performCleanup(mode, preserve_library);
    
          if (result.success) {
            log.success(`✅ [TOOL] cleanup_data completed - deleted ${result.deletedPaths.length} items`);
          } else {
            log.warning(`⚠️  [TOOL] cleanup_data completed with ${result.failedPaths.length} errors`);
          }
    
          return {
            success: result.success,
            data: {
              status: result.success ? "completed" : "partial",
              mode,
              result: {
                deletedPaths: result.deletedPaths,
                failedPaths: result.failedPaths,
                totalSizeBytes: result.totalSizeBytes,
                categorySummary: result.categorySummary,
              },
            },
          };
        }
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        log.error(`❌ [TOOL] cleanup_data failed: ${errorMessage}`);
        return {
          success: false,
          error: errorMessage,
        };
      }
    }
  • Tool definition including name, detailed description, and inputSchema specifying 'confirm' (required boolean) and 'preserve_library' (optional boolean with default false).
    {
      name: "cleanup_data",
      description:
        "ULTRATHINK Deep Cleanup - Scans entire system for ALL NotebookLM MCP data files across 8 categories. Always runs in deep mode, shows categorized preview before deletion.\n\n" +
        "⚠️ CRITICAL: Close ALL Chrome/Chromium instances BEFORE running this tool! Open browsers can prevent cleanup and cause issues.\n\n" +
        "Categories scanned:\n" +
        "1. Legacy Installation (notebooklm-mcp-nodejs) - Old paths with -nodejs suffix\n" +
        "2. Current Installation (notebooklm-mcp) - Active data, browser profiles, library\n" +
        "3. NPM/NPX Cache - Cached installations from npx\n" +
        "4. Claude CLI MCP Logs - MCP server logs from Claude CLI\n" +
        "5. Temporary Backups - Backup directories in system temp\n" +
        "6. Claude Projects Cache - Project-specific cache (optional)\n" +
        "7. Editor Logs (Cursor/VSCode) - MCP logs from code editors (optional)\n" +
        "8. Trash Files - Deleted notebooklm files in system trash (optional)\n\n" +
        "Works cross-platform (Linux, Windows, macOS). Safe by design: shows detailed preview before deletion, requires explicit confirmation.\n\n" +
        "LIBRARY PRESERVATION: Set preserve_library=true to keep your notebook library.json file while cleaning everything else.\n\n" +
        "RECOMMENDED WORKFLOW for fresh start:\n" +
        "1. Ask user to close ALL Chrome/Chromium instances\n" +
        "2. Run cleanup_data(confirm=false, preserve_library=true) to preview\n" +
        "3. Run cleanup_data(confirm=true, preserve_library=true) to execute\n" +
        "4. Run setup_auth or re_auth for fresh browser session\n\n" +
        "Use cases: Clean reinstall, troubleshooting auth issues, removing all traces before uninstall, cleaning old browser sessions and installation data.",
      inputSchema: {
        type: "object",
        properties: {
          confirm: {
            type: "boolean",
            description:
              "Confirmation flag. Tool shows preview first, then user confirms deletion. " +
              "Set to true only after user has reviewed the preview and explicitly confirmed.",
          },
          preserve_library: {
            type: "boolean",
            description:
              "Preserve library.json file during cleanup. Default: false. " +
              "Set to true to keep your notebook library while deleting everything else (browser data, caches, logs).",
            default: false,
          },
        },
        required: ["confirm"],
      },
    },
  • The buildToolDefinitions function aggregates all tool definitions, including systemTools (which contains cleanup_data), making it available to the MCP server via list_tools.
    export function buildToolDefinitions(library: NotebookLibrary): Tool[] {
      // Update the description for ask_question based on the library state
      const dynamicAskQuestionTool = {
        ...askQuestionTool,
        description: buildAskQuestionDescription(library),
      };
    
      return [
        dynamicAskQuestionTool,
        ...notebookManagementTools,
        ...sessionManagementTools,
        ...systemTools,
      ];
    }
  • src/index.ts:266-270 (registration)
    Dispatch case in the main MCP call_tool handler that routes 'cleanup_data' calls to the specific handleCleanupData method.
    case "cleanup_data":
      result = await this.toolHandlers.handleCleanupData(
        args as { confirm: boolean }
      );
      break;
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden and does an excellent job disclosing behavioral traits: it explains the two-phase preview-then-confirm workflow, cross-platform compatibility, safety design with preview before deletion, critical browser closure requirement, and library preservation option. It doesn't mention rate limits or specific error conditions, but covers most essential behavioral aspects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately structured with clear sections (warning, categories, cross-platform note, preservation option, workflow, use cases). While somewhat lengthy, every sentence earns its place by providing essential information. The critical warning is front-loaded appropriately, and information is well-organized rather than repetitive.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given this is a complex, potentially destructive operation with no annotations and no output schema, the description provides comprehensive context: it details what gets scanned/deleted (8 categories), safety mechanisms, prerequisites, parameters, workflow, use cases, and integration with sibling tools. For a tool with this level of responsibility, the description leaves no significant gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema description coverage, the baseline is 3. The description adds significant value by explaining the practical meaning of parameters: it clarifies that 'confirm=false' shows preview while 'confirm=true' executes deletion, and explains that 'preserve_library=true' keeps the notebook library.json file while deleting everything else. The recommended workflow demonstrates parameter usage in context.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool scans for and deletes NotebookLM MCP data files across 8 specific categories, distinguishing it from all sibling tools which handle notebook operations, authentication, or session management. It specifies 'deep cleanup' with preview functionality, making its purpose explicit and differentiated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit usage scenarios (clean reinstall, troubleshooting auth issues, removing traces before uninstall) and a detailed recommended workflow with step-by-step instructions. It clearly states when to use this tool versus alternatives like setup_auth or re_auth for fresh sessions, and includes critical prerequisites (closing browsers).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/inventra/notebooklm-mcp'

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