epicaltrendweb/notebooklm-mcp-simple
0
1# Advanced Usage Guide2 3This guide covers advanced usage patterns, best practices, and detailed examples for the NotebookLM MCP server.4 5> π For installation and quick start, see the main [README](../README.md).6 7## Research Patterns8 9### The Iterative Research Pattern10 11The server is designed to make your agent **ask questions automatically** with NotebookLM. Here's how to leverage this:12 131. **Start with broad context**14 ```15 "Before implementing the webhook system, research the complete webhook architecture in NotebookLM, including error handling, retry logic, and security considerations."16 ```17 182. **The agent will automatically**:19 - Ask an initial question to NotebookLM20 - Read the reminder at the end of each response21 - Ask follow-up questions to gather more details22 - Continue until it has comprehensive understanding23 - Only then provide you with a complete answer24 253. **Session management**26 - The agent maintains the same `session_id` throughout the research27 - This preserves context across multiple questions28 - Sessions auto-cleanup after 15 minutes of inactivity29 30### Deep Dive Example31 32```33User: "I need to implement OAuth2 with refresh tokens. Research the complete flow first."34 35Agent behavior:361. Asks NotebookLM: "How does OAuth2 refresh token flow work?"372. Gets answer with reminder to ask more383. Asks: "What are the security best practices for storing refresh tokens?"394. Asks: "How to handle token expiration and renewal?"405. Asks: "What are common implementation pitfalls?"416. Synthesizes all answers into comprehensive implementation plan42```43 44## Notebook Management Strategies45 46### Multi-Project Setup47 48Organize notebooks by project or domain:49 50```51Production Docs Notebook β APIs, deployment, monitoring52Development Notebook β Local setup, debugging, testing53Architecture Notebook β System design, patterns, decisions54Legacy Code Notebook β Old systems, migration guides55```56 57### Notebook Switching Patterns58 59```60"For this bug fix, use the Legacy Code notebook."61"Switch to the Architecture notebook for this design discussion."62"Use the Production Docs for deployment steps."63```64 65### Metadata Best Practices66 67When adding notebooks, provide rich metadata:68```69"Add this notebook with description: 'Complete React 18 documentation including hooks, performance, and migration guides' and tags: react, frontend, hooks, performance"70```71 72## Authentication Management73 74### Account Rotation Strategy75 76Free tier provides 50 queries/day per account. Maximize usage:77 781. **Primary account** β Main development work792. **Secondary account** β Testing and validation803. **Backup account** β Emergency queries when others are exhausted81 82```83"Switch to secondary account" β When approaching limit84"Check health status" β Verify which account is active85```86 87### Handling Auth Failures88 89The agent can self-repair authentication:90 91```92"NotebookLM says I'm logged outβrepair authentication"93```94 95This triggers: `get_health` β `setup_auth` β `get_health`96 97## Advanced Configuration98 99### Performance Optimization100 101For faster interactions during development:102```bash103STEALTH_ENABLED=false # Disable human-like typing104TYPING_WPM_MAX=500 # Increase typing speed105HEADLESS=false # See what's happening106```107 108### Debugging Sessions109 110Enable browser visibility to watch the live conversation:111```112"Research this issue and show me the browser"113```114 115Your agent automatically enables browser visibility for that research session.116 117### Session Management118 119Monitor active sessions:120```121"List all active NotebookLM sessions"122"Close inactive sessions to free resources"123"Reset the stuck session for notebook X"124```125 126## Complex Workflows127 128### Multi-Stage Research129 130For complex implementations requiring multiple knowledge sources:131 132```133Stage 1: "Research the API structure in the API notebook"134Stage 2: "Switch to Architecture notebook and research the service patterns"135Stage 3: "Use the Security notebook to research authentication requirements"136Stage 4: "Synthesize all findings into implementation plan"137```138 139### Validation Workflow140 141Cross-reference information across notebooks:142 143```1441. "In Production notebook, find the current API version"1452. "Switch to Migration notebook, check compatibility notes"1463. "Verify in Architecture notebook if this aligns with our patterns"147```148 149## Tool Integration Patterns150 151### Direct Tool Calls152 153For manual scripting, capture and reuse session IDs:154 155```json156// First call - capture session_id157{158 "tool": "ask_question",159 "question": "What is the webhook structure?",160 "notebook_id": "abc123"161}162 163// Follow-up - reuse session_id164{165 "tool": "ask_question",166 "question": "Show me error handling examples",167 "session_id": "captured_session_id_here"168}169```170 171### Resource URIs172 173Access library data programmatically:174- `notebooklm://library` - Full library JSON175- `notebooklm://library/{id}` - Specific notebook metadata176 177## Best Practices178 179### 1. **Context Preservation**180- Always let the agent complete its research cycle181- Don't interrupt between questions in a research session182- Use descriptive notebook names for easy switching183 184### 2. **Knowledge Base Quality**185- Upload comprehensive documentation to NotebookLM186- Merge related docs into single notebooks (up to 500k words)187- Update notebooks when documentation changes188 189### 3. **Error Recovery**190- The server auto-recovers from browser crashes191- Sessions rebuild automatically if context is lost192- Profile corruption triggers automatic cleanup193 194### 4. **Resource Management**195- Close unused sessions to free memory196- The server maintains max 10 concurrent sessions197- Inactive sessions auto-close after 15 minutes198 199### 5. **Security Considerations**200- Use dedicated Google accounts for NotebookLM201- Never share authentication profiles between projects202- Backup `library.json` for important notebook collections203 204## Troubleshooting Patterns205 206### When NotebookLM returns incomplete answers207```208"The answer seems incomplete. Ask NotebookLM for more specific details about [topic]"209```210 211### When hitting rate limits212```213"We've hit the rate limit. Re-authenticate with the backup account"214```215 216### When browser seems stuck217```218"Reset all NotebookLM sessions and try again"219```220 221## Example Conversations222 223### Complete Feature Implementation224```225User: "I need to implement a webhook system with retry logic"226 227You: "Research webhook patterns with retry logic in NotebookLM first"228Agent: [Researches comprehensively, asking 4-5 follow-up questions]229Agent: "Based on my research, here's the implementation..."230[Provides detailed code with patterns from NotebookLM]231```232 233### Architecture Decision234```235User: "Should we use microservices or monolith for this feature?"236 237You: "Research our architecture patterns and decision criteria in the Architecture notebook"238Agent: [Gathers context about existing patterns, scalability needs, team constraints]239Agent: "According to our architecture guidelines..."240[Provides recommendation based on documented patterns]241```242 243---244 245Remember: The power of this integration lies in letting your agent **ask multiple questions** β gathering context and building comprehensive understanding before responding. Don't rush the research phase!