Skip to main content
Glama
hjsh200219

Saju Fortune-Telling MCP Server

by hjsh200219

convert_calendar

Convert dates between solar and lunar calendars for Korean Saju fortune-telling analysis. Specify input date, source calendar, and target calendar.

Instructions

양력↔음력 변환

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateYesYYYY-MM-DD
fromCalendarYes
toCalendarYes
isLeapMonthNo

Implementation Reference

  • The main tool handler for 'convert_calendar' that validates input, performs conversion, and returns formatted JSON response.
    export function handleConvertCalendar(args: ConvertCalendarArgs): string {
      // 입력 검증
      if (!isValidDate(args.date)) {
        throw new Error(`유효하지 않은 날짜 형식입니다: ${args.date}. YYYY-MM-DD 형식을 사용하세요.`);
      }
    
      if (args.fromCalendar === args.toCalendar) {
        return JSON.stringify(
          {
            success: true,
            message: '동일한 달력 체계입니다.',
            data: {
              originalDate: args.date,
              convertedDate: args.date,
            },
          },
          null,
          2
        );
      }
    
      // 달력 변환 (로컬 테이블 사용)
      const result = convertCalendar(args.date, args.fromCalendar, args.toCalendar);
    
      const formatted = `
    📅 음양력 변환 결과
    
    ${getCalendarKorean(args.fromCalendar)} → ${getCalendarKorean(args.toCalendar)}
    
    입력: ${result.originalDate} (${getCalendarKorean(result.originalCalendar)})
    결과: ${result.convertedDate} (${getCalendarKorean(result.convertedCalendar)})
    
    ${result.isLeapMonth ? '⚠️ 윤달입니다' : ''}
    ${result.solarTerm ? `절기: ${result.solarTerm}` : ''}
      `.trim();
    
      return JSON.stringify(
        {
          success: true,
          data: result,
          formatted,
        },
        null,
        2
      );
    }
  • Core implementation of calendar conversion logic between solar and lunar calendars using local data tables.
    export function convertCalendar(
      date: string,
      fromCalendar: CalendarType,
      toCalendar: CalendarType
    ): CalendarConversion {
      const inputDate = new Date(date);
    
      if (fromCalendar === toCalendar) {
        return {
          originalDate: date,
          originalCalendar: fromCalendar,
          convertedDate: date,
          convertedCalendar: toCalendar,
          solarTerm: getCurrentSolarTerm(inputDate),
        };
      }
    
      // 양력 → 음력
      if (fromCalendar === 'solar' && toCalendar === 'lunar') {
        const result = solarToLunarLocal(
          inputDate.getFullYear(),
          inputDate.getMonth() + 1,
          inputDate.getDate()
        );
    
        if (!result) {
          throw new Error(
            `지원하지 않는 연도입니다: ${inputDate.getFullYear()} (1900-2200만 지원)`
          );
        }
    
        const dateString = `${result.year}-${String(result.month).padStart(2, '0')}-${String(result.day).padStart(2, '0')}`;
    
        return {
          originalDate: date,
          originalCalendar: 'solar',
          convertedDate: dateString,
          convertedCalendar: 'lunar',
          isLeapMonth: result.isLeapMonth,
          solarTerm: getCurrentSolarTerm(inputDate),
        };
      }
    
      // 음력 → 양력
      if (fromCalendar === 'lunar' && toCalendar === 'solar') {
        const result = lunarToSolarLocal(
          inputDate.getFullYear(),
          inputDate.getMonth() + 1,
          inputDate.getDate(),
          false // 기본적으로 평달로 가정
        );
    
        if (!result) {
          throw new Error(
            `지원하지 않는 연도입니다: ${inputDate.getFullYear()} (1900-2200만 지원)`
          );
        }
    
        const dateString = `${result.year}-${String(result.month).padStart(2, '0')}-${String(result.day).padStart(2, '0')}`;
        const solarDate = new Date(dateString);
    
        return {
          originalDate: date,
          originalCalendar: 'lunar',
          convertedDate: dateString,
          convertedCalendar: 'solar',
          solarTerm: getCurrentSolarTerm(solarDate),
        };
      }
    
      throw new Error('유효하지 않은 달력 변환입니다');
    }
  • Registration of the 'convert_calendar' tool schema factory in the MCP tool definitions.
    convert_calendar: () => ({
      name: 'convert_calendar',
      description: '양력↔음력 변환',
      inputSchema: {
        type: 'object',
        properties: {
          date: { type: 'string', description: 'YYYY-MM-DD' },
          fromCalendar: { type: 'string', enum: ['solar', 'lunar'] },
          toCalendar: { type: 'string', enum: ['solar', 'lunar'] },
          isLeapMonth: { type: 'boolean', default: false },
        },
        required: ['date', 'fromCalendar', 'toCalendar'],
      },
    }),
  • Zod schema definition for input validation of the 'convert_calendar' tool.
    export const ConvertCalendarSchema = z.object({
      date: DateSchema.describe('변환할 날짜 (YYYY-MM-DD)'),
      fromCalendar: CalendarTypeSchema.describe('입력 달력 타입'),
      toCalendar: CalendarTypeSchema.describe('출력 달력 타입'),
      isLeapMonth: z.boolean().default(false).describe('음력 윤달 여부 (음력 입력 시)')
    });
  • Dispatch case in central tool handler that routes 'convert_calendar' calls to the specific handler.
    case 'convert_calendar':
      return handleConvertCalendar(args as Parameters<typeof handleConvertCalendar>[0]);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure but offers minimal information. It doesn't mention whether this is a read-only calculation or has side effects, what happens with invalid dates, whether it handles historical/ future dates, or any rate limits. The description states what the tool does but not how it behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise (just 4 Korean characters) and front-loaded with the core purpose. There's zero wasted text or unnecessary elaboration, making it efficient for quick understanding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 4-parameter conversion tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what the tool returns (converted date format? success/failure?), doesn't address edge cases (invalid dates, calendar boundaries), and provides minimal guidance on parameter usage despite low schema coverage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is only 25% (only the 'date' parameter has a description), and the description adds no parameter information beyond the tool's general purpose. It doesn't explain the meaning of 'fromCalendar'/'toCalendar' enums beyond what's in the schema, nor does it clarify the purpose of 'isLeapMonth' or how parameters interact.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description '양력↔음력 변환' (Solar↔Lunar conversion) clearly states the tool's function with specific verbs (convert/transform) and resources (calendar systems). It distinguishes this conversion tool from sibling tools like fortune-telling or compatibility analysis, though it doesn't explicitly mention what distinguishes it from potential similar conversion tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. While the purpose is clear, there's no mention of prerequisites, typical use cases, or how this differs from other calendar-related operations that might exist in the broader context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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