analyze_ziwei_palace
Analyze specific palace positions in Ziwei Doushu astrology to interpret life aspects like career, relationships, and health based on birth details and palace selection.
Instructions
分析紫微斗数特定宫位的详细信息
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| birth_date | Yes | 出生日期,格式:YYYY-MM-DD | |
| time_index | Yes | 出生时辰序号(0-12) | |
| gender | Yes | ||
| palace_name | Yes | 要分析的宫位名称 | |
| calendar | No | solar | |
| is_leap_month | No | ||
| format | No | markdown | |
| language | No | zh-CN |
Implementation Reference
- mcp/tools/ziwei_handlers.py:138-162 (handler)The main handler function for the 'analyze_ziwei_palace' tool. It validates input parameters, builds birth info, retrieves the Ziwei system, calls analyze_palace method, and formats the output as markdown or JSON.@log_performance def handle_analyze_ziwei_palace(args: Dict[str, Any]) -> str: """工具:分析紫微斗数宫位""" # Validate parameters _validate_common_params( args, ["birth_date", "time_index", "gender", "palace_name"], ZIWEI_PALACE_PARAM_DESCRIPTIONS, date_key="birth_date", ) with PerformanceTimer("紫微宫位分析"): birth_info = _build_birth_info(args, date_key="birth_date") palace_name = args["palace_name"] language = args.get("language", "zh-CN") system = get_system("ziwei") analysis = system.analyze_palace(birth_info, palace_name, language) output_format = args.get("format", "markdown") if output_format == "json": return _format_response(analysis, "json") else: return _ziwei_formatter.format_palace_analysis_markdown(analysis)
- mcp/tools/definitions.py:151-218 (schema)Defines the input schema and metadata for the 'analyze_ziwei_palace' tool, including parameters like birth_date, time_index, gender, palace_name, and output options.def get_analyze_ziwei_palace_definition() -> Dict[str, Any]: """Get definition for analyze_ziwei_palace tool""" return { "name": "analyze_ziwei_palace", "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": ["男", "女"], }, "palace_name": { "type": "string", "enum": [ "命宫", "兄弟宫", "夫妻宫", "子女宫", "财帛宫", "疾厄宫", "迁移宫", "交友宫", "官禄宫", "田宅宫", "福德宫", "父母宫", ], "description": "要分析的宫位名称", }, "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", "palace_name"], }, }
- mcp/tools/__init__.py:35-35 (registration)Registers the 'analyze_ziwei_palace' tool handler in the ToolRegistry during initialization.self.register("analyze_ziwei_palace", handle_analyze_ziwei_palace)