Skip to main content
Glama
djalal

quran-mcp-server

by djalal

chapter-reciters

Find chapter reciters for Quranic verses by specifying the desired language. Integrates with the Quran.com corpus REST API v4 for accurate and accessible recitation options.

Instructions

List of Chapter Reciters

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
languageNoName of reciters in specific language

Implementation Reference

  • The primary handler function that executes the 'chapter-reciters' tool logic. It validates the input arguments using the schema, calls the audio service, formats the response, and handles errors.
    /**
     * Handler for the chapter-reciters tool
     */
    export async function handleChapterReciters(args: any) {
      try {
        // Validate arguments
        const validatedArgs = chapterRecitersSchema.parse(args);
        
        // Call the service
        const result = await audioService.listChapterReciters(validatedArgs);
        
        // Log the response in verbose mode
        verboseLog('response', {
          tool: 'chapter-reciters',
          result
        });
        
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(result, null, 2)
            }
          ]
        };
      } catch (error) {
        verboseLog('error', {
          tool: 'chapter-reciters',
          error: error instanceof Error ? error.message : String(error)
        });
        
        // Use the standardized error response utility
        const { createErrorResponse } = require('../utils/error-handler');
        return createErrorResponse(error, 'chapter-reciters');
      }
    }
  • Zod schema for validating input parameters to the 'chapter-reciters' tool, specifically an optional language parameter.
    /**
     * Schema for chapter-reciters
     */
    export const chapterRecitersSchema = z.object({
      language: z.string().optional().describe("Name of reciters in specific language"),
    });
  • src/server.ts:221-225 (registration)
    Registration of the 'chapter-reciters' tool in the MCP server's listTools response, defining its name, description, and input schema.
      name: ApiTools.chapter_reciters,
      description: "List of Chapter Reciters",
      inputSchema: zodToJsonSchema(audioSchemas.chapterReciters),
    },
    {
  • src/server.ts:303-304 (registration)
    Dispatch/registration of the handler function for the 'chapter-reciters' tool in the MCP callTool request handler switch statement.
    case ApiTools.chapter_reciters:
      return await handleChapterReciters(request.params.arguments);
  • Core service method implementing the logic for fetching chapter reciters: API request, caching, fallback to mock data on errors.
    async listChapterReciters(params: z.infer<typeof chapterRecitersSchema>): Promise<ChapterRecitersResponse> {
      try {
        // Validate parameters
        const validatedParams = chapterRecitersSchema.parse(params);
        
        // Check cache first
        const now = Date.now();
        if (this.chapterRecitersCache && (now - this.chapterRecitersCacheTimestamp < CACHE_DURATION_MS)) {
          verboseLog('response', {
            method: 'listChapterReciters',
            source: 'cache',
            age: `${(now - this.chapterRecitersCacheTimestamp) / 1000} seconds`
          });
          
          return {
            success: true,
            message: "chapter-reciters executed successfully (from cache)",
            data: this.chapterRecitersCache
          };
        }
        
        try {
          // Make request to Quran.com API
          const url = `${API_BASE_URL}/resources/chapter_reciters`;
          const response = await makeApiRequest(url, {
            language: validatedParams.language
          });
          
          verboseLog('response', {
            method: 'listChapterReciters',
            source: 'api',
            dataSize: JSON.stringify(response).length
          });
          
          // Update cache
          this.chapterRecitersCache = response;
          this.chapterRecitersCacheTimestamp = now;
          
          return {
            success: true,
            message: "chapter-reciters executed successfully",
            data: response
          };
        } catch (axiosError) {
          verboseLog('error', {
            method: 'listChapterReciters',
            error: axiosError instanceof Error ? axiosError.message : String(axiosError)
          });
          
          // If the API call fails, return mock data
          verboseLog('response', {
            method: 'listChapterReciters',
            source: 'mock',
            reason: 'API unavailable'
          });
          
          const mockData = this.getChapterRecitersMockData();
          
          return {
            success: true,
            message: "chapter-reciters executed with mock data (API unavailable)",
            data: mockData
          };
        }
      } catch (error) {
        verboseLog('error', {
          method: 'listChapterReciters',
          error: error instanceof Error ? error.message : String(error)
        });
        
        if (error instanceof z.ZodError) {
          throw new ApiError(`Validation error: ${error.errors.map(e => `${e.path.join('.')}: ${e.message}`).join(', ')}`, 400);
        }
        
        // Return mock data as a fallback for any error
        verboseLog('response', {
          method: 'listChapterReciters',
          source: 'mock',
          reason: 'error occurred'
        });
        
        const mockData = this.getChapterRecitersMockData();
        
        return {
          success: true,
          message: "chapter-reciters executed with mock data (error occurred)",
          data: mockData
        };
      }
    }
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 doesn't disclose behavioral traits such as whether this is a read-only operation, if it requires authentication, rate limits, or what the output format looks like. The description only states the purpose without any operational context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description 'List of Chapter Reciters' is extremely concise with zero waste—a single phrase that front-loads the core purpose. It's appropriately sized for a simple listing tool, though this conciseness comes at the cost of detail.

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

Completeness2/5

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

Given the tool's complexity (simple listing with 1 parameter) and lack of annotations or output schema, the description is incomplete. It doesn't explain what 'Chapter Reciters' refers to (e.g., Quran reciters), the return format, or any behavioral aspects, leaving significant gaps for an AI agent.

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?

The input schema has 1 parameter with 100% description coverage ('language: Name of reciters in specific language'), so the schema does the heavy lifting. The description adds no meaning beyond the schema, as it doesn't mention parameters at all. Baseline 3 is appropriate when schema coverage is high.

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

Purpose3/5

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

The description 'List of Chapter Reciters' states a general purpose (listing reciters) but lacks specificity about what resource is being listed (e.g., Quran chapter reciters) and doesn't distinguish from siblings like 'recitation-styles' or 'languages'. It's vague about the exact domain, though it implies a listing operation.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives. It doesn't mention siblings like 'recitation-styles' or 'languages', nor does it specify prerequisites or context for usage. The description offers no explicit or implied usage instructions.

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

Related 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/djalal/quran-mcp-server'

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