Skip to main content
Glama

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
NameRequiredDescriptionDefault
topicYesTopic to search for. Common topics: prayer, patience, charity, faith, paradise, hell, prophet, allah, mercy, justice, knowledge, family, death, creation, guidance
translationNoTranslation to search in (default: en.sahih)en.sahih
max_resultsNoMaximum number of results to return (default: 10)

Implementation Reference

  • 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'],
      },
    },
  • 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;
  • Import statement that brings the handler into the executor scope.
    searchQuranByTopic
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It mentions 'predefined topic mappings' and that the AI can suggest topics, but doesn't disclose key behavioral traits such as how results are returned (e.g., format, pagination), whether it's a read-only operation, potential rate limits, or error handling. This leaves gaps for an AI agent to understand the tool's behavior fully.

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 description is appropriately sized with three sentences that are front-loaded: the first states the purpose, the second lists topics and mappings, and the third adds AI context. There's no wasted text, but the third sentence could be more directly about tool usage rather than AI capabilities.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is incomplete for a search tool with 3 parameters. It covers the purpose and topics but lacks details on behavioral aspects (e.g., result format, limitations) and doesn't compensate for the missing output schema. This makes it adequate but with clear gaps for an AI agent to rely on.

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 the input schema already documents all parameters thoroughly. The description adds minimal value by listing example topics, which overlaps with the schema's description for the 'topic' parameter. It doesn't provide additional semantics beyond what's in the schema, such as usage tips or constraints not covered there.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Search the Quran by common Islamic topics' with 'predefined topic mappings to find relevant verses.' It specifies the verb (search), resource (Quran), and scope (by topic). However, it doesn't explicitly distinguish it from sibling tools like 'search_quran' or 'search_hadith_by_topic,' which might have overlapping functionality.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by listing common topics and noting that 'The AI understands these topics and can suggest them to users,' which suggests when to use it. However, it lacks explicit guidance on when to choose this tool over alternatives like 'search_quran' or 'search_hadith_by_topic,' and doesn't mention any exclusions or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Prince77-7/quranMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server