INNER CODE UNIT · TypeScript
getAstroServer
Kong/volcano-agent-sdk · mcp/astro/server.ts:12
function getAstroServer() {
const server = new McpServer({ name: 'astro-mcp', version: '1.0.0' });
server.tool('get_sign', 'Return astrological sign for a birthdate (YYYY-MM-DD)', {
birthdate: z.string()
}, async ({ birthdate }) => {
const sign = zodiacForDate(birthdate);
return { content: [{ type: 'text', text: sign }] };
});
return server;
}
function zodiacForDate(dateStr) {
const d = new Date(dateStr);
const m = d.getUTCMonth() + 1;
const day = d.getUTCDate();
const ranges = [
['Capricorn', 12, 22, 1, 19], ['Aquarius', 1, 20, 2, 18], ['Pisces', 2, 19, 3, 20],
['Aries', 3, 21, 4, 19], ['Taurus', 4, 20, 5, 20], ['Gemini', 5, 21, 6, 20],