Skip to main content
Glama
Sneezry

XiaoLiuRen MCP Server

by Sneezry

analyze_xiaoliuren

Analyzes XiaoLiuRen divination guidance for specific dates and times using traditional Chinese six-spirit fortune telling methods with solar or lunar calendar support.

Instructions

分析指定日期时辰的小六壬指导意见

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateYes日期,格式:YYYY-MM-DD
timeYes时辰,格式:HH:MM 或者传统时辰名称(如:子时、丑时等)
calendar_typeYes日历类型:solar=阳历,lunar=农历solar

Implementation Reference

  • index.js:91-179 (handler)
    Core handler function for the 'analyze_xiaoliuren' tool. Parses date and time inputs, converts to lunar calendar using js-calendar-converter, computes the Xiao Liu Ren divination based on lunar month, day, and hour, generates detailed output with process, result, and advice.
      async analyzeXiaoLiuRen(date, time, calendar_type) {
        try {
          // 解析日期
          const dateMatch = date.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/);
          if (!dateMatch) {
            throw new Error('日期格式错误,请使用 YYYY-MM-DD 格式');
          }
    
          const year = parseInt(dateMatch[1]);
          const month = parseInt(dateMatch[2]);
          const day = parseInt(dateMatch[3]);
    
          let lunarDate;
    
          if (calendar_type === 'solar') {
            // 阳历转农历 - 使用专业库
            const result = calendar.solar2lunar(year, month, day);
            lunarDate = {
              year: result.lYear,
              month: result.lMonth,
              day: result.lDay,
              isLeap: result.isLeap,
              yearGanZhi: result.gzYear,
              monthGanZhi: result.gzMonth,
              dayGanZhi: result.gzDay,
              lunarMonthName: result.IMonthCn,
              lunarDayName: result.IDayCn,
              term: result.Term || ''
            };
          } else {
            // 如果是农历,先转为阳历再转回农历获得完整信息
            const solarResult = calendar.lunar2solar(year, month, day);
            const lunarResult = calendar.solar2lunar(solarResult.cYear, solarResult.cMonth, solarResult.cDay);
            lunarDate = {
              year: year,
              month: month,
              day: day,
              isLeap: false,
              yearGanZhi: lunarResult.gzYear,
              monthGanZhi: lunarResult.gzMonth,
              dayGanZhi: lunarResult.gzDay,
              lunarMonthName: lunarResult.IMonthCn,
              lunarDayName: lunarResult.IDayCn,
              term: lunarResult.Term || ''
            };
          }
    
          // 解析时辰 - 简化版本
          const timeHour = parseInt(time.split(':')[0]);
          const shichen = this.getShichen(timeHour);
    
          // 执行小六壬推算
          const xiaoLiuRenResult = this.calculateXiaoLiuRen(lunarDate.month, lunarDate.day, timeHour);
    
          // 构建分析结果
          const calendarTypeText = calendar_type === "lunar" ? "农历" : "阳历";
    
          return `小六壬占卜结果:
    
    🗓️ 输入信息:
    - 原始日期:${date}(${calendarTypeText})
    - 时辰:${time} (${shichen})
    
    📅 农历信息:
    - 农历日期:${lunarDate.year}年${lunarDate.lunarMonthName}${lunarDate.lunarDayName}${lunarDate.isLeap ? '(闰月)' : ''}
    - 年干支:${lunarDate.yearGanZhi}
    - 月干支:${lunarDate.monthGanZhi} 
    - 日干支:${lunarDate.dayGanZhi}
    - 时辰:${shichen}
    ${lunarDate.term ? `- 节气:${lunarDate.term}` : ''}
    
    🧮 小六壬推算过程:
    - ${xiaoLiuRenResult.calculation.月将}
    - ${xiaoLiuRenResult.calculation.日期}  
    - ${xiaoLiuRenResult.calculation.时辰}
    
    🔮 占卜结果:【${xiaoLiuRenResult.finalResult.name}】
    - 五行属性:${xiaoLiuRenResult.finalResult.element}
    - 吉凶性质:${xiaoLiuRenResult.finalResult.nature}
    - 基本含义:${xiaoLiuRenResult.finalResult.meaning}
    - 详细解释:${xiaoLiuRenResult.finalResult.details}
    
    💡 建议指导:
    ${this.getAdvice(xiaoLiuRenResult.finalResult.name)}`;
    
        } catch (error) {
          throw new Error(`日期时间处理错误:${error.message}`);
        }
      }
  • Input schema for the analyze_xiaoliuren tool, defining parameters for date, time, and calendar_type with validation.
    inputSchema: {
      type: "object",
      properties: {
        date: {
          type: "string",
          description: "日期,格式:YYYY-MM-DD",
        },
        time: {
          type: "string",
          description: "时辰,格式:HH:MM 或者传统时辰名称(如:子时、丑时等)",
        },
        calendar_type: {
          type: "string",
          enum: ["solar", "lunar"],
          description: "日历类型:solar=阳历,lunar=农历",
          default: "solar"
        }
      },
      required: ["date", "time", "calendar_type"],
    },
  • index.js:32-55 (registration)
    Tool registration in the ListTools response, including name, description, and input schema.
    {
      name: "analyze_xiaoliuren",
      description: "分析指定日期时辰的小六壬指导意见",
      inputSchema: {
        type: "object",
        properties: {
          date: {
            type: "string",
            description: "日期,格式:YYYY-MM-DD",
          },
          time: {
            type: "string",
            description: "时辰,格式:HH:MM 或者传统时辰名称(如:子时、丑时等)",
          },
          calendar_type: {
            type: "string",
            enum: ["solar", "lunar"],
            description: "日历类型:solar=阳历,lunar=农历",
            default: "solar"
          }
        },
        required: ["date", "time", "calendar_type"],
      },
    },
  • index.js:60-88 (handler)
    MCP CallTool request handler that dispatches to analyzeXiaoLiuRen when the tool name matches 'analyze_xiaoliuren', handles errors, and formats the response.
    this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
      if (request.params.name === "analyze_xiaoliuren") {
        const { date, time, calendar_type } = request.params.arguments;
    
        try {
          const result = await this.analyzeXiaoLiuRen(date, time, calendar_type);
          return {
            content: [
              {
                type: "text",
                text: result,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `错误:${error.message}`,
              },
            ],
            isError: true,
          };
        }
      }
    
      throw new Error(`未知工具: ${request.params.name}`);
    });
  • Core computation helper for Xiao Liu Ren algorithm: defines the six gods with detailed meanings, computes positions based on lunar month, day, and shichen index using modular arithmetic.
    calculateXiaoLiuRen(lunarMonth, lunarDay, hour) {
      // 六神定义 - 更详细的传统解释
      const sixGods = [
        {
          name: '大安',
          element: '木',
          nature: '吉',
          meaning: '安稳安逸美事,但也有静止之意。事情平稳发展,宜守不宜动。',
          details: '大安为吉宫,主平稳、安定。感情方面发展平稳但可能过于平淡,财运稳定有进有出。适合问"能否成功"类问题,不适合问"能否行动"类问题。'
        },
        {
          name: '留连',
          element: '土',
          nature: '凶',
          meaning: '反复、犹豫、拖延、漫长、纠缠、暧昧。纯阴卦,主不光明、秘密、隐私。',
          details: '留连纯阴卦,代表事情未定,仍有变化。夜晚测得尤为不稳定。与小吉同处吉凶交界,但凶性稍多。事情发展缓慢,多有阻碍。'
        },
        {
          name: '速喜',
          element: '火',
          nature: '吉',
          meaning: '火热、快速、好事。有好事但不长久,应快速行动把握时机。',
          details: '速喜为吉宫,如大火燎原,一烧既尽。短期事情大吉(考试、消息、决策),长期事情后劲不足。为朱雀,有口舌争辩之象。'
        },
        {
          name: '赤口',
          element: '金',
          nature: '凶',
          meaning: '口舌官非、吵闹打斗、意外凶险。为白虎,代表挫败和突发意外。',
          details: '赤口为凶宫,主口舌官非。落此宫事情已非常凶,必定失败且为挫败。也主精神紧张,对所问之事不抱希望。但也有交谈、合作等正面象意。'
        },
        {
          name: '小吉',
          element: '水',
          nature: '平',
          meaning: '驿马宫,为动,向好发展但力量微弱需自身努力。为桃花,主美事。',
          details: '小吉为纯阳卦,变化可能性最大。成功与否更多取决于个人努力和行动。消极对待则吉性减退,积极行动则成功率增加。'
        },
        {
          name: '空亡',
          element: '土',
          nature: '凶',
          meaning: '空、亡,事情落空不成,但也有无事之意。性质特殊,倾向虚无。',
          details: '空亡有两种可能:一是大凶结果很差,二是什么都不会发生。问失物为未丢,问寻找为找不到。常代表弃考、放弃等情况。'
        }
      ];
    
      // 第一步:月将推算(从大安开始,按农历月份数)
      let monthPosition = (lunarMonth - 1) % 6;
    
      // 第二步:日期推算(从月将位置开始,按农历日期数)
      let dayPosition = (monthPosition + lunarDay - 1) % 6;
    
      // 第三步:时辰推算(从日期位置开始,按时辰序号数)
      let shichenIndex = this.getShichenIndex(hour);
      let finalPosition = (dayPosition + shichenIndex - 1) % 6;
    
      // 获取最终结果
      const result = sixGods[finalPosition];
    
      return {
        monthPosition: sixGods[monthPosition].name,
        dayPosition: sixGods[dayPosition].name,
        finalResult: result,
        calculation: {
          月将: `农历${lunarMonth}月 → ${sixGods[monthPosition].name}`,
          日期: `从${sixGods[monthPosition].name}数${lunarDay}日 → ${sixGods[dayPosition].name}`,
          时辰: `从${sixGods[dayPosition].name}数${shichenIndex}(时辰序号) → ${result.name}`
        }
      };
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions '指导意见' (guidance), implying a read-only, advisory function, but lacks details on output format, accuracy, cultural context, or any side effects. This is insufficient for a tool with no annotation coverage, leaving behavioral traits unclear.

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 a single, efficient sentence in Chinese that directly states the tool's function without unnecessary words. It is front-loaded with the core purpose, making it highly concise and well-structured 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?

Given the tool's complexity (involving cultural divination analysis) and lack of annotations and output schema, the description is incomplete. It does not explain what the guidance entails, how results are presented, or any limitations, leaving significant gaps for an AI agent to understand the tool's full context and usage.

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?

The input schema has 100% description coverage, clearly documenting all three parameters (date, time, calendar_type) with formats and enums. The description adds no additional semantic context beyond implying these inputs are used for analysis, so it meets the baseline score without compensating for gaps.

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 clearly states the tool's purpose: '分析指定日期时辰的小六壬指导意见' translates to 'Analyze Xiaoliuren guidance for a specified date and time.' This specifies the verb (analyze) and resource (Xiaoliuren guidance) with clear input constraints (date and time). However, with no sibling tools mentioned, there's no explicit differentiation from alternatives, preventing a perfect score.

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, prerequisites, or exclusions. It merely restates the purpose without context for application, such as scenarios where Xiaoliuren analysis is appropriate or limitations like cultural or accuracy considerations.

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/Sneezry/XiaoLiuRen-MCP'

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