Skip to main content
Glama
This connector has been deprecated

Read pages, sections and tables of contents

shamela_read
Read-onlyIdempotent

Read an installed book's text and structure by internal ids. unit:

  • page (default): one page_id → body (author's matn), foot (editor's footnotes), printed page label, prev/next page ids, enclosing headings.

  • range: up to 20 consecutive pages from start_page_id, each with text, footnotes, printed page — to read on past a hit or through a span.

  • section: one chapter by title_id with its sub-headings, up to the next heading outside it.

  • toc: headings with their title_ids; top level by default, parent_id/depth expand, containing_page_id gives the chain enclosing a page.

  • parts: volumes — part label, page count, first/last page_id.

  • services: what one page cites (aya ids, hadith keys, isnad markers, as stored) → shamela_lookup_quran(mode='aya'), shamela_lookup_hadith(mode='sources'), shamela_lookup_rijal(mode='isnad'). Rules: a parameter of another unit is refused. page_id is not the printed page and ids have gaps: step with prev_page_id/next_page_id, not ±1; for a printed «vol./page» call shamela_cite(mode='printed_page') first. A size budget cuts long text: follow body_has_more (body_part+1) or next_start_page_id. Errors: PAGE_NOT_FOUND (also a range start past the end), TITLE_NOT_FOUND, BOOK_NOT_FOUND, BOOK_NOT_DOWNLOADED (catalogued, not installed: use an installed edition from shamela_get_details(kind='book') same_group). Instead: a heading by its words → shamela_find(kind='heading'); books of untitled «فصل» headings → shamela_search(match='words') scoped to the book; any catalogued book's metadata → shamela_get_details(kind='book').

Input Schema

NameRequiredDescriptionDefault
unitNoSelects what the call does: page | range | section | toc | parts | services. Default page.
countNoHow many consecutive pages to fetch (1–20, default 5). Fewer come back when the ~12,000-character budget is reached; has_more then stays true. Use shamela_read(unit='section') for full chapter reads. Faster than looping unit='page'. E.g. {unit:'range', book_id, start_page_id:1, count:5}. (unit=range only.)
depthNoLevels below parent_id to include (1–5, default 1); deeper levels arrive nested in `children`. Ignored when containing_page_id is set. E.g. {unit:'toc', book_id, depth:1} lists the top-level chapters. (unit=toc only.)
book_idNoThe book id, from shamela_find(kind='book'), shamela_find(kind='work') or shamela_find(kind='name'). Installed ids: shamela_list_downloaded_books.
page_idNo[unit=page] Internal page id, as search hits, shamela_read(unit='toc') and shamela_cite(mode='printed_page') return it; not the printed page number. Ids have gaps, so take neighbours from prev_page_id/next_page_id. [unit=services] Shamela's internal page id (from a search hit or reader tool), not the printed page number. Example: {unit:'services', book_id:1681, page_id:10}. (unit=page|services only.)
title_idNoThe title id of the chapter / section to fetch, from shamela_read(unit='toc') or shamela_find(kind='heading'). Its sub-headings are included. (unit=section only.)
body_partNoFor long pages: when the body exceeds ~4000 characters it is split into parts. Pass the 1-based part to read (default 1). The response reports body_part/body_total_parts/body_has_more; request the next part by incrementing. The footnote/comment are returned with part 1. (unit=page only.)
keep_htmlNo[unit=page] If true, preserve inline HTML markers (e.g. <span data-type='title'>). Default false strips them for plain Arabic display. [unit=range|section] If true, keep Shamela's inline markup: <span data-type='title'> headings, <a href="inr://man-<narrator_id>"> narrator links, <hadeeth-N> markers. Default false strips them for plain Arabic display. (unit=page|range|section only.)
max_pagesNoCap on pages to read (1–100, default 30). The ~12,000-character budget can stop the read earlier; either way truncated:true and next_start_page_id say where to resume with shamela_read(unit='range'). (unit=section only.)
parent_idNoTitle id whose children to list; 0 (default) = top-level chapters. Ignored when containing_page_id is set. (unit=toc only.)
start_page_idNoFirst page id to read (inclusive). To continue a range that was cut short, pass the previous response's next_start_page_id. (unit=range only.)
response_formatNoFormat of the human-readable text: 'markdown' (default) for display; 'json' the same data as one JSON code block; 'none' only a one-line pointer, leaving structuredContent as the whole answer. structuredContent is always returned, so a caller that parses it should pass 'none': the character budget counts both channels, and the unread copy otherwise spends most of it. Requires the 'response_format.none' capability (see shamela_get_brief).
containing_page_idNoPage id. Switches to ancestor-chain mode: returns the headings that enclose this page, root to leaf, in `ancestor_chain`; parent_id and depth are then ignored. E.g. containing_page_id:17 gives the chapter holding page 17. (unit=toc only.)

Output Schema

NameRequiredDescriptionDefault
rawNoThe raw service record, for debugging. (unit=services only.)
ayatNoCumulative aya ids (1-6236, 262 = 2:255) cited on the page, as stored; pass to shamela_lookup_quran(mode='aya'). (unit=services only.)
bodyNoMain text (matn), or the requested body_part of it. (unit=page only.)
footNoFootnotes (editor's words, not the author's); returned with body_part 1 only. (unit=page only.)
modeNo'subtree' (parent_id/depth) or 'ancestor_chain' (containing_page_id). (unit=toc only.)
partNoVolume/part label, e.g. '4'; null for single-volume books. (unit=page only.)
countNoPages actually returned (may be fewer than requested). (unit=range only.)
depthNoLevels expanded in subtree mode; null in ancestor_chain mode. (unit=toc only.)
esnadNoRaw isnad markers, one string per chain: «<zero-padded hadith key> s <narrator ids, Companion first, collector last>». Ids, not names; resolve with shamela_lookup_rijal(mode='isnad'). (unit=services only.)
pagesNoPages in reading order. (unit=range|section only.)
partsNoVolumes in reading order: whether a citation needs a part designator. Empty for a single-volume book unless its pages carry one part label (kept: citations print it). (unit=parts only.)
titlesNoSubtree mode: the headings, nested via children. Empty under a leaf. (unit=toc only.)
book_idNoCatalogue book id.
commentNoUser annotation; returned with body_part 1 only. (unit=page only.)
hadeethNoNumeric hadith keys, as stored; pass to shamela_lookup_hadith(mode='sources'). (unit=services only.)
page_idNo[unit=page] Internal page id that was read. [unit=services] Page id. (unit=page|services only.)
_displayNoAdvice on presenting a long text (show in parts, or ask the user how); null when the text is short. (unit=page|range|section only.)
has_moreNoTrue when pages exist after the last one returned. (unit=range only.)
title_idNoHeading that was read. (unit=section only.)
body_partNo1-based part of the body returned. (unit=page only.)
book_nameNoCatalogue title of the book (Arabic). (unit=page|range|section|toc|parts only.)
parent_idNoParent expanded in subtree mode; null in ancestor_chain mode. (unit=toc only.)
truncatedNoTrue when fewer pages were returned than the section has.
title_textNoHeading text. (unit=section only.)
author_nameNoMain author name. (unit=page|range|section only.)
end_page_idNoLast page id of the section. (unit=section only.)
esnad_countNoNumber of isnad markers. (unit=services only.)
total_pagesNoPage records in the book. (unit=parts only.)
has_servicesNoFalse when the page carries no markers (common outside hadith works). (unit=services only.)
next_page_idNoNext existing page id; null at the end. (unit=page only.)
prev_page_idNoPrevious existing page id (ids have gaps); null at the start. (unit=page only.)
printed_pageNoPrinted page label as Shamela renders it, e.g. '4/ 405'; null when the page has no printed number. (unit=page only.)
rows_droppedNo
body_has_moreNoTrue when another body_part follows. (unit=page only.)
category_pathNoCategory names, broadest first. (unit=page only.)
start_page_idNo[unit=range] First page id requested. [unit=section] First page id of the section. (unit=range|section only.)
ancestor_chainNoancestor_chain mode: headings enclosing the page, root to leaf. (unit=toc only.)
is_multi_volumeNoTrue when the pages carry more than one part label. (unit=parts only.)
body_total_partsNoHow many parts the body is split into. (unit=page only.)
containing_titlesNoChapter headings enclosing the page, root to leaf. (unit=page only.)
next_start_page_idNo[unit=range] Where to continue when the size budget cut the range short; null otherwise. [unit=section] Continue with shamela_read(unit='range') from here; null when the section is complete. (unit=range|section only.)
truncation_messageNo
total_pages_in_sectionNoPages the whole section spans. (unit=section only.)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.9/5.0
Behavior5/5

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

Annotations only cover the read-only/safe profile; the description goes well beyond them with a size-budget model (~12,000 chars, body_has_more/body_part+1, next_start_page_id), truncation flags, the fact that page ids have gaps so ±1 stepping is wrong, and a named error taxonomy (PAGE_NOT_FOUND, TITLE_NOT_FOUND, BOOK_NOT_FOUND, BOOK_NOT_DOWNLOADED with remediation). This is exactly the operational context annotations cannot convey.

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

Conciseness5/5

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

Front-loaded with the overview and the unit list, then rules, then errors, then alternatives — a deliberate and correct ordering. Despite its length, almost every clause carries load (mode behavior, budget, id semantics, error recovery), and the dash-per-unit format is scannable rather than prose-bloated.

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?

For a 13-parameter, six-mode dispatcher with an output schema, the description covers everything an agent needs: which unit to pick, which parameters belong to which unit, continuation on truncation, id semantics, and recoverable errors. Return-value shape is delegated appropriately to structuredContent and the output schema.

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 100%, so the per-parameter unit scoping is largely already in the schema. The description still adds cross-parameter semantics the schema cannot express: 'a parameter of another unit is refused', the continuation contract (feed next_start_page_id back in), and the budget interaction between range and section reads. That is real added meaning, though it does not restate every parameter.

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?

Starts with a specific verb+resource ('Read an installed book's text and structure by internal ids') and then enumerates the six distinct modes, each with what it returns (page → body/foot/printed label/prev-next ids; toc → headings with title_ids; parts → volumes). The closing 'Instead:' block names sibling tools and the conditions that route away from this one, so an agent can distinguish it from shamela_find, shamela_search and shamela_get_details without opening a 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 when-to-use guidance per mode ('to read on past a hit or through a span', 'for a printed «vol./page» call shamela_cite first') plus negative routing: headings by words → shamela_find(kind='heading'), untitled «فصل» headings → shamela_search(match='words'), metadata → shamela_get_details. It also states a hard rule about what will be refused, which is the kind of exclusion guidance that prevents wrong calls.

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