This skill provides specialized tools for searching and retrieving Islamic classical texts from the Turath.io API and local metadata database. Use this skill when researching Islamic literature, finding book references, extracting page content, or creating content based on classical Islamic texts.
This skill provides direct access to the Turath.io library (100,000+ Islamic classical texts) and local metadata database for deep research into Islamic literature.
This skill should be used when:
Import from src/turath_skill/scripts/turath_tools.py:
from src.turath_skill.scripts.turath_tools import (
search_library,
get_book_details,
get_page_content,
get_author_bio,
get_filter_ids,
list_all_categories,
list_all_authors,
)
search_library(q, precision=0, cat=None, author=None, ...)Search the library for Arabic queries. Returns results enriched with local metadata.
Parameters:
q (str): Arabic search queryprecision (int): 0=broad, 3=exact matchcat (str): Category IDs to filter (comma-separated)author (str): Author IDs to filter (comma-separated)Example:
results = await search_library(q="صحيح البخاري", precision=3)
# Returns: {"count": 99733, "data": [...]}
get_book_details(book_id, include=None)Get detailed information about a specific book.
Parameters:
book_id (int): The book IDinclude (str): Optional - "meta,index" for table of contentsExample:
details = await get_book_details(book_id=9942, include="index")
# Returns book info with local enrichment (PDF links, author, category)
get_page_content(book_id, pg)Get the text content of a specific page.
Parameters:
book_id (int): The book IDpg (int): Page numberExample:
page = await get_page_content(book_id=9942, pg=5)
# Returns: {"text": "...page content..."}
get_author_bio(author_id)Get author biography and death dates.
Example:
bio = await get_author_bio(author_id=123)
get_filter_ids(category_name=None, author_name=None)Find category/author IDs by Arabic name for filtering searches.
Example:
ids = await get_filter_ids(category_name="فقه")
# Returns: {"category_ids": "11,17,14,16,18,15,12,19"}
list_all_categories()List all 40 available categories.
Example:
cats = await list_all_categories()
# Returns: {"categories": [{"id": 11, "name": "أصول الفقه"}, ...]}
list_all_authors()List all 3,102 available authors.
Example:
authors = await list_all_authors()
# Returns: {"authors": [{"id": 1, "name": "...", "death": 123}, ...]}
# 1. Find category ID
ids = await get_filter_ids(category_name="الفقه الشافعي")
# 2. Search with filter
results = await search_library(q="الصلاة", cat=ids["category_ids"])
# 3. Get book details
book = await get_book_details(book_id=results["data"][0]["book_id"])
# 4. Extract page content
page = await get_page_content(book_id=book["id"], pg=1)
# Get book structure
details = await get_book_details(book_id=9942, include="index")
# Extract content for each topic
for pg in range(1, 10):
content = await get_page_content(book_id=9942, pg=pg)
# Process content for articles/videos/social media
The skill uses a local SQLite database (data/turath_metadata.db) containing:
This enables offline metadata access and enriches API results with additional information.
Available test scripts in _test_/:
test_new_functional_tools.py - Core function teststest_simple_islamic.py - Islamic query workflow testtest_agent_tools.py - All available tools testcontent_generator_ushul.py - Content generation from Ushul book