Skip to main content
Glama
spyfree

Mingli MCP Server

by spyfree

get_bazi_chart

Generate a Bazi (Four Pillars) chart for Chinese fortune-telling analysis by inputting birth date, time, gender, and calendar type to receive detailed pillar, element, and deity information.

Instructions

获取八字(四柱)排盘信息,包含年月日时四柱、十神、五行、地支藏干等详细信息

Input Schema

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

Implementation Reference

  • The main handler function that implements the core logic for the get_bazi_chart tool. It validates input parameters, builds birth information, retrieves the Bazi chart from the system, and formats the output.
    @log_performance
    def handle_get_bazi_chart(args: Dict[str, Any]) -> str:
        """工具:获取八字排盘"""
        # Validate parameters
        _validate_common_params(
            args, ["date", "time_index", "gender"], BAZI_CHART_PARAM_DESCRIPTIONS, date_key="date"
        )
    
        with PerformanceTimer("八字排盘"):
            birth_info = _build_birth_info(args)
            language = args.get("language", "zh-CN")
    
            system = get_system("bazi")
            chart = system.get_chart(birth_info, language)
    
            output_format = args.get("format", "markdown")
            if output_format == "json":
                return _format_response(chart, "json")
            else:
                return _bazi_formatter.format_chart(chart, "markdown")
  • The input schema and tool definition for get_bazi_chart, specifying parameters, types, descriptions, and required fields.
    def get_bazi_chart_definition() -> Dict[str, Any]:
        """Get definition for get_bazi_chart tool"""
        return {
            "name": "get_bazi_chart",
            "description": "获取八字(四柱)排盘信息,包含年月日时四柱、十神、五行、地支藏干等详细信息",
            "annotations": {
                "readOnlyHint": True,
                "destructiveHint": False,
                "idempotentHint": True,
            },
            "inputSchema": {
                "type": "object",
                "properties": {
                    "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": ["date", "time_index", "gender"],
            },
        }
  • Registration of the get_bazi_chart handler (and related Bazi tools) 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)
  • Inclusion of the get_bazi_chart schema definition in the list of all tool definitions.
    get_bazi_chart_definition(),
  • Loading of all tool definitions, including get_bazi_chart, into the registry.
    # Load definitions
    self._definitions = get_all_tool_definitions()

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