Skip to main content
Glama
cantian-ai

Bazi MCP

getSolarTimes

Converts Bazi (Chinese astrological chart) data into a list of Gregorian calendar times formatted as YYYY-MM-DD hh:mm:ss for accurate Chinese astrological calculations.

Instructions

根据八字获取公历时间列表。返回的时间格式为:YYYY-MM-DD hh:mm:ss。例如时间1998年7月31日下午2点整表示为:1998-07-31 14:00:00

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
baziYes八字,按年柱、月柱、日柱、时柱顺序,用空格隔开。例如:戊寅 己未 己卯 辛未

Implementation Reference

  • Core handler function that implements the getSolarTimes tool logic: parses the bazi string into year, month, day, hour pillars, computes solar times using the EightChar class from tyme4ts library, maps over them formatting with formatSolarTime, and returns the list.
    export const getSolarTimes = async ({ bazi }) => {
      const [year, month, day, hour] = bazi.split(' ');
      const solarTimes = new EightChar(year, month, day, hour).getSolarTimes(1700, new Date().getFullYear());
      const result = solarTimes.map((time) => formatSolarTime(time));
      return result;
    };
  • src/mcp.ts:36-53 (registration)
    Registration of the getSolarTimes tool in the MCP server using server.tool(), including name, description, Zod input schema, and a thin wrapper handler that invokes the core getSolarTimes function and formats the response as MCP content.
    server.tool(
      'getSolarTimes',
      '根据八字获取公历时间列表。返回的时间格式为:YYYY-MM-DD hh:mm:ss。例如时间1998年7月31日下午2点整表示为:1998-07-31 14:00:00',
      {
        bazi: z.string().describe('八字,按年柱、月柱、日柱、时柱顺序,用空格隔开。例如:戊寅 己未 己卯 辛未'),
      },
      async (data) => {
        const result = await getSolarTimes(data);
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(result),
            },
          ],
        };
      },
    );
  • Zod input schema for the getSolarTimes tool, defining the 'bazi' parameter as a string describing the eight characters in year, month, day, hour pillars separated by spaces.
    {
      bazi: z.string().describe('八字,按年柱、月柱、日柱、时柱顺序,用空格隔开。例如:戊寅 己未 己卯 辛未'),
    },
  • Helper function formatSolarTime that converts a SolarTime object from tyme4ts into a formatted string 'YYYY-MM-DD hh:mm:ss', used in the getSolarTimes handler to format the list of solar times.
    export function formatSolarTime(solarTime: SolarTime) {
      return (
        [
          solarTime.getYear(),
          solarTime.getMonth().toString().padStart(2, '0'),
          solarTime.getDay().toString().padStart(2, '0'),
        ].join('-') +
        ' ' +
        [
          solarTime.getHour().toString().padStart(2, '0'),
          solarTime.getMinute().toString().padStart(2, '0'),
          solarTime.getSecond().toString().padStart(2, '0'),
        ].join(':')
      );
    }
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 the return format ('YYYY-MM-DD hh:mm:ss') with an example, which is helpful. However, it lacks critical details such as whether the tool is read-only or has side effects, error handling, rate limits, or authentication needs. For a tool with no annotation coverage, this is a significant gap.

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 concise and well-structured in two sentences: the first states the purpose and output format, and the second provides a concrete example. Every sentence adds essential information without redundancy, making it easy to understand quickly.

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

Completeness3/5

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

Given the tool has one parameter with full schema coverage and no output schema, the description is moderately complete. It explains the purpose and output format but lacks behavioral details (e.g., error cases, side effects) and usage context. For a simple conversion tool, this is adequate but has clear gaps in transparency and guidelines.

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

Parameters4/5

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

The description doesn't explicitly discuss parameters, but the input schema has 100% coverage with a clear description for the single parameter 'bazi'. Since schema coverage is high, the baseline is 3. The description adds value by providing an example output format, which indirectly clarifies the parameter's purpose (converting Bazi to times), justifying a score of 4.

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: '根据八字获取公历时间列表' (Get Gregorian calendar time list based on Bazi). It specifies the verb ('获取' - get) and resource ('公历时间列表' - Gregorian calendar time list), making the function evident. However, it doesn't explicitly differentiate from sibling tools like 'getBaziDetail', which might provide detailed Bazi analysis rather than time conversion.

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. It doesn't mention sibling tools such as 'buildBaziFromLunarDatetime' or 'buildBaziFromSolarDatetime', which might be used for different conversion directions (e.g., from dates to Bazi). There's no context on prerequisites or exclusions, leaving usage unclear.

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