Skip to main content
Glama
cantian-ai

Bazi MCP

getChineseCalendar

Retrieve traditional Chinese calendar details for any Gregorian date to align with lunar and cultural events. Perfect for planning, cultural study, or astrological analysis.

Instructions

获取指定公历时间(默认今天)的黄历信息。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
solarDatetimeNo用ISO时间格式表示的公历时间. 例如:`2008-03-01T13:00:00+08:00`。

Implementation Reference

  • The core handler function that implements the getChineseCalendar tool, computing Chinese calendar details like lunar date, Ganzhi, festivals, auspicious directions, etc., from a solar datetime.
    export const getChineseCalendar = (date?: string) => {
      if (!date) {
        date = today();
      }
      const solarTime = getSolarTime(date);
      const lunarHour = solarTime.getLunarHour();
      const eightChar = lunarHour.getEightChar();
      const lunarDay = lunarHour.getLunarDay();
      const twentyStar = lunarDay.getTwentyEightStar();
      const daySixtyCycle = lunarDay.getSixtyCycle();
      const dayHeavenStem = daySixtyCycle.getHeavenStem();
      const dayEarthBranch = daySixtyCycle.getEarthBranch();
      return {
        公历: solarTime.toString().split(' ').shift() + ' 星期' + solarTime.getSolarDay().getWeek(),
        农历: lunarDay.toString(),
        干支: eightChar.toString().split(' ').slice(0, 3).join(' '),
        生肖: eightChar.getYear().getEarthBranch().getZodiac().toString(),
        纳音: eightChar.getDay().getSound().toString(),
        农历节日: lunarDay.getFestival()?.toString() || undefined,
        公历节日: solarTime.getSolarDay().getFestival()?.toString() || undefined,
        节气: solarTime.getSolarDay().getTerm().toString(),
        二十八宿: twentyStar.toString() + twentyStar.getSevenStar() + twentyStar.getAnimal() + twentyStar.getLuck(),
        彭祖百忌: daySixtyCycle.getPengZu().toString(),
        喜神方位: dayHeavenStem.getJoyDirection().toString(),
        阳贵神方位: dayHeavenStem.getYangDirection().toString(),
        阴贵神方位: dayHeavenStem.getYinDirection().toString(),
        福神方位: dayHeavenStem.getMascotDirection().toString(),
        财神方位: dayHeavenStem.getWealthDirection().toString(),
        冲煞: `冲${dayEarthBranch.getOpposite().getZodiac()}(${dayEarthBranch.getOpposite()})煞${dayEarthBranch.getOminous()}`,
        宜: lunarDay.getRecommends().toString(),
        忌: lunarDay.getAvoids().toString(),
      };
    };
  • src/mcp.ts:55-72 (registration)
    Registers the getChineseCalendar tool with the MCP server, defining its name, description, input schema, and a thin wrapper handler that calls the core function and formats the response.
    server.tool(
      'getChineseCalendar',
      '获取指定公历时间(默认今天)的黄历信息。',
      {
        solarDatetime: z.string().optional().describe('用ISO时间格式表示的公历时间. 例如:`2008-03-01T13:00:00+08:00`。'),
      },
      async ({ solarDatetime }) => {
        const result = getChineseCalendar(solarDatetime);
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(result),
            },
          ],
        };
      },
    );
  • Zod input schema for the getChineseCalendar tool, validating the optional solarDatetime parameter.
    {
      solarDatetime: z.string().optional().describe('用ISO时间格式表示的公历时间. 例如:`2008-03-01T13:00:00+08:00`。'),
    },
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions the default behavior (today if no datetime provided), which is useful. However, it doesn't disclose other behavioral traits like what specific information is returned (e.g., auspicious activities, taboos), whether there are rate limits, error conditions, or cultural/regional considerations. For a tool with no annotations, this leaves significant gaps.

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 front-loads the core purpose ('获取...黄历信息') and includes the key detail about default behavior. There is zero waste or redundancy, making it appropriately concise for a simple tool.

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 no annotations and no output schema, the description is incomplete. It doesn't explain what '黄历信息' entails (e.g., structure, fields like lucky directions or activities), potential errors, or cultural context. For a tool that likely returns rich cultural data, this lack of detail makes it inadequate for an agent to fully understand the tool's behavior and output.

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 the parameter 'solarDatetime' well-documented in the schema (ISO format, example). The description adds marginal value by clarifying the default (today) and that it's Gregorian time, but doesn't provide additional semantic context beyond what the schema already covers. Baseline 3 is appropriate given high schema coverage.

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 verb '获取' (get) and the resource '黄历信息' (Chinese calendar/almanac information), specifying it's for a given Gregorian date. It distinguishes from siblings like getBaziDetail (which provides detailed Bazi analysis) and getSolarTimes (which provides solar terms). However, it doesn't explicitly differentiate from buildBaziFromSolarDatetime, which also uses solar datetime input.

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

Usage Guidelines3/5

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

The description implies usage by stating it retrieves Chinese calendar information for a specified Gregorian date (defaulting to today). It doesn't provide explicit when-not-to-use guidance or name alternatives, though the sibling tools suggest different purposes (Bazi calculation vs. calendar info). The default behavior (today if unspecified) is helpful but not comprehensive 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

Related 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/cantian-ai/bazi-mcp'

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