Skip to main content
Glama

jpl_sbdb

Search NASA's Small-Body Database to retrieve detailed asteroid and comet data, including orbital parameters and close approach information.

Instructions

Small-Body Database (SBDB) - asteroid and comet data

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sstrYesSearch string (e.g., asteroid name, number, or designation)
cadNoInclude close approach data

Implementation Reference

  • Core handler function that validates parameters, constructs the JPL SBDB API request, transforms parameter names, fetches data using axios, and returns MCP-formatted content or error.
    export async function jplSbdbHandler(params: SbdbParams) {
      try {
        const { 
          sstr, 
          full_precision, 
          solution_epoch, 
          orbit_class, 
          body_type, 
          phys_par, 
          close_approach, 
          ca_time, 
          ca_dist, 
          ca_tbl, 
          format 
        } = params;
        
        // Construct the SBDB query URL
        const url = 'https://ssd-api.jpl.nasa.gov/sbdb.api';
        
        // Prepare the query parameters
        const queryParams: Record<string, any> = {
          sstr
        };
        
        // Add optional parameters
        if (full_precision) queryParams.full_precision = full_precision ? 'yes' : 'no';
        if (solution_epoch) queryParams.solution_epoch = solution_epoch;
        if (orbit_class) queryParams.orbit_class = orbit_class ? 'yes' : 'no';
        if (body_type !== 'all') queryParams.body_type = body_type;
        if (phys_par) queryParams.phys_par = phys_par ? 'yes' : 'no';
        if (close_approach) queryParams.close_approach = close_approach ? 'yes' : 'no';
        if (ca_time !== 'all') queryParams.ca_time = ca_time;
        if (ca_dist !== 'au') queryParams.ca_dist = ca_dist;
        if (ca_tbl !== 'approach') queryParams.ca_tbl = ca_tbl;
        if (format !== 'json') queryParams.format = format;
        
        // Transform parameter names from underscore to hyphenated format
        const transformedParams = transformParamsToHyphenated(queryParams);
        
        // Make the request to SBDB API
        const response = await axios.get(url, { params: transformedParams });
        
        // Return the response
        return {
          content: [
            {
              type: "text",
              text: `Retrieved data for small body "${params.sstr}".`
            },
            {
              type: "text",
              text: JSON.stringify(response.data, null, 2)
            }
          ],
          isError: false
        };
      } catch (error: any) {
        console.error('Error in JPL SBDB handler:', error);
        
        return {
          isError: true,
          content: [{
            type: "text",
            text: `Error: ${error.message || 'An unexpected error occurred'}`
          }]
        };
      }
    } 
  • Zod schema defining and validating input parameters for the jpl_sbdb tool, including required search string and various optional filters.
    export const sbdbParamsSchema = z.object({
      sstr: z.string().min(1),
      full_precision: z.boolean().optional().default(false),
      solution_epoch: z.string().optional(),
      orbit_class: z.boolean().optional().default(false),
      body_type: z.enum(['ast', 'com', 'all']).optional().default('all'),
      phys_par: z.boolean().optional().default(false),
      close_approach: z.boolean().optional().default(false),
      ca_time: z.enum(['all', 'now', 'fut', 'past']).optional().default('all'),
      ca_dist: z.enum(['au', 'ld', 'lu']).optional().default('au'),
      ca_tbl: z.enum(['elem', 'approach']).optional().default('approach'),
      format: z.enum(['json', 'xml']).optional().default('json')
    });
  • Helper utility to transform API parameter keys from underscore_case (e.g., full_precision) to hyphen-case (full-precision) as required by JPL APIs.
    export function transformParamsToHyphenated(params: Record<string, any>): Record<string, any> {
      const transformed: Record<string, any> = {};
      
      for (const [key, value] of Object.entries(params)) {
        // Replace underscores with hyphens for parameter names
        const transformedKey = key.replace(/_/g, '-');
        transformed[transformedKey] = value;
      }
      
      return transformed;
    } 
  • src/index.ts:1896-1932 (registration)
    Dynamic registration and execution logic for JPL tools (including jpl/sbdb): dynamically imports the handler module from ./handlers/jpl/sbdb.js and invokes the exported handler function with arguments.
    } else if (internalToolId.startsWith("jpl/")) {
      // Extract the JPL API endpoint name
      const endpoint = internalToolId.split("/")[1];
      serverInstance?.sendLoggingMessage({
        level: "info",
        data: `JPL Endpoint: ${endpoint}`,
      });
      
      try {
        // Dynamic import for JPL handlers using the original slash format path
        serverInstance?.sendLoggingMessage({
          level: "info",
          data: `Importing handler module: ./handlers/jpl/${endpoint}.js`,
        });
        const handlerModule = await import(`./handlers/jpl/${endpoint}.js`);
        
        // Try to find the handler function in various export formats
        const handlerFunction = handlerModule.default || 
                               handlerModule[`jpl${endpoint.charAt(0).toUpperCase() + endpoint.slice(1)}Handler`] ||
                               handlerModule[`${endpoint}Handler`];
        
        if (typeof handlerFunction === 'function') {
          return await handlerFunction(args);
        } else {
          throw new Error(`Handler for ${endpoint} not found in module`);
        }
      } catch (error: unknown) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        return {
          content: [{
            type: "text",
            text: `Error executing JPL tool '${toolName}': ${errorMessage}`
          }],
          isError: true
        };
      }
    }
  • src/index.ts:1032-1048 (registration)
    Tool registration in MCP tools/list handler: defines the 'jpl_sbdb' tool name, description, and JSON input schema.
      name: "jpl_sbdb",
      description: "Small-Body Database (SBDB) - asteroid and comet data",
      inputSchema: {
        type: "object",
        properties: {
          sstr: {
            type: "string",
            description: "Search string (e.g., asteroid name, number, or designation)"
          },
          cad: {
            type: "boolean",
            description: "Include close approach data"
          }
        },
        required: ["sstr"]
      }
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It only states what data is accessed without describing how: no information about rate limits, authentication requirements, data freshness, error conditions, or response format. For a data query tool with zero annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise - just one phrase stating the tool's purpose. It's front-loaded with the essential information. However, given the complexity of astronomical data tools and lack of behavioral context, this brevity might be under-specified rather than optimally concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a data query tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what data is returned, in what format, or any limitations. Given the rich sibling tool ecosystem and the complexity of astronomical data, more context about the scope and boundaries of this specific tool would be helpful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, so both parameters are well-documented in the schema. The description adds no additional parameter information beyond what's in the schema. According to scoring rules, when schema_description_coverage is high (>80%), the baseline is 3 even with no param info in the description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: accessing asteroid and comet data from the Small-Body Database (SBDB). It specifies the resource (asteroid/comet data) and source (SBDB), but doesn't distinguish it from sibling tools like 'jpl_horizons' or 'nasa_neo' which might also provide asteroid data. The description is accurate but lacks sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With multiple sibling tools potentially offering related astronomical data (e.g., 'jpl_horizons', 'nasa_neo'), there's no indication of when this specific SBDB tool is appropriate versus others. The description only states what it does, not when to choose it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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