search_quran_by_topic
Find Quran verses by topic to explore Islamic teachings on subjects like prayer, charity, faith, mercy, and knowledge. Use predefined topics to quickly locate relevant verses with translations.
Instructions
Search the Quran by common Islamic topics. This tool uses predefined topic mappings to find relevant verses. Topics include: prayer, patience, charity, faith, paradise, hell, prophet, allah, mercy, justice, knowledge, family, death, creation, guidance. The AI understands these topics and can suggest them to users.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| topic | Yes | Topic to search for. Common topics: prayer, patience, charity, faith, paradise, hell, prophet, allah, mercy, justice, knowledge, family, death, creation, guidance | |
| translation | No | Translation to search in (default: en.sahih) | en.sahih |
| max_results | No | Maximum number of results to return (default: 10) |
Implementation Reference
- src/tools/search.ts:411-437 (handler)The main handler function that implements the tool logic by mapping predefined topics to search keywords and delegating to the general searchQuran function.export async function searchQuranByTopic( topic: string, translationSlug: string = 'en.sahih', maxResults: number = 10 ): Promise<SearchResult[]> { // Map common topics to search terms const topicKeywords: Record<string, string> = { 'prayer': 'prayer salah worship prostrate bow', 'patience': 'patient patience persevere steadfast', 'charity': 'charity alms poor needy spend', 'faith': 'believe faith believer trust', 'paradise': 'paradise garden heaven jannah', 'hell': 'hell fire punishment hellfire', 'prophet': 'prophet messenger muhammad', 'allah': 'allah god lord', 'mercy': 'mercy merciful compassion forgive', 'justice': 'justice just fair equity', 'knowledge': 'knowledge learn wisdom understand', 'family': 'family parents children wife husband', 'death': 'death die hereafter resurrection', 'creation': 'creation create heavens earth', 'guidance': 'guidance guide straight path', }; const searchQuery = topicKeywords[topic.toLowerCase()] || topic; return searchQuran(searchQuery, translationSlug, maxResults); }
- MCP tool schema definition specifying the input parameters, description, and validation rules.{ name: 'search_quran_by_topic', description: 'Search the Quran by common Islamic topics. This tool uses predefined topic mappings to find relevant verses. Topics include: prayer, patience, charity, faith, paradise, hell, prophet, allah, mercy, justice, knowledge, family, death, creation, guidance. The AI understands these topics and can suggest them to users.', inputSchema: { type: 'object', properties: { topic: { type: 'string', description: 'Topic to search for. Common topics: prayer, patience, charity, faith, paradise, hell, prophet, allah, mercy, justice, knowledge, family, death, creation, guidance', }, translation: { type: 'string', description: 'Translation to search in (default: en.sahih)', default: 'en.sahih', }, max_results: { type: 'number', description: 'Maximum number of results to return (default: 10)', default: 10, }, }, required: ['topic'], }, },
- src/shared/tool-executor.ts:135-138 (registration)Runtime dispatch/registration in the tool executor switch statement that calls the handler function with parsed arguments.case 'search_quran_by_topic': { const { topic, translation = 'en.sahih', max_results = 10 } = args; result = await searchQuranByTopic(topic, translation, max_results); break;
- src/shared/tool-executor.ts:23-23 (registration)Import statement that brings the handler into the executor scope.searchQuranByTopic