Skip to main content
Glama

remove_notebook

Remove a notebook from your NotebookLM library after explicit user confirmation. This action only removes the notebook reference from the library interface without deleting the actual NotebookLM notebook content.

Instructions

Dangerous — requires explicit user confirmation.

Confirmation Workflow

  1. User requests removal ("Remove the React notebook")

  2. Look up full name to confirm

  3. Ask: "Remove '[notebook_name]' from your library? (Does not delete the actual NotebookLM notebook)"

  4. Only on explicit "Yes" → call remove_notebook

Never remove without permission or based on assumptions.

Example: User: "Delete the old React notebook" You: "Remove 'React Best Practices' from your library?" User: "Yes" → call remove_notebook

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe notebook ID to remove

Implementation Reference

  • Main handler function executing the remove_notebook tool: validates notebook exists, removes it via library, closes associated sessions, handles errors, returns success/error with closed_sessions count.
    /**
     * Handle remove_notebook tool
     */
    async handleRemoveNotebook(args: { id: string }): Promise<ToolResult<{ removed: boolean; closed_sessions: number }>> {
      log.info(`🔧 [TOOL] remove_notebook called`);
      log.info(`  ID: ${args.id}`);
    
      try {
        const notebook = this.library.getNotebook(args.id);
        if (!notebook) {
          log.warning(`⚠️  [TOOL] Notebook not found: ${args.id}`);
          return {
            success: false,
            error: `Notebook not found: ${args.id}`,
          };
        }
    
        const removed = this.library.removeNotebook(args.id);
        if (removed) {
          const closedSessions = await this.sessionManager.closeSessionsForNotebook(
            notebook.url
          );
          log.success(`✅ [TOOL] remove_notebook completed`);
          return {
            success: true,
            data: { removed: true, closed_sessions: closedSessions },
          };
        } else {
          log.warning(`⚠️  [TOOL] Notebook not found: ${args.id}`);
          return {
            success: false,
            error: `Notebook not found: ${args.id}`,
          };
        }
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        log.error(`❌ [TOOL] remove_notebook failed: ${errorMessage}`);
        return {
          success: false,
          error: errorMessage,
        };
      }
    }
  • Tool schema definition: name, detailed description with confirmation workflow, input schema requiring 'id' string.
      {
        name: "remove_notebook",
        description:
          `Dangerous — requires explicit user confirmation.
    
    ## Confirmation Workflow
    1) User requests removal ("Remove the React notebook")
    2) Look up full name to confirm
    3) Ask: "Remove '[notebook_name]' from your library? (Does not delete the actual NotebookLM notebook)"
    4) Only on explicit "Yes" → call remove_notebook
    
    Never remove without permission or based on assumptions.
    
    Example:
    User: "Delete the old React notebook"
    You: "Remove 'React Best Practices' from your library?"
    User: "Yes" → call remove_notebook`,
        inputSchema: {
          type: "object",
          properties: {
            id: {
              type: "string",
              description: "The notebook ID to remove",
            },
          },
          required: ["id"],
        },
      },
  • src/index.ts:216-220 (registration)
    Dispatch/registration in main tool call handler: routes 'remove_notebook' calls to handleRemoveNotebook with typed args.
    case "remove_notebook":
      result = await this.toolHandlers.handleRemoveNotebook(
        args as { id: string }
      );
      break;
  • Core library method: filters notebook from list, updates active_notebook_id if needed, persists to storage.
     */
    removeNotebook(id: string): boolean {
      const notebook = this.getNotebook(id);
      if (!notebook) {
        return false;
      }
    
      log.info(`🗑️  Removing notebook: ${id}`);
    
      const updated = { ...this.library };
      updated.notebooks = updated.notebooks.filter((n) => n.id !== id);
    
      // If we removed the active notebook, select another one
      if (updated.active_notebook_id === id) {
        updated.active_notebook_id =
          updated.notebooks.length > 0 ? updated.notebooks[0].id : null;
      }
    
      this.saveLibrary(updated);
      log.success(`✅ Notebook removed: ${id}`);
    
      return true;
    }

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