Skip to main content
Glama
oksure

Bible Korean MCP Server

by oksure

get-chapter

Retrieve all verses from a specific chapter of the Korean Bible. Provide the book name (English, Korean, or code), chapter number, and optional translation version to access the full chapter text.

Instructions

Get all verses from a specific chapter of the Korean Bible

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bookYesBook name (English or Korean) or code (e.g., 'Genesis', '창세기', 'gen')
chapterYesChapter number
versionNoBible translation version (default: GAE)GAE

Implementation Reference

  • src/index.ts:30-54 (registration)
    Tool registration with name 'get-chapter' and input schema definition (book, chapter, version)
    {
      name: "get-chapter",
      description: "Get all verses from a specific chapter of the Korean Bible",
      inputSchema: {
        type: "object",
        properties: {
          book: {
            type: "string",
            description: "Book name (English or Korean) or code (e.g., 'Genesis', '창세기', 'gen')",
          },
          chapter: {
            type: "number",
            description: "Chapter number",
            minimum: 1,
          },
          version: {
            type: "string",
            description: "Bible translation version (default: GAE)",
            enum: ["GAE", "GAE1", "NIR", "KOR", "CEV"],
            default: "GAE",
          },
        },
        required: ["book", "chapter"],
      },
    },
  • Handler logic for 'get-chapter': validates input via Zod schema, resolves book code, fetches chapter data via API, formats verses as markdown text, and returns result
    case "get-chapter": {
      const validated = validateInput(getChapterSchema, args, 'get-chapter');
      const bookCode = findBookCode(validated.book);
      if (!bookCode) {
        return {
          content: [
            {
              type: "text",
              text: `Error: Book '${validated.book}' not found. Use list-books to see available books.`,
            },
          ],
        };
      }
    
      const chapterData = await fetchChapter(bookCode, validated.chapter, validated.version || "GAE");
    
      let result = `# ${chapterData.book} (${chapterData.bookKorean}) ${chapterData.chapter}\n`;
      result += `**Translation:** ${chapterData.versionName}\n\n`;
    
      for (const verse of chapterData.verses) {
        result += `**${verse.number}.** ${verse.text}\n\n`;
      }
    
      return {
        content: [{ type: "text", text: result }],
      };
    }
  • Zod validation schema for 'get-chapter' input: required book (string), required chapter (positive int), optional version (one of 5 translations)
    export const getChapterSchema = z.object({
      book: z.string().min(1),
      chapter: z.number().positive().int(),
      version: z.enum(['GAE', 'GAE1', 'NIR', 'KOR', 'CEV']).optional(),
    });
  • Core helper function that fetches chapter data from the Bible API with caching, retry logic, timeout, and HTML parsing (cheerio) to extract verses from span elements
    export async function fetchChapter(
      bookCode: string,
      chapter: number,
      version: string = "GAE"
    ): Promise<Chapter> {
      const cacheKey = `${version}:${bookCode}:${chapter}`;
      const cached = verseCache.get(cacheKey);
      if (cached) {
        return cached;
      }
    
      const url = `${CONFIG.API.BASE_URL}?version=${version}&book=${bookCode}&chap=${chapter}`;
    
      for (let attempt = 0; attempt <= CONFIG.API.RETRY.MAX_RETRIES; attempt++) {
        const controller = new AbortController();
        const timeoutId = setTimeout(() => controller.abort(), CONFIG.API.TIMEOUT);
        try {
          const response = await fetch(url, { signal: controller.signal });
          if (!response.ok) {
            throw new Error(`HTTP ${response.status}: ${response.statusText}`);
          }
    
          const html = await response.text();
          const $ = cheerio.load(html);
    
          const verses: Verse[] = [];
          const seenVerses = new Set<number>();
    
          // Parse verses from span elements
          // The website uses span elements where verse text starts with verse number
          $("span").each((i, elem) => {
            const text = $(elem).text().trim();
    
            // Look for pattern: number followed by spaces and text
            const match = text.match(/^(\d+)\s+(.+)$/s);
            if (match) {
              const verseNum = parseInt(match[1]);
              let verseText = match[2];
    
              // Remove footnote markers (like 1), 2), etc.)
              verseText = verseText.replace(/\d+\)/g, "").trim();
    
              // Remove explanatory text that comes after line breaks (like "또는 ...")
              const lines = verseText.split("\n");
              verseText = lines[0].trim();
    
              // Avoid duplicate verses (website has multiple spans per verse)
              if (!seenVerses.has(verseNum)) {
                seenVerses.add(verseNum);
                verses.push({
                  number: verseNum,
                  text: verseText,
                });
              }
            }
          });
    
          // Empty-verse guard
          if (verses.length === 0) {
            console.error(`Warning: No verses parsed for ${bookCode} chapter ${chapter} (version: ${version})`);
          }
    
          const bookInfo = getBookInfo(bookCode);
    
          const chapterData: Chapter = {
            book: bookInfo?.name || bookCode,
            bookKorean: bookInfo?.korean || "",
            chapter,
            version,
            versionName: TRANSLATIONS[version] || version,
            verses,
          };
    
          verseCache.set(cacheKey, chapterData);
          return chapterData;
        } catch (error: unknown) {
          if (attempt === CONFIG.API.RETRY.MAX_RETRIES) {
            throw new Error(`Failed to fetch chapter ${bookCode} ${chapter}: ${error}`);
          }
          const delay = Math.min(
            CONFIG.API.RETRY.INITIAL_DELAY_MS * Math.pow(CONFIG.API.RETRY.BACKOFF_FACTOR, attempt),
            CONFIG.API.RETRY.MAX_DELAY_MS
          );
          await new Promise(r => setTimeout(r, delay));
        } finally {
          clearTimeout(timeoutId);
        }
      }
    
      // Unreachable, but TypeScript needs it
      throw new Error(`Failed to fetch chapter ${bookCode} ${chapter} after retries`);
    }
  • Helper function to resolve book name (English, Korean, or code) to a normalized book code used by the API
    export function findBookCode(bookName: string): string | null {
      const normalized = bookName.toLowerCase().trim();
      if (!normalized) return null;
    
      // Try direct match
      for (const [name, info] of Object.entries(BIBLE_BOOKS)) {
        if (name.toLowerCase() === normalized ||
            info.korean === bookName ||
            info.code === normalized) {
          return info.code;
        }
      }
    
      // Try partial match
      for (const [name, info] of Object.entries(BIBLE_BOOKS)) {
        if (name.toLowerCase().includes(normalized) ||
            info.korean.includes(bookName)) {
          return info.code;
        }
      }
    
      return null;
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. It only states the basic retrieval action, omitting details about read-only nature, output format, or any constraints.

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, clear sentence with no unnecessary words or repetition. It is front-loaded and efficient.

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?

The description covers the core functionality but lacks context about output format, edge cases, or integration with sibling tools. Given the tool's simplicity, it is mostly complete but could be improved.

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 baseline is 3. The description adds no additional meaning beyond the schema, simply restating the purpose.

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

Purpose5/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 'all verses from a specific chapter of the Korean Bible', distinguishing it from sibling tools like get-verses (probably individual verses) and search-bible.

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 does not provide explicit guidance on when to use this tool versus alternatives like get-verses or compare-translations. Usage context is implied but not articulated.

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/oksure/bible-ko-mcp'

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