list-books
Retrieve a list of all books in the Bible. Optionally filter by Old Testament (OT) or New Testament (NT) to narrow down the books to a specific testament.
Instructions
List all available books in the Bible
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| testament | No | Filter by testament (OT/NT, optional) |
Implementation Reference
- src/index.ts:268-297 (handler)The handler/case for the 'list-books' tool. Validates input with listBooksSchema, then iterates over BIBLE_BOOKS to produce a formatted list of OT and/or NT books (filtered by optional 'testament' argument). Returns the result as text content.
case "list-books": { const validated = validateInput(listBooksSchema, args, 'list-books'); const { testament } = validated; let result = "# Bible Books\n\n"; const books = Object.entries(BIBLE_BOOKS); if (!testament || testament === "OT") { result += "## Old Testament\n"; books .filter(([, info]) => info.testament === "OT") .forEach(([name, info]) => { result += `- **${name}** (${info.korean}) - code: \`${info.code}\`\n`; }); } if (!testament || testament === "NT") { result += "\n## New Testament\n"; books .filter(([, info]) => info.testament === "NT") .forEach(([name, info]) => { result += `- **${name}** (${info.korean}) - code: \`${info.code}\`\n`; }); } return { content: [{ type: "text", text: result }], }; } - src/validation.ts:25-27 (schema)Zod schema for 'list-books' tool input. Defines an optional 'testament' field restricted to 'OT' or 'NT' enum values.
export const listBooksSchema = z.object({ testament: z.enum(['OT', 'NT']).optional(), }); - src/index.ts:110-123 (registration)Tool registration/definition for 'list-books'. Specifies name, description, and inputSchema (object with optional testament enum). Listed in the tools array passed to the MCP ListTools handler.
{ name: "list-books", description: "List all available books in the Bible", inputSchema: { type: "object", properties: { testament: { type: "string", description: "Filter by testament (OT/NT, optional)", enum: ["OT", "NT"], }, }, }, }, - src/bible.ts:148-170 (helper)findBookCode helper function used indirectly by the handler (though list-books doesn't call it directly, it relies on BIBLE_BOOKS which is exported from this file).
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; } - src/bible.ts:21-90 (helper)The BIBLE_BOOKS data dictionary containing all 66 books of the Bible with codes, Korean names, and testament classification (OT/NT). This is the data source for the list-books handler.
export const BIBLE_BOOKS: Record<string, { code: string; korean: string; testament: string }> = { // Old Testament "Genesis": { code: "gen", korean: "창세기", testament: "OT" }, "Exodus": { code: "exo", korean: "출애굽기", testament: "OT" }, "Leviticus": { code: "lev", korean: "레위기", testament: "OT" }, "Numbers": { code: "num", korean: "민수기", testament: "OT" }, "Deuteronomy": { code: "deu", korean: "신명기", testament: "OT" }, "Joshua": { code: "jos", korean: "여호수아", testament: "OT" }, "Judges": { code: "jdg", korean: "사사기", testament: "OT" }, "Ruth": { code: "rut", korean: "룻기", testament: "OT" }, "1 Samuel": { code: "1sa", korean: "사무엘상", testament: "OT" }, "2 Samuel": { code: "2sa", korean: "사무엘하", testament: "OT" }, "1 Kings": { code: "1ki", korean: "열왕기상", testament: "OT" }, "2 Kings": { code: "2ki", korean: "열왕기하", testament: "OT" }, "1 Chronicles": { code: "1ch", korean: "역대상", testament: "OT" }, "2 Chronicles": { code: "2ch", korean: "역대하", testament: "OT" }, "Ezra": { code: "ezr", korean: "에스라", testament: "OT" }, "Nehemiah": { code: "neh", korean: "느헤미야", testament: "OT" }, "Esther": { code: "est", korean: "에스더", testament: "OT" }, "Job": { code: "job", korean: "욥기", testament: "OT" }, "Psalms": { code: "psa", korean: "시편", testament: "OT" }, "Proverbs": { code: "pro", korean: "잠언", testament: "OT" }, "Ecclesiastes": { code: "ecc", korean: "전도서", testament: "OT" }, "Song of Solomon": { code: "sng", korean: "아가", testament: "OT" }, "Isaiah": { code: "isa", korean: "이사야", testament: "OT" }, "Jeremiah": { code: "jer", korean: "예레미야", testament: "OT" }, "Lamentations": { code: "lam", korean: "예레미야애가", testament: "OT" }, "Ezekiel": { code: "ezk", korean: "에스겔", testament: "OT" }, "Daniel": { code: "dan", korean: "다니엘", testament: "OT" }, "Hosea": { code: "hos", korean: "호세아", testament: "OT" }, "Joel": { code: "jol", korean: "요엘", testament: "OT" }, "Amos": { code: "amo", korean: "아모스", testament: "OT" }, "Obadiah": { code: "oba", korean: "오바댜", testament: "OT" }, "Jonah": { code: "jon", korean: "요나", testament: "OT" }, "Micah": { code: "mic", korean: "미가", testament: "OT" }, "Nahum": { code: "nam", korean: "나훔", testament: "OT" }, "Habakkuk": { code: "hab", korean: "하박국", testament: "OT" }, "Zephaniah": { code: "zep", korean: "스바냐", testament: "OT" }, "Haggai": { code: "hag", korean: "학개", testament: "OT" }, "Zechariah": { code: "zec", korean: "스가랴", testament: "OT" }, "Malachi": { code: "mal", korean: "말라기", testament: "OT" }, // New Testament "Matthew": { code: "mat", korean: "마태복음", testament: "NT" }, "Mark": { code: "mrk", korean: "마가복음", testament: "NT" }, "Luke": { code: "luk", korean: "누가복음", testament: "NT" }, "John": { code: "jhn", korean: "요한복음", testament: "NT" }, "Acts": { code: "act", korean: "사도행전", testament: "NT" }, "Romans": { code: "rom", korean: "로마서", testament: "NT" }, "1 Corinthians": { code: "1co", korean: "고린도전서", testament: "NT" }, "2 Corinthians": { code: "2co", korean: "고린도후서", testament: "NT" }, "Galatians": { code: "gal", korean: "갈라디아서", testament: "NT" }, "Ephesians": { code: "eph", korean: "에베소서", testament: "NT" }, "Philippians": { code: "php", korean: "빌립보서", testament: "NT" }, "Colossians": { code: "col", korean: "골로새서", testament: "NT" }, "1 Thessalonians": { code: "1th", korean: "데살로니가전서", testament: "NT" }, "2 Thessalonians": { code: "2th", korean: "데살로니가후서", testament: "NT" }, "1 Timothy": { code: "1ti", korean: "디모데전서", testament: "NT" }, "2 Timothy": { code: "2ti", korean: "디모데후서", testament: "NT" }, "Titus": { code: "tit", korean: "디도서", testament: "NT" }, "Philemon": { code: "phm", korean: "빌레몬서", testament: "NT" }, "Hebrews": { code: "heb", korean: "히브리서", testament: "NT" }, "James": { code: "jas", korean: "야고보서", testament: "NT" }, "1 Peter": { code: "1pe", korean: "베드로전서", testament: "NT" }, "2 Peter": { code: "2pe", korean: "베드로후서", testament: "NT" }, "1 John": { code: "1jn", korean: "요한일서", testament: "NT" }, "2 John": { code: "2jn", korean: "요한이서", testament: "NT" }, "3 John": { code: "3jn", korean: "요한삼서", testament: "NT" }, "Jude": { code: "jud", korean: "유다서", testament: "NT" }, "Revelation": { code: "rev", korean: "요한계시록", testament: "NT" }, };