Skip to main content
Glama

nasa_exoplanet

Query NASA's Exoplanet Archive database to retrieve data about planets beyond our solar system using customizable filters and parameters.

Instructions

NASA Exoplanet Archive - data about planets beyond our solar system

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tableYesDatabase table to query
selectNoColumns to return
whereNoFilter conditions
orderNoOrdering of results
limitNoMaximum number of results

Implementation Reference

  • Main handler function that queries the NASA Exoplanet Archive API, processes the response, adds a resource, and returns formatted content.
    export async function nasaExoplanetHandler(params: ExoplanetParams) {
      try {
        const { table, select, where, order, format, limit } = params;
        
        // Construct the API parameters directly - nstedAPI has different params than TAP/sync
        const apiParams: Record<string, any> = {
          table: table,
          format: format
        };
        
        // Add optional parameters if provided
        if (select) {
          apiParams.select = select;
        }
        
        if (where) {
          apiParams.where = where;
        }
        
        if (order) {
          apiParams.order = order;
        }
        
        if (limit) {
          apiParams.top = limit; // Use 'top' instead of 'limit' for this API
        }
        
        // Make the request to the Exoplanet Archive
        const response = await axios.get(EXOPLANET_API_URL, {
          params: apiParams
        });
        
        // Create a resource ID based on the query parameters
        const resourceId = `nasa://exoplanet/data?table=${table}${where ? `&where=${encodeURIComponent(where)}` : ''}${limit ? `&limit=${limit}` : ''}`;
        
        // Register the response as a resource
        addResource(resourceId, {
          name: `Exoplanet data from ${table}${where ? ` with filter` : ''}`,
          mimeType: format === 'json' ? 'application/json' : 'text/plain',
          text: format === 'json' ? JSON.stringify(response.data, null, 2) : response.data
        });
        
        // Format response based on the data type
        if (Array.isArray(response.data) && response.data.length > 0) {
          // If we got an array of results
          const count = response.data.length;
          return {
            content: [
              {
                type: "text",
                text: `Found ${count} exoplanet records from the ${table} table.`
              },
              {
                type: "text",
                text: JSON.stringify(response.data.slice(0, 10), null, 2) + 
                     (count > 10 ? `\n... and ${count - 10} more records` : '')
              }
            ],
            isError: false
          };
        } else {
          // If we got a different format or empty results
          return { 
            content: [
              {
                type: "text",
                text: `Exoplanet query complete. Results from ${table} table.`
              },
              {
                type: "text",
                text: typeof response.data === 'string' ? response.data : JSON.stringify(response.data, null, 2)
              }
            ],
            isError: false
          };
        }
      } catch (error: any) {
        console.error('Error in Exoplanet handler:', error);
        
        return {
          isError: true,
          content: [{
            type: "text",
            text: `Error accessing NASA Exoplanet Archive: ${error.message || 'Unknown error'}`
          }]
        };
      }
    }
  • Zod schema for validating input parameters to the nasa_exoplanet tool.
    export const exoplanetParamsSchema = z.object({
      table: z.string(),
      select: z.string().optional(),
      where: z.string().optional(),
      order: z.string().optional(),
      format: z.enum(['json', 'csv', 'ipac', 'xml']).optional().default('json'),
      limit: z.number().int().min(1).max(1000).optional()
    });
  • src/index.ts:1609-1623 (registration)
    Registers the MCP request handler for the 'nasa/exoplanet' method, which delegates to the dynamic handler import.
    server.setRequestHandler(
      z.object({ 
        method: z.literal("nasa/exoplanet"),
        params: z.object({
          table: z.string().optional(),
          select: z.string().optional(),
          where: z.string().optional(),
          order: z.string().optional(),
          limit: z.number().optional()
        }).optional()
      }),
      async (request) => {
        return await handleToolCall("nasa/exoplanet", request.params || {});
      }
    );
  • Input schema definition for the nasa_exoplanet tool in the tools/list response.
    name: "nasa_exoplanet",
    description: "NASA Exoplanet Archive - data about planets beyond our solar system",
    inputSchema: {
      type: "object",
      properties: {
        table: {
          type: "string",
          description: "Database table to query"
        },
        select: {
          type: "string",
          description: "Columns to return"
        },
        where: {
          type: "string",
          description: "Filter conditions"
        },
        order: {
          type: "string",
          description: "Ordering of results"
        },
        limit: {
          type: "number",
          description: "Maximum number of results"
        }
      },
      required: ["table"]
    }
  • src/index.ts:478-481 (registration)
    Tool listing in the tools/manifest response.
      name: "nasa_exoplanet",
      id: "nasa/exoplanet",
      description: "Access NASA's Exoplanet Archive data"
    },
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 the tool accesses, without mentioning how it behaves—such as whether it's read-only, requires authentication, has rate limits, or what format the results are in. For a data query tool with no annotation coverage, this leaves significant gaps in understanding its operational traits.

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

Conciseness5/5

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

The description is extremely concise and front-loaded, consisting of a single sentence that directly states the tool's purpose. There is no wasted language or unnecessary elaboration, making it efficient and easy to parse quickly.

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?

Given the complexity of a data query tool with 5 parameters and no annotations or output schema, the description is incomplete. It lacks details on behavior, usage context, and result format, which are crucial for effective tool invocation. While the schema covers parameters well, the overall context for using the tool is insufficient.

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 description adds no information about parameters beyond what the input schema provides. Since schema description coverage is 100%, the baseline score is 3. The schema already documents all parameters (table, select, where, order, limit) with clear descriptions, so the description doesn't need to compensate, but it also doesn't enhance understanding of parameter usage or examples.

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 data from the NASA Exoplanet Archive about exoplanets. It specifies the resource (NASA Exoplanet Archive) and the type of data (planets beyond our solar system), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'nasa_apod' or 'nasa_neo', which also access NASA data but for different topics.

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. It doesn't mention any specific scenarios, prerequisites, or comparisons to sibling tools like 'jpl_cad' or 'nasa_neo', which might also provide planetary data. Without such context, users must infer usage from the tool name alone.

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