celestial-position-mcp
Version:
MCP server for celestial object altitude-azimuth coordinates
27 lines (26 loc) • 987 B
JavaScript
import { MCPTool } from 'mcp-framework';
import { z } from 'zod';
import { listCelestialObjects as getObjectsList } from '../utils/astronomy.js';
class ListCelestialObjectsTool extends MCPTool {
constructor() {
super(...arguments);
this.name = 'listCelestialObjects';
this.description = 'Get a list of supported celestial objects by category';
this.schema = {
category: {
type: z.string().optional(),
description: 'Filter by category (planets, stars, dso, all)'
}
};
}
async execute(params) {
const category = params.category?.toLowerCase() || 'all';
// Use the astronomy utility function to get objects from catalogs
const result = getObjectsList(category);
return {
totalObjectCount: result.reduce((sum, cat) => sum + cat.objects.length, 0),
categories: result
};
}
}
export default ListCelestialObjectsTool;