Skip to main content
Glama
Espivc

ming-metaphysics-mcp

by Espivc

ming_qmdj_direction

Find the optimal direction and best timing windows for any intention using Qi Men Dun Jia. Returns lead star and strategic framing based on classical solar term accuracy for informed decision-making.

Instructions

Compute a Qi Men Dun Jia (奇門遁甲) reading for a specific date. Returns the optimal direction, best timing windows, lead star, and strategic framing. Ju number computed via sxtwl solar term library for classical accuracy.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateNoDate for the QMDJ reading in YYYY-MM-DD format. Defaults to today (SGT) if omitted.
hourNoOptional hour for hour-level resolution. If omitted, returns the best hour block for the day.
questionYesThe specific intention (e.g. 'Best direction for a job interview', 'Is today favourable for signing a contract?').

Implementation Reference

  • Main tool definition for ming_qmdj_direction. Contains both the inputSchema (definition) and the async handler function that calls getQmdj() from the engine client, then shapes the response with optimal direction, door, star, hour, favorable hours, and avoidance info.
    export const qmdjTool: MingTool = {
      definition: {
        name: "ming_qmdj_direction",
        description:
          "Compute a Qi Men Dun Jia (奇門遁甲) reading for a specific date. Returns the optimal " +
          "direction, best timing windows, lead star, and strategic framing. Ju number computed " +
          "via sxtwl solar term library for classical accuracy.",
        inputSchema: {
          type: "object",
          properties: {
            date: {
              type: "string",
              format: "date",
              description:
                "Date for the QMDJ reading in YYYY-MM-DD format. Defaults to today (SGT) if omitted.",
            },
            hour: {
              type: "integer",
              minimum: 0,
              maximum: 23,
              description:
                "Optional hour for hour-level resolution. If omitted, returns the best hour block for the day.",
            },
            question: {
              type: "string",
              description:
                "The specific intention (e.g. 'Best direction for a job interview', " +
                "'Is today favourable for signing a contract?').",
            },
          },
          required: ["question"],
        },
      },
    
      handler: async (args) => {
        const raw = (await getQmdj({ date: args.date as string | undefined })) as Record<
          string,
          unknown
        >;
    
        // Shape the raw /qmdj response into the spec's return shape
        const best = (raw.best_now ?? {}) as Record<string, unknown>;
        const shaped = {
          ju_number: raw.ju,
          ju_type: raw.is_yang ? "Yang" : "Yin",
          structure: raw.structure,
          optimal_direction: best.direction ?? null,
          optimal_door: best.door ? `${best.door} (${doorCn(best.door as string)})` : null,
          lead_star: best.star ?? null,
          best_hour: best.hour ?? null,
          favorable_hours: buildFavorableHours(raw.hours as Record<string, unknown>[]),
          avoidance: buildAvoidance(raw.hours as Record<string, unknown>[]),
          date: raw.date,
          day_pillar: raw.day_pillar,
          formations_summary: (raw.formations_summary as Record<string, unknown> | undefined)
            ?.headline ?? null,
          raw_hours: raw.hours,
        };
        return JSON.stringify(shaped, null, 2);
      },
  • Input schema for ming_qmdj_direction: defines optional 'date' (string, date format), optional 'hour' (integer 0-23), and required 'question' (string) parameters.
    export const qmdjTool: MingTool = {
      definition: {
        name: "ming_qmdj_direction",
        description:
          "Compute a Qi Men Dun Jia (奇門遁甲) reading for a specific date. Returns the optimal " +
          "direction, best timing windows, lead star, and strategic framing. Ju number computed " +
          "via sxtwl solar term library for classical accuracy.",
        inputSchema: {
          type: "object",
          properties: {
            date: {
              type: "string",
              format: "date",
              description:
                "Date for the QMDJ reading in YYYY-MM-DD format. Defaults to today (SGT) if omitted.",
            },
            hour: {
              type: "integer",
              minimum: 0,
              maximum: 23,
              description:
                "Optional hour for hour-level resolution. If omitted, returns the best hour block for the day.",
            },
            question: {
              type: "string",
              description:
                "The specific intention (e.g. 'Best direction for a job interview', " +
                "'Is today favourable for signing a contract?').",
            },
          },
          required: ["question"],
        },
  • Registration of qmdjTool into the TOOLS array, which is exported and consumed by src/index.ts to expose the tool via MCP server.
    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 getQmdj() HTTP client function that makes a GET request to the /qmdj endpoint of the Ming FastAPI engine, used by the handler to fetch raw QMDJ data.
    export interface QmdjParams {
      date?: string;
    }
    
    export async function getQmdj(params: QmdjParams): Promise<unknown> {
      const url = buildUrl("/qmdj", { date: params.date });
      const res = await fetch(url.toString(), { signal: AbortSignal.timeout(TIMEOUT_MS) });
      return handleResponse(res, "/qmdj");
    }
Behavior3/5

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

No annotations are provided, so the description must convey behavioral traits. It mentions the use of 'sxtwl solar term library for classical accuracy', adding technical transparency. However, it does not disclose whether the operation is idempotent, safe (read-only), or any error conditions. The description is adequate but not comprehensive.

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?

Two sentences, no wasted words. The first sentence states purpose and outputs, the second adds technical detail. Information is front-loaded and easy to parse.

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?

No output schema exists, so the description covers the key return values (optimal direction, timing windows, lead star, strategic framing). For a complex divination tool, this provides a good overview. Minor gap: no mention of error handling or edge cases (e.g., invalid date), but overall sufficient for an agent to understand the output.

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?

Input schema has 100% description coverage, so the schema itself documents the parameters well. The description provides minimal additional meaning beyond the schema, only reiterating that omitted hour returns best hour block. Since schema coverage is high, baseline 3 is appropriate.

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 computes a Qi Men Dun Jia reading for a specific date and lists specific outputs (optimal direction, best timing windows, lead star, strategic framing). The verb 'Compute' and resource 'reading' are specific, and the tool name 'direction' aligns with the main output, differentiating it from sibling tools that focus on other Ming methods.

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

Usage Guidelines3/5

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

The description implies use when a QMDJ reading is needed for a date, but lacks explicit guidance on when to use this tool versus siblings like 'ming_bazi_analyze' or 'ming_fengshui_flying_stars'. No exclusions or alternatives are mentioned, leaving the agent to infer context.

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