@xzkcz/iztro-mcp-server
Version:
MCP server exposing iztro astrology methods for Zi Wei Dou Shu astrolabe generation and horoscope analysis
40 lines • 1.67 kB
JavaScript
import { astro } from "iztro";
import { hourToTimeIndex } from "./utils/hourToTimeIndex.js";
export function getMutagedPlaces({ date, hour, gender, fixLeap, locale, palaceName }) {
// Convert hour to timeIndex for iztro library
const timeIndex = hourToTimeIndex(hour);
// Generate astrolabe using iztro's bySolar method
const astrolabe = astro.bySolar(date, timeIndex, gender, fixLeap, locale);
// Get the specified palace
const palace = astrolabe.palace(palaceName);
if (!palace) {
return JSON.stringify({
success: false,
error: `Palace "${palaceName}" not found`,
message: 'Invalid palace name provided'
}, null, 2);
}
// Get the mutaged places array [禄, 权, 科, 忌]
const mutagedPlaces = palace.mutagedPlaces();
return mutagedPlaces.map((place, index) => ({
transformation: ['禄', '权', '科', '忌'][index],
transformationIndex: index,
// place: place ? JSON.parse(JSON.stringify(place,getCircularReplacer())) : null
place: place ? {
index: place.index,
name: place.name,
isBodyPalace: place.isBodyPalace,
isOriginalPalace: place.isOriginalPalace,
heavenlyStem: place.heavenlyStem,
earthlyBranch: place.earthlyBranch,
majorStars: place.majorStars.map(star => ({
"name": star.name,
"type": star.type,
"scope": star.scope,
"brightness": star.brightness,
"mutagen": star.mutagen
}))
} : null
}));
}
//# sourceMappingURL=getMutagedPlaces.js.map