| name | nlm-skill |
| version | 0.9.0 |
| description | Expert guide for the NotebookLM CLI (`nlm`) and MCP server - interfaces for Google NotebookLM. Use this skill when users want to interact with NotebookLM programmatically, including: creating/managing notebooks, adding sources (URLs, YouTube, text, Google Drive), generating content (podcasts, reports, quizzes, flashcards, mind maps, slides, infographics, videos, data tables), conducting research, chatting with sources, or automating NotebookLM workflows. Triggers on mentions of "nlm", "notebooklm", "notebook lm", "podcast generation", "audio overview", "refactor document", "critique draft", or any NotebookLM-related automation task. |
NotebookLM CLI & MCP Expert
This skill provides comprehensive guidance for using NotebookLM via both the nlm CLI and MCP tools.
Tool Detection (CRITICAL - Read First!)
ALWAYS check which tools are available before proceeding:
- Check for MCP tools: Look for tools starting with
mcp__notebooklm-mcp__* or mcp_notebooklm_*
- If BOTH MCP tools AND CLI are available: ASK the user which they prefer to use before proceeding
- If only MCP tools are available: Use them directly (refer to tool docstrings for parameters)
- If only CLI is available: Use
nlm CLI commands via Bash
Decision Logic:
has_mcp_tools = check_available_tools() # Look for mcp__notebooklm-mcp__* or mcp_notebooklm_*
has_cli = check_bash_available() # Can run nlm commands
if has_mcp_tools and has_cli:
# ASK USER: "I can use either MCP tools or the nlm CLI. Which do you prefer?"
user_preference = ask_user()
else if has_mcp_tools:
# Use MCP tools directly
mcp__notebooklm-mcp__notebook_list()
else:
# Use CLI via Bash
bash("nlm notebook list")
This skill documents BOTH approaches. Choose the appropriate one based on tool availability and user preference.
Quick Reference
Run nlm --ai to get comprehensive AI-optimized documentation - this provides a complete view of all CLI capabilities.
nlm --help
nlm <command> --help
nlm --ai
nlm --version
Critical Rules (Read First!)
- Authenticate when needed: Run
nlm login for first-time setup or confirmed stale/missing credentials. Saved cookies often remain usable for weeks.
- Do not confuse network failures with expired auth:
auth_status="unverified" means the probe was inconclusive. Check connectivity or try an API call before asking the user to log in again.
- Auto-Authentication Recovery: The CLI includes automatic 3-layer auth recovery (CSRF refresh -> Token reload -> Headless Auth) and 3x server error retries. Most errors are handled automatically. You only need to manually run
nlm login if all recovery layers fail.
- โ ๏ธ ALWAYS ASK USER BEFORE DELETE: Before executing ANY delete command, ask the user for explicit confirmation. Deletions are irreversible. Show what will be deleted and warn about permanent data loss.
- Always obtain approval before generation or deletion: Direct
studio_create and delete operations enforce --confirm / confirm=True.
The current MCP batch Studio path does not enforce its confirm parameter,
so the agent must preserve the approval gate.
- Research needs a destination: Pass
--notebook-id <id> for an existing notebook or --title <title> to create one.
- Capture IDs from output: Create/start commands return IDs needed for subsequent operations
- Use aliases: Simplify long UUIDs with
nlm alias set <name> <uuid>
- Check aliases before creating: Run
nlm alias list before creating a new alias to avoid conflicts with existing names.
- DO NOT launch REPL: Never use
nlm chat start - it opens an interactive REPL that AI tools cannot control. Use nlm notebook query for one-shot Q&A instead.
- Choose output format wisely: Default output (no flags) is compact and token-efficientโuse it for status checks. Use
--quiet to capture IDs for piping. Only use --json when you need to parse specific fields programmatically.
- Use
--help when unsure: Run nlm <command> --help to see available options and flags for any command.
- Studio: fast track by default: Infer format/style/prompt silentlyโone compact line, then
studio_create(confirm=True). No intake questionnaires. Fast track reduces clarifying questions, not the confirm gate. Cinematic video is always guided (quota-limited). Full preview only when vague, high-stakes, cinematic, or user asks. See references/studio-prompting-guide.md.
Current MCP surface: 40 tools. Consolidated action tools include note,
label, studio_status, batch, pipeline, and tag. Consolidated type
tools include source_add, studio_create, and download_artifact.
Workflow Decision Tree
Use this to determine the right sequence of commands:
User wants to...
โ
โโโบ Work with NotebookLM for the first time
โ โโโบ nlm login โ nlm notebook create "Title"
โ
โโโบ Add content to a notebook
โ โโโบ From a URL/webpage โ nlm source add <nb-id> --url "https://..."
โ โโโบ From YouTube โ nlm source add <nb-id> --url "https://youtube.com/..."
โ โโโบ From pasted text โ nlm source add <nb-id> --text "content" --title "Title"
โ โโโบ From Google Drive โ nlm source add <nb-id> --drive <doc-id> --type doc
โ โโโบ Discover new sources โ nlm research start "query" --notebook-id <nb-id>
โ
โโโบ Generate content from sources (โ Studio Prompting for optimal focus_prompt)
โ โโโบ Podcast/Audio โ nlm audio create <nb-id> --confirm
โ โโโบ Written summary โ nlm report create <nb-id> --confirm
โ โโโบ Study materials โ nlm quiz/flashcards create <nb-id> --confirm
โ โโโบ Visual content โ nlm mindmap/slides/infographic create <nb-id> --confirm
โ โโโบ Video โ nlm video create <nb-id> --confirm
โ โโโบ Extract data โ nlm data-table create <nb-id> "description" --confirm
โ
โโโบ Refactor, critique, or improve a draft document
โ โโโบ See Workflow 15 in references/workflows.md
โ
โโโบ Ask questions about sources
โ โโโบ nlm notebook query <nb-id> "question"
โ (Use --conversation-id for follow-ups)
โ โ ๏ธ Do NOT use `nlm chat start` - it's a REPL for humans only
โ
โโโบ Check generation status
โ โโโบ nlm studio status <nb-id>
โ
โโโบ Manage/cleanup
โโโบ List notebooks โ nlm notebook list
โโโบ List sources โ nlm source list <nb-id>
โโโบ Delete source โ nlm source delete <source-id> --confirm
โโโบ Delete notebook โ nlm notebook delete <nb-id> --confirm
Command Categories
1. Authentication
MCP Authentication
If using MCP tools and encountering authentication errors:
nlm login
mcp__notebooklm-mcp__refresh_auth()
Or manually save cookies via MCP (fallback):
mcp__notebooklm-mcp__save_auth_tokens(cookies="<cookie_header>")
#### CLI Authentication
```bash
nlm login # Launch browser, extract cookies (primary method)
nlm login --check # Validate current session
nlm login --profile work # Use named profile for multiple accounts
nlm login --provider openclaw --cdp-url http://127.0.0.1:18800 # External CDP provider
nlm login switch <profile> # Switch the default profile
nlm login profile list # List all profiles with email addresses
nlm login profile delete <name> # Delete a profile
nlm login profile rename <old> <new> # Rename a profile
Multi-Profile Support: Each profile gets its own isolated browser session (supports Chrome, Arc, Brave, Edge, Chromium, and more), so you can be logged into multiple Google accounts simultaneously.
Auth status: configured means usable; stale means run nlm login;
not_configured means first-time setup is required; unverified means the
probe was inconclusive; error means the health check itself failed.
Switching MCP Accounts: The MCP server always uses the active default profile. If you need to switch which Google account the MCP server is communicating with, you MUST use the CLI: run nlm login switch <name>. Your next MCP tool call will instantly use the new account.
Note: Both MCP and CLI share the same authentication backend, so authenticating with one works for both.
2. Notebook Management
MCP Tools
Use notebook_list, notebook_create, notebook_get, notebook_describe,
notebook_query, notebook_rename, and notebook_delete. The
get/describe/query/rename/delete tools require notebook_id; list and create
do not. Delete requires confirm=True.
For large notebooks or long-running questions, call notebook_query_start,
then poll notebook_query_status(query_id) until completed or errored.
CLI Commands
nlm notebook list
nlm notebook list --json
nlm notebook list --quiet
nlm notebook create "Title"
nlm notebook create "Title" --json
nlm notebook get <id>
nlm notebook describe <id>
nlm notebook query <id> "question"
nlm notebook rename <id> "New Title"
nlm notebook delete <id> --confirm
3. Source Management
MCP Tools
Use source_add with these source_type values:
url - Web page or YouTube URL (url param)
text - Pasted content (text + title params)
file - Server-local file upload (file_path param). The path must exist on
the machine running the MCP server, not merely on the client host. Failures
preserve the concrete reason and include a host-path hint. Supported:
PDF, TXT, MD, DOCX, CSV, EPUB, MP3, M4A, WAV, AAC, OGG, OPUS, MP4, JPG, JPEG, PNG, GIF, WEBP.
drive - Google Drive doc (document_id + doc_type params)
Other tools: source_list_drive (skip_freshness=True reports
stale/is_stale=null, meaning unknown, not fresh), source_describe,
source_get_content, source_rename, source_sync_drive, and
source_delete. Bulk URL add uses source_add(source_type="url", urls=[...]);
bulk delete uses source_delete(source_ids=[...], confirm=True). MCP Drive
sync requires explicit source UUIDs: list first, select stale IDs, then call
source_sync_drive(source_ids=[...], confirm=True).
Source Labels
Use label with actions auto, list, reorganize, create, rename,
set_emoji, move_source, and delete. Full reorganization and deletion
require confirm=True; reorganize(unlabeled_only=True) does not.
CLI Commands
nlm source add <nb-id> --url "https://..."
nlm source add <nb-id> --url "https://youtube.com/..."
nlm source add <nb-id> --text "content" --title "X"
nlm source add <nb-id> --drive <doc-id>
nlm source add <nb-id> --drive <doc-id> --type slides
nlm source add <nb-id> --file "/path/to/diagram.png" --wait
nlm source list <nb-id>
nlm source list <nb-id> --drive
nlm source list <nb-id> --drive -S
nlm source get <source-id>
nlm source describe <source-id>
nlm source content <source-id>
nlm source content <source-id> -o file.txt
nlm source stale <nb-id>
nlm source sync <nb-id> --confirm
nlm source sync <nb-id> --source-ids <ids> --confirm
nlm source rename <source-id> "New Title" --notebook <nb-id>
nlm rename source <source-id> "New Title" --notebook <nb-id>
nlm source delete <source-id> --confirm
Drive types: doc, slides, sheets, pdf
4. Research (Source Discovery)
Research finds NEW sources from the web or Google Drive.
MCP Tools
Use research_start with:
source: web or drive
mode: fast (~30s) or deep (~5min, web only)
Preferred workflow: research_start โ research_status(auto_import=True).
For manual source selection, poll without auto-import and then call
research_import. research_start accepts either notebook_id or title
to create a destination notebook. MCP status defaults to a 900-second wait
with 30-second polling.
CLI Commands
nlm research start "query" --notebook-id <id>
nlm research start "query" --title "New Research"
nlm research start "query" --notebook-id <id> --mode deep
nlm research start "query" --notebook-id <id> --source drive
nlm research start "query" --notebook-id <id> --mode deep --auto-import
nlm research status <nb-id>
nlm research status <nb-id> --max-wait 0
nlm research status <nb-id> --task-id <tid>
nlm research status <nb-id> --full
nlm research import <nb-id> <task-id>
nlm research import <nb-id> <task-id> --indices 0,2,5
nlm research import <nb-id> <task-id> --cited-only
nlm research import <nb-id> <task-id> --timeout 600
Modes: fast (~30s, ~10 sources) | deep (~5min, ~40+ sources, web only)
5. Content Generation (Studio)
MCP Tools (Unified Creation)
Use studio_create with artifact_type and type-specific options. All require confirm=True. studio_create runs a pre-flight auth check before firing the request, so stale auth fails immediately with an nlm login hint instead of returning a fake success that collapses seconds later.
| artifact_type | Key Options |
|---|
audio | audio_format: deep_dive/brief/critique/debate, audio_length: short/default/long |
video | video_format: explainer/brief/cinematic/short, visual_style: auto_select/classic/whiteboard/kawaii/anime/watercolor/retro_print/heritage/paper_craft (not for cinematic/short), video_style_prompt |
report | report_format: Briefing Doc/Study Guide/Blog Post/Create Your Own, custom_prompt |
quiz | question_count, difficulty: easy/medium/hard |
flashcards | difficulty: easy/medium/hard |
mind_map | title |
slide_deck | slide_format: detailed_deck/presenter_slides, slide_length: short/default |
infographic | orientation: landscape/portrait/square, detail_level: concise/standard/detailed, infographic_style: auto_select/sketch_note/professional/bento_grid/editorial/instructional/bricks/clay/anime/kawaii/scientific |
data_table | description (REQUIRED) |
Common options: source_ids, language (BCP-47 code, including regional
locales such as es-419), focus_prompt
Audio accent: NotebookLM has been observed using the language region
subtag, not the prompt, to choose the Audio Overview accent. For example,
es/es-ES produces Spain Spanish, while es-US/es-419 produces
Latin-American Spanish. NOTEBOOKLM_HL can set the same regional locale as
the default. Treat this as observed upstream behavior, not a guaranteed API
contract.
Revise Slides: Use studio_revise to revise individual slides in an existing slide deck.
- Requires
artifact_id (from studio_status) and slide_instructions
- Creates a NEW artifact โ the original is not modified
- Slide numbers are 1-based (slide 1 = first slide)
- Poll
studio_status after calling to check when the new deck is ready
CLI Commands
All generation commands share --confirm, --source-ids, and --profile.
--language is available for audio, report, slides, infographic, video, and
data-table:
--confirm or -y: REQUIRED to execute
--source-ids <id1,id2>: Limit to specific sources
--language <code>: BCP-47 code (en, es-ES, es-US, es-419, fr, etc.)
nlm audio create <id> --confirm
nlm audio create <id> --format deep_dive --length default --confirm
nlm audio create <id> --format brief --focus "key topic" --confirm
nlm report create <id> --confirm
nlm report create <id> --format "Study Guide" --confirm
nlm report create <id> --format "Create Your Own" --prompt "Custom..." --confirm
nlm quiz create <id> --confirm
nlm quiz create <id> --count 5 --difficulty 3 --confirm
nlm quiz create <id> --count 10 --difficulty 3 --focus "Focus on key concepts" --confirm
nlm flashcards create <id> --confirm
nlm flashcards create <id> --difficulty hard --confirm
nlm flashcards create <id> --difficulty medium --focus "Focus on definitions" --confirm
nlm mindmap create <id> --confirm
nlm mindmap create <id> --title "Topic Overview" --confirm
nlm studio status <id>
nlm slides create <id> --confirm
nlm slides create <id> --format presenter_slides --length short --confirm
nlm slides revise <artifact-id> --slide '1 Make the title larger' --confirm
nlm infographic create <id> --confirm
nlm infographic create <id> --orientation portrait --detail detailed --style professional --confirm
nlm video create <id> --confirm
nlm video create <id> --format brief --style whiteboard --confirm
nlm video create <id> --format cinematic --focus "Full creative brief..." --confirm
nlm video create <id> --format short --focus "Key topic" --confirm
nlm data-table create <id> "Extract all dates and events" --confirm
Studio Prompting (Read Before Generating)
Full guides: studio-prompting-guide.md | studio-prompt-examples.md
Fast track (default): Silently infer (user message โ notebook title โ notebook_describe if needed) โ minimal 1โ3 sentence prompt with grounding anchor โ one-line notice โ studio_create(confirm=True). Never run multi-question intake.
Guided preview (exception): Vague request, any cinematic video, high-stakes deliverable, empty notebook, or user asks โ show settings + full prompt โ one optional refine โ generate.
Grounding anchor (every prompt): Use only uploaded sources. Do not invent statistics, quotes, or examples not in the sources.
Iterate only on failure or user dissatisfaction โ do not proactively offer regen on success. Slides: use studio_revise for targeted fixes.
Prompt parameters by artifact:
| Artifact | Prompt field | CLI flag |
|---|
| audio, video, infographic, slide_deck, quiz, flashcards | focus_prompt | --focus |
| report (Create Your Own) | custom_prompt | --prompt |
| data_table | description | positional arg (required) |
Quick format picks:
| User intent | Default |
|---|
| Podcast / learn | audio: deep_dive, default |
| Quick audio recap | audio: brief, short |
| Teach / explain | video: explainer |
| Exec video summary | video: brief |
| Narrative / launch video | video: cinematic + full brief in focus |
| Shareable slides | slide_deck: detailed_deck |
| Live presentation | slide_deck: presenter_slides |
| LinkedIn visual | infographic: square, concise, bento_grid |
| Custom report | report: Create Your Own + custom_prompt |
| Structured extraction | data_table: explicit column schema in description |
After generation: Poll studio_status by artifact_id. Revise slides with studio_revise. Request include_details=True only when reusing a successful prompt from custom_instructions.
6. Studio (Artifact Management)
MCP Tools
Use studio_status to check progress, rename with action="rename", or inspect
supported types with action="list_types". Failed artifacts include
error_reason. Detailed mode also includes source_ids; an empty list means
the upstream payload did not expose provenance, not necessarily that no
sources were used. Use download_artifact with artifact_type and
output_path, download_all_artifacts to fetch every completed artifact of a
notebook (or every notebook with all_notebooks=True) into per-notebook
folders, export_artifact with export_type (docs/sheets), and
studio_delete with confirm=True.
CLI Commands
nlm studio status <nb-id>
nlm studio status <nb-id> --full
nlm studio status <nb-id> --json
nlm studio status <nb-id> --json --full
nlm studio status <nb-id> --artifact-id <id>
nlm studio status <nb-id> --json --mcp-compatible
nlm video list <nb-id> --json
nlm download audio <nb-id> --output podcast.mp3
nlm download video <nb-id> --output video.mp4
nlm download report <nb-id> --output report.md
nlm download slide-deck <nb-id> --output slides.pdf
nlm download slide-deck <nb-id> --output slides.pptx --format pptx
nlm download quiz <nb-id> --output quiz.html --format html
nlm download all <nb-id> -d ./exports
nlm download all --all-notebooks -d ./exports --skip-existing
nlm export sheets <nb-id> <artifact-id> --title "My Data Table"
nlm export docs <nb-id> <artifact-id> --title "My Report"
nlm studio delete <nb-id> <artifact-id> --confirm
Status values: completed (โ), in_progress (โ), failed (โ)
Prompt Extraction: MCP studio_status is lean and returns at most 20 artifacts by default. Pass include_details=True to retrieve custom_instructions, source IDs, report content, and media details. Pass artifact_id when polling a newly created artifact. CLI --full preserves the detailed output.
Renaming Resources
Rename a Source
MCP Tool: source_rename(notebook_id, source_id, new_title)
CLI:
nlm source rename <source-id> "New Title" --notebook <notebook-id>
nlm rename source <source-id> "New Title" --notebook <notebook-id>
Rename a Studio Artifact
MCP Tools
Use studio_status with action="rename", artifact_id, and new_title.
CLI Commands
nlm studio rename <artifact-id> "New Title"
nlm rename studio <artifact-id> "New Title"
Server Info (Version Check)
MCP Tools
Use server_info to get version and check for updates:
mcp__notebooklm-mcp__server_info()
Treat stale as requiring nlm login. unverified is an inconclusive probe,
not confirmed expiration.
CLI Commands
nlm --version
7. Chat Configuration and Notes
MCP Tools
Use chat_configure with goal: default/learning_guide/custom. Use note with action: create/list/update/delete. Delete requires confirm=True.
CLI Commands
โ ๏ธ AI TOOLS: DO NOT USE nlm chat start - It launches an interactive REPL that cannot be controlled programmatically. Use nlm notebook query for one-shot Q&A instead.
For human users at a terminal:
nlm chat start <nb-id>
REPL Commands:
/sources - List available sources
/clear - Reset conversation context
/help - Show commands
/exit - Exit REPL
Configure chat behavior (works for both REPL and query):
nlm chat configure <id> --goal default
nlm chat configure <id> --goal learning_guide
nlm chat configure <id> --goal custom --prompt "Act as a tutor..."
nlm chat configure <id> --response-length longer
Notes management:
nlm note create <nb-id> --content "Content" --title "Title"
nlm note list <nb-id>
nlm note update <nb-id> <note-id> --content "New content"
nlm note delete <nb-id> <note-id> --confirm
8. Notebook Sharing
MCP Tools
Use notebook_share_status to check, notebook_share_public to enable/disable
public links, and notebook_share_invite for one collaborator. Use
notebook_share_batch with recipients=[{"email": "...", "role": "viewer|editor"}] and confirm=True for multiple collaborators.
CLI Commands
nlm share status <nb-id>
nlm share public <nb-id>
nlm share public <nb-id> --off
nlm share invite <nb-id> user@example.com
nlm share invite <nb-id> user@example.com --role editor
9. Aliases (UUID Shortcuts)
Simplify long UUIDs:
nlm alias set myproject abc123-def456...
nlm alias get myproject
nlm alias list
nlm alias delete myproject
nlm notebook get myproject
nlm source list myproject
nlm audio create myproject --confirm
10. Configuration
CLI-only commands for managing settings:
nlm config show
nlm config get <key>
nlm config set <key> <value>
nlm config set output.format json
nlm login switch work
Available Settings:
| Key | Default | Description |
|---|
output.format | table | Default output format (table, json) |
output.color | true | Enable colored output |
output.short_ids | true | Show shortened IDs |
auth.browser | auto | Preferred browser for login (auto, chrome, arc, brave, edge, chromium, vivaldi, opera) |
auth.default_profile | default | Profile to use when --profile not specified |
Diagnostics & Setup
Diagnose and fix issues with your NotebookLM installation, MCP server, and AI tools:
nlm doctor
nlm setup mcp
nlm setup add json
nlm setup add claude
nlm setup add cursor
nlm setup remove cursor
11. Skill Management
Manage the NotebookLM skill installation for various AI assistants:
nlm skill list
nlm skill update
nlm skill update <tool>
nlm skill install <tool>
nlm skill uninstall <tool>
Verb-first aliases: nlm update skill, nlm list skills, nlm install skill
Output Formats
Most list commands support multiple formats:
| Flag | Description |
|---|
| (none) | Rich table (human-readable) |
--json | JSON output (for parsing) |
--quiet | IDs only (for piping) |
--title | "ID: Title" format |
--url | "ID: URL" format (sources only) |
--full | All columns/details |
12. Batch Operations
Perform the same action across multiple notebooks at once.
MCP Tools
Use batch with action parameter. Select notebooks by notebook_names, tags, or all=True.
batch(action="query", query="What are the key findings?", notebook_names="AI Research, Dev Tools")
batch(action="add_source", source_url="https://example.com", tags="ai,research")
batch(action="create", titles="Project A, Project B, Project C")
batch(action="delete", notebook_names="Old Project", confirm=True)
batch(action="studio", artifact_type="audio", tags="research", confirm=True)
CLI Commands
nlm batch query "What are the key takeaways?" --notebooks "id1,id2"
nlm batch query "Summarize" --tags "ai,research"
nlm batch query "Summarize" --all
nlm batch add-source "https://..." --notebooks "id1,id2"
nlm batch create "Project A, Project B, Project C"
nlm batch delete --notebooks "id1,id2" --confirm
nlm batch studio audio --tags "research"
13. Cross-Notebook Query
Query multiple notebooks and get aggregated answers with per-notebook citations.
MCP Tools
cross_notebook_query(query="Compare approaches", notebook_names="Notebook A, Notebook B")
cross_notebook_query(query="Summarize", tags="ai,research")
cross_notebook_query(query="Everything", all=True)
CLI Commands
nlm cross query "What features are discussed?" --notebooks "id1,id2"
nlm cross query "Compare approaches" --tags "ai,research"
nlm cross query "Summarize everything" --all
14. Pipelines
Define and execute multi-step notebook workflows. Three built-in pipelines plus support for custom YAML pipelines.
MCP Tools
pipeline(action="list")
pipeline(action="run", notebook_id="...", pipeline_name="ingest-and-podcast", input_url="https://...")
CLI Commands
nlm pipeline list
nlm pipeline run ingest-and-podcast --notebook <id> --input-url "https://..."
nlm pipeline run research-and-report --notebook <id> --input-url "https://..."
nlm pipeline run multi-format --notebook <id>
nlm pipeline create my-pipeline --file pipeline.yaml
Built-in pipelines: ingest-and-podcast, research-and-report, multi-format
Create custom pipelines: add YAML files to ~/.notebooklm-mcp-cli/pipelines/
15. Tags & Smart Select
Tag notebooks for organization and use tags to target batch operations.
MCP Tools
tag(action="add", notebook_id="...", tags="ai,research,llm")
tag(action="remove", notebook_id="...", tags="ai")
tag(action="list")
tag(action="select", query="ai research")
CLI Commands
nlm tag add <notebook> --tags "ai,research,llm"
nlm tag add <notebook> --tags "ai" --title "My Notebook"
nlm tag remove <notebook> --tags "ai"
nlm tag list
nlm tag select "ai research"
16. Long-Lived MCP Server Configuration
The MCP server runs as a long-lived process. For 24/7 deployments (e.g. an always-on assistant), a few knobs help bound memory and tune behavior.
Conversation cache bounds (added in 0.6.14)
The in-process conversation history cache used to grow without bound, eventually OOM'ing the host on always-on servers. Three env-var knobs cap memory. Set any to 0 to disable that specific cap and restore the old unbounded behavior:
| Env var | Default | Purpose |
|---|
NOTEBOOKLM_CONVERSATION_MAX_TURNS | 50 | Max turns kept per conversation. Older turns are FIFO-dropped. Survivors are renumbered 1..N so turn_number stays a stable 1-indexed position in the current list. |
NOTEBOOKLM_CONVERSATION_MAX_CONVS | 500 | Max distinct conversations cached. On overflow, the least-recently-used conversation is evicted. Reads and writes both promote to MRU. |
NOTEBOOKLM_CONVERSATION_MAX_CHARS_PER_TURN | 100000 | Per-turn answer char cap. Safety net against pathological payloads. Queries are user input and not truncated. |
With all defaults: 500 convs ร 50 turns ร up to 100k chars = hard upper bound around ~2.5 GB of answer text. In practice answers are 1โ10 KB, so the typical ceiling is ~25 MB.
Negative values are clamped to 0 (unlimited) with a warning. Invalid values fall back to the default with a warning.
Cache stats (added in 0.6.14)
For monitoring from Python, the BaseClient exposes get_conversation_cache_stats() which returns:
{
"conversations": int,
"total_turns": int,
"max_turns_per_conversation": int,
"max_conversations": int,
"max_chars_per_turn": int,
}
There's no MCP or CLI tool wrapper in 0.6.14. Call it directly from Python if you need to surface cache pressure in your own tooling.
Server startup flags (notebooklm-mcp)
When starting the MCP server directly, two flags control transport-layer behavior. Neither affects the conversation cache above.
--stateless / --no-stateless (default: true, env NOTEBOOKLM_MCP_STATELESS): Controls whether the MCP HTTP transport keeps per-session state. Leave it true unless you know you need sessions. The flag exists to work around an MCP SDK double-response crash (python-sdk#2416) and is unrelated to the conversation cache.
--transport http / --transport stdio (default: stdio): Pick the transport. --transport http requires --port (default 8000).
--host <addr> (default 127.0.0.1): Bind address for HTTP/SSE. Refuses external binds unless NOTEBOOKLM_ALLOW_EXTERNAL_BIND=1 is set.
Remote MCP security
The server has no built-in endpoint authentication or TLS and uses one
process-wide Google account. Never expose it directly to the public internet.
Put authentication, TLS, and network restrictions in front of remote
deployments. Browser/phone-local files are not transferred automatically;
source_add(file) requires a path already present on the server host.
Common Patterns
Pattern 1: Research โ Podcast Pipeline
nlm notebook create "AI Research 2026"
nlm alias set ai <notebook-id>
nlm research start "agentic AI trends" --notebook-id ai --mode deep
nlm research status ai --max-wait 900
nlm research import ai <task-id>
nlm audio create ai --format deep_dive --confirm
nlm studio status ai
Pattern 2: Quick Content Ingestion
nlm source add <id> --url "https://example1.com"
nlm source add <id> --url "https://example2.com"
nlm source add <id> --text "My notes..." --title "Notes"
nlm source list <id>
Pattern 3: Study Materials Generation
nlm report create <id> --format "Study Guide" --confirm
nlm quiz create <id> --count 10 --difficulty 3 --focus "Exam prep" --confirm
nlm flashcards create <id> --difficulty medium --focus "Core terms" --confirm
Pattern 4: Drive Document Workflow
nlm source add <id> --drive 1KQH3eW0hMBp7WK... --type slides
nlm source stale <id>
nlm source list <id> --drive -S
nlm source sync <id> --confirm
Pattern 5: Batch & Cross-Notebook Workflow
nlm tag add <id1> --tags "ai,research"
nlm tag add <id2> --tags "ai,product"
nlm cross query "What are the main conclusions?" --tags "ai"
nlm batch studio audio --tags "ai"
nlm pipeline run ingest-and-podcast --notebook <id> --input-url "https://example.com"
Error Recovery
| Error | Cause | Solution |
|---|
| "Cookies have expired" | Session timeout | nlm login |
| "authentication may have expired" | Session timeout | nlm login |
| "Notebook not found" | Invalid ID | nlm notebook list |
| "Source not found" | Invalid ID | nlm source list <nb-id> |
| "Rate limit exceeded" | Too many calls | Studio creation: wait 1-2 minutes; avoid parallel video batches |
| "Research already in progress" | Pending research | Use --force or import first |
| "Import timed out" | Too many sources | Use --timeout 600 for larger notebooks |
| "Google API error code 3" | Transient deep research error | Retry in a few minutes, or use --mode fast |
| Browser doesn't launch | Port conflict | Close browser, retry |
nlm login crashes with ClientAuthenticationError | (Fixed in 0.6.14) Disk tokens fully expired | nlm login now works directly, no manual nlm login profile delete needed |
RPCDriftError / rotated method ID | NotebookLM changed an internal RPC ID | Run with --debug, apply the suggested NOTEBOOKLM_RPC_OVERRIDES JSON mapping, then restart the MCP server |
| File upload path not found | Path exists on the client but not the CLI/MCP host | Use a path accessible on the machine running nlm or the MCP server |
Rate Limiting
Wait between operations to avoid rate limits:
- Source operations: 2 seconds
- Content generation: run sequentially; after a rate limit, wait 1-2 minutes
- Research operations: 2 seconds
- Query operations: 2 seconds
Advanced Reference
For detailed information, see: