Skip to main content
Glama

nasa_firms

Retrieve fire detection data for specific coordinates to monitor wildfire activity and support resource management decisions.

Instructions

NASA Fire Information for Resource Management System - fire data

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
latitudeYesLatitude coordinate
longitudeYesLongitude coordinate
daysNoNumber of days of data to retrieve

Implementation Reference

  • The nasaFirmsHandler function implements the core logic for the nasa_firms tool. It validates parameters, calls the NASA FIRMS API, parses CSV response into JSON, registers a resource, and returns formatted content.
    export async function nasaFirmsHandler(params: FirmsParams) {
      try {
        const { latitude, longitude, radius, days, source } = params;
        
        // Validate required parameters
        if (!process.env.NASA_API_KEY) {
          return {
            isError: true,
            content: [{
              type: "text",
              text: "Error: NASA API key is required for FIRMS requests"
            }]
          };
        }
        
        // Get the NASA API key from environment variables
        const apiKey = process.env.NASA_API_KEY;
        
        // Construct request URL
        const url = FIRMS_API_BASE_URL;
        
        // Send request to FIRMS API
        const response = await axios.get(url, {
          params: {
            lat: latitude,
            lon: longitude,
            radius: radius,
            days: days,
            source: source,
            api_key: apiKey
          }
        });
        
        // Parse the CSV response into a structured format
        const csvData = response.data;
        const rows = csvData.split('\n');
        
        if (rows.length < 2) {
          return { results: [] };
        }
        
        const headers = rows[0].split(',');
        const results = rows.slice(1)
          .filter((row: string) => row.trim() !== '')
          .map((row: string) => {
            const values = row.split(',');
            const entry: Record<string, string | number> = {};
            
            headers.forEach((header: string, index: number) => {
              const value = values[index] ? values[index].trim() : '';
              // Try to convert numeric values
              const numValue = Number(value);
              entry[header] = !isNaN(numValue) && value !== '' ? numValue : value;
            });
            
            return entry;
          });
        
        // Register the response as a resource
        const resourceId = `nasa://firms/data?lat=${latitude}&lon=${longitude}&days=${days}&source=${source}`;
        const resourceData = {
          metadata: {
            latitude,
            longitude,
            radius,
            days,
            source
          },
          results
        };
        
        addResource(resourceId, {
          name: `Fire Data near (${latitude}, ${longitude}) for the past ${days} day(s)`,
          mimeType: 'application/json',
          text: JSON.stringify(resourceData, null, 2)
        });
        
        // Return data in MCP format
        return {
          content: [
            {
              type: "text",
              text: `Found ${results.length} fire hotspots near (${latitude}, ${longitude}) in the past ${days} day(s)`
            },
            {
              type: "text",
              text: JSON.stringify(results, null, 2)
            }
          ],
          isError: false
        };
      } catch (error: any) {
        console.error('Error in FIRMS handler:', error);
        
        return {
          isError: true,
          content: [{
            type: "text",
            text: `Error: ${error.message || 'An unexpected error occurred'}`
          }]
        };
      }
    }
  • Zod schema defining input parameters for the nasa_firms tool handler.
    export const firmsParamsSchema = z.object({
      latitude: z.number(),
      longitude: z.number(),
      radius: z.number().optional().default(1.0),
      days: z.number().int().min(1).max(10).optional().default(1),
      source: z.enum(['VIIRS_SNPP_NRT', 'MODIS_NRT', 'VIIRS_NOAA20_NRT']).optional().default('VIIRS_SNPP_NRT')
    });
  • src/index.ts:1577-1589 (registration)
    Registers the specific MCP request handler for the 'nasa/firms' method, which delegates execution to the general handleToolCall function.
    server.setRequestHandler(
      z.object({ 
        method: z.literal("nasa/firms"),
        params: z.object({
          days: z.number().optional(),
          latitude: z.number().optional(),
          longitude: z.number().optional()
        }).optional()
      }),
      async (request) => {
        return await handleToolCall("nasa/firms", request.params || {});
      }
    );
  • src/index.ts:468-471 (registration)
    Registers the nasa_firms tool in the tools/manifest response, listing it with name, id, and description.
      name: "nasa_firms",
      id: "nasa/firms",
      description: "Fire Information for Resource Management System"
    },
  • Dynamic import and invocation of the nasa/firms handler module within the general handleToolCall function used by all tools.
    const handlerModule = await import(`./handlers/nasa/${endpoint}.js`);
    serverInstance?.sendLoggingMessage({
      level: "info",
      data: `Successfully imported handler module for: ./handlers/nasa/${endpoint}.js`,
    });
    
    // Try different potential handler function names
    const handlerFunctionName = `nasa${endpoint.charAt(0).toUpperCase() + endpoint.slice(1).replace(/-/g, '_')}Handler`; // e.g. nasaMars_roverHandler
    const simpleHandlerName = `${endpoint.replace(/-/g, '_')}Handler`; // e.g. mars_roverHandler
    
    const handlerFunction = handlerModule.default || 
                           handlerModule[handlerFunctionName] || 
                           handlerModule[simpleHandlerName];
    
    if (typeof handlerFunction === 'function') {
      serverInstance?.sendLoggingMessage({
        level: "info",
        data: `Executing handler function for ${endpoint}`,
      });
      return await handlerFunction(args);
Behavior1/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. It fails to describe key traits: whether this is a read-only query, if it requires authentication, rate limits, data freshness, or output format. The phrase 'fire data' is vague, offering no insight into what the tool returns or how it behaves, leaving the agent uninformed.

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

Conciseness3/5

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

The description is concise but under-specified, consisting of a single phrase. While it avoids verbosity, it lacks front-loaded clarity and fails to convey essential information efficiently. Every word earns its place, but the content is insufficient, making it more of a label than a helpful description.

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 3-parameter tool with no annotations and no output schema, the description is incomplete. It does not compensate for missing behavioral context or output details. While the schema covers parameters well, the description lacks purpose, usage, and transparency, making it inadequate for effective tool selection and invocation.

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?

Schema description coverage is 100%, with clear parameter descriptions in the schema (latitude, longitude, days). The description adds no meaning beyond this, as it does not explain parameter interactions, units, or constraints. However, with high schema coverage, the baseline score is 3, as the schema adequately documents parameters without need for description enhancement.

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 'NASA Fire Information for Resource Management System - fire data' restates the tool name with minimal elaboration. It identifies the domain (NASA FIRMS) and mentions 'fire data', but lacks a specific verb indicating what the tool does (e.g., retrieve, query, or analyze). It does not distinguish from sibling tools like 'nasa_eonet' or 'nasa_donki', which also handle NASA data but for different purposes.

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?

No guidance is provided on when to use this tool versus alternatives. The description does not mention context, prerequisites, or exclusions. Given sibling tools like 'nasa_eonet' for natural events or 'jpl_fireball' for meteor data, there is no indication of when fire data from FIRMS is appropriate, leading to potential misuse.

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