Skip to main content
Glama
spyfree

Mingli MCP Server

by spyfree

analyze_bazi_element

Analyzes the strength and balance of the Five Elements (Wu Xing) in a BaZi (Four Pillars of Destiny) chart. Calculates element scores, identifies imbalances, and determines missing elements to provide insights into a person's elemental composition.

Instructions

分析八字五行强弱,包含五行分数、平衡度、缺失五行等

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
birth_dateYes出生日期,格式:YYYY-MM-DD
time_indexYes出生时辰序号(0-12)
genderYes
calendarNosolar
is_leap_monthNo
formatNomarkdown
languageNozh-CN

Implementation Reference

  • Main handler function that executes the analyze_bazi_element tool logic: validates parameters, retrieves Bazi system, performs element analysis, and formats output.
    @log_performance
    def handle_analyze_bazi_element(args: Dict[str, Any]) -> str:
        """工具:分析八字五行"""
        # Validate parameters
        _validate_common_params(
            args,
            ["birth_date", "time_index", "gender"],
            BAZI_ELEMENT_PARAM_DESCRIPTIONS,
            date_key="birth_date",
        )
    
        with PerformanceTimer("八字五行分析"):
            birth_info = _build_birth_info(args, date_key="birth_date")
    
            system = get_system("bazi")
            analysis = system.analyze_element(birth_info)
    
            output_format = args.get("format", "markdown")
            if output_format == "json":
                return _format_response(analysis, "json")
            else:
                return _bazi_formatter.format_element_analysis(analysis, "markdown")
  • Tool schema definition including input parameters, descriptions, required fields, and annotations.
    def get_analyze_bazi_element_definition() -> Dict[str, Any]:
        """Get definition for analyze_bazi_element tool"""
        return {
            "name": "analyze_bazi_element",
            "description": "分析八字五行强弱,包含五行分数、平衡度、缺失五行等",
            "annotations": {
                "readOnlyHint": True,
                "destructiveHint": False,
                "idempotentHint": True,
            },
            "inputSchema": {
                "type": "object",
                "properties": {
                    "birth_date": {
                        "type": "string",
                        "description": "出生日期,格式:YYYY-MM-DD",
                    },
                    "time_index": {
                        "type": "integer",
                        "description": "出生时辰序号(0-12)",
                        "minimum": 0,
                        "maximum": 12,
                    },
                    "gender": {
                        "type": "string",
                        "enum": ["男", "女"],
                    },
                    "calendar": {
                        "type": "string",
                        "enum": ["solar", "lunar"],
                        "default": "solar",
                    },
                    "is_leap_month": {
                        "type": "boolean",
                        "default": False,
                    },
                    "format": {
                        "type": "string",
                        "enum": ["json", "markdown"],
                        "default": "markdown",
                    },
                    "language": {
                        "type": "string",
                        "enum": ["zh-CN", "zh-TW", "en-US", "ja-JP", "ko-KR", "vi-VN"],
                        "default": "zh-CN",
                    },
                },
                "required": ["birth_date", "time_index", "gender"],
            },
        }
  • Registration of the analyze_bazi_element handler in the ToolRegistry during initialization.
    # Bazi tools
    self.register("get_bazi_chart", handle_get_bazi_chart)
    self.register("get_bazi_fortune", handle_get_bazi_fortune)
    self.register("analyze_bazi_element", handle_analyze_bazi_element)
  • Import of the handler function for registration.
    from mcp.tools.bazi_handlers import (
        handle_analyze_bazi_element,
        handle_get_bazi_chart,
        handle_get_bazi_fortune,
    )
  • Parameter descriptions used for validation error messages in the handler.
    BAZI_ELEMENT_PARAM_DESCRIPTIONS = {
        "birth_date": "出生日期 (格式: YYYY-MM-DD)",
        "time_index": "出生时辰序号 (0-12)",
        "gender": "性别 (男/女)",
    }

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/spyfree/mingli-mcp'

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