Use this skill when the user asks to search or browse a Calibre ebook library. It helps find books by title/author/topic, locate file paths, and search inside EPUB/AZW3 text for quotes or passages. Do not use this skill for conversion, metadata editing, downloads, recommendations, or non-Calibre sources.
Use this skill when a user wants to look up, search, or resolve books in a local Calibre collection.
This skill is read-only. It can inspect Calibre databases and file paths but does not write to library metadata.
Use a real Calibre library only. The source of truth is metadata.db and, for text lookup, full-text-search.db.
Never create substitute library content, fake JSON catalogs, invented book files, or ad hoc metadata when the real library is missing.
export CALIBRE_LIBRARY_ROOT="/path/to/Calibre Library"
export CALIBRE_METADATA_DB="$CALIBRE_LIBRARY_ROOT/metadata.db"
export CALIBRE_FTS_DB="$CALIBRE_LIBRARY_ROOT/full-text-search.db"
find "$HOME" -name metadata.db 2>/dev/null
find "$HOME" -name full-text-search.db 2>/dev/null
test -r "$CALIBRE_METADATA_DB" && echo "metadata ok"
test -r "$CALIBRE_FTS_DB" && echo "fts ok"
metadata.db is missing or unreadable, stop and report the missing path.full-text-search.db is missing or unreadable, restrict yourself to metadata/path tasks and say content search is unavailable.find_books.py.search_content.py (prefer --book-id when possible).get_excerpt.py.resolve_book.py.list_books.py.inspect_calibre_metadata.py.Use these directly for the most common tasks.
python3 scripts/find_books.py \
--db-path "$CALIBRE_METADATA_DB" \
--query "Dune" \
--limit 5
Returns a JSON array like:
[{"id": 4, "title": "Dune", "authors": "Frank Herbert"}]
python3 scripts/search_content.py \
--fts-db "$CALIBRE_FTS_DB" \
--metadata-db "$CALIBRE_METADATA_DB" \
--book-id 4 \
--query "knowledge" \
--context 400
Use this first when you already know the target book_id.
python3 scripts/search_content.py \
--fts-db "$CALIBRE_FTS_DB" \
--metadata-db "$CALIBRE_METADATA_DB" \
--query "artificial intelligence" \
--limit 10
python3 scripts/get_excerpt.py \
--fts-db "$CALIBRE_FTS_DB" \
--metadata-db "$CALIBRE_METADATA_DB" \
--book-id 4 \
--around "knowledge" \
--chars 800
python3 scripts/resolve_book.py \
--metadata-db "$CALIBRE_METADATA_DB" \
--library-root "$CALIBRE_LIBRARY_ROOT" \
--book-id 4 \
--format EPUB
python3 scripts/list_books.py \
--db-path "$CALIBRE_METADATA_DB" \
--limit 50
python3 scripts/inspect_calibre_metadata.py \
--db-path "$CALIBRE_METADATA_DB" \
--limit 20
find_books.py and search_content.py return [] for honest no-match cases.{"error": "Book 999 not found", "error_code": "BOOK_NOT_FOUND"}.search_content.py --book-id ... over global content search whenever possible.get_excerpt.py and quote the returned snippet.After the library discovery step, use the decision tree and common commands above. Apply these extra fallback rules only when the first pass does not resolve the task:
find_books.py returns no results, run inspect_calibre_metadata.py to confirm DB accessibility, then retry with a shorter or partial query.inspect_calibre_metadata.py, then retry with a narrower phrase.find_books.py returns multiple plausible titles, run scoped search_content.py searches to disambiguate before choosing a candidate.get_excerpt.py; if it errors, retry with a broader search in the same source before concluding failure.resolve_book.py returns exists: false, verify the book_id via find_books.py, then retry path resolution with the preferred format.[]) are valid "no result" responses.search_content.py/get_excerpt.py/resolve_book.py can return structured errors for invalid IDs, missing text, or bad positions.book_id seems stale, rerun metadata lookup first (find_books.py by title/author context), then retry resolve_book.py before concluding the library is broken.For exact script arguments, output formats, examples, and error payloads, see references/scripts.md.