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::new("http://127.0.0.1:3000")?;
let health = client.health().await?;
if !health.authenticated {
// One setup command, once per machine.
return Ok(());
}
let library = client.library().await?;
let notebook = &library.notebooks[0];
let answer = client
.ask(&AskRequest::new(¬ebook.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::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.
Modules§
- blocking
- A synchronous façade, for programs with no async runtime.
Structs§
- Answer
- An answer, with the chat it belongs to and the quotations behind it.
- AskRequest
- A question, and the few knobs worth having on it.
- Call
Template - How a client should call an operation.
- Citation
- One marker in an answer, and the passage it points at.
- Client
- A client for one local server.
- Client
Builder - Builds a
Clientwhen the defaults are not enough. - Health
- What
/healthreports: the Google session, not the build. The version lives on the root route. - Library
- The local library the server keeps: the notebooks you registered, which is not the same as everything in your Google account.
- Manual
- The UTCP manual: every operation the server exposes, named, with the address and authentication a client needs. Not wrapped in the envelope — its shape belongs to the UTCP client, not to this server.
- Notebook
- One registered notebook.
- Passage
- One matching passage of a source.
- Passage
Search - What a passage search returns.
- Search
Request - Retrieval instead of generation: the indexed passages matching a query. Nothing is generated, so no generation allowance is spent.
- Source
List - Every source in a notebook.
- Source
Summary - A source, named and identified.
- Source
Text - The exact text Gemini Notebook indexed for a source — what it reasons over, which the web interface only ever shows in fragments.
- Sources
- The quotations behind an answer.
- Tool
- One named operation in the manual.
Enums§
- Error
- What can go wrong between a Rust program and the local server.
- Source
Format - How the quotations behind an answer should be returned.
Type Aliases§
- Result
- The result of every call in this crate.