Skip to main content
Glama

get_compatibility

Analyze zodiac sign compatibility by calculating pairing scores and relationship insights for two specified star signs.

Instructions

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

Input Schema

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

Implementation Reference

  • Core handler function that computes 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 the get_compatibility tool, defining zodiac1 and zodiac2 as required string parameters with enum validation based on zodiacData.
    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))
        }
      },
      required: ['zodiac1', 'zodiac2']
    }
  • index.js:471-490 (registration)
    Registration of the get_compatibility tool in the tools array, including name, description, and input schema, used by ListToolsRequestHandler.
    {
      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))
          }
        },
        required: ['zodiac1', 'zodiac2']
      }
    },
  • Predefined compatibility data structure used by getCompatibilityScore to determine best, good, and poor matches between zodiac signs.
    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'] }
    };
  • Dispatch handler in the main CallToolRequestSchema switch that processes get_compatibility requests, validates inputs, calls getCompatibilityScore, and formats the MCP response.
          case 'get_compatibility': {
            const zodiac1Key = getZodiacKey(args.zodiac1);
            const zodiac2Key = getZodiacKey(args.zodiac2);
            
            if (!zodiac1Key || !zodiac2Key) {
              throw new Error('星座名称无效');
            }
            
            const zodiac1 = zodiacData[zodiac1Key];
            const zodiac2 = zodiacData[zodiac2Key];
            const compatibility = getCompatibilityScore(zodiac1Key, zodiac2Key);
            
            result = {
              content: [
                {
                  type: 'text',
                  text: `# ${zodiac1.symbol} ${zodiac1.name} & ${zodiac2.symbol} ${zodiac2.name} 配对分析
    
    **配对指数:** ${compatibility.score}/100
    **配对等级:** ${compatibility.level}
    
    **关系分析:**
    ${compatibility.description}
    
    **元素关系:**
    ${zodiac1.element} + ${zodiac2.element} = ${getElementCompatibility(zodiac1.element, zodiac2.element)}
    
    **建议:**
    - 多了解对方的性格特点
    - 保持开放和包容的心态
    - 在关系中寻找平衡点
    - 珍惜彼此的独特之处`
                }
              ]
            };
            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/jlankellii/star-mcp'

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