Skip to main content
Glama
SiwuXue

Yijing Bazi MCP Server

by SiwuXue

bazi_forecast

Generate personalized fortune forecasts for career, wealth, relationships, and health based on traditional Chinese Bazi astrology, using your birth chart and specified time periods.

Instructions

预测未来运势

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chartYes八字命盘数据
start_dateYes预测起始日期
end_dateYes预测结束日期
aspectsYes预测方面
resolutionNo预测精度

Implementation Reference

  • Core handler function that executes the bazi_forecast tool logic, handling different period types and generating forecast results.
    async forecastLuck({ chart, period_type, start_date, end_date, focus_aspects = [] }) { try { this.logger.info('开始运势预测', { period_type, start_date, end_date }); const currentDate = start_date ? moment(start_date) : moment(); let forecast = {}; switch (period_type) { case 'monthly': forecast = await this.forecastMonthly(chart, currentDate, focus_aspects); break; case 'yearly': forecast = await this.forecastYearly(chart, currentDate, focus_aspects); break; case 'decade': forecast = await this.forecastDecade(chart, currentDate, focus_aspects); break; case 'custom': if (!start_date || !end_date) { throw new Error('自定义预测需要提供开始和结束日期'); } forecast = await this.forecastCustomPeriod(chart, start_date, end_date, focus_aspects); break; default: throw new Error(`不支持的预测周期类型: ${period_type}`); } const result = { timestamp: new Date().toISOString(), period_type: period_type, forecast_period: { start: start_date || currentDate.format('YYYY-MM-DD'), end: end_date || this.calculateEndDate(currentDate, period_type) }, focus_aspects: focus_aspects, forecast: forecast, key_periods: this.identifyKeyPeriods(chart, forecast), overall_trend: this.analyzeOverallTrend(forecast), actionable_advice: this.generateActionableAdvice(forecast, focus_aspects) }; this.logger.info('运势预测完成'); return result; } catch (error) { this.logger.error('运势预测失败', { error: error.message }); throw error; } }
  • src/index.js:430-442 (registration)
    Tool dispatch/registration in the main CallToolRequest handler switch statement.
    case 'bazi_forecast': // 转换参数格式以匹配BaziEngine期望的格式 // 处理嵌套的params结构 const params = args.params || args; const forecastArgs = { chart: params.chart, period_type: this.mapResolutionToPeriodType(params.resolution), start_date: params.start_date, end_date: params.end_date, focus_aspects: params.aspects || [] }; result = await baziEngine.forecastLuck(forecastArgs); break;
  • MCP tool schema definition registered in ListToolsRequestHandler.
    name: 'bazi_forecast', description: '预测未来运势', inputSchema: { type: 'object', properties: { chart: { type: 'object', description: '八字命盘数据' }, start_date: { type: 'string', format: 'date', description: '预测起始日期' }, end_date: { type: 'string', format: 'date', description: '预测结束日期' }, aspects: { type: 'array', items: { type: 'string', enum: ['overall', 'career', 'wealth', 'relationship', 'health'] }, description: '预测方面' }, resolution: { type: 'string', enum: ['year', 'month', 'day'], description: '预测精度' } }, required: ['chart', 'start_date', 'end_date', 'aspects'] } },
  • Joi validation schema used by validateToolInput for bazi_forecast parameters.
    function createBaziForecastSchema() { return Joi.object({ chart: Joi.object().required(), start_date: Joi.date().iso().default(() => new Date()), end_date: Joi.date().iso().min(Joi.ref('start_date')), aspects: Joi.array().items( Joi.string().valid('career', 'wealth', 'relationship', 'health', 'general') ).single().default(['general']), resolution: Joi.string().valid('year', 'month', 'day').default('month') }); }

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/SiwuXue/yijing-bazi-mcp-server'

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