Skip to main content
Glama
hjsh200219

Saju Fortune-Telling MCP Server

by hjsh200219

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
NameRequiredDescriptionDefault
birthDateYesYYYY-MM-DD
birthTimeYesHH:mm
calendarNosolar
isLeapMonthNo
genderYes
analysisTypeYesbasic:사주계산 | fortune:운세 | yongsin:용신 | school_compare:유파비교 | yongsin_method:용신방법론
fortuneTypeNofortune용 (general/career/wealth/health/love)
schoolsNoschool_compare용
methodNoyongsin_method용 (strength/seasonal/mediation/disease)

Implementation Reference

  • 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}`);
      }
    }
  • 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'],
      },
    }),
  • 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]);
  • 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';

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hjsh200219/fortuneteller'

If you have feedback or need assistance with the MCP directory API, please join our Discord server