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

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changed
    • addedInput schema / properties / lines / maxLength
      Added value: +6
    • addedInput schema / properties / lower_trigram / maxLength
      Added value: +20
    • addedInput schema / properties / name / maxLength
      Added value: +40
    • addedInput schema / properties / upper_trigram / maxLength
      Added value: +20
    • 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. 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"
      +  }
      +]
  3. Added
  4. Removed
  5. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations carry only readOnlyHint=true, idempotentHint=true, destructiveHint=false, leaving the description to explain actual behavior. It discloses rejection semantics ('ambiguous pinyin such as qian or bi is rejected with the candidates'), input-agreement behavior ('Multiple identification methods may be supplied when they agree'), internal computation details (the nuclear/inverse/opposite formulas and 应 = 世 ± 3 rule), and a usage directive ('Call this tool directly and return its calculation instead of answering the formula from memory'). Nothing contradicts the read-only/idempotent annotations.

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 (~300 words) but deliberately sectioned: use-case, exclusion, computation scope, inputs, valid combinations, examples, outputs, formula, REST fallback, docs. Actionable guidance is front-loaded in the first sentence. The Inputs list somewhat redundantly restates schema parameter names, and the formula uses dense notation, but given the domain complexity each section earns its place; minor trimming would be possible.

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 5 optional params, anyOf constraints, derived hexagram calculations, and an output schema, the description is fully complete: it covers routing, all valid input combinations, worked JSON examples, the full output field list, computation formulas, direct REST fallback with an explicit 'Do not guess another /api/* path' warning, and a docs link. The only minor blemish is referencing sibling tools ('hexagram-change', 'meihua-yishu') by names that don't exactly match the visible sibling list, but cast_plum_blossom_hexagram is clearly the Meihua Yishu tool.

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%, with each parameter already richly documented (e.g., lines accepts '1/0 for yang/yin, or 6/7/8/9'). The description adds value beyond the schema: the validity rule that upper_trigram and lower_trigram must form a complete pair and 'may be supplied when they agree', complete JSON argument examples, and the line-to-trigram mapping formula. It does not merely restate the schema, but the schema already does the heavy lifting, so a 4 rather than 5.

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 opening sentence names specific verbs and resources: 'identify or describe a hexagram, convert between its number, name, trigram pair and line pattern, or find its derived hexagrams and palace position.' This precisely delimits the tool's scope and, via the explicit 'Do not use this when...' sentence, distinguishes it from hexagram-change and meihua-yishu. An agent can select this tool 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 an explicit when-to-use directive ('Use this when you need to identify or describe a hexagram...') and equally explicit when-not-to-use exclusions ('Do not use this when you have moving lines and need the changed hexagram... use hexagram-change, or you need to cast a hexagram from a date or numbers... use meihua-yishu'). Named alternatives with the condition that selects each make routing unambiguous.

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