Skip to main content
Glama
djalal

quran-mcp-server

by djalal

recitation-styles

Retrieve and explore available Quran recitation styles using the quran-mcp-server, enabling users to access diverse audio formats for Quranic verses.

Instructions

Get the available recitation styles

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP handler function for the 'recitation-styles' tool. Validates input (none), calls audioService.listRecitationStyles(), logs response/error, returns formatted JSON content or error.
    /**
     * Handler for the recitation-styles tool
     */
    export async function handleRecitationStyles(args: any) {
      try {
        // Call the service
        const result = await audioService.listRecitationStyles();
        
        // Log the response in verbose mode
        verboseLog('response', {
          tool: 'recitation-styles',
          result
        });
        
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(result, null, 2)
            }
          ]
        };
      } catch (error) {
        verboseLog('error', {
          tool: 'recitation-styles',
          error: error instanceof Error ? error.message : String(error)
        });
        
        // Use the standardized error response utility
        const { createErrorResponse } = require('../utils/error-handler');
        return createErrorResponse(error, 'recitation-styles');
      }
    }
  • Zod input schema for recitation-styles tool, empty object as no parameters are required.
    /**
     * Schema for recitation-styles
     */
    export const recitationStylesSchema = z.object({});
  • src/server.ts:226-229 (registration)
    Tool registration in listTools handler: defines name 'recitation-styles', description, and inputSchema from audioSchemas.recitationStyles.
      name: ApiTools.recitation_styles,
      description: "Get the available recitation styles",
      inputSchema: zodToJsonSchema(audioSchemas.recitationStyles),
    },
  • src/server.ts:305-306 (registration)
    Tool dispatch registration in callTool handler switch: routes 'recitation-styles' calls to handleRecitationStyles function.
    case ApiTools.recitation_styles:
      return await handleRecitationStyles(request.params.arguments);
  • Core implementation in AudioService: fetches recitation styles from Quran.com API (/resources/recitation_styles), uses caching, falls back to mock data on API failure or errors, returns structured response.
    async listRecitationStyles(): Promise<RecitationStylesResponse> {
      try {
        // Check cache first
        const now = Date.now();
        if (this.recitationStylesCache && (now - this.recitationStylesCacheTimestamp < CACHE_DURATION_MS)) {
          verboseLog('response', {
            method: 'listRecitationStyles',
            source: 'cache',
            age: `${(now - this.recitationStylesCacheTimestamp) / 1000} seconds`
          });
          
          return {
            success: true,
            message: "recitation-styles executed successfully (from cache)",
            data: this.recitationStylesCache
          };
        }
        
        try {
          // Make request to Quran.com API
          const url = `${API_BASE_URL}/resources/recitation_styles`;
          const response = await makeApiRequest(url);
          
          verboseLog('response', {
            method: 'listRecitationStyles',
            source: 'api',
            dataSize: JSON.stringify(response).length
          });
          
          // Update cache
          this.recitationStylesCache = response;
          this.recitationStylesCacheTimestamp = now;
          
          return {
            success: true,
            message: "recitation-styles executed successfully",
            data: response
          };
        } catch (axiosError) {
          verboseLog('error', {
            method: 'listRecitationStyles',
            error: axiosError instanceof Error ? axiosError.message : String(axiosError)
          });
          
          // If the API call fails, return mock data
          verboseLog('response', {
            method: 'listRecitationStyles',
            source: 'mock',
            reason: 'API unavailable'
          });
          
          const mockData = this.getRecitationStylesMockData();
          
          return {
            success: true,
            message: "recitation-styles executed with mock data (API unavailable)",
            data: mockData
          };
        }
      } catch (error) {
        verboseLog('error', {
          method: 'listRecitationStyles',
          error: error instanceof Error ? error.message : String(error)
        });
        
        // Return mock data as a fallback for any error
        verboseLog('response', {
          method: 'listRecitationStyles',
          source: 'mock',
          reason: 'error occurred'
        });
        
        const mockData = this.getRecitationStylesMockData();
        
        return {
          success: true,
          message: "recitation-styles 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 of behavioral disclosure. It states 'Get' which implies a read operation, but doesn't cover aspects like authentication needs, rate limits, or what the output format might be (e.g., list of styles with metadata). This leaves significant gaps for a tool with no structured safety hints.

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 is a single, efficient sentence that directly states the tool's function without any wasted words. It's front-loaded and appropriately sized for a simple tool with no parameters.

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 no annotations and no output schema, the description is incomplete. It doesn't explain what 'available recitation styles' means in practice (e.g., audio formats, reciter names, or metadata), leaving the agent uncertain about the return values and usage context. This is inadequate for a tool that might involve audio or cultural specifics.

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

Parameters4/5

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

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description doesn't add parameter details, which is appropriate here, but it could slightly enhance value by hinting at implicit context (e.g., if styles vary by language). Baseline is 4 for zero parameters.

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 verb ('Get') and resource ('available recitation styles'), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'chapter-reciters' or 'languages' that might also relate to recitation or audio features, so it's not fully specific.

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?

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'chapter-reciters' and 'languages' that could overlap in audio or recitation contexts, there's no explicit or implied direction on usage scenarios or exclusions.

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