Skip to main content
Glama
Rkm1999

Celestial Position MCP Server

by Rkm1999

listCelestialObjects

Discover and filter celestial objects by category using this tool. Explore planets, stars, Messier objects, IC, NGC, and other deep sky objects to identify targets for celestial position queries.

Instructions

Lists available celestial objects that can be queried by other tools. Objects are grouped by category. You can request all objects, or filter by a specific category. This tool helps in discovering what objects are known to the system.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryNoOptional. Filters the list by category. Valid categories are: 'planets' (for Solar System objects like Sun, Moon, and planets), 'stars', 'messier' (for Messier objects), 'ic' (for Index Catalogue objects), 'ngc' (for New General Catalogue objects), 'dso' (for all Deep Sky Objects, including Messier, IC, NGC, and others), or 'all' (to list objects from all available categories). If omitted, defaults to 'all'.

Implementation Reference

  • The MCPTool subclass implementing the listCelestialObjects tool handler, including name, description, schema, and execute method that calls the astronomy helper to list objects by category.
    class ListCelestialObjectsTool extends MCPTool<ListCelestialObjectsInput> { name = 'listCelestialObjects'; description = "Lists available celestial objects that can be queried by other tools. Objects are grouped by category. You can request all objects, or filter by a specific category. This tool helps in discovering what objects are known to the system."; protected schema = { category: { type: z.string().optional(), description: "Optional. Filters the list by category. Valid categories are: 'planets' (for Solar System objects like Sun, Moon, and planets), 'stars', 'messier' (for Messier objects), 'ic' (for Index Catalogue objects), 'ngc' (for New General Catalogue objects), 'dso' (for all Deep Sky Objects, including Messier, IC, NGC, and others), or 'all' (to list objects from all available categories). If omitted, defaults to 'all'." } }; async execute(params: ListCelestialObjectsInput) { try { const allCategoriesFromAstronomy = listCelestialObjects(); // Get all categories from astronomy.ts let relevantCategories: { category: string, objects: string[] }[] = []; if (params.category) { const requestedCategoryLower = params.category.toLowerCase(); if (requestedCategoryLower === 'all') { const totalObjects = allCategoriesFromAstronomy.reduce((sum, cat) => sum + cat.objects.length, 0); return { totalCategories: allCategoriesFromAstronomy.length, totalObjects: totalObjects, categories: allCategoriesFromAstronomy.map(cat => ({ category: cat.category, objectCount: cat.objects.length, objects: cat.objects })) }; } else if (requestedCategoryLower === 'dso') { const dsoCategories = allCategoriesFromAstronomy.filter(cat => cat.category === 'Messier Objects' || cat.category === 'IC Objects' || cat.category === 'NGC Objects' || cat.category === 'Other Deep Sky Objects' ); const totalObjectsDSO = dsoCategories.reduce((sum, cat) => sum + cat.objects.length, 0); return { totalCategories: dsoCategories.length, totalObjects: totalObjectsDSO, categories: dsoCategories.map(cat => ({ category: cat.category, objectCount: cat.objects.length, objects: cat.objects })) }; } else { // For specific categories like 'planets', 'stars', 'messier', 'ic', 'ngc' const targetCategory = allCategoriesFromAstronomy.find(cat => { if (requestedCategoryLower === 'planets' && cat.category === 'Solar System Objects') return true; if (requestedCategoryLower === 'stars' && cat.category === 'Stars') return true; if (requestedCategoryLower === 'messier' && cat.category === 'Messier Objects') return true; if (requestedCategoryLower === 'ic' && cat.category === 'IC Objects') return true; if (requestedCategoryLower === 'ngc' && cat.category === 'NGC Objects') return true; return false; }); if (!targetCategory) { const userFriendlyCategories = ['planets', 'stars', 'messier', 'ic', 'ngc', 'dso', 'all']; return { message: `No objects found in category "${params.category}". Available categories: ${userFriendlyCategories.join(', ')}.`, availableCategories: userFriendlyCategories }; } return { category: params.category, // Echo back the requested category objectCount: targetCategory.objects.length, objects: targetCategory.objects }; } } else { // Default behavior if no category parameter is provided (same as 'all') const totalObjects = allCategoriesFromAstronomy.reduce((sum, cat) => sum + cat.objects.length, 0); return { totalCategories: allCategoriesFromAstronomy.length, totalObjects: totalObjects, categories: allCategoriesFromAstronomy.map(cat => ({ category: cat.category, objectCount: cat.objects.length, objects: cat.objects })) }; } } catch (error: any) { throw new Error(`Failed to list celestial objects: ${error.message}`); } } } // Export the class directly (not an instance) export default ListCelestialObjectsTool;
  • TypeScript interface and Zod schema for ListCelestialObjectsInput defining the optional 'category' parameter.
    interface ListCelestialObjectsInput { category?: string; } class ListCelestialObjectsTool extends MCPTool<ListCelestialObjectsInput> { name = 'listCelestialObjects'; description = "Lists available celestial objects that can be queried by other tools. Objects are grouped by category. You can request all objects, or filter by a specific category. This tool helps in discovering what objects are known to the system."; protected schema = { category: { type: z.string().optional(), description: "Optional. Filters the list by category. Valid categories are: 'planets' (for Solar System objects like Sun, Moon, and planets), 'stars', 'messier' (for Messier objects), 'ic' (for Index Catalogue objects), 'ngc' (for New General Catalogue objects), 'dso' (for all Deep Sky Objects, including Messier, IC, NGC, and others), or 'all' (to list objects from all available categories). If omitted, defaults to 'all'." } };
  • Helper function in astronomy.ts that provides categorized lists of available celestial objects (Solar System, Stars, Messier, IC, NGC, other DSOs), imported and called by the tool handler.
    export function listCelestialObjects(category: string = 'all'): { category: string, objects: string[] }[] { const result: { category: string, objects: string[] }[] = []; if (category === 'all' || category === 'planets') { result.push({ category: 'Solar System Objects', objects: Object.keys(SOLAR_SYSTEM_OBJECTS).map(name => name.charAt(0).toUpperCase() + name.slice(1) // Capitalize first letter ) }); } if (category === 'all' || category === 'stars') { // Get unique star names and sort them const starNames = Array.from(new Set( Array.from(STAR_CATALOG.keys()).map(name => name.charAt(0).toUpperCase() + name.slice(1) // Capitalize first letter ) )).sort(); result.push({ category: 'Stars', objects: starNames }); } if (category === 'all' || category === 'dso' || category === 'messier' || category === 'ic' || category === 'ngc') { const messierObjects: string[] = []; const icObjects: string[] = []; const ngcObjects: string[] = []; const otherDsoObjects: string[] = []; Array.from(DSO_CATALOG.keys()).forEach(name => { const formattedName = name.charAt(0).toUpperCase() + name.slice(1); if (name.startsWith('m') && /^m\d+$/i.test(name)) { messierObjects.push(formattedName); } else if (name.startsWith('ic') && /^ic\d+$/i.test(name)) { icObjects.push(formattedName); } else if (name.startsWith('ngc') && /^ngc\d+$/i.test(name)) { ngcObjects.push(formattedName); } else { otherDsoObjects.push(formattedName); } }); if ((category === 'all' || category.toLowerCase() === 'messier' || category.toLowerCase() === 'dso') && messierObjects.length > 0) { result.push({ category: 'Messier Objects', objects: messierObjects.sort((a, b) => { const numA = parseInt(a.substring(1)); const numB = parseInt(b.substring(1)); return numA - numB; }) }); } if ((category === 'all' || category.toLowerCase() === 'ic' || category.toLowerCase() === 'dso') && icObjects.length > 0) { result.push({ category: 'IC Objects', objects: icObjects.sort((a, b) => { const numA = parseInt(a.substring(2)); const numB = parseInt(b.substring(2)); return numA - numB; }) }); } if ((category === 'all' || category.toLowerCase() === 'ngc' || category.toLowerCase() === 'dso') && ngcObjects.length > 0) { result.push({ category: 'NGC Objects', objects: ngcObjects.sort((a, b) => { const numA = parseInt(a.substring(3)); const numB = parseInt(b.substring(3)); return numA - numB; }) }); } if ((category === 'all' || category.toLowerCase() === 'dso') && otherDsoObjects.length > 0) { result.push({ category: 'Other Deep Sky Objects', objects: otherDsoObjects.sort() }); } } return result; }

Other Tools

Related Tools

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/Rkm1999/CelestialMCP'

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