Goal-oriented recipes. Parameter-level SQL and search construction also live in SEARCH_QUERY_EXAMPLES.md. Architecture for RAG/FTS is in AGENTIC_AND_RAG.md. MCP prompt names and tool pairings are in PROMPTS.md.
Why Calibre (and thus CalibreMCP) at all: If you have very large collections—many thousands of files, up to on the order of 100,000 EPUBs, PDFs, CBZ/CBR comics, manga, etc.—Calibre is the standard way to organize, tag, search, and read them locally, and to expose the same library via Calibre’s Content server (browser/OPDS on the LAN or beyond). CalibreMCP layers agentic search and workflows on top of that catalog (metadata.db + files).
- Use
search_fulltextwith the phrase (or keywords). - If you need the exact place: set
resolve_locations=Truefor PDF page / EPUB spine / Calibre viewerebook-viewer --open-at search:…hints. - Open the book with
manage_viewerif the user wants to read immediately.
Why not RAG first: phrase and rare-word matches are what Calibre’s FTS index is for; metadata RAG does not search the full body.
- Ensure index:
calibre_metadata_index_build(webapp Semantic Search page can build/rebuild). calibre_metadata_search(query="…", top_k=…)over title, authors, tags, comments, series.- Optional: open a result with
manage_viewer.
External vector DB / backup: call calibre_metadata_export_json (writes JSON via metadata.db; default file calibre_mcp_metadata_export.json in the library folder) or run scripts/export_metadata_for_rag.py through calibre-debug -e for Calibre’s new_api. Tune CALIBRE_METADATA_COMMENT_MAX_CHARS and CALIBRE_METADATA_STRIP_HTML before calibre_metadata_index_build so the LanceDB metadata index matches how you treat comments. Details: CALIBRE_DEBUG_EXPORT_AND_RAG_PLAN.md.
- Build chunk index:
rag_index_build(FTS-backed chunks → LanceDBbooks_ragunder the library). rag_retrieve(or portmanteaucalibre_ragper your deployment) for semantic passage retrieval.- Combine with
search_fulltextwhen the user gives exact wording.
Formats (content RAG only): Metadata RAG (§2) is the same for PDF and EPUB — it never reads the file body. Chunk RAG (this section) indexes searchable_text from Calibre FTS; by default PDF is excluded (CALIBRE_RAG_CHUNK_EXCLUDE_FORMATS unset → PDF skipped) because PDF body text is often a poor fit for semantic chunks. Set CALIBRE_RAG_CHUNK_EXCLUDE_FORMATS= empty to include PDFs, or CALIBRE_RAG_MAX_BOOK_TEXT_CHARS to skip oversized rows.
See AGENTIC_AND_RAG.md for lancedb* layout and DeepIngestor vs FTS chunk paths. FULL_TEXT_RAG_DESIGN.md for backlog and filters.
Use query_books with operation="search" — title, author, tag, text, date ranges, rating, format, auto_open=True for a unique hit. Natural-language phrasing is mapped by the client; examples in the root README.md “Usage Examples”.
manage_libraries(operation="list")manage_libraries(operation="switch", library_id=…)- Run search / RAG / viewer as above.
- Prompts
library_health,duplicate_detection,metadata_cleanup(see PROMPTS.md) set the intent. manage_analysisandmanage_library_operations(per docstrings) for duplicates, stats, and cleanup actions your deployment exposes.
- With sampling:
agentic_library_workflow(workflow_prompt="…") - Without sampling: decompose into steps 4–6 manually; use
calibre_mcp_guideprompt orskill://calibre-expert/SKILL.mdfor heuristics.
With --http, optional /api/v1/chat proxies to a local or cloud LLM (LLM_* env) — same semantics as the webapp backend; see transport.py and AGENTIC_AND_RAG.md.
| User goal | Start here |
|---|---|
| Exact quote / line | search_fulltext (+ resolve_locations) |
| Topic by title/tags/comments | calibre_metadata_search |
| Theme inside the text (paraphrase) | rag_index_build → rag_retrieve / calibre_rag |
| Known title/author | query_books |