get_daily_fortune
Retrieve daily fortune predictions for any Western zodiac or Chinese zodiac sign. Provides cached GPT-generated forecasts for fast response.
Instructions
오늘의 운세 조회 (별자리 또는 띠). 한국 사용자가 가장 자주 보는 운세 카테고리. 사용자가 '오늘의 운세 봐줘', '내 별자리 오늘 어때?', '말띠 오늘 운세' 같은 질문을 할 때 사용하세요. GPT 기반 자연어 운세지만 사로 서버에서 하루 한 번만 생성하고 캐시하므로 응답 빠름.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | Yes | 'zodiac' = 서양 별자리 (12개), 'chinese' = 동양 띠 (12개) | |
| sign | Yes | 별자리 또는 띠 ID. zodiac: aries, taurus, gemini, cancer, leo, virgo, libra, scorpio, sagittarius, capricorn, aquarius, pisces. chinese: rat, ox, tiger, rabbit, dragon, snake, horse, sheep, monkey, rooster, dog, pig. 사용자 생년월일을 받았다면 자체적으로 계산하여 ID 추론 후 호출. |
Implementation Reference
- index.js:104-129 (schema)Tool schema definition for 'get_daily_fortune'. Defines the tool name, description, and inputSchema with 'type' (enum: zodiac/chinese) and 'sign' (string) parameters.
{ name: "get_daily_fortune", description: "오늘의 운세 조회 (별자리 또는 띠). 한국 사용자가 가장 자주 보는 운세 카테고리. " + "사용자가 '오늘의 운세 봐줘', '내 별자리 오늘 어때?', '말띠 오늘 운세' 같은 질문을 할 때 사용하세요. " + "GPT 기반 자연어 운세지만 사로 서버에서 하루 한 번만 생성하고 캐시하므로 응답 빠름.", inputSchema: { type: "object", properties: { type: { type: "string", enum: ["zodiac", "chinese"], description: "'zodiac' = 서양 별자리 (12개), 'chinese' = 동양 띠 (12개)", }, sign: { type: "string", description: "별자리 또는 띠 ID. " + "zodiac: aries, taurus, gemini, cancer, leo, virgo, libra, scorpio, sagittarius, capricorn, aquarius, pisces. " + "chinese: rat, ox, tiger, rabbit, dragon, snake, horse, sheep, monkey, rooster, dog, pig. " + "사용자 생년월일을 받았다면 자체적으로 계산하여 ID 추론 후 호출.", }, }, required: ["type", "sign"], }, }, - index.js:235-257 (handler)The main handler function for get_daily_fortune. Validates 'type' (zodiac/chinese) and 'sign', calls the Saroday API at /api/v1/today/{type}/{sign}, formats the response with emoji, date, period, and fortune text.
async function handleDailyFortune(args) { const type = args.type; const sign = String(args.sign || "").trim(); if (type !== "zodiac" && type !== "chinese") { return { isError: true, content: [{ type: "text", text: "Error: 'type' must be 'zodiac' or 'chinese'." }], }; } if (!sign) { return { isError: true, content: [{ type: "text", text: "Error: 'sign' is required." }] }; } const { body } = await callSarodayAPI(`/api/v1/today/${type}/${encodeURIComponent(sign)}`); const d = body.data; let text = `# 오늘의 운세 - ${d.sign?.emoji || ""} ${d.sign?.name || sign}\n`; text += `**날짜:** ${d.date}\n`; if (d.sign?.period) text += `**기간:** ${d.sign.period}\n`; text += `\n${d.fortune || "운세 정보를 불러오지 못했습니다."}\n`; return { content: [{ type: "text", text }] }; } - index.js:378-379 (registration)Registration of the get_daily_fortune tool in the CallToolRequestSchema handler switch-case. Maps the tool name string to the handleDailyFortune function.
case "get_daily_fortune": return await handleDailyFortune(args); - index.js:146-180 (helper)Generic HTTP helper function callSarodayAPI that all tool handlers use to make requests to the Saroday API. Handles URL construction, error handling, and response parsing.
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}`); } }