Skip to main content
Glama
spyfree

Mingli MCP Server

by spyfree

get_ziwei_fortune

Read-onlyIdempotent

Generate Ziwei Doushu fortune readings for specific dates using birth details. This tool provides comprehensive divination analysis including major cycles, yearly, monthly, daily, and hourly fortunes based on Chinese astrology principles.

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 handler function that implements the core logic for the get_ziwei_fortune tool: validates parameters, builds birth info, queries the ziwei system for fortune data based on optional query_date, and formats output as markdown or JSON.
    @log_performance
    def handle_get_ziwei_fortune(args: Dict[str, Any]) -> str:
        """工具:获取紫微斗数运势"""
        # Validate parameters
        _validate_common_params(
            args,
            ["birth_date", "time_index", "gender"],
            ZIWEI_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("ziwei")
            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 _ziwei_formatter.format_fortune_markdown(fortune)
  • The schema definition function that provides the input schema, description, and annotations for the get_ziwei_fortune tool.
    def get_ziwei_fortune_definition() -> Dict[str, Any]:
        """Get definition for get_ziwei_fortune tool"""
        return {
            "name": "get_ziwei_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": ["男", "女"],
                        "description": "性别:男 或 女",
                    },
                    "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"],
            },
        }
  • The registration of the get_ziwei_fortune tool handler in the ToolRegistry.
    self.register("get_ziwei_fortune", handle_get_ziwei_fortune)
  • The import of the handle_get_ziwei_fortune handler function, necessary for registration.
    from mcp.tools.ziwei_handlers import (
        handle_analyze_ziwei_palace,
        handle_get_ziwei_chart,
        handle_get_ziwei_fortune,
    )
Behavior4/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false, so the agent knows this is a safe, repeatable read operation. The description adds valuable context by specifying what fortune information is included (大限, 流年, 流月, 流日, 流时), which goes beyond the annotations. It doesn't mention rate limits, authentication needs, or response format details, but with good annotation coverage, this is acceptable.

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 that clearly states the tool's purpose. Every word earns its place - it specifies what information is retrieved and what time periods are included. There's no wasted verbiage or redundancy.

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

Completeness3/5

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

For a read-only tool with good annotations, the description provides adequate basic purpose information. However, with 8 parameters (some complex like time_index and calendar/is_leap_month interactions) and no output schema, the description should ideally provide more context about what the tool returns and how parameters work together. It's minimally complete but leaves significant gaps.

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 only 50% (4 of 8 parameters have descriptions in the schema). The description provides no additional parameter information beyond what's implied by the tool name. It doesn't explain relationships between parameters (e.g., how birth_date and query_date interact, what time_index represents, or what calendar and is_leap_month control). With low schema coverage, the description should compensate but doesn't.

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 Ziwei fortune information) with specific details about what it includes (大限, 流年, 流月, 流日, 流时). It distinguishes this from sibling tools like 'get_ziwei_chart' (which likely provides charts rather than fortune details) and 'get_bazi_fortune' (which provides different fortune system information). However, it doesn't explicitly contrast with all siblings like 'analyze_ziwei_palace'.

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 when to choose this over 'get_ziwei_chart' (for fortune vs. chart) or 'get_bazi_fortune' (for different fortune systems). There's no context about prerequisites or typical use cases beyond the basic function stated.

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