Skip to main content
Glama
Espivc

ming-metaphysics-mcp

by Espivc

ming_iching_cast

Cast an I Ching hexagram using the classical 納甲法 (Liu Yao) method for a specific question. Returns the hexagram, changing lines, transformed hexagram, and interpretation based on the current date/time or a provided timestamp.

Instructions

Cast an I Ching (易經) hexagram using the classical 納甲法 (Liu Yao method). Returns the hexagram, changing lines, transformed hexagram, and interpretation. The casting derives from the current date/time (SGT) by default.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
questionYesThe specific question to cast for. Must be a genuine question about a real situation. Example: 'Should I accept the offer from Company X?' — not 'What will happen to the economy?'
casting_timestampNoOptional. ISO 8601 timestamp of the casting moment (e.g. '2026-04-18T14:30:00'). When provided, the date and time are both forwarded to the engine — the time component determines the hour branch (地支) used for 納甲 analysis. If omitted, uses the server's current SGT time.

Implementation Reference

  • The main handler function for the ming_iching_cast tool. It calls castIching() with the user's question and optional casting_timestamp, then flattens the raw response into a clean JSON result with hexagram details, changing lines, transformed hexagram, and interpretation.
      handler: async (args) => {
        const raw = (await castIching({
          question: args.question as string,
          casting_timestamp: args.casting_timestamp as string | undefined,
        })) as Record<string, unknown>;
    
        // The /iching-cast endpoint returns { ok, hexagram, analysis }
        // Flatten for cleaner MCP response
        const hexagram = raw.hexagram as Record<string, unknown> | undefined;
        const analysis = raw.analysis as Record<string, unknown> | undefined;
    
        const result = {
          question: args.question,
          cast_date: args.casting_timestamp ?? "today (SGT)",
          hexagram_number: hexagram?.king_wen_number ?? hexagram?.number ?? null,
          hexagram_name_cn: hexagram?.name ?? null,
          hexagram_name_en: hexagram?.english_name ?? hexagram?.english ?? null,
          upper_trigram: hexagram?.upper_trigram ?? null,
          lower_trigram: hexagram?.lower_trigram ?? null,
          changing_lines: hexagram?.moving_lines ?? hexagram?.changing_lines ?? null,
          transformed_hexagram: hexagram?.changed_hexagram ?? hexagram?.transformed ?? null,
          world_line: hexagram?.world_line ?? null,
          response_line: hexagram?.response_line ?? null,
          useful_god: hexagram?.useful_god ?? analysis?.useful_god ?? null,
          interpretation: analysis?.interpretation ?? analysis?.summary ?? null,
          action_guidance: analysis?.guidance ?? analysis?.recommendation ?? null,
          raw: raw,
        };
        return JSON.stringify(result, null, 2);
      },
    };
  • Input schema for ming_iching_cast. Defines 'question' (required string) and 'casting_timestamp' (optional ISO 8601 datetime string).
    inputSchema: {
      type: "object",
      properties: {
        question: {
          type: "string",
          description:
            "The specific question to cast for. Must be a genuine question about a real situation. " +
            "Example: 'Should I accept the offer from Company X?' — not 'What will happen to the economy?'",
        },
        casting_timestamp: {
          type: "string",
          format: "date-time",
          description:
            "Optional. ISO 8601 timestamp of the casting moment (e.g. '2026-04-18T14:30:00'). " +
            "When provided, the date and time are both forwarded to the engine — the time component " +
            "determines the hour branch (地支) used for 納甲 analysis. " +
            "If omitted, uses the server's current SGT time.",
        },
      },
      required: ["question"],
    },
  • The tool is registered in the TOOLS array alongside five other tools, making it discoverable by the MCP server.
    export const TOOLS = [baziTool, qmdjTool, zwdsTool, fengshuiTool, ichingTool, forecastTool];
  • The castIching() helper function that sends a POST request to the FastAPI /iching-cast endpoint with query parameters (question, date, hour_branch, casting_timestamp).
    export async function castIching(params: IchingParams): Promise<unknown> {
      const url = buildUrl("/iching-cast", {
        question: params.question,
        date: params.date,
        hour_branch: params.hour_branch,
        casting_timestamp: params.casting_timestamp,
      });
      const res = await fetch(url.toString(), {
        method: "POST",
        signal: AbortSignal.timeout(TIMEOUT_MS),
      });
      return handleResponse(res, "/iching-cast");
    }
  • src/index.ts:39-41 (registration)
    The MCP server's ListToolsRequestSchema handler, which iterates TOOLS and exposes their definitions (including ming_iching_cast) to the client.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: TOOLS.map((t) => t.definition),
    }));
Behavior3/5

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

No annotations are provided, so the description carries the burden. It mentions that casting derives from current date/time by default and that the optional timestamp affects the hour branch. However, it does not explicitly state that the operation is read-only (non-destructive) or any limitations. Adequate but not thorough.

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 only two sentences, gets straight to the point, and front-loads the main purpose. Every sentence adds essential information without redundancy.

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

Completeness4/5

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

Given the tool has 2 parameters and no output schema, the description covers the return elements (hexagram, changing lines, etc.) and the default behavior with date/time. It could elaborate on the interpretation output, but overall it provides sufficient context for a divination 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?

The input schema already has good descriptions (100% coverage). The description adds value by emphasizing that the question must be genuine and about a real situation, and by explaining how the timestamp's time component affects the analysis. This enhances the schema's information.

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 clearly states the tool casts an I Ching hexagram using the classical nàjiǎ method, and specifies the output includes hexagram, changing lines, transformed hexagram, and interpretation. This is specific and distinguishes it from sibling tools like bazi or fengshui.

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?

No explicit guidance on when to use this tool versus alternatives like ming_bazi_analyze or ming_fengshui_flying_stars. The description gives an example of question format but does not explain when I Ching is appropriate compared to other divination systems.

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

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/Espivc/ming-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server