Skip to main content
Glama

get_epic_imagery_by_date

Retrieve Earth Polychromatic Imaging Camera (EPIC) images for a specified date. Choose between natural or enhanced collection types to access detailed Earth imagery directly.

Instructions

Get images from the EPIC (Earth Polychromatic Imaging Camera) for a specific date.

Args: date: Date in YYYY-MM-DD format. collection: Collection type. Options: natural, enhanced.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collectionNonatural
dateYes

Implementation Reference

  • The main handler function for the get_epic_imagery_by_date tool. It fetches EPIC images for a specific date from the NASA API, processes the metadata, constructs image URLs, and formats the output.
    @mcp.tool() async def get_epic_imagery_by_date(date: str, collection: str = "natural") -> str: """Get images from the EPIC (Earth Polychromatic Imaging Camera) for a specific date. Args: date: Date in YYYY-MM-DD format. collection: Collection type. Options: natural, enhanced. """ if collection not in ["natural", "enhanced"]: return "Invalid collection. Available options: natural, enhanced." # Use the 'date' endpoint to get images for a specific date api_path = f"/EPIC/api/{collection}/date/{date}" url = f"{NASA_API_BASE}{api_path}" data = await make_nasa_request(url) if not data: return f"Could not retrieve EPIC images for date {date} due to a connection error." # Check for error response (must be a dictionary) if isinstance(data, dict): if "error" in data: return f"API Error: {data.get('error')} - Details: {data.get('details', 'N/A')}" if data.get("binary_content"): return f"Received unexpected binary content from EPIC API. URL: {data.get('url')}" # Ensure data is a list if not isinstance(data, list): logger.error(f"Unexpected non-list response from EPIC API: {data}") return "Received unexpected data format from EPIC API." try: if not data: # Empty list return f"No EPIC images available for the specified date ({date})." result = [f"EPIC images found for date {date}: {len(data)}"] display_limit = 10 count = 0 for image_meta in data: if count >= display_limit: result.append(f"n... and {len(data) - display_limit} more images.") break image_date_time = image_meta.get('date', 'Unknown') image_identifier = image_meta.get('identifier', 'Unknown') # Use identifier if available image_name = image_meta.get('image', 'Unknown') # Base name like epic_1b_... # Build image URL if image_date_time != 'Unknown' and image_name != 'Unknown': try: # Extract date parts for URL path dt_obj = datetime.strptime(image_date_time, '%Y-%m-%d %H:%M:%S') year, month, day = dt_obj.strftime('%Y'), dt_obj.strftime('%m'), dt_obj.strftime('%d') # Construct archive URL archive_url = f"https://api.nasa.gov/EPIC/archive/{collection}/{year}/{month}/{day}/png/{image_name}.png" # Add API key for direct access image_url_with_key = f"{archive_url}?api_key={API_KEY}" except ValueError: logger.warning(f"Could not parse date {image_date_time} for EPIC image URL construction.") image_url_with_key = "URL construction failed" else: image_url_with_key = "URL not available" result.append(f"nIdentifier: {image_identifier}") result.append(f"Date/Time: {image_date_time}") result.append(f"Caption: {image_meta.get('caption', 'No caption')}") result.append(f"Image Name: {image_name}") result.append(f"Archive URL: {image_url_with_key}") # Coordinates coords = image_meta.get('centroid_coordinates', {}) if coords: result.append(f"Centroid Coordinates: Lat {coords.get('lat', 'N/A')}, Lon {coords.get('lon', 'N/A')}") result.append("-" * 40) count += 1 return "n".join(result) except Exception as e: logger.error(f"Error processing EPIC image data: {str(e)}") return f"Error processing EPIC image data: {str(e)}"

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/AnCode666/nasa-mcp'

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