Skip to main content
Glama

nasa_gibs

Access and retrieve satellite imagery from NASA's Global Imagery Browse Services for specific dates and layers to visualize Earth observation data.

Instructions

Global Imagery Browse Services - satellite imagery

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
layerYesLayer name (e.g., MODIS_Terra_CorrectedReflectance_TrueColor)
dateYesDate of imagery (YYYY-MM-DD)
formatNoImage format (png, jpg, jpeg)
resolutionNoResolution in pixels per degree

Implementation Reference

  • Main handler function nasaGibsHandler that fetches GIBS satellite imagery, processes the image, registers it as a resource, and returns image data.
    export async function nasaGibsHandler(params: GibsParams) { try { const { date, layer, resolution, format, bbox } = params; // Default bbox if not provided const bboxParam = bbox || '-180,-90,180,90'; // Construct the GIBS URL const baseUrl = 'https://gibs.earthdata.nasa.gov/wms/epsg4326/best/wms.cgi'; // Convert format to proper MIME type format for WMS const mimeFormat = format === 'jpg' ? 'jpeg' : format; const requestParams = { SERVICE: 'WMS', VERSION: '1.3.0', REQUEST: 'GetMap', FORMAT: `image/${mimeFormat}`, LAYERS: layer, CRS: 'EPSG:4326', BBOX: bboxParam, WIDTH: 720, HEIGHT: 360, TIME: date }; // Make the request to GIBS directly const response = await axios({ url: baseUrl, params: requestParams, responseType: 'arraybuffer', timeout: 30000 }); // Convert response to base64 const imageBase64 = Buffer.from(response.data).toString('base64'); // Register the image as a resource const formattedDate = date || new Date().toISOString().split('T')[0]; const resourceUri = `nasa://gibs/imagery?layer=${layer}&date=${formattedDate}`; addResource(resourceUri, { name: `NASA GIBS: ${layer} (${formattedDate})`, mimeType: `image/${format}`, // Store metadata as text (optional) text: JSON.stringify({ layer: layer, date: formattedDate, bbox: bboxParam, width: 720, height: 360 }), // Store the actual image data as a blob blob: Buffer.from(response.data) }); // Return metadata and image data return { content: [ { type: "text", text: `NASA GIBS satellite imagery for ${layer} on ${date || 'latest'}` }, { type: "image", mimeType: `image/${format}`, data: imageBase64 }, { type: "text", text: `Resource registered at: ${resourceUri}` } ], isError: false }; } catch (error: any) { console.error('Error in GIBS handler:', error); if (error.name === 'ZodError') { return { content: [ { type: "text", text: `Invalid request parameters: ${error.message}` } ], isError: true }; } return { content: [ { type: "text", text: `Error retrieving GIBS data: ${error.message}` } ], isError: true }; } }
  • Zod schema for validating input parameters to the nasa_gibs tool.
    export const gibsParamsSchema = z.object({ date: z.string().optional(), layer: z.string(), resolution: z.number().optional(), format: z.enum(['png', 'jpg', 'jpeg']).optional().default('png'), bbox: z.string().optional()
  • src/index.ts:1543-1556 (registration)
    MCP server request handler registration specifically for the 'nasa/gibs' method, which dispatches to handleToolCall.
    server.setRequestHandler( z.object({ method: z.literal("nasa/gibs"), params: z.object({ layer: z.string(), date: z.string(), format: z.enum(['png', 'jpg', 'jpeg']).optional(), resolution: z.number().optional() }).optional() }), async (request) => { return await handleToolCall("nasa/gibs", request.params || {}); } );
  • src/index.ts:458-461 (registration)
    Tool 'nasa_gibs' listed in the tools/manifest response.
    name: "nasa_gibs", id: "nasa/gibs", description: "Global Imagery Browse Services satellite imagery" },
  • Input schema for 'nasa_gibs' tool advertised in tools/list response.
    name: "nasa_gibs", description: "Global Imagery Browse Services - satellite imagery", inputSchema: { type: "object", properties: { layer: { type: "string", description: "Layer name (e.g., MODIS_Terra_CorrectedReflectance_TrueColor)" }, date: { type: "string", description: "Date of imagery (YYYY-MM-DD)" }, format: { type: "string", description: "Image format (png, jpg, jpeg)" }, resolution: { type: "number", description: "Resolution in pixels per degree" } }, required: ["layer", "date"] } },

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