Find a hadith by its wording
shamela_search_hadithبحث عن حديث بنصه
Find a hadith by its TEXT (not its numeric key). Text-searches the hadith shelves (كتب السنة، شروح الحديث، التخريج والأطراف، علوم الحديث — 1,957 books here, reported as books_searched) across matn + footnotes, reads each matching page's service annotations for hadith keys, then resolves each key's cross-collection takhrij via hadeeth.db. Keep the two numbers apart: the TEXT search covers those shelves, while takhrij keys exist only in the books hadeeth.db indexes (key_index_books — ten on this install), so a hadith can be found on 1,746 pages and still yield takhrij from ten books. takhrij[].books counts distinct BOOKS and index_entries the pages behind them. Returns matched pages (snippets often show the printed takhrij «رواه البخاري ومسلم») plus cross-book takhrij where service keys exist. Scoping to those shelves is deliberate: unscoped, term-frequency ranking fills the scan window with fiqh/usul works that merely QUOTE the hadith and carry no service keys, so no takhrij is found. Pass search_all_categories:true to find who CITES a hadith across the whole library instead of who NARRATES it. Example: shamela_search_hadith({query:'إنما الأعمال بالنيات'}).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of results to return (1-100, default 20). | |
| query | Yes | The hadith text (or a distinctive part of it). AND-combines words across matn + footnotes. | |
| 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 |
| max_pages_scanned | No | How many matching pages to scan for hadith service keys. | |
| search_all_categories | No | Search the ENTIRE library instead of the hadith shelves (كتب السنة، شروح الحديث، التخريج، علوم الحديث). Off by default because unscoped ranking buries the collections under works that merely quote the hadith. Turn on to find who CITES a hadith (e.g. in fiqh or tafsir) rather than who NARRATES it. |