Get a book's table of contents
shamela_get_tocجلب فهرس الكتاب
Fetch a downloaded book's table of contents. Two modes: (a) subtree mode (default) — pass parent_id (0 = top level) and depth (1–5) to get a tree of titles; (b) ancestor-chain mode — pass containing_page_id to get the root → leaf chapter chain that contains that page. Returns title_id, title_text, page_id, has_children for each entry. Use the title_id with shamela_get_book_section to read the section. Examples: shamela_get_toc({book_id:, depth:1}) lists top-level chapters; shamela_get_toc({book_id:, containing_page_id:17}) returns the chapter containing page 17. Find downloaded book ids via shamela_list_downloaded_books or shamela_resolve.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| depth | No | How many levels deep to recurse (1–5, default 1). | |
| book_id | Yes | The book id. | |
| parent_id | No | Title id whose children to expand. 0 (default) returns top-level chapters. | |
| response_format | No | Output format for the human-readable text. 'markdown' (default) is best for direct display; 'json' returns the same data as a single JSON code block; 'none' skips the rendered text entirely and returns a one-line pointer, leaving `structuredContent` as the whole answer. The structured data is returned in `structuredContent` regardless of this setting, so a caller that parses it should pass 'none' — the character budget is measured over BOTH channels, and the unread copy is otherwise spending most of it. Requires the 'response_format.none' capability (see shamela_brief). | markdown |
| containing_page_id | No | Alternate mode: instead of returning a subtree, return the ancestor chain (root → leaf chapter) for this page. |