Skip to main content
Glama
This connector has been deprecated

Find a hadith by its wording

shamela_search_hadith
Read-onlyIdempotent

بحث عن حديث بنصه

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

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of results to return (1-100, default 20).
queryYesThe hadith text (or a distinctive part of it). AND-combines words across matn + footnotes.
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
max_pages_scannedNoHow many matching pages to scan for hadith service keys.
search_all_categoriesNoSearch 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.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already cover the safety profile (readOnly, idempotent, openWorld=false, non-destructive), and the description adds substantial context beyond them: the deliberate shelf scoping and its ranking rationale, the distinction between `books_searched` (text-search scope) and takhrij key books, and what `takhrij[].books` vs `index_entries` count. This tells the agent how to interpret the result rather than just that it is safe.

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?

The core selector ('by its TEXT, not its numeric key') is front-loaded, and the discussion of scoping and the two counts each earns its place by preventing a common misread. It is nonetheless dense, with install-specific figures ('ten on this install', '1,746 pages') that are illustrative rather than necessary for invocation.

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?

There is no output schema, so the description carries the burden of describing returns — and it does, explaining matched pages with snippets (e.g. the printed takhrij «رواه البخاري ومسلم») plus cross-book takhrij, and the two distinct counts. For a 5-parameter search with no output schema, nothing an agent needs to call or interpret it is missing.

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

Parameters3/5

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

Schema description coverage is 100%, so each of the five parameters is already documented in the schema (including the rationale for search_all_categories and the response_format budget guidance). The description largely reiterates rather than extends parameter meaning, so the baseline 3 applies; the two-number framing adds interpretation context but no new argument syntax.

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?

The opening line states a precise verb+resource: find a hadith by its TEXT, explicitly 'not its numeric key', which cleanly separates it from key-based siblings like shamela_get_books_for_hadith. It further scopes the operation to the hadith shelves (كتب السنة، شروح الحديث، التخريج، علوم الحديث) and names the return shape (matched pages + takhrij). An agent can select this over the other search_* siblings 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?

It gives an explicit when-to-use branch: default scoping finds who NARRATES, while search_all_categories:true finds who CITES across fiqh/tafsir. It also justifies the default (unscoped ranking buries collections under quoting works with no service keys), effectively stating when-not to widen. The only minor gap is that it does not name a specific sibling as the alternative for key-based lookup, but the behavioral boundary is unambiguous.

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