get_daily_fortune
Retrieve personalized daily fortune predictions using Korean Saju astrology based on birth details, gender, and target date to guide daily decisions.
Instructions
일일 운세
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| birthDate | Yes | ||
| birthTime | Yes | ||
| calendar | No | solar | |
| isLeapMonth | No | ||
| gender | Yes | ||
| targetDate | Yes | YYYY-MM-DD |
Implementation Reference
- src/tools/get_daily_fortune.ts:19-41 (handler)The core handler function implementing the logic for the 'get_daily_fortune' tool. Validates input date, computes saju data, generates daily fortune using helper, and returns JSON.export function handleGetDailyFortune(args: GetDailyFortuneArgs): string { const { birthDate, birthTime, calendar = 'solar', isLeapMonth = false, gender, targetDate, } = args; // 입력 검증 if (!isValidDate(targetDate)) { throw new Error(`유효하지 않은 날짜 형식입니다: ${targetDate}. YYYY-MM-DD 형식을 사용하세요.`); } // 사주 계산 const sajuData = calculateSaju(birthDate, birthTime, calendar, isLeapMonth, gender); // 일일 운세 생성 const dailyFortune = getDailyFortune(sajuData, targetDate); return JSON.stringify(dailyFortune); }
- src/core/tool-definitions.ts:97-112 (schema)MCP tool schema definition for 'get_daily_fortune', including input schema and metadata.get_daily_fortune: () => ({ name: 'get_daily_fortune', description: '일일 운세', inputSchema: { type: 'object', properties: { birthDate: { type: 'string' }, birthTime: { type: 'string' }, calendar: { type: 'string', enum: ['solar', 'lunar'], default: 'solar' }, isLeapMonth: { type: 'boolean', default: false }, gender: { type: 'string', enum: ['male', 'female'] }, targetDate: { type: 'string', description: 'YYYY-MM-DD' }, }, required: ['birthDate', 'birthTime', 'gender', 'targetDate'], }, }),
- src/core/tool-handler.ts:35-37 (registration)Registration in the main tool dispatcher/switch statement that routes 'get_daily_fortune' calls to the handler function.case 'get_daily_fortune': return handleGetDailyFortune(args as Parameters<typeof handleGetDailyFortune>[0]);
- src/schemas/index.ts:93-100 (schema)Zod validation schema for GetDailyFortune input parameters.export const GetDailyFortuneSchema = z.object({ birthDate: DateSchema.describe('생년월일 (YYYY-MM-DD)'), birthTime: TimeSchema.describe('출생 시간 (HH:mm)'), targetDate: DateSchema.describe('운세를 볼 날짜 (YYYY-MM-DD)'), calendar: CalendarTypeSchema.default('solar').describe('달력 타입'), isLeapMonth: z.boolean().default(false).describe('음력 윤달 여부'), gender: GenderSchema.describe('성별') });
- src/lib/fortune.ts:659-686 (helper)Helper function that generates the daily fortune data based on saju and target date using seeded random for variability.export function getDailyFortune(sajuData: SajuData, date: string): DailyFortune { const targetDate = new Date(date); const seed = generateDateSeed(targetDate, sajuData); const dayElement = sajuData.day.stemElement; // 날짜 기반 운세 변동 const dateNumber = targetDate.getDate(); const monthNumber = targetDate.getMonth() + 1; const variance = ((dateNumber + monthNumber) % 20) - 10; // -10 ~ +10 // 시드 기반 변동 (-10 ~ +10) const getVariance = (offset: number) => { return (seededRandom(seed + offset) - 0.5) * 20; }; return { date, overallLuck: Math.round(Math.min(100, Math.max(30, 70 + variance))), wealthLuck: Math.round(Math.min(100, Math.max(30, 65 + variance + getVariance(1)))), careerLuck: Math.round(Math.min(100, Math.max(30, 75 + variance + getVariance(2)))), healthLuck: Math.round(Math.min(100, Math.max(30, 70 + variance + getVariance(3)))), loveLuck: Math.round(Math.min(100, Math.max(30, 68 + variance + getVariance(4)))), luckyColor: WUXING_DATA[dayElement].color[0]!, luckyDirection: WUXING_DATA[dayElement].direction, advice: `오늘은 ${dayElement} 기운이 강한 날입니다. ${WUXING_DATA[dayElement].personality[0]}하게 행동하세요.`, }; }