NASA MCP Server

by ProgramComputer
Verified
import { z } from 'zod'; import { jplApiRequest } from '../../utils/api-client'; import { ScoutParams } from '../setup'; import axios from 'axios'; /** * Handle requests for JPL's Scout API * Scout is a hazard assessment system that automatically calculates the potential * for an object to be an impactor based on the available observations. */ export async function jplScoutHandler(params: ScoutParams) { try { // Call the Scout API const base_url = 'https://ssd-api.jpl.nasa.gov/scout.api'; const response = await axios.get(base_url, { params }); return { content: [{ type: "text", text: `Retrieved Scout data for object ${params.orbit_id || params.tdes || 'latest'}.` }], isError: false }; } catch (error: any) { console.error('Error in JPL Scout handler:', error); return { isError: true, content: [{ type: "text", text: `Error: ${error.message || 'An unexpected error occurred'}` }] }; } }