lookup_glossary
Look up definitions of over 80 Myeongni-hak terms including Saju elements like Cheon-eok Gwiyi, Dohwasal, and Yookhap. Get precise explanations for Saju glossary terms.
Instructions
명리학 용어 풀이 조회. 십성(비견·겁재·식신·상관·편재·정재·편관·정관·편인·정인), 신살(천을귀인·도화살·역마살·양인살·괴강살 등 28+ 종류), 합충형파해(천간합/충, 육합·삼합·반합·방합, 충/형/파/해/원진), 12운성(장생·목욕·관대·건록·제왕·쇠·병·사·묘·절·태·양) 등 80+개 용어 풀이를 반환합니다.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| term | Yes | 조회할 명리학 용어 (한글). 예: '도화살', '식신', '천을귀인', '육합', '제왕' |
Implementation Reference
- index.js:211-233 (handler)The main handler function for the 'lookup_glossary' tool. It takes a 'term' argument, calls the Saroday API at /api/v1/glossary/{term}, and formats the response with term details, Hanja, classification, summary, meaning, positive/negative aspects, effect, and tips.
async function handleLookupGlossary(args) { const term = encodeURIComponent(String(args.term || "").trim()); if (!term) { return { isError: true, content: [{ type: "text", text: "Error: 'term' parameter is required." }], }; } const { body } = await callSarodayAPI(`/api/v1/glossary/${term}`); const d = body.data; let text = `# ${d.term}${d.hanja ? ` (${d.hanja})` : ""}\n`; text += `**분류:** ${d.type}${d.category ? ` · ${d.category}` : ""}\n\n`; if (d.summary) text += `**요약:** ${d.summary}\n\n`; if (d.meaning) text += `**의미:** ${d.meaning}\n\n`; if (d.positive) text += `**긍정 측면:** ${d.positive}\n\n`; if (d.negative) text += `**주의 사항:** ${d.negative}\n\n`; if (d.effect) text += `**작용:** ${d.effect}\n\n`; if (d.tip) text += `**활용 팁:** ${d.tip}\n`; return { content: [{ type: "text", text }] }; } - index.js:86-103 (schema)The tool definition and input schema for 'lookup_glossary'. Defines the tool name, description in Korean, and inputSchema requiring a single 'term' string parameter.
{ name: "lookup_glossary", description: "명리학 용어 풀이 조회. 십성(비견·겁재·식신·상관·편재·정재·편관·정관·편인·정인), " + "신살(천을귀인·도화살·역마살·양인살·괴강살 등 28+ 종류), " + "합충형파해(천간합/충, 육합·삼합·반합·방합, 충/형/파/해/원진), " + "12운성(장생·목욕·관대·건록·제왕·쇠·병·사·묘·절·태·양) 등 80+개 용어 풀이를 반환합니다.", inputSchema: { type: "object", properties: { term: { type: "string", description: "조회할 명리학 용어 (한글). 예: '도화살', '식신', '천을귀인', '육합', '제왕'", }, }, required: ["term"], }, }, - index.js:376-377 (registration)The dispatch/call routing that maps the tool name 'lookup_glossary' to the handleLookupGlossary handler function in the CallToolRequestSchema handler.
case "lookup_glossary": return await handleLookupGlossary(args); - index.js:365-367 (registration)The ListToolsRequestSchema handler that registers all tools (including lookup_glossary) from the TOOLS array.
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS, })); - index.js:146-180 (helper)The callSarodayAPI helper function used by handleLookupGlossary to make HTTP requests to the Saroday API.
async function callSarodayAPI(path, options = {}) { const url = `${API_BASE}${path}`; const startedAt = Date.now(); try { const res = await fetch(url, { ...options, headers: { "User-Agent": USER_AGENT, "Accept": "application/json", ...(options.headers || {}), }, }); const elapsedMs = Date.now() - startedAt; const text = await res.text(); let body; try { body = JSON.parse(text); } catch (_) { body = { raw: text }; } if (!res.ok) { const errMsg = (body && body.error && body.error.message) || `HTTP ${res.status}`; throw new Error(`Saroday API error (${res.status}): ${errMsg}`); } // Saroday API wraps response: { success, data, ... } return { body, elapsedMs }; } catch (err) { if (err.message.startsWith("Saroday API error")) throw err; throw new Error(`Network error calling Saroday API: ${err.message}`); } }