Skip to main content
Glama
SiwuXue

Yijing Bazi MCP Server

by SiwuXue

yijing_interpret

Interpret I Ching hexagrams for insights on career, relationships, health, or finance, providing tailored analysis based on your specific focus and context.

Instructions

对卦象进行多层次解读

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hexagramYes卦象数据,包含本卦和变卦信息
focusYes解读焦点:总体/特定爻/变卦
line_numberNo当focus为specific_line时,指定关注的爻位(1-6)
contextYes应用场景
detail_levelNo解读详细程度

Implementation Reference

  • The primary handler function implementing the core logic for interpreting Yijing hexagrams based on focus areas (overall, specific line, changing), context, and detail level. Delegates to helper methods for specific interpretations and assembles the result.
    async interpretHexagram({ hexagram, focus, line_number, context, detail_level = 'standard' }) { try { this.logger.info('开始解读卦象', { focus, context, detail_level }); const originalInfo = await this.hexagramDB.getHexagram(hexagram.original?.id || hexagram.id || 1); const changedInfo = hexagram.changed ? await this.hexagramDB.getHexagram(hexagram.changed?.id || 1) : null; let interpretation = {}; switch (focus) { case 'overall': interpretation = this.interpretOverall(originalInfo, changedInfo, context, detail_level); break; case 'specific_line': if (!line_number || line_number < 1 || line_number > 6) { throw new Error('解读特定爻位时必须提供有效的爻位号(1-6)'); } interpretation = this.interpretSpecificLine(originalInfo, line_number, context, detail_level); break; case 'changing': if (!changedInfo) { throw new Error('没有变卦信息,无法进行变卦解读'); } interpretation = this.interpretChanging(originalInfo, changedInfo, hexagram.changing_lines, context, detail_level); break; default: throw new Error(`不支持的解读焦点: ${focus}`); } const result = { timestamp: new Date().toISOString(), focus: focus, context: context, detail_level: detail_level, interpretation: interpretation, practical_guidance: this.generatePracticalGuidance(interpretation, context), cultural_context: this.getCulturalContext(originalInfo, context) }; this.logger.info('卦象解读成功'); return result; } catch (error) { this.logger.error('卦象解读失败', { error: error.message }); throw error; } }
  • src/index.js:97-129 (registration)
    MCP tool registration for 'yijing_interpret', defining the tool name, description, and input schema for the Model Context Protocol server.
    { name: 'yijing_interpret', description: '对卦象进行多层次解读', inputSchema: { type: 'object', properties: { hexagram: { type: 'object', description: '卦象数据,包含本卦和变卦信息' }, focus: { type: 'string', enum: ['overall', 'specific_line', 'changing'], description: '解读焦点:总体/特定爻/变卦' }, line_number: { type: 'integer', description: '当focus为specific_line时,指定关注的爻位(1-6)' }, context: { type: 'string', enum: ['general', 'career', 'relationship', 'health', 'finance'], description: '应用场景' }, detail_level: { type: 'string', enum: ['brief', 'standard', 'detailed'], description: '解读详细程度' } }, required: ['hexagram', 'focus', 'context'] } },
  • Runtime validation schema using Joi for input parameters of the 'yijing_interpret' tool.
    function createYijingInterpretSchema() { return Joi.object({ hexagram: Joi.object().required(), focus: Joi.string().valid('overall', 'specific_line', 'changing_hexagram').default('overall'), line_number: Joi.when('focus', { is: 'specific_line', then: Joi.number().integer().min(1).max(6).required(), otherwise: Joi.number().optional() }) }); }
  • Dispatch handler in the main server request handler that routes 'yijing_interpret' calls to the YijingEngine.interpretHexagram method.
    case 'yijing_interpret': result = await yijingEngine.interpretHexagram(args); break;

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