Skip to main content
Glama

jpl_nhats

Query NASA's NHATS database to find accessible Near-Earth Objects for potential missions using delta-V, duration, and launch window parameters.

Instructions

Human-accessible NEOs (Near-Earth Objects) data

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dvNoMinimum total delta-V (km/s). Values: 4-12, default: 12
durNoMinimum total mission duration (days). Values: 60-450, default: 450
stayNoMinimum stay time (days). Values: 8, 16, 24, 32, default: 8
launchNoLaunch window (year range). Values: 2020-2025, 2025-2030, 2030-2035, 2035-2040, 2040-2045, 2020-2045, default: 2020-2045
hNoObject's maximum absolute magnitude (mag). Values: 16-30
occNoObject's maximum orbit condition code. Values: 0-8
desNoObject designation (e.g., '2000 SG344' or '433')
spkNoObject SPK-ID (e.g., '2000433')
plotNoInclude base-64 encoded plot image

Implementation Reference

  • The `nhatsHandler` function implements the core logic of the `jpl_nhats` tool. It queries the JPL NHATS API at `https://ssd-api.jpl.nasa.gov/nhats.api`, transforms input parameters, fetches data using axios, creates resource URIs like `jpl://nhats/object/{des}`, stores the JSON response as a resource, and returns formatted content or error.
    export async function nhatsHandler(args: Record<string, any>) {
      try {
        // Base URL for the NHATS API
        const baseUrl = 'https://ssd-api.jpl.nasa.gov/nhats.api';
        
        // Validate parameters if needed
        // Parameters are fairly flexible in this API, so minimal validation is needed
        
        // Transform parameter names from underscore to hyphenated format
        const transformedParams = transformParamsToHyphenated(args);
        
        // Make the API request
        const response = await axios.get(baseUrl, { params: transformedParams });
        const data = response.data;
        
        // Create a resource URI that represents this query
        let resourceUri: string;
        
        if (args.des) {
          // Object mode - query for a specific object
          resourceUri = `jpl://nhats/object/${args.des}`;
        } else if (args.spk) {
          // Object mode - query for a specific object by SPK-ID
          resourceUri = `jpl://nhats/object/${args.spk}`;
        } else {
          // Summary mode - query for a list of objects with constraints
          const constraints = Object.entries(args)
            .map(([key, value]) => `${key}=${value}`)
            .join('&');
          
          resourceUri = `jpl://nhats/summary${constraints ? '?' + constraints : ''}`;
        }
        
        // Add response to resources
        addResource(resourceUri, {
          name: args.des || args.spk 
            ? `NHATS data for object: ${args.des || args.spk}`
            : 'NHATS summary data',
          mimeType: "application/json",
          text: JSON.stringify(data, null, 2)
        });
        
        // Format the response
        return {
          content: [{
            type: "text",
            text: JSON.stringify(data, null, 2)
          }]
        };
      } catch (error: any) {
        return {
          content: [{
            type: "text",
            text: `Error accessing JPL NHATS API: ${error.message}`
          }],
          isError: true
        };
      }
    }
    
    // Export default for dynamic imports
    export default nhatsHandler; 
  • src/index.ts:518-523 (registration)
    Registration of the `jpl_nhats` tool in the `tools/manifest` response, specifying its name, internal ID `jpl/nhats`, and description.
      name: "jpl_nhats",
      id: "jpl/nhats",
      description: "Human-accessible NEOs (Near-Earth Objects) data"
    },
    {
      name: "jpl_cad",
  • Detailed input schema and description for the `jpl_nhats` tool defined in the `tools/list` handler response, including parameters like `dv`, `dur`, `des`, `spk`, etc.
      name: "jpl_nhats",
      description: "Human-accessible NEOs (Near-Earth Objects) data",
      inputSchema: {
        type: "object",
        properties: {
          dv: {
            type: "number",
            description: "Minimum total delta-V (km/s). Values: 4-12, default: 12"
          },
          dur: {
            type: "number",
            description: "Minimum total mission duration (days). Values: 60-450, default: 450"
          },
          stay: {
            type: "number",
            description: "Minimum stay time (days). Values: 8, 16, 24, 32, default: 8"
          },
          launch: {
            type: "string",
            description: "Launch window (year range). Values: 2020-2025, 2025-2030, 2030-2035, 2035-2040, 2040-2045, 2020-2045, default: 2020-2045"
          },
          h: {
            type: "number",
            description: "Object's maximum absolute magnitude (mag). Values: 16-30"
          },
          occ: {
            type: "number",
            description: "Object's maximum orbit condition code. Values: 0-8"
          },
          des: {
            type: "string",
            description: "Object designation (e.g., '2000 SG344' or '433')"
          },
          spk: {
            type: "string",
            description: "Object SPK-ID (e.g., '2000433')"
          },
          plot: {
            type: "boolean",
            description: "Include base-64 encoded plot image"
          }
        }
      }
    },

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/ProgramComputer/NASA-MCP-server'

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