Skip to main content
Glama
spyfree

Mingli MCP Server

by spyfree

get_bazi_fortune

Read-onlyIdempotent

Calculate Bazi (Four Pillars) fortune readings based on birth details to analyze destiny cycles, annual luck, and elemental influences for personal insight.

Instructions

获取八字运势信息,包含大运、流年等详情

Input Schema

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

Implementation Reference

  • The main handler function executing the tool logic: validates parameters, constructs birth information, retrieves fortune from the Bazi system, and formats the response.
    @log_performance
    def handle_get_bazi_fortune(args: Dict[str, Any]) -> str:
        """工具:获取八字运势"""
        # Validate parameters
        _validate_common_params(
            args,
            ["birth_date", "time_index", "gender"],
            BAZI_FORTUNE_PARAM_DESCRIPTIONS,
            date_key="birth_date",
        )
    
        with PerformanceTimer("八字运势查询"):
            birth_info = _build_birth_info(args, date_key="birth_date")
    
            query_date_str = args.get("query_date")
            if query_date_str:
                query_date = datetime.strptime(query_date_str, "%Y-%m-%d")
            else:
                query_date = datetime.now()
    
            language = args.get("language", "zh-CN")
            system = get_system("bazi")
            fortune = system.get_fortune(birth_info, query_date, language)
    
            output_format = args.get("format", "markdown")
            if output_format == "json":
                return _format_response(fortune, "json")
            else:
                return _bazi_formatter.format_fortune(fortune, "markdown")
  • Defines the input schema, description, and annotations for the get_bazi_fortune tool.
    def get_bazi_fortune_definition() -> Dict[str, Any]:
        """Get definition for get_bazi_fortune tool"""
        return {
            "name": "get_bazi_fortune",
            "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,
                    },
                    "query_date": {
                        "type": "string",
                        "description": "查询运势的日期,格式:YYYY-MM-DD",
                    },
                    "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"],
            },
        }
  • Registers the get_bazi_fortune handler in the ToolRegistry alongside other Bazi tools.
    # 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)
  • Includes the get_bazi_fortune definition in the list of all tool definitions used for MCP tools/list.
    def get_all_tool_definitions() -> List[Dict[str, Any]]:
        """Get all tool definitions"""
        return [
            get_ziwei_chart_definition(),
            get_ziwei_fortune_definition(),
            get_analyze_ziwei_palace_definition(),
            get_list_fortune_systems_definition(),
            get_bazi_chart_definition(),
            get_bazi_fortune_definition(),
            get_analyze_bazi_element_definition(),
        ]
  • Helper function used by the handler to construct standardized birth information dictionary.
    def _build_birth_info(args: Dict[str, Any], date_key: str = "date") -> Dict[str, Any]:
        """构建生辰信息字典"""
        return {
            "date": args[date_key],
            "time_index": args["time_index"],
            "gender": args["gender"],
            "calendar": args.get("calendar", "solar"),
            "is_leap_month": args.get("is_leap_month", False),
        }
Behavior3/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false, indicating a safe, repeatable read operation. The description adds minimal behavioral context beyond this, mentioning it returns '详情' (details) but not elaborating on format, rate limits, or authentication needs. It doesn't contradict annotations, so a baseline 3 is appropriate given annotations cover core safety.

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 a single, efficient sentence in Chinese that directly states the purpose and scope ('包含大运、流年等详情'). It's front-loaded with no wasted words, making it easy to parse quickly. Every part of the sentence contributes to understanding the tool's function.

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?

Given the complexity (8 parameters, low schema coverage, no output schema) and annotations that only cover safety, the description is insufficient. It doesn't explain the return format, how parameters interact (e.g., 'birth_date' with 'calendar'), or provide examples. For a tool with rich cultural context like Bazi fortune-telling, more guidance is needed to ensure correct usage.

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?

Schema description coverage is low at 38%, with only 3 of 8 parameters having descriptions in the schema. The description doesn't compensate by explaining any parameters, their relationships, or semantics (e.g., what 'time_index' represents, how 'calendar' affects calculations). It adds no value beyond the schema, failing to address the coverage gap.

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: '获取八字运势信息,包含大运、流年等详情' (Get Bazi fortune information, including details like major cycles and yearly fortunes). It specifies the verb ('获取' - get) and resource ('八字运势信息' - Bazi fortune information), but doesn't explicitly differentiate from sibling tools like 'get_bazi_chart' or 'get_ziwei_fortune', which likely provide different types of Bazi/fortune 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 (e.g., 'get_bazi_chart' for chart data, 'get_ziwei_fortune' for Ziwei fortune, 'analyze_bazi_element' for element analysis) or specify contexts where this tool is preferred. Usage is implied by the purpose but lacks explicit alternatives or exclusions.

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