Skip to main content
Glama

get_compatibility

Analyze compatibility and relationship dynamics between two zodiac signs using Chinese or English names to understand their pairing potential and interactions.

Instructions

获取两个星座的配对指数和关系分析

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
zodiac1Yes第一个星座名称(中文或英文)
zodiac2Yes第二个星座名称(中文或英文)

Implementation Reference

  • Main execution logic for the get_compatibility tool in the CallToolRequestSchema handler. Parses arguments, gets zodiac keys, handles local (using getCompatibilityScore) and remote sources, formats markdown response with compatibility details.
    case 'get_compatibility': { const zodiac1Key = getZodiacKey(args.zodiac1); const zodiac2Key = getZodiacKey(args.zodiac2); const source = args.source || 'local'; if (!zodiac1Key || !zodiac2Key) { throw new Error('星座名称无效'); } const zodiac1 = zodiacData[zodiac1Key]; const zodiac2 = zodiacData[zodiac2Key]; let text; if (source === 'remote') { // 传递第一个星座的中文名给天行API const remote = await fetchRemoteCompatibility(zodiac1.name); if (remote.error) { text = remote.error; } else { // remote 结构参考天行API文档 text = `# ${zodiac1.symbol} ${zodiac1.name} & ${zodiac2.symbol} ${zodiac2.name} 配对分析(天行数据)\n\n` + `- 配对指数: ${remote.zhishu}\n` + `- 配对建议: ${remote.jieguo}\n` + `- 配对分析: ${remote.lianai}\n` + `- 友情建议: ${remote.youyi}\n` + `- 事业建议: ${remote.gongzuo}\n` + `- 财运建议: ${remote.caifu}`; } } else { const compatibility = getCompatibilityScore(zodiac1Key, zodiac2Key); text = `# ${zodiac1.symbol} ${zodiac1.name} & ${zodiac2.symbol} ${zodiac2.name} 配对分析\n\n` + `**配对指数:** ${compatibility.score}/100\n` + `**配对等级:** ${compatibility.level}\n\n` + `**关系分析:**\n${compatibility.description}\n\n` + `**元素关系:**\n${zodiac1.element} + ${zodiac2.element} = ${getElementCompatibility(zodiac1.element, zodiac2.element)}\n\n` + `**建议:**\n- 多了解对方的性格特点\n- 保持开放和包容的心态\n- 在关系中寻找平衡点\n- 珍惜彼此的独特之处`; } result = { content: [ { type: 'text', text } ] }; break;
  • Helper function that calculates the compatibility score, level, and description between two zodiac signs based on predefined best/good/poor matches in compatibilityData.
    function getCompatibilityScore(zodiac1, zodiac2) { const compat1 = compatibilityData[zodiac1]; const compat2 = compatibilityData[zodiac2]; if (!compat1 || !compat2) return { score: 50, level: '一般', description: '配对信息不足' }; if (compat1.best.includes(zodiac2) || compat2.best.includes(zodiac1)) { return { score: 95, level: '绝配', description: '天生一对,非常般配' }; } if (compat1.good.includes(zodiac2) || compat2.good.includes(zodiac1)) { return { score: 80, level: '良好', description: '相处融洽,关系稳定' }; } if (compat1.poor.includes(zodiac2) || compat2.poor.includes(zodiac1)) { return { score: 30, level: '挑战', description: '需要更多理解和包容' }; } return { score: 60, level: '一般', description: '普通配对,需要努力经营' }; }
  • Input schema for get_compatibility tool, defining required zodiac1 and zodiac2 as strings from zodiac enum, optional source (local/remote).
    inputSchema: { type: 'object', properties: { zodiac1: { type: 'string', description: '第一个星座名称(中文或英文)', enum: Object.keys(zodiacData).concat(Object.values(zodiacData).map(z => z.name)) }, zodiac2: { type: 'string', description: '第二个星座名称(中文或英文)', enum: Object.keys(zodiacData).concat(Object.values(zodiacData).map(z => z.name)) }, source: { type: 'string', description: '数据来源(local: 本地, remote: 天行数据)', enum: ['local', 'remote'], default: 'local' } }, required: ['zodiac1', 'zodiac2']
  • index.js:220-245 (registration)
    Tool registration object in the tools array, which is returned by the ListToolsRequestHandler. Includes name, description, and inputSchema.
    { name: 'get_compatibility', description: '获取两个星座的配对指数和关系分析', inputSchema: { type: 'object', properties: { zodiac1: { type: 'string', description: '第一个星座名称(中文或英文)', enum: Object.keys(zodiacData).concat(Object.values(zodiacData).map(z => z.name)) }, zodiac2: { type: 'string', description: '第二个星座名称(中文或英文)', enum: Object.keys(zodiacData).concat(Object.values(zodiacData).map(z => z.name)) }, source: { type: 'string', description: '数据来源(local: 本地, remote: 天行数据)', enum: ['local', 'remote'], default: 'local' } }, required: ['zodiac1', 'zodiac2'] } },
  • Static data structure defining best, good, and poor compatibility matches for each zodiac sign, used by getCompatibilityScore.
    const compatibilityData = { aries: { best: ['leo', 'sagittarius'], good: ['gemini', 'aquarius'], poor: ['cancer', 'capricorn'] }, taurus: { best: ['virgo', 'capricorn'], good: ['cancer', 'pisces'], poor: ['leo', 'aquarius'] }, gemini: { best: ['libra', 'aquarius'], good: ['aries', 'leo'], poor: ['virgo', 'pisces'] }, cancer: { best: ['scorpio', 'pisces'], good: ['taurus', 'virgo'], poor: ['aries', 'libra'] }, leo: { best: ['aries', 'sagittarius'], good: ['gemini', 'libra'], poor: ['taurus', 'scorpio'] }, virgo: { best: ['taurus', 'capricorn'], good: ['cancer', 'scorpio'], poor: ['gemini', 'sagittarius'] }, libra: { best: ['gemini', 'aquarius'], good: ['leo', 'sagittarius'], poor: ['cancer', 'capricorn'] }, scorpio: { best: ['cancer', 'pisces'], good: ['virgo', 'capricorn'], poor: ['leo', 'aquarius'] }, sagittarius: { best: ['aries', 'leo'], good: ['libra', 'aquarius'], poor: ['virgo', 'pisces'] }, capricorn: { best: ['taurus', 'virgo'], good: ['scorpio', 'pisces'], poor: ['aries', 'libra'] }, aquarius: { best: ['gemini', 'libra'], good: ['aries', 'sagittarius'], poor: ['taurus', 'scorpio'] }, pisces: { best: ['cancer', 'scorpio'], good: ['taurus', 'capricorn'], poor: ['gemini', 'sagittarius'] }

Other Tools

Related 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/jlankellii/star-mcp'

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