Skip to main content

Crate notebooklm

Crate notebooklm 

Source
Expand description

An async Rust client for a local Gemini Notebook (NotebookLM) server.

Google ships no public API for the consumer product, and the part that cannot live in a crate is the Google session: the login is bound to the machine it was made on, the session expires server-side while local cookies still look valid, and the browser driving it has to stay patched against detection. So this crate does not own a browser. It talks to a process that does — npx -y @roomi-fields/notebooklm-mcp, listening on loopback — and gives you its API with types instead of serde_json::Value.

use notebooklm::{AskRequest, Client};

let client = Client::local()?;

let health = client.get_health().await?;
if !health.authenticated {
    // One setup command, once per machine.
    return Ok(());
}

let library = client.list_notebooks().await?;
let notebook = &library.notebooks[0];

let answer = client
    .ask_question(&AskRequest::new(&notebook.id, "What is this notebook about?"))
    .await?;
println!("{}", answer.answer);
for citation in answer.citations() {
    println!("  [{}] {}", citation.number, citation.source_text);
}

§Retrieval costs nothing

Client::search_passages returns the indexed passages matching a query without generating anything, so it spends no generation allowance. When you mean to reason over the evidence yourself, ask for the evidence.

§Everything else

This crate covers reading and asking. The server exposes 56 operations in all, and Client::get_utcp_manual returns the UTCP manual describing every one of them — which a UTCP client can call natively, without any of the types here.

§Features

  • rustls (default) / native-tls — which TLS stack to use.
  • blocking — a synchronous façade, for programs with no async runtime.

Re-exports§

pub use generated::*;

Modules§

blocking
The synchronous twin of every call, behind the blocking feature.
generated
Every operation of the server’s REST API, generated from its OpenAPI specification so that a route added upstream reaches a Rust caller on the release that ships it.

Structs§

Client
A client for one local server.
ClientBuilder
Builds a Client when the defaults are not enough.

Enums§

Error
What can go wrong between a Rust program and the local server.
SourceFormat
How the quotations behind an answer should come back.

Type Aliases§

Result
The result of every call in this crate.