Skip to main content
Glama
SiwuXue

Yijing Bazi MCP Server

by SiwuXue

knowledge_learn

Learn I Ching and Bazi knowledge by selecting topics, systems, and levels to understand traditional Chinese metaphysics concepts for divination and life analysis.

Instructions

学习易经和八字知识

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
topicYes学习主题
systemYes知识体系
levelYes学习级别
formatNo学习内容格式

Implementation Reference

  • Primary handler function executed when the knowledge_learn tool is called. It processes parameters, determines focus areas and learning style, calls the core learnKnowledge method, and returns structured learning content.
    async provideKnowledge({ topic, system, level = 'beginner', format = 'text' }) { try { this.logger.info('开始提供知识学习服务', { topic, system, level, format }); // 根据知识体系调整学习内容 const focus_areas = this.getFocusAreasBySystem(system); const learning_style = this.getLearningStyleByFormat(format); // 调用核心学习方法 const result = await this.learnKnowledge({ topic, level, focus_areas, learning_style }); // 添加系统特定信息 result.system = system; result.format = format; this.logger.info('知识学习服务完成'); return result; } catch (error) { this.logger.error('知识学习服务失败', { error: error.message }); throw error; } }
  • src/index.js:319-346 (registration)
    Tool registration in the ListToolsRequestHandler. Defines the tool's name, description, and input schema for MCP tool discovery.
    name: 'knowledge_learn', description: '学习易经和八字知识', inputSchema: { type: 'object', properties: { topic: { type: 'string', description: '学习主题' }, system: { type: 'string', enum: ['yijing', 'bazi', 'both'], description: '知识体系' }, level: { type: 'string', enum: ['beginner', 'intermediate', 'advanced'], description: '学习级别' }, format: { type: 'string', enum: ['text', 'interactive', 'visual'], description: '学习内容格式' } }, required: ['topic', 'system', 'level'] } },
  • Joi validation schema for knowledge_learn tool inputs, used by validateToolInput in the request handler.
    function createKnowledgeLearnSchema() { return Joi.object({ topic: Joi.string().required(), system: Joi.string().valid('yijing', 'bazi', 'both').default('both'), level: Joi.string().valid('beginner', 'intermediate', 'advanced').default('intermediate'), format: Joi.string().valid('text', 'structured', 'interactive').default('structured') }); }
  • Dispatch case in the CallToolRequestHandler switch statement that invokes the KnowledgeEngine's provideKnowledge method.
    case 'knowledge_learn': result = await knowledgeEngine.provideKnowledge(args); break;
  • Core helper method called by provideKnowledge that generates comprehensive learning content including topic details, path, exercises, resources, and assessments.
    async learnKnowledge({ topic, level = 'beginner', focus_areas = [], learning_style = 'comprehensive' }) { try { this.logger.info('开始知识学习', { topic, level, focus_areas, learning_style }); // 获取主题相关的知识内容 const topicContent = await this.getTopicContent(topic, level); // 根据学习风格组织内容 const organizedContent = await this.organizeContentByStyle(topicContent, learning_style); // 生成学习路径 const learningPath = await this.generateLearningPath(topic, level, focus_areas); // 提供实践练习 const practiceExercises = await this.generatePracticeExercises(topic, level); // 推荐相关资源 const relatedResources = await this.getRelatedResources(topic, level); // 生成学习评估 const assessment = await this.generateLearningAssessment(topic, level); const result = { timestamp: new Date().toISOString(), topic: topic, level: level, focus_areas: focus_areas, learning_style: learning_style, content: organizedContent, learning_path: learningPath, practice_exercises: practiceExercises, related_resources: relatedResources, assessment: assessment, progress_tracking: this.generateProgressTracking(topic, level), next_steps: this.generateNextSteps(topic, level, focus_areas) }; this.logger.info('知识学习内容生成完成'); return result; } catch (error) { this.logger.error('知识学习失败', { error: error.message }); throw error; } }

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