Skip to main content
Glama
djalal

quran-mcp-server

by djalal

tafsir-info

Retrieve detailed information about a specific tafsir using its unique ID, enabling users to access Quranic commentary insights effectively.

Instructions

Get the information of a specific tafsir

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tafsir_idYesTafsir id

Implementation Reference

  • The handler function that executes the tafsir-info tool: validates input using tafsirInfoSchema, calls tafsirsService.getTafsirInfo, logs, and returns formatted text response.
    export async function handleTafsirInfo(args: any) {
      try {
        // Validate arguments
        const validatedArgs = tafsirInfoSchema.parse(args);
        
        // Call the service
        const result = await tafsirsService.getTafsirInfo(validatedArgs);
        
        // Log the response in verbose mode
        verboseLog('response', {
          tool: 'tafsir-info',
          result
        });
        
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(result, null, 2)
            }
          ]
        };
      } catch (error) {
        verboseLog('error', {
          tool: 'tafsir-info',
          error: error instanceof Error ? error.message : String(error)
        });
        
        // Use the standardized error response utility
        const { createErrorResponse } = require('../utils/error-handler');
        return createErrorResponse(error, 'tafsir-info');
      }
  • Zod schema defining the input parameters for the tafsir-info tool (requires tafsir_id).
    export const tafsirInfoSchema = z.object({
      tafsir_id: z.string().describe("Tafsir id"),
    });
  • src/server.ts:209-213 (registration)
    Tool registration in the listTools response: defines name, description, and inputSchema for tafsir-info.
    {
      name: ApiTools.tafsir_info,
      description: "Get the information of a specific tafsir",
      inputSchema: zodToJsonSchema(tafsirsSchemas.tafsirInfo),
    },
  • src/server.ts:297-299 (registration)
    Tool call routing in the switch statement: dispatches tafsir-info calls to handleTafsirInfo handler.
    case ApiTools.tafsir_info:
      return await handleTafsirInfo(request.params.arguments);
    case ApiTools.tafsir:
  • Service method that performs the core API request to fetch tafsir info from Quran.com API.
    async getTafsirInfo(params: z.infer<typeof tafsirInfoSchema>): Promise<TafsirInfoResponse> {
      try {
        // Validate parameters
        const validatedParams = tafsirInfoSchema.parse(params);
        
        const url = `${API_BASE_URL}/resources/tafsirs/${validatedParams.tafsir_id}/info`;
        
        // Make request to Quran.com API
        const data = await makeApiRequest(url);
        
        return {
          success: true,
          message: "tafsir-info executed successfully",
          data
        };
      } catch (error) {
        verboseLog('error', {
          method: 'getTafsirInfo',
          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);
        }
        
        // Re-throw other errors
        throw error;
      }
    }
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 states a read operation ('Get'), implying it's likely safe, but doesn't disclose any behavioral traits like authentication needs, rate limits, error handling, or what the information includes, which is insufficient 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 with zero waste. It's front-loaded and appropriately sized for a simple tool, making it easy to parse quickly.

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 lacks details on what the information includes, how it's returned, or any behavioral context, which is inadequate for a tool that might return complex data about tafsirs.

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 schema already documents the single parameter 'tafsir_id'. The description adds no additional meaning beyond implying it's for a specific tafsir, which aligns with the schema but doesn't provide extra context like format examples or constraints.

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 action ('Get') and resource ('information of a specific tafsir'), making the purpose understandable. However, it doesn't distinguish this tool from sibling tools like 'tafsir' or 'tafsirs', which likely have related functionality, so it misses full differentiation.

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 such as 'tafsir' and 'tafsirs' present, there's no indication of context, prerequisites, or exclusions, leaving usage ambiguous.

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