← Về thư mục
📄 / / root / ceo-project / integrations / notebooklm-mcp-cli / docs / FILE_UPLOAD_IMPLEMENTATION.md

File Upload Implementation

Overview

File upload uses HTTP Resumable Upload – the reliable, headless method.

HTTP Resumable Upload

Implementation

Uses Google's 3-step resumable upload protocol:

  1. Register source intent (RPC: o4cbdc) → get SOURCE_ID
  2. Start upload session (POST to /upload/_/) → get upload URL
  3. Stream file content → upload URL (memory-efficient streaming)

Code Structure

Usage

Python:

from notebooklm_tools.core.client import NotebookLMClient

with NotebookLMClient() as client:
    result = client.add_file(notebook_id="...", file_path="document.pdf")
# Returns: {"id": "source-id", "title": "document.pdf"}

CLI:

nlm source add <notebook-id> --file document.pdf

MCP:

source_add(notebook_id="...", source_type="file", file_path="/path/to/file.pdf")

Supported File Types

Advantages

Testing

# Create a test file
echo "Test content" > test.txt

# Upload the file
nlm source add <notebook-id> --file test.txt

# Verify it was added
nlm source list <notebook-id>

Troubleshooting

"File not found"

"Unsupported file type"

Upload times out


Historical Note

A browser-based upload fallback using Chrome automation was previously available (--browser flag) but has been removed. NotebookLM's UI now uses the File System Access API which cannot be automated via CDP. The HTTP method is more reliable anyway.