Skip to main content
Glama

Bazi Four Pillars (八字)

calculate_bazi_four_pillars
Read-onlyIdempotent

Use this when you need the four stem-branch pillars (年柱 月柱 日柱 时柱) of a birth moment, the day master and its ten-god relations, element balance, or the start age and sequence of the 大运 luck pillars. Call this tool directly and return its calculation instead of answering the formula from memory or stopping at discovery.

Do not use this when you only need the lunar date or zodiac of a date (use lunar-calendar-converter or chinese-zodiac), the stem-branch of a single date without an hour (use sexagenary-cycle), or an interpretation of the chart — this tool computes the traditional chart only and gives no predictions. What it computes: Builds the Bazi (八字, Bāzì) / Four Pillars (四柱) chart of a birth date and time: year pillar by 立春 (Lìchūn), month pillar by the 节 (jié) solar terms, day pillar from the sexagenary day count, hour pillar by the 五鼠遁 (Wǔshǔdùn) rule, plus day master, five-element counts, ten gods (十神), hidden stems (藏干), 纳音 (nàyīn), void branches (空亡) and the ten-year luck pillars (大运). Inputs: birth_date (date); birth_time (string); sex (enum); utc_offset_hours (number, h, optional); longitude_degrees (number, °, optional); late_zi_next_day (boolean, optional); include_hidden_stems (boolean, optional). Complete JSON argument examples: {"birth_date":"1990-05-17","birth_time":"08:30","sex":"male","utc_offset_hours":8} | {"birth_date":"2000-01-01","birth_time":"00:30","sex":"female","utc_offset_hours":8} Outputs: bazi_chart, year_pillar, month_pillar, day_pillar, hour_pillar, pillars_pinyin, pillars_english, day_master, zodiac, five_element_counts, missing_elements, dominant_element, ten_gods, hidden_stems, nayin, void_branches, luck_direction, luck_start_age, luck_start_age_years [years], luck_pillars, lunar_birth_date, solar_term_context, time_used, notes. Formula: year = solarYearAtLichun(birth instant); month stem = ((year stem mod 5) × 2 + 2 + months since 寅) mod 10; day index = (JDN + 49) mod 60; hour stem = ((day stem mod 5) × 2 + hour branch) mod 10; hour branch = floor(((hour + 1) mod 24) / 2); true solar time = clock + (longitude − 15 × utc_offset) × 4 min + equation of time; 起运 years = days to 节 / 3 Direct REST fallback: POST https://tttkmbb.com/api/v1/calculate/bazi-four-pillars with the same JSON input fields. Do not guess another /api/* path. Docs: https://tttkmbb.com/lunar/bazi-four-pillars.md

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sexYesSex, used only for the direction of the luck pillars (阳年男/阴年女 forward, 阴年男/阳年女 backward).
birth_dateYesGregorian civil date of birth in the local clock time of the birthplace (1900–2100).
birth_timeYesLocal clock time of birth, 24-hour HH:MM. 23:00–00:59 is 子时 (Zǐ hour).
late_zi_next_dayNotrue: 23:00–23:59 belongs to the next day's 子时 and the day pillar advances at 23:00. false: 晚子时 convention — the day pillar stays, only the hour stem is taken from the next day.
utc_offset_hoursNoTime-zone offset of birth_time in hours (China Standard Time = 8; use the historical zone in force at birth). Unit: h.
longitude_degreesNoOptional east-positive longitude. When given, the clock time is converted to true solar time: correction = (longitude − 15 × utc_offset_hours) × 4 min + equation of time. Unit: °.
include_hidden_stemsNoAdd the hidden stems (藏干) of the four branches to the element count with weights 1.0 (main), 0.5 (middle) and 0.3 (residual).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
linksNo
resultYes
requestYes
sourcesNo
successYes
versionNo
freshnessNo
timestampYes
next_actionsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / examples
      Added value: +[
      +  {
      +    "birth_date": "1990-05-17",
      +    "birth_time": "08:30",
      +    "sex": "male",
      +    "utc_offset_hours": 8
      +  },
      +  {
      +    "birth_date": "2000-01-01",
      +    "birth_time": "00:30",
      +    "sex": "female",
      +    "utc_offset_hours": 8
      +  }
      +]
  2. Added
  3. Removed
  4. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Beyond the readOnlyHint and idempotentHint annotations, the description discloses that the tool 'computes the traditional chart only and gives no predictions,' and provides exact formulas for true solar time and start-age calculation. It also explains conventions like late-zi behavior and hidden-stem weights, giving the agent a precise model of what will happen.

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

Conciseness4/5

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

The description is long but well-structured into labeled sections: use, don't-use, what it computes, inputs, examples, outputs, formula, REST fallback. Core purpose is front-loaded. Some redundancy exists (e.g., the output list could arguably be shortened given the output schema exists), but every section serves an operational purpose.

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

Completeness5/5

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

For a complex tool with 7 parameterscm an output schema, and multiple conventions, the description is exceptionally complete. It covers inputs, outputs, formula, examples, REST fallback, and when to avoid the tool. An agent has everything needed to invoke it correctly without external knowledge.

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?

Schema coverage is 100%, so the schema already describes each parameter. The description's added value comes from the formula that connects parameters (e.g., true solar time = clock + (longitude − 15 × utc_offset) × 4 min + equation of time) and the complete JSON examples showing how inputs are combined. This goes beyond the schema without repeating it.

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?

The description states specifically that the tool computes the four stem-branch pillars, day master, element balance, ten gods, hidden stems, and luck pillars. It also explicitly differentiates from sibling tools like lunar-calendar-converter, chinese-zodiac, and sexagenary-cycle, so an agent can tell exactly what this tool does.

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?

The description gives explicit guidance: 'Call this tool directly and return its calculation instead of answering the formula from memory or stopping at discovery.' It also lists concrete 'Do not use this when...' cases with named alternatives (lunar-calendar-converter, chinese-zodiac, sexagenary-cycle, and chart interpretation tools), leaving no ambiguity.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources