Skip to content

feat(notebooks): add get_toolset_preferences read API (EEr8Nb) - #2546

Merged
teng-lin merged 6 commits into
teng-lin:mainfrom
saariuslystoned:feat/toolsets-connected-apps-read
Nov 18, 2026
Merged

teng-lin merged 6 commits into
teng-lin:mainfrom
saariuslystoned:feat/toolsets-connected-apps-read

Conversation

@saariuslystoned

@saariuslystoned saariuslystoned commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds read-only support for NotebookLM Connected Apps preferences (ToolManagementService.ListNotebookToolsetPreferences, batchexecute RPC ID EEr8Nb) via client.notebooks.get_toolset_preferences(notebook_id) -> list[ToolsetPreference].

  • RPC & Wire Layer:
    • Registers RPCMethod.LIST_TOOLSET_PREFERENCES = "EEr8Nb" in src/notebooklm/rpc/_identifiers.py and _IDEMPOTENT_READ_OR_SET_OP_NOTES in src/notebooklm/_web/policy.py.
    • Adds build_toolset_preferences_params(notebook_id) ([notebook_id]) and ToolsetPreferenceRow / decode_toolset_preferences ([[[toolset_id, display_name, enabled, [[tool_name], ...]], ...]], handling null/empty responses cleanly).
  • Public Types & Backend Parity:
    • Exports frozen dataclass ToolsetPreference(toolset_id, display_name=None, enabled=False, tools=()) from notebooklm.types and notebooklm.
    • Adds get_toolset_preferences(notebook_id) to NotebooksAPI ABC, WebNotebooksAPI (EEr8Nb with allow_null=True), and AndroidNotebooksAPI (ValidationError on blank ID; UnsupportedOperationError on valid ID since Android gRPC does not expose ToolManagementService).
    • Scope is strictly read-only (EEr8Nb); SetNotebookToolsetPreferences (x8h5wd) is intentionally left out of scope.
  • Guardrails, Docs, & Tests:
    • Updates scripts/check_rpc_health.py, _wire_contract.py, _public_import_manifest.py, test_backend_abstract_contracts.py, test_golden_decode_coverage.py, golden fixture LIST_TOOLSET_PREFERENCES.json, VCR cassette notebooks_toolset_preferences.yaml, unit tests (tests/unit/test_toolset_preferences.py), regenerated baselines, and docs (docs/python-api.md, docs/rpc-reference.md, docs/web-android-public-behavior.md).

Verification

  • uv run ruff format --check . && uv run ruff check .
  • uv run mypy src/notebooklm --ignore-missing-imports
  • uv run python tests/scripts/check_cassettes_clean.py --strict --recursive
  • uv run python tests/scripts/check_method_coverage.py
  • uv run python scripts/check_docs_module_refs.py
  • uv run pytest tests/_guardrails tests/unit/test_toolset_preferences.py tests/unit/test_rpc_health_coverage.py tests/unit/test_rpc_golden_payloads.py tests/integration/test_notebooks_toolset_preferences_vcr.py

Summary by CodeRabbit

  • New Features
    • Added a Web API for retrieving a notebook’s Connected Apps and toolset preferences, including each preference’s enabled status and available tools.
    • Added ToolsetPreference as a public type for accessing the returned preference details.
  • Documentation
    • Documented the API and its Web-only availability. Android reports the operation as unsupported.

@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

Walkthrough

The pull request adds get_toolset_preferences to the notebook API. The Web implementation calls the LIST_TOOLSET_PREFERENCES RPC and decodes its response into public ToolsetPreference values. Android validates the notebook ID, then reports the operation as unsupported. The Python 3.12 CI matrix cell now uses Ubuntu 24.04.

Changes: Toolset Preferences

Layer / File(s) Summary
Public API and request contract
src/notebooklm/_types/notebooks.py, src/notebooklm/_notebooks.py, src/notebooklm/rpc/_identifiers.py, src/notebooklm/_web/params/notebooks.py, src/notebooklm/types.py, src/notebooklm/__init__.py, tests/_guardrails/*, tests/fixtures/baselines/*, tests/unit/test_notebooks_base.py, tests/unit/android/test_notebook_source_reads.py
Adds the ToolsetPreference type and abstract API method. Adds the EEr8Nb RPC identifier and a parameter builder that sends the notebook ID. Exports the public type and updates API contract checks.
Web RPC and response decoding
src/notebooklm/_web/notebooks.py, src/notebooklm/_web/rows/notebooks.py, src/notebooklm/_web/policy.py, scripts/check_rpc_health.py, tests/_guardrails/*, tests/fixtures/rpc_golden/*, tests/integration/*, tests/unit/_golden_mappers.py, tests/unit/test_rpc_golden_payloads.py, tests/unit/test_toolset_preferences.py, tests/fixtures/baselines/backend_static_coupling.json
Adds the Web RPC call and response decoder. The decoder returns an empty list for empty responses and raises DecodingError for malformed envelopes, rows, or missing IDs. Adds wire, golden-payload, and API tests.
Android behavior and documentation
src/notebooklm/_android/notebooks.py, tests/unit/test_toolset_preferences.py, tests/unit/test_backend_selection.py, docs/python-api.md, docs/rpc-reference.md, docs/web-android-public-behavior.md
Adds Android-side notebook ID validation. For a valid ID, the method raises UnsupportedOperationError. Documents the API and Web-only capability.

CI Matrix

Layer / File(s) Summary
Pin Python 3.12 runner
.github/workflows/test.yml, tests/unit/test_ci_test_matrix.py
Changes the canonical Python 3.12 Linux runner from ubuntu-latest to ubuntu-24.04 and updates the matrix test expectations.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant WebNotebooksAPI
  participant build_toolset_preferences_params
  participant LIST_TOOLSET_PREFERENCES
  participant decode_toolset_preferences
  WebNotebooksAPI->>build_toolset_preferences_params: Build parameters from notebook_id
  WebNotebooksAPI->>LIST_TOOLSET_PREFERENCES: Send notebook-specific request
  LIST_TOOLSET_PREFERENCES-->>WebNotebooksAPI: Return RPC response
  WebNotebooksAPI->>decode_toolset_preferences: Decode response into preferences
Loading

Suggested reviewers: teng-lin

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "feat(notebooks): add get_toolset_preferences read API (EEr8Nb)" names the main change. The PR adds a read-only get_toolset_preferences method to the notebooks API, including RPC parameter b…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "feat(notebooks): add get_toolset_preferences read API (EEr8Nb)" names the main change. The PR adds a read-only get_toolset_preferences method to the notebooks API, including RPC parameter building, response decoding, the ToolsetPreference type, and Web and Android backend behavior. The title is specific and matches the changeset. It omits the Web-only scope and the Android unsupported-operation behavior, which is acceptable for a title.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1e75a6a8-8606-473c-bde0-b6822a5e1ac6
Commits

Reviewing files that changed from the base of the PR and between 327d403 and 98fa409.

Files selected for processing: 2

  • .github/workflows/test.yml
  • tests/unit/test_ci_test_matrix.py

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@teng-lin
teng-lin merged commit eecc39c into teng-lin:main Nov 18, 2026
11 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants