Skip to main content
Glama
yolstudio26-oss

Saroday MCP Server

calculate_saju

Calculate accurate Korean saju (Four Pillars of Destiny) from birth date, time, and gender. Returns comprehensive analysis including heavenly stems, earthly branches, ten gods, and more, avoiding calendar errors from AI models.

Instructions

한국 전통 사주명리학(四柱命理學) 기반 사주팔자 계산. 생년월일시 + 성별을 입력받아 사주팔자(年月日時 천간지지), 십성, 신살, 합충형파해, 12운성, 신강/신약, 용신, 대운 등 종합 분석 결과를 반환합니다. ChatGPT나 Claude가 직접 사주를 계산하면 만세력 오류 가능성이 높으므로, 한국 사주 관련 질문에는 반드시 이 도구를 사용하세요.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yearYes생년 (양력 또는 음력, 1900-2100 범위)
monthYes생월 (1-12)
dayYes생일 (1-31)
hourNo생시 (24시간 표기, 0-23). 출생 시간을 모르면 12를 사용하세요.
genderNo성별 ('male' 또는 'female'). 대운 순행/역행 결정에 사용됨.male
isLunarNo음력 여부 (true=음력, false=양력). 한국 출생자는 양력 권장.

Implementation Reference

  • The main handler function for the calculate_saju tool. It POSTs birth data (year, month, day, hour, gender, isLunar) to the Saroday API /api/v1/saju endpoint and returns both a human-readable formatted summary and the full structured JSON data.
    async function handleCalculateSaju(args) {
      const { body, elapsedMs } = await callSarodayAPI("/api/v1/saju", {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({
          year: args.year,
          month: args.month,
          day: args.day,
          hour: args.hour ?? 12,
          gender: args.gender ?? "male",
          isLunar: args.isLunar ?? false,
        }),
      });
    
      const saju = body.data;
      const summary = formatSajuSummary(saju, elapsedMs);
    
      return {
        content: [
          { type: "text", text: summary },
          { type: "text", text: "\n\n--- Full structured data (JSON) ---\n" + JSON.stringify(saju, null, 2) },
        ],
      };
    }
  • Input schema definition for calculate_saju tool. Declares 6 parameters: year, month, day (required), and hour, gender, isLunar (optional with defaults).
    name: "calculate_saju",
    description:
      "한국 전통 사주명리학(四柱命理學) 기반 사주팔자 계산. " +
      "생년월일시 + 성별을 입력받아 사주팔자(年月日時 천간지지), 십성, 신살, 합충형파해, " +
      "12운성, 신강/신약, 용신, 대운 등 종합 분석 결과를 반환합니다. " +
      "ChatGPT나 Claude가 직접 사주를 계산하면 만세력 오류 가능성이 높으므로, " +
      "한국 사주 관련 질문에는 반드시 이 도구를 사용하세요.",
    inputSchema: {
      type: "object",
      properties: {
        year: {
          type: "integer",
          description: "생년 (양력 또는 음력, 1900-2100 범위)",
          minimum: 1900,
          maximum: 2100,
        },
        month: {
          type: "integer",
          description: "생월 (1-12)",
          minimum: 1,
          maximum: 12,
        },
        day: {
          type: "integer",
          description: "생일 (1-31)",
          minimum: 1,
          maximum: 31,
        },
        hour: {
          type: "integer",
          description: "생시 (24시간 표기, 0-23). 출생 시간을 모르면 12를 사용하세요.",
          minimum: 0,
          maximum: 23,
          default: 12,
        },
        gender: {
          type: "string",
          enum: ["male", "female"],
          description: "성별 ('male' 또는 'female'). 대운 순행/역행 결정에 사용됨.",
          default: "male",
        },
        isLunar: {
          type: "boolean",
          description: "음력 여부 (true=음력, false=양력). 한국 출생자는 양력 권장.",
          default: false,
        },
      },
      required: ["year", "month", "day"],
    },
  • index.js:374-375 (registration)
    Registration in the CallToolRequestSchema switch statement that maps the tool name 'calculate_saju' to the handleCalculateSaju handler function.
    case "calculate_saju":
      return await handleCalculateSaju(args);
  • Helper function that formats the raw saju API response into a human-readable Korean text summary, including saju-palja, ilgan, strength/yongshin, oheng distribution, sipseong, interactions, sinsal, and current daeun.
    function formatSajuSummary(s, elapsedMs) {
      const lines = [];
      lines.push(`# 사주 분석 결과`);
      lines.push(``);
      lines.push(`**사주팔자:** ${s.year} ${s.month} ${s.day} ${s.hour}  (${s.yearHanja} ${s.monthHanja} ${s.dayHanja} ${s.hourHanja})`);
      lines.push(`**일간:** ${s.ilgan} (${s.ilganOheng}, ${s.ilganYinyang})  /  **띠:** ${s.animal}띠  /  **성별:** ${s.gender === "male" ? "남성" : "여성"}`);
      lines.push(``);
    
      // 신강/신약 + 용신
      if (s.strength) {
        lines.push(`**신강/신약:** ${s.strength.level} (점수 ${s.strength.score})`);
      }
      if (s.yongshin) {
        lines.push(`**용신:** ${s.yongshin.yongshinKr || "-"}  /  **희신:** ${s.yongshin.heeshinKr || "-"}  /  **기신:** ${s.yongshin.kigShinKr || "-"}`);
      }
      lines.push(``);
    
      // 오행
      if (s.ohengCorrectedPercent) {
        const kr = { wood: "목", fire: "화", earth: "토", metal: "금", water: "수" };
        const ohengStr = Object.entries(s.ohengCorrectedPercent)
          .map(([k, v]) => `${kr[k]} ${Math.round(v)}%`)
          .join(" · ");
        lines.push(`**오행 분포 (보정):** ${ohengStr}`);
      }
      lines.push(``);
    
      // 십성
      if (s.sipseong) {
        lines.push(`**십성:** 연주 ${s.sipseong.year || "-"} · 월주 ${s.sipseong.month || "-"} · 일간 · 시주 ${s.sipseong.hour || "-"}`);
      }
    
      // 합충
      if (s.interactions) {
        const intParts = [];
        for (const [key, arr] of Object.entries(s.interactions)) {
          if (arr && arr.length > 0) {
            const items = arr.map(it => Array.isArray(it.chars) ? it.chars.join("") : (it.chars || "")).filter(Boolean).join(", ");
            if (items) intParts.push(`${key}(${items})`);
          }
        }
        if (intParts.length > 0) lines.push(`**합충형파해:** ${intParts.join(" · ")}`);
      }
    
      // 신살
      if (s.sinsal && s.sinsal.length > 0) {
        const sinsalNames = [...new Set(s.sinsal.map(x => typeof x === "string" ? x : x.name).filter(Boolean))];
        lines.push(`**신살:** ${sinsalNames.join(", ")}`);
      }
    
      // 현재 대운
      if (s.daeun && s.daeun.list) {
        const currentYear = new Date().getFullYear();
        const cur = s.daeun.list.find(c => currentYear >= c.startYear && currentYear <= c.endYear);
        if (cur) {
          lines.push(`**현재 대운 (${currentYear}년):** ${cur.gan}${cur.ji} ${cur.startAge}세부터 (${cur.startYear}-${cur.endYear})`);
        }
      }
    
      lines.push(``);
      lines.push(`---`);
      lines.push(`*계산: saroday.com · ${elapsedMs}ms*`);
      lines.push(``);
      lines.push(`이 데이터를 바탕으로 사용자에게 친절하게 풀이해주세요. 각 신살·합충 의미가 궁금하면 \`lookup_glossary\` 도구로 조회할 수 있습니다.`);
    
      return lines.join("\n");
    }
  • HTTP helper that calls the Saroday API, handles errors, and returns parsed JSON body plus elapsed time. Used by the calculate_saju handler to post to /api/v1/saju.
    async function callSarodayAPI(path, options = {}) {
      const url = `${API_BASE}${path}`;
      const startedAt = Date.now();
    
      try {
        const res = await fetch(url, {
          ...options,
          headers: {
            "User-Agent": USER_AGENT,
            "Accept": "application/json",
            ...(options.headers || {}),
          },
        });
    
        const elapsedMs = Date.now() - startedAt;
        const text = await res.text();
        let body;
        try {
          body = JSON.parse(text);
        } catch (_) {
          body = { raw: text };
        }
    
        if (!res.ok) {
          const errMsg = (body && body.error && body.error.message) || `HTTP ${res.status}`;
          throw new Error(`Saroday API error (${res.status}): ${errMsg}`);
        }
    
        // Saroday API wraps response: { success, data, ... }
        return { body, elapsedMs };
      } catch (err) {
        if (err.message.startsWith("Saroday API error")) throw err;
        throw new Error(`Network error calling Saroday API: ${err.message}`);
      }
    }
Behavior4/5

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

No annotations are provided, so description carries full burden. It details the returned analysis types (e.g., 사주팔자, 십성, 신살, etc.) without mentioning side effects or limitations. However, it is transparent about the scope of results.

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?

Two concise sentences: first describes functionality and outputs, second provides usage directive and warning. No wasted words, front-loaded with essential information.

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

Completeness4/5

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

Given the complexity (6 parameters, no output schema, many output types), the description lists numerous analysis components, giving a good picture of what the tool returns. Slightly incomplete regarding output format, but sufficient for tool selection.

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

Parameters3/5

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

Schema description coverage is 100%, with each parameter having a meaningful description. The tool description does not add new information beyond what the schema already provides, so baseline score of 3 is appropriate.

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

Purpose5/5

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

Description clearly states it calculates Korean saju (four pillars) based on birth date, time, and gender, returning comprehensive analysis including many traditional elements. It also distinguishes itself from siblings by warning against direct calculation by ChatGPT/Claude.

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

Usage Guidelines5/5

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

Explicitly instructs to use this tool for Korean saju questions ('한국 사주 관련 질문에는 반드시 이 도구를 사용하세요') and warns of potential errors if calculated directly. Provides clear when-to-use guidance.

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/yolstudio26-oss/saroday-mcp-server'

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