Skip to main content
Glama
hjsh200219

Saju Fortune-Telling MCP Server

by hjsh200219

check_compatibility

Analyze compatibility between two individuals using Korean Saju astrology by comparing birth dates, times, and genders to provide relationship insights.

Instructions

두 사람 궁합 분석

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
person1Yes
person2Yes

Implementation Reference

  • Main handler function for the 'check_compatibility' tool. Calculates saju data for two persons using calculateSaju and performs compatibility analysis using checkCompatibility, returning JSON result.
    export function handleCheckCompatibility(args: CheckCompatibilityArgs): string {
      const { person1, person2 } = args;
    
      // 각 사람의 사주 계산
      const sajuData1 = calculateSaju(
        person1.birthDate,
        person1.birthTime,
        person1.calendar || 'solar',
        person1.isLeapMonth || false,
        person1.gender
      );
    
      const sajuData2 = calculateSaju(
        person2.birthDate,
        person2.birthTime,
        person2.calendar || 'solar',
        person2.isLeapMonth || false,
        person2.gender
      );
    
      // 궁합 분석
      const compatibility = checkCompatibility(sajuData1, sajuData2);
    
      return JSON.stringify(compatibility);
    }
  • Zod schema for validating input to check_compatibility tool, defining structure for person1 and person2 data.
    export const CheckCompatibilitySchema = z.object({
      person1: z.object({
        birthDate: DateSchema.describe('생년월일 (YYYY-MM-DD)'),
        birthTime: TimeSchema.describe('출생 시간 (HH:mm)'),
        calendar: CalendarTypeSchema.default('solar').describe('달력 타입'),
        isLeapMonth: z.boolean().default(false).describe('음력 윤달 여부'),
        gender: GenderSchema.describe('성별')
      }).describe('첫 번째 사람'),
      person2: z.object({
        birthDate: DateSchema.describe('생년월일 (YYYY-MM-DD)'),
        birthTime: TimeSchema.describe('출생 시간 (HH:mm)'),
        calendar: CalendarTypeSchema.default('solar').describe('달력 타입'),
        isLeapMonth: z.boolean().default(false).describe('음력 윤달 여부'),
        gender: GenderSchema.describe('성별')
      }).describe('두 번째 사람')
    });
  • Lazy registration of the 'check_compatibility' tool schema in the toolSchemaFactories object.
    check_compatibility: () => ({
      name: 'check_compatibility',
      description: '두 사람 궁합 분석',
      inputSchema: {
        type: 'object',
        properties: {
          person1: {
            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'] },
            },
            required: ['birthDate', 'birthTime', 'gender'],
          },
          person2: {
            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'] },
            },
            required: ['birthDate', 'birthTime', 'gender'],
          },
        },
        required: ['person1', 'person2'],
      },
    }),
  • Dispatch in the main tool handler switch statement that routes 'check_compatibility' calls to handleCheckCompatibility.
    case 'check_compatibility':
      return handleCheckCompatibility(args as Parameters<typeof handleCheckCompatibility>[0]);
  • Core compatibility analysis function that performs detailed analysis including day pillar, element harmony, branch relations, and ten gods compatibility to compute overall score and advice.
    export function checkCompatibility(person1: SajuData, person2: SajuData): CompatibilityAnalysis {
      // 1. 일주 궁합 (가장 중요)
      const dayCompatibility = analyzeDayPillarCompatibility(person1, person2);
    
      // 2. 오행 조화
      const elementHarmony = analyzeElementHarmony(person1, person2);
    
      // 3. 지지 충극 관계
      const branchRelation = analyzeBranchRelation(person1, person2);
    
      // 4. 십성 궁합
      const tenGodsCompatibility = analyzeTenGodsCompatibility(person1, person2);
    
      // 종합 점수 계산
      const compatibilityScore = calculateOverallScore(
        dayCompatibility,
        elementHarmony,
        branchRelation,
        tenGodsCompatibility
      );
    
      // 장단점 분석
      const strengths: string[] = [];
      const weaknesses: string[] = [];
      const advice: string[] = [];
    
      if (dayCompatibility.score >= 70) {
        strengths.push('일주 궁합이 좋아 기본적으로 잘 맞는 사이입니다');
      } else if (dayCompatibility.score < 50) {
        weaknesses.push('일주가 충돌하여 의견 차이가 있을 수 있습니다');
        advice.push('서로의 차이를 인정하고 존중하는 자세가 필요합니다');
      }
    
      if (elementHarmony.harmony >= 70) {
        strengths.push('오행이 조화로워 서로를 보완합니다');
      } else if (elementHarmony.harmony < 50) {
        weaknesses.push('오행이 충돌하여 갈등이 생길 수 있습니다');
        advice.push('상대방의 장점을 인정하고 이해하려 노력하세요');
      }
    
      if (branchRelation.isHarmony) {
        strengths.push('지지가 조화로워 편안한 관계를 유지합니다');
      } else if (branchRelation.isConflict) {
        weaknesses.push('지지가 충돌하여 예기치 않은 문제가 발생할 수 있습니다');
        advice.push('감정적인 대립을 피하고 이성적으로 대화하세요');
      }
    
      // 십성 궁합
      if (tenGodsCompatibility.score >= 70) {
        strengths.push(tenGodsCompatibility.description);
      } else if (tenGodsCompatibility.score < 50) {
        weaknesses.push(tenGodsCompatibility.description);
        advice.push(tenGodsCompatibility.advice);
      }
    
      // 성격 궁합
      const personalityMatch = analyzePersonalityMatch(person1, person2);
      strengths.push(...personalityMatch.strengths);
      weaknesses.push(...personalityMatch.weaknesses);
      advice.push(...personalityMatch.advice);
    
      return {
        compatibilityScore,
        summary: getSummary(compatibilityScore),
        strengths,
        weaknesses,
        advice,
        elementHarmony,
      };
    }

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