Skip to main content
Glama
This connector has been deprecated

Get a book's table of contents

shamela_get_toc
Read-onlyIdempotent

جلب فهرس الكتاب

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

TableJSON Schema
NameRequiredDescriptionDefault
depthNoHow many levels deep to recurse (1–5, default 1).
book_idYesThe book id.
parent_idNoTitle id whose children to expand. 0 (default) returns top-level chapters.
response_formatNoOutput 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_idNoAlternate mode: instead of returning a subtree, return the ancestor chain (root → leaf chapter) for this page.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already cover the safety profile (readOnly, idempotent, non-destructive), so the description's job is to add operational context — it discloses the return fields (title_id, title_text, page_id, has_children), the two-mode behavior, and depth recursion semantics. It stops short of discussing pagination or large-book limits, so it is strong but not exhaustive.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loads the purpose, then modes, then return shape, then examples — a clean information hierarchy. Slightly long because it carries two examples and a mode enumeration, but each sentence earns its place. The duplicated Arabic title line is minor padding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema exists, so the description carries the return-value burden and does so by enumerating the per-entry fields. Combined with dual-mode explanation, id-lookup guidance, and downstream usage, an agent has everything needed to invoke and interpret this correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is already 100%, so the baseline is 3, but the description adds cross-parameter semantics the schema cannot express — that parent_id=0 means top level, that depth 1–5 controls tree recursion, and that containing_page_id switches modes entirely. Worked examples with concrete values reinforce this.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb+resource ('Fetch a downloaded book's table of contents') and explicitly distinguishes itself from sibling shamela_get_book_section, which it routes users to for reading the section. An agent can tell what this returns without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives explicit modes with the conditions that select each: subtree mode (default, via parent_id/depth) vs ancestor-chain mode (via containing_page_id). It also names the alternative tools for finding book ids (shamela_list_downloaded_books, shamela_resolve) and the downstream consumer (shamela_get_book_section).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources