Skip to main content
Glama
Espivc

ming-metaphysics-mcp

by Espivc

ming_bazi_analyze

Compute a complete BaZi (Four Pillars of Destiny) chart including Day Master analysis, pattern classification, decade luck pillars, and annual outlook. Optional question feature for targeted readings.

Instructions

Compute a full BaZi (Four Pillars of Destiny 八字) chart. Returns Day Master analysis, pattern classification (格局), decade luck pillars (大运), and annual outlook. Engine verified against 子平真詮 and 淵海子平. Requires Ming engine running at MING_API_URL.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
birth_dateYesDate of birth in YYYY-MM-DD format. Must be after 1900-01-01.
birth_hourNoHour of birth in 24-hour format (0–23). If unknown, omit — analysis will note the limitation.
birth_locationNoCity and country of birth (e.g. 'Singapore, Singapore'). Provides timezone context.
genderYesGender determines luck pillar direction (forward for males in yang years, backward for females).
questionNoOptional. Specific question to orient the reading (e.g. 'Is 2026 good for a career change?').

Implementation Reference

  • The handler function that executes the ming_bazi_analyze tool logic. It calls analyzeBazi() from engines-client with birth_date, birth_hour, and gender, then returns the result as JSON.
      handler: async (args) => {
        const result = await analyzeBazi({
          date: args.birth_date as string,
          hour: (args.birth_hour as number) ?? 12,
          gender: args.gender as string,
        });
        return JSON.stringify(result, null, 2);
      },
    };
  • The inputSchema definition for ming_bazi_analyze. Defines five parameters: birth_date (required), birth_hour (optional), birth_location (optional), gender (required, enum male/female), and question (optional).
    export const baziTool: MingTool = {
      definition: {
        name: "ming_bazi_analyze",
        description:
          "Compute a full BaZi (Four Pillars of Destiny 八字) chart. Returns Day Master analysis, " +
          "pattern classification (格局), decade luck pillars (大运), and annual outlook. " +
          "Engine verified against 子平真詮 and 淵海子平. Requires Ming engine running at MING_API_URL.",
        inputSchema: {
          type: "object",
          properties: {
            birth_date: {
              type: "string",
              format: "date",
              description: "Date of birth in YYYY-MM-DD format. Must be after 1900-01-01.",
            },
            birth_hour: {
              type: "integer",
              minimum: 0,
              maximum: 23,
              description:
                "Hour of birth in 24-hour format (0–23). If unknown, omit — analysis will note the limitation.",
            },
            birth_location: {
              type: "string",
              description:
                "City and country of birth (e.g. 'Singapore, Singapore'). Provides timezone context.",
            },
            gender: {
              type: "string",
              enum: ["male", "female"],
              description:
                "Gender determines luck pillar direction (forward for males in yang years, backward for females).",
            },
            question: {
              type: "string",
              description:
                "Optional. Specific question to orient the reading (e.g. 'Is 2026 good for a career change?').",
            },
          },
          required: ["birth_date", "gender"],
        },
  • The tool registration point where baziTool is exported and included in the TOOLS array that gets imported by index.ts for the ListToolsRequestSchema handler.
    export { baziTool } from "./bazi.js";
    export { qmdjTool } from "./qmdj.js";
    export { zwdsTool } from "./zwds.js";
    export { fengshuiTool } from "./fengshui.js";
    export { ichingTool } from "./iching.js";
    export { forecastTool } from "./forecast.js";
    export type { MingTool } from "./types.js";
    
    import { baziTool } from "./bazi.js";
    import { qmdjTool } from "./qmdj.js";
    import { zwdsTool } from "./zwds.js";
    import { fengshuiTool } from "./fengshui.js";
    import { ichingTool } from "./iching.js";
    import { forecastTool } from "./forecast.js";
    
    export const TOOLS = [baziTool, qmdjTool, zwdsTool, fengshuiTool, ichingTool, forecastTool];
  • The analyzeBazi helper function that makes an HTTP POST request to the Ming engine's /analyze endpoint with the BaZi parameters.
    export interface BaziParams {
      date: string;
      hour: number;
      gender: string;
    }
    
    export async function analyzeBazi(params: BaziParams): Promise<unknown> {
      const res = await fetch(`${API_URL}/analyze`, {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ date: params.date, hour: params.hour, gender: params.gender }),
        signal: AbortSignal.timeout(TIMEOUT_MS),
      });
      return handleResponse(res, "/analyze");
    }
  • src/index.ts:45-69 (registration)
    The MCP server's CallToolRequestSchema handler that dispatches incoming tool calls by name, routing to the appropriate tool's handler function.
    server.setRequestHandler(CallToolRequestSchema, async (request) => {
      const { name, arguments: args } = request.params;
    
      const tool = TOOLS.find((t) => t.definition.name === name);
      if (!tool) {
        throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`);
      }
    
      try {
        const text = await tool.handler((args ?? {}) as Record<string, unknown>);
        return { content: [{ type: "text" as const, text }] };
      } catch (err) {
        const message = err instanceof Error ? err.message : String(err);
        // Return structured error — don't expose raw stack traces to the client
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify({ error: true, tool: name, message }, null, 2),
            },
          ],
          isError: true,
        };
      }
    });
Behavior4/5

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

No annotations exist, so the description carries full burden. It discloses the compute behavior, output types, and engine verification. It does not mention destructive actions or permissions, but for a read-only computation tool, the behavioral transparency is adequate and adds value beyond the schema.

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 three sentences (∼50 words), each serving a purpose: stating the main action and outputs, verifying accuracy, and noting a requirement. No redundant or extraneous information.

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?

The tool has 5 parameters (2 required) and no output schema. The description provides high-level output categories and verification context, which is helpful. However, it does not detail the output structure or error handling, so completeness is slightly lacking.

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%, so the baseline is 3. The description does not add significant meaning beyond what the schema already provides for each parameter. It mentions the engine requirement but not parameter-specific details.

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 uses a specific verb 'Compute' with a clear resource 'BaZi chart'. It lists exact outputs and references verification against authoritative sources. Sibling tools are distinct (fengshui, forecast, iching, etc.), so differentiation is clear.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description states it requires the Ming engine running at MING_API_URL, providing a prerequisite. It does not explicitly state when not to use or compare with siblings, but given the distinct domains of siblings, the usage context is clear and no explicit exclusions are critical.

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