Skip to main content
Glama
spyfree

Mingli MCP Server

by spyfree

analyze_bazi_element

Read-onlyIdempotent

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": "性别 (男/女)",
    }
Behavior3/5

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

Annotations already declare this as read-only, idempotent, and non-destructive, so the agent knows it's a safe analysis operation. The description adds value by specifying what the analysis includes (五行分数, 平衡度, 缺失五行), but doesn't provide additional behavioral context like rate limits, authentication needs, or output format details beyond the 'format' parameter.

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 extremely concise - a single Chinese sentence that efficiently states the core functionality. Every word earns its place with no wasted text, and the information is front-loaded with the main purpose.

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

Completeness2/5

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

For a 7-parameter analysis tool with low schema coverage (29%) and no output schema, the description is insufficient. It doesn't explain the complex Bazi analysis domain, doesn't clarify parameter relationships, and provides no information about return values or analysis methodology, leaving significant gaps for an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With only 29% schema description coverage (2 of 7 parameters have descriptions), the description doesn't compensate for the significant documentation gap. It mentions '八字五行' analysis but provides no information about what the 7 parameters mean or how they affect the analysis, leaving most parameters semantically unclear.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: analyzing the strength of Five Elements in a Bazi chart, including scores, balance, and missing elements. It uses specific verbs ('分析' - analyze) and resources ('八字五行' - Bazi Five Elements), but doesn't explicitly differentiate from sibling tools like 'get_bazi_chart' or 'get_bazi_fortune' which might provide related information.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'get_bazi_chart' (which might provide the raw chart) or 'get_bazi_fortune' (which might provide fortune analysis), leaving the agent to guess about appropriate usage contexts.

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

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