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
service_versionYesDeployed Calcgrid implementation version used for the result.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedOutput schema / properties / service_version
      Added value: +{
      +  "description": "Deployed Calcgrid implementation version used for the result.",
      +  "type": "string"
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "success",
      -  "request",
      -  "result",
      -  "timestamp"
      -]New value: +[
      +  "success",
      +  "service_version",
      +  "request",
      +  "result",
      +  "timestamp"
      +]
  2. 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
      +  }
      +]
  3. Added
  4. Removed
  5. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Beyond the readOnlyHint, idempotentHint, and destructiveHint annotations, the description reveals the tool's computational behavior in depth: pillar construction rules, solar-term conventions, true solar time correction formula, and the 起运 years calculation. It also explicitly states that the tool gives no predictions, setting clear expectations about the boundary of what it does.

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 well structured with labeled sections and is front-loaded with the primary usage directive. It is somewhat long and includes redundant material such as a full output list even though an output schema exists and detailed formula text already present in property descriptions, but the organization keeps the extra length navigable.

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 astrological calculator, the description is remarkably complete: it defines the computation rules, optional parameter conventions, complete JSON examples, an output field list, a REST fallback endpoint, and a documentation link. An agent has everything needed to select and invoke the tool correctly for the intended use cases.

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% and the schema already explains each parameter's purpose, units, defaults, and edge-case behavior. The description's parameter list and example JSONs largely duplicate the schema examples, so it adds little new semantic meaning beyond what is already structured.

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 opens with a clear, specific statement of when to use the tool and enumerates exactly what it computes: the four stem-branch pillars, day master, ten gods, element balance, and 大运 luck pillars. It also explicitly distinguishes itself from interpretation tools and other calendar-related siblings, so an agent can tell this calculator apart without opening the schema.

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 both positive and negative usage criteria: use it when you need Bazi chart components, and do not use it for lunar dates, zodiac, single-day stem-branch, or interpretation. It names alternatives such as lunar-calendar-converter, chinese-zodiac, and sexagenary-cycle, making the routing decision explicit and actionable.

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