get_rising_sign
Calculate your rising sign using birth time, location, and date to determine the zodiac sign ascending on the eastern horizon at birth.
Instructions
计算上升星座,需要出生时间、地点和日期
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| birthHour | Yes | 出生小时(0-23) | |
| birthMinute | Yes | 出生分钟(0-59) | |
| latitude | Yes | 出生地纬度(-90到90) | |
| longitude | Yes | 出生地经度(-180到180) | |
| birthMonth | Yes | 出生月份(1-12) | |
| birthDay | Yes | 出生日期(1-31) | |
| birthYear | Yes | 出生年份(1900-2100) |
Implementation Reference
- index.js:854-948 (handler)Main execution logic for 'get_rising_sign' tool. Computes rising sign using astronomical calculations (Julian day, sidereal time, ascendant) and formats detailed response with sun sign, rising sign info, and explanations.case 'get_rising_sign': { const birthDate = new Date(args.birthYear, args.birthMonth - 1, args.birthDay); const risingSignKey = calculateRisingSign( args.birthHour, args.birthMinute, args.latitude, args.longitude, birthDate ); const risingSign = risingSignData[risingSignKey]; const zodiacKey = getZodiacByDate(args.birthMonth, args.birthDay); const zodiac = zodiacData[zodiacKey]; // 计算详细的天文数据用于显示 const birthTime = args.birthHour + args.birthMinute / 60; const year = birthDate.getFullYear(); const month = birthDate.getMonth() + 1; const day = birthDate.getDate(); // 计算儒略日 let jd = 0; if (month <= 2) { const tempYear = year - 1; const tempMonth = month + 12; const a = Math.floor(tempYear / 100); const b = 2 - a + Math.floor(a / 4); jd = Math.floor(365.25 * (tempYear + 4716)) + Math.floor(30.6001 * (tempMonth + 1)) + day + b - 1524.5 + birthTime / 24; } else { const a = Math.floor(year / 100); const b = 2 - a + Math.floor(a / 4); jd = Math.floor(365.25 * (year + 4716)) + Math.floor(30.6001 * (month + 1)) + day + b - 1524.5 + birthTime / 24; } // 计算恒星时 const t = (jd - 2451545.0) / 36525; let gst = 280.46061837 + 360.98564736629 * (jd - 2451545.0) + 0.000387933 * t * t - t * t * t / 38710000; gst = gst % 360; if (gst < 0) gst += 360; // 计算地方恒星时 let lst = gst + args.longitude; lst = lst % 360; if (lst < 0) lst += 360; result = { content: [ { type: 'text', text: `# 上升星座查询结果 **出生信息:** - 出生时间: ${args.birthYear}年${args.birthMonth}月${args.birthDay}日 ${args.birthHour}:${args.birthMinute.toString().padStart(2, '0')} - 出生地点: 纬度 ${args.latitude}°, 经度 ${args.longitude}° **天文计算数据:** - 儒略日: ${jd.toFixed(6)} - 格林威治恒星时: ${gst.toFixed(2)}° - 地方恒星时: ${lst.toFixed(2)}° **星座信息:** - 太阳星座: ${zodiac.symbol} ${zodiac.name} (${zodiac.english}) - 上升星座: ${risingSign.symbol} ${risingSign.name} (${risingSign.english}) **上升星座特征:** ${risingSign.description} **外貌特征:** ${risingSign.appearance} **性格特点:** ${risingSign.traits.map(trait => `- ${trait}`).join('\n')} **个性分析:** ${risingSign.personality} **计算说明:** 此计算基于准确的天文算法,包括: - 儒略日计算 - 格林威治恒星时计算 - 地方恒星时计算 - 上升点黄经计算 - 星座边界确定 **上升星座的意义:** 上升星座代表一个人给外界的第一印象,以及面对新环境时的表现方式。它反映了我们如何与世界互动,以及他人如何看待我们。` } ] }; break;
- index.js:521-572 (registration)Tool registration in the tools array provided to ListToolsRequestSchema, defining name, description, and detailed input schema for birth data.{ name: 'get_rising_sign', description: '计算上升星座,需要出生时间、地点和日期', inputSchema: { type: 'object', properties: { birthHour: { type: 'integer', description: '出生小时(0-23)', minimum: 0, maximum: 23 }, birthMinute: { type: 'integer', description: '出生分钟(0-59)', minimum: 0, maximum: 59 }, latitude: { type: 'number', description: '出生地纬度(-90到90)', minimum: -90, maximum: 90 }, longitude: { type: 'number', description: '出生地经度(-180到180)', minimum: -180, maximum: 180 }, birthMonth: { type: 'integer', description: '出生月份(1-12)', minimum: 1, maximum: 12 }, birthDay: { type: 'integer', description: '出生日期(1-31)', minimum: 1, maximum: 31 }, birthYear: { type: 'integer', description: '出生年份(1900-2100)', minimum: 1900, maximum: 2100 } }, required: ['birthHour', 'birthMinute', 'latitude', 'longitude', 'birthMonth', 'birthDay', 'birthYear'] } },
- index.js:524-571 (schema)Input schema defining parameters and validation for the get_rising_sign tool (hours, minutes, lat/long, birth date).inputSchema: { type: 'object', properties: { birthHour: { type: 'integer', description: '出生小时(0-23)', minimum: 0, maximum: 23 }, birthMinute: { type: 'integer', description: '出生分钟(0-59)', minimum: 0, maximum: 59 }, latitude: { type: 'number', description: '出生地纬度(-90到90)', minimum: -90, maximum: 90 }, longitude: { type: 'number', description: '出生地经度(-180到180)', minimum: -180, maximum: 180 }, birthMonth: { type: 'integer', description: '出生月份(1-12)', minimum: 1, maximum: 12 }, birthDay: { type: 'integer', description: '出生日期(1-31)', minimum: 1, maximum: 31 }, birthYear: { type: 'integer', description: '出生年份(1900-2100)', minimum: 1900, maximum: 2100 } }, required: ['birthHour', 'birthMinute', 'latitude', 'longitude', 'birthMonth', 'birthDay', 'birthYear'] }
- index.js:261-385 (helper)Primary helper function implementing the astronomical algorithm to compute rising sign (ascendant) from birth time and location. Includes nested helpers for Julian day, sidereal times, and sign mapping.function calculateRisingSign(birthHour, birthMinute, latitude, longitude, birthDate) { // 准确计算上升星座需要以下步骤: // 1. 计算恒星时 (Sidereal Time) // 2. 计算地方恒星时 (Local Sidereal Time) // 3. 计算上升点 (Ascendant) // 将出生时间转换为小数小时 const birthTime = birthHour + birthMinute / 60; // 获取出生日期的年、月、日 const year = birthDate.getFullYear(); const month = birthDate.getMonth() + 1; // getMonth() 返回 0-11 const day = birthDate.getDate(); // 1. 计算儒略日 (Julian Day) function calculateJulianDay(year, month, day, hour) { if (month <= 2) { year -= 1; month += 12; } const a = Math.floor(year / 100); const b = 2 - a + Math.floor(a / 4); const jd = Math.floor(365.25 * (year + 4716)) + Math.floor(30.6001 * (month + 1)) + day + b - 1524.5 + hour / 24; return jd; } // 2. 计算格林威治恒星时 (Greenwich Sidereal Time) function calculateGST(julianDay) { const t = (julianDay - 2451545.0) / 36525; // 计算平均恒星时 let gst = 280.46061837 + 360.98564736629 * (julianDay - 2451545.0) + 0.000387933 * t * t - t * t * t / 38710000; // 标准化到 0-360 度 gst = gst % 360; if (gst < 0) gst += 360; return gst; } // 3. 计算地方恒星时 (Local Sidereal Time) function calculateLST(gst, longitude) { let lst = gst + longitude; // 标准化到 0-360 度 lst = lst % 360; if (lst < 0) lst += 360; return lst; } // 4. 计算上升点 (Ascendant) function calculateAscendant(lst, latitude) { // 黄道倾角 (Obliquity of the Ecliptic) const obliquity = 23.4397; // 度 // 将角度转换为弧度 const lstRad = lst * Math.PI / 180; const latRad = latitude * Math.PI / 180; const oblRad = obliquity * Math.PI / 180; // 计算上升点的黄经 const ascRad = Math.atan2( Math.cos(oblRad) * Math.sin(lstRad), Math.cos(lstRad) * Math.cos(latRad) - Math.sin(oblRad) * Math.sin(latRad) ); let ascendant = ascRad * 180 / Math.PI; // 标准化到 0-360 度 if (ascendant < 0) ascendant += 360; return ascendant; } // 5. 根据上升点黄经确定上升星座 function getRisingSignFromAscendant(ascendant) { // 星座边界(黄经度数) const zodiacBoundaries = [ { sign: 'aries', start: 0, end: 30 }, { sign: 'taurus', start: 30, end: 60 }, { sign: 'gemini', start: 60, end: 90 }, { sign: 'cancer', start: 90, end: 120 }, { sign: 'leo', start: 120, end: 150 }, { sign: 'virgo', start: 150, end: 180 }, { sign: 'libra', start: 180, end: 210 }, { sign: 'scorpio', start: 210, end: 240 }, { sign: 'sagittarius', start: 240, end: 270 }, { sign: 'capricorn', start: 270, end: 300 }, { sign: 'aquarius', start: 300, end: 330 }, { sign: 'pisces', start: 330, end: 360 } ]; for (const boundary of zodiacBoundaries) { if (ascendant >= boundary.start && ascendant < boundary.end) { return boundary.sign; } } // 处理边界情况 if (ascendant >= 330) return 'pisces'; return 'aries'; // 默认值 } try { // 执行计算 const julianDay = calculateJulianDay(year, month, day, birthTime); const gst = calculateGST(julianDay); const lst = calculateLST(gst, longitude); const ascendant = calculateAscendant(lst, latitude); const risingSign = getRisingSignFromAscendant(ascendant); return risingSign; } catch (error) { console.error('上升星座计算错误:', error); // 如果计算失败,返回基于时间的简化计算 return calculateRisingSignSimple(birthHour, birthMinute, latitude, longitude, birthDate); } }
- index.js:605-617 (helper)Helper function to normalize and lookup rising sign name from user input to internal key.function getRisingSignKey(risingSignName) { const lowerName = risingSignName.toLowerCase(); if (risingSignData[lowerName]) { return lowerName; } for (const [key, data] of Object.entries(risingSignData)) { if (data.name === risingSignName || data.english.toLowerCase() === lowerName) { return key; } } return null; }