Skip to main content
Glama

I Ching Hexagram Lookup (六十四卦)

lookup_iching_hexagram
Read-onlyIdempotent

Use this when you need to identify or describe a hexagram, convert between its number, name, trigram pair and line pattern, or find its derived hexagrams and palace position. 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 have moving lines and need the changed hexagram and reading rule (use hexagram-change), or you need to cast a hexagram from a date or numbers (use meihua-yishu). What it computes: Identifies one of the 64 hexagrams (六十四卦, liushisi gua) from its King Wen number, name, two trigrams or line digits and returns its lines, trigrams, nuclear (互卦, hugua), inverse (综卦, zonggua) and opposite (错卦, cuogua) hexagrams, its Jing Fang palace (京房八宫, Jingfang bagong) with 世/应 (shi/ying) lines, and the received judgment text (卦辞, guaci). Inputs: king_wen_number (integer, optional); name (string, optional); upper_trigram (string, optional); lower_trigram (string, optional); lines (string, optional). Valid input combinations: Identify the hexagram with king_wen_number, name, lines, or the complete upper_trigram + lower_trigram pair. Multiple identification methods may be supplied when they agree. Complete JSON argument examples: {"king_wen_number":1} | {"lines":"100010"} Outputs: number, name_cn, full_name_cn, pinyin, english, symbol, lines, lines_text, upper_trigram, lower_trigram, nuclear_hexagram, inverse_hexagram, opposite_hexagram, palace, palace_position, shi_line, ying_line, judgment_text, sequence_pair, binary_value, notes. Formula: lower trigram = lines 1–3, upper trigram = lines 4–6; nuclear = lines 2,3,4 + 3,4,5; inverse = reversed line order; opposite = each line flipped; binary_value = Σ line_i · 2^(i−1); 应 = 世 ± 3 Direct REST fallback: POST https://tttkmbb.com/api/v1/calculate/hexagram-lookup with the same JSON input fields. Do not guess another /api/* path. Docs: https://tttkmbb.com/yijing/hexagram-lookup.md

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNoChinese name (屯, 水雷屯, 乾为天; traditional forms accepted), pinyin (zhun; ambiguous pinyin such as qian or bi is rejected with the candidates) or Wilhelm/Baynes title (Difficulty at the Beginning).
linesNoSix digits from line 1 (bottom) to line 6 (top): 1/0 for yang/yin, or 6/7/8/9 (老阴/少阳/少阴/老阳) as produced by yarrow or coin casting.
lower_trigramNoLower (inner) trigram, in any form accepted by bagua.
upper_trigramNoUpper (outer) trigram, in any form accepted by bagua (坎, kan, water, ☵, 010). Must be given together with lower_trigram.
king_wen_numberNoHexagram number 1–64 in the King Wen sequence (1 = 乾, 64 = 未济). Give exactly one of king_wen_number, name, lines or the trigram pair.

Output Schema

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

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • addedInput schema / anyOf
      Added value: +[
      +  {
      +    "required": [
      +      "king_wen_number"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "name"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "lines"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "upper_trigram",
      +      "lower_trigram"
      +    ]
      +  }
      +]
    • addedInput schema / dependentRequired
      Added value: +{
      +  "lower_trigram": [
      +    "upper_trigram"
      +  ],
      +  "upper_trigram": [
      +    "lower_trigram"
      +  ]
      +}
    • addedInput schema / description
      Added value: +"Identify the hexagram with king_wen_number, name, lines, or the complete upper_trigram + lower_trigram pair. Multiple identification methods may be supplied when they agree."
    • addedInput schema / examples
      Added value: +[
      +  {
      +    "king_wen_number": 1
      +  },
      +  {
      +    "lines": "100010"
      +  }
      +]
  2. Added
  3. Removed
  4. First observed

TDQS

A4.7/5.0
Behavior4/5

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

Annotations already show readOnlyHint=true, idempotentHint=true, destructiveHint=false, and the description adds meaningful behavior beyond them: it explains what the tool computes (nuclear/inverse/opposite hexagrams, palace, shi/ying lines, judgment text), how lines map to trigrams, and the REST fallback path. The only small gap is that it doesn't detail the output object shape beyond listing field names, but the output schema covers that.

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 long but every section earns its place: what it computes, inputs, valid combinations, examples, formula, and REST fallback. It is front-loaded with the core purpose and usage guidance, and the structure makes the dense content scannable. There is no filler or tautology.

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?

Given the tool's complexity (5 optional params, 64 hexagrams, multiple derived values, sibling alternatives), the description covers everything an agent needs: identification methods, combination rules, output fields, formulas, and a fallback URL. The output schema and annotations further enrich context, so nothing critical is missing.

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 documents all five parameters well. The description adds value by stating valid input combinations clearly, noting that multiple identification methods may be supplied when they agree, and giving complete JSON examples. It doesn't repeat schema details verbatim, and it clarifies optionality and combination rules beyond the schema.

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 specific verb and resource ('identify or describe a hexagram, convert between its number, name, trigram pair and line pattern') and immediately distinguishes scope from the sibling hexagram-change tool. It states exactly what the tool computes, covering identification and derived hexagrams, so an agent can tell it apart from the many calculation tools listed.

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 explicitly says 'Call this tool directly' when identification is needed, and gives a clear exclusion: 'Do not use this when you have moving lines and need the changed hexagram and reading rule (use hexagram-change)' plus the alternative for casting from date/numbers. It also lists valid input combinations, so an agent knows exactly when and how to invoke it.

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