analyze_saju
Analyze Korean Saju (Four Pillars of Destiny) fortune-telling based on birth details to calculate charts, check compatibility, assess yearly fortunes, and provide personalized life guidance.
Instructions
사주 분석 통합 (basic/fortune/yongsin/school_compare/yongsin_method)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| birthDate | Yes | YYYY-MM-DD | |
| birthTime | Yes | HH:mm | |
| calendar | No | solar | |
| isLeapMonth | No | ||
| gender | Yes | ||
| analysisType | Yes | basic:사주계산 | fortune:운세 | yongsin:용신 | school_compare:유파비교 | yongsin_method:용신방법론 | |
| fortuneType | No | fortune용 (general/career/wealth/health/love) | |
| schools | No | school_compare용 | |
| method | No | yongsin_method용 (strength/seasonal/mediation/disease) |
Implementation Reference
- src/tools/analyze_saju.ts:40-92 (handler)The core handler function implementing the analyze_saju tool. Calculates saju data and dispatches to specific analysis types (basic, fortune, yongsin, school_compare, yongsin_method).export async function handleAnalyzeSaju(args: AnalyzeSajuArgs): Promise<string> { const { birthDate, birthTime, calendar = 'solar', isLeapMonth = false, gender, analysisType, fortuneType, schools, method, } = args; // 사주 계산 const sajuData = calculateSaju(birthDate, birthTime, calendar, isLeapMonth, gender); switch (analysisType) { case 'basic': // 기본 사주팔자만 반환 return JSON.stringify(sajuData); case 'fortune': { if (!fortuneType) { throw new Error('fortune 분석 시 fortuneType 필수'); } const fortune = analyzeFortune(sajuData, fortuneType); return JSON.stringify(fortune); } case 'yongsin': { const yongsin = selectYongSinOrig(sajuData); return JSON.stringify(yongsin); } case 'school_compare': { const schoolList: SchoolCode[] = schools || ['ziping', 'dts', 'qtbj', 'modern', 'shensha']; const settings = InterpretationSettings.getInstance().getSettings(); const comparison = await SchoolComparator.compareSchools(sajuData, schoolList, settings); return JSON.stringify(comparison); } case 'yongsin_method': { if (!method) { throw new Error('yongsin_method 분석 시 method 필수'); } const yongsinResult = selectYongSin(sajuData, method as YongSinMethod); return JSON.stringify(yongsinResult); } default: throw new Error(`알 수 없는 analysisType: ${analysisType}`); } }
- src/core/tool-definitions.ts:13-47 (schema)JSON Schema definition for the analyze_saju tool, used by MCP for input validation.analyze_saju: () => ({ name: 'analyze_saju', description: '사주 분석 통합 (basic/fortune/yongsin/school_compare/yongsin_method)', inputSchema: { type: 'object', properties: { birthDate: { type: 'string', description: 'YYYY-MM-DD' }, birthTime: { type: 'string', description: 'HH:mm' }, calendar: { type: 'string', enum: ['solar', 'lunar'], default: 'solar' }, isLeapMonth: { type: 'boolean', default: false }, gender: { type: 'string', enum: ['male', 'female'] }, analysisType: { type: 'string', enum: ['basic', 'fortune', 'yongsin', 'school_compare', 'yongsin_method'], description: 'basic:사주계산 | fortune:운세 | yongsin:용신 | school_compare:유파비교 | yongsin_method:용신방법론', }, fortuneType: { type: 'string', enum: ['general', 'career', 'wealth', 'health', 'love'], description: 'fortune용 (general/career/wealth/health/love)', }, schools: { type: 'array', items: { type: 'string', enum: ['ziping', 'dts', 'qtbj', 'modern', 'shensha'] }, description: 'school_compare용', }, method: { type: 'string', enum: ['strength', 'seasonal', 'mediation', 'disease'], description: 'yongsin_method용 (strength/seasonal/mediation/disease)', }, }, required: ['birthDate', 'birthTime', 'gender', 'analysisType'], }, }),
- src/core/tool-handler.ts:23-25 (registration)Registration in the main tool dispatcher switch statement, routing analyze_saju calls to the handler.case 'analyze_saju': return await handleAnalyzeSaju(args as Parameters<typeof handleAnalyzeSaju>[0]);
- src/tools/analyze_saju.ts:22-38 (schema)TypeScript interface defining the input parameters for the handler, matching the JSON schema.export interface AnalyzeSajuArgs { birthDate: string; birthTime: string; calendar?: CalendarType; isLeapMonth?: boolean; gender: Gender; analysisType: AnalysisType; // fortune용 fortuneType?: FortuneAnalysisType; // school_compare용 schools?: Array<'ziping' | 'dts' | 'qtbj' | 'modern' | 'shensha'>; // yongsin_method용 method?: 'strength' | 'seasonal' | 'mediation' | 'disease'; }
- src/tools/index.ts:9-9 (registration)Export of the handler function, enabling import in tool-handler.ts.export { handleAnalyzeSaju } from './analyze_saju.js';