Skip to main content
Glama

nasa_donki

Access space weather event data from NASA's DONKI database to analyze solar activity, geomagnetic storms, and other space weather phenomena by specifying event type and date range.

Instructions

Space Weather Database Of Notifications, Knowledge, Information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeYesType of space weather event
startDateNoStart date (YYYY-MM-DD)
endDateNoEnd date (YYYY-MM-DD)

Implementation Reference

  • The core handler function `nasaDonkiHandler` that implements the logic for the 'nasa_donki' tool. It validates the event type, constructs the API endpoint, fetches data from NASA's DONKI API using `nasaApiRequest`, creates a resource, and returns formatted content.
    export async function nasaDonkiHandler(params: DonkiParams) {
      try {
        const { type, startDate, endDate } = params;
        
        // Map the type to the appropriate endpoint
        const typeEndpoints: Record<string, string> = {
          cme: '/DONKI/CME',
          cmea: '/DONKI/CMEAnalysis',
          gst: '/DONKI/GST',
          ips: '/DONKI/IPS',
          flr: '/DONKI/FLR',
          sep: '/DONKI/SEP',
          mpc: '/DONKI/MPC',
          rbe: '/DONKI/RBE',
          hss: '/DONKI/HSS',
          wsa: '/DONKI/WSAEnlilSimulations',
          notifications: '/DONKI/notifications'
        };
        
        const endpoint = typeEndpoints[type.toLowerCase()];
        
        // Validate that the endpoint exists for the given type
        if (!endpoint) {
          return {
            isError: true,
            content: [{
              type: "text",
              text: `Error: Invalid DONKI type "${type}". Valid types are: ${Object.keys(typeEndpoints).join(', ')}`
            }]
          };
        }
        
        const queryParams: Record<string, any> = {};
        
        // Add date parameters if provided
        if (startDate) queryParams.startDate = startDate;
        if (endDate) queryParams.endDate = endDate;
        
        // Call the NASA DONKI API
        const result = await nasaApiRequest(endpoint, queryParams);
        
        // Create a resource ID and register the resource
        const dateParams = [];
        if (startDate) dateParams.push(`start=${startDate}`);
        if (endDate) dateParams.push(`end=${endDate}`);
        
        const resourceId = `nasa://donki/${type}${dateParams.length > 0 ? '?' + dateParams.join('&') : ''}`;
        
        addResource(resourceId, {
          name: `DONKI ${type.toUpperCase()} Space Weather Data${startDate ? ` from ${startDate}` : ''}${endDate ? ` to ${endDate}` : ''}`,
          mimeType: 'application/json',
          text: JSON.stringify(result, null, 2)
        });
        
        // Return the confirmation message and the actual data
        return { 
          content: [
            {
              type: "text",
              text: `Retrieved DONKI ${type.toUpperCase()} space weather data${startDate ? ` from ${startDate}` : ''}${endDate ? ` to ${endDate}` : ''}.`
            },
            {
              type: "text",
              text: JSON.stringify(result, null, 2)
            }
          ],
          isError: false
        };
      } catch (error: any) {
        console.error('Error in DONKI handler:', error);
        
        return {
          isError: true,
          content: [{
            type: "text",
            text: `Error: ${error.message || 'An unexpected error occurred'}`
          }]
        };
      }
    }
    
    // Export the handler function directly as default
    export default nasaDonkiHandler; 
  • Zod schema definition for DonkiParams used for input validation in the nasaDonkiHandler. Exported as donkiParamsSchema and typed as DonkiParams.
    const DonkiSchema = z.object({
      type: z.enum(['cme', 'cmea', 'gst', 'ips', 'flr', 'sep', 'mpc', 'rbe', 'hss', 'wsa', 'notifications']),
      startDate: z.string().optional(),
      endDate: z.string().optional()
    });
  • src/index.ts:1626-1638 (registration)
    Registers the MCP server request handler specifically for the 'nasa/donki' tool method, which dispatches parameters to the shared handleToolCall function.
    server.setRequestHandler(
      z.object({ 
        method: z.literal("nasa/donki"),
        params: z.object({
          type: z.string(),
          startDate: z.string().optional(),
          endDate: z.string().optional()
        }).optional()
      }),
      async (request) => {
        return await handleToolCall("nasa/donki", request.params || {});
      }
    );
  • src/index.ts:482-486 (registration)
    Lists the 'nasa_donki' tool in the tools/manifest response, providing its name, ID, and description.
    {
      name: "nasa_donki",
      id: "nasa/donki",
      description: "Space Weather Database Of Notifications, Knowledge, Information"
    },
  • src/index.ts:913-933 (registration)
    Registers the 'nasa_donki' tool in the tools/list response, including its inputSchema for MCP tool discovery.
      name: "nasa_donki",
      description: "Space Weather Database Of Notifications, Knowledge, Information",
      inputSchema: {
        type: "object",
        properties: {
          type: {
            type: "string",
            description: "Type of space weather event"
          },
          startDate: {
            type: "string",
            description: "Start date (YYYY-MM-DD)"
          },
          endDate: {
            type: "string",
            description: "End date (YYYY-MM-DD)"
          }
        },
        required: ["type"]
      }
    },
Behavior1/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. However, the description fails to describe any behavioral traits such as whether this is a read-only or mutating operation, what permissions or authentication might be required, rate limits, or what the output format looks like. It only states what the database contains without explaining how the tool interacts with it, making it inadequate for a tool with no annotation coverage.

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

Conciseness2/5

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

The description is a single phrase that is under-specified rather than concise. It fails to front-load critical information such as the tool's action or purpose, and the phrase does not earn its place by adding value beyond the tool name. While it is brief, it lacks the structure and informative content needed for effective tool selection, making it inefficient rather than appropriately concise.

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

Completeness1/5

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

Given the complexity of a space weather database tool with 3 parameters, no annotations, and no output schema, the description is incomplete. It does not explain what the tool does, how to use it, what behavior to expect, or what the output will contain. The lack of annotations and output schema means the description should compensate by providing more context, but it fails to do so, leaving significant gaps for the agent.

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, with clear documentation for all three parameters (type, startDate, endDate). The description does not add any meaning beyond what the schema provides, as it does not mention parameters at all. According to the rules, when schema_description_coverage is high (>80%), the baseline score is 3 even with no parameter info in the description, which applies here.

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

Purpose2/5

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

The description 'Space Weather Database Of Notifications, Knowledge, Information' is essentially a tautology that restates the tool name 'nasa_donki' (which stands for 'Database Of Notifications, Knowledge, Information'). It does not specify what action the tool performs (e.g., 'retrieve', 'search', 'list') or what resource it operates on beyond the vague 'space weather' reference. While it hints at a database related to space weather, it lacks a clear verb+resource statement that distinguishes it from sibling tools like 'nasa_apod' or 'nasa_neo'.

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

Usage Guidelines1/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 does not mention any context, prerequisites, or exclusions for usage, nor does it reference sibling tools. For example, it does not clarify if this is for querying historical data, real-time alerts, or specific types of space weather events compared to other NASA tools. This leaves the agent with no explicit or implied usage instructions.

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