Skip to main content
Glama

get_notifications

Retrieve space weather and astronomical notifications from NASA's DONKI system. Specify date range and notification type (e.g., FLR, CME, SEP) to access alerts and reports directly via the NASA-MCP server.

Instructions

Get DONKI notifications.

Args: start_date: Start date in YYYY-MM-DD format. Defaults to 7 days before current date. end_date: End date in YYYY-MM-DD format. Defaults to current date. notification_type: Notification type. Options: all, FLR, SEP, CME, IPS, MPC, GST, RBE, report.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
end_dateNo
notification_typeNoall
start_dateNo

Implementation Reference

  • The handler function decorated with @mcp.tool() that implements the get_notifications tool. It queries the NASA DONKI notifications endpoint, handles the response, formats the notifications list, and returns a formatted string summary.
    async def get_notifications(start_date: str = None, end_date: str = None, notification_type: str = "all") -> str: """Get DONKI notifications. Args: start_date: Start date in YYYY-MM-DD format. Defaults to 7 days before current date. end_date: End date in YYYY-MM-DD format. Defaults to current date. notification_type: Notification type. Options: all, FLR, SEP, CME, IPS, MPC, GST, RBE, report. """ params = {"type": notification_type} if start_date: params["startDate"] = start_date if end_date: params["endDate"] = end_date url = f"{NASA_API_BASE}/DONKI/notifications" data = await make_nasa_request(url, params) if not data: return "Could not retrieve DONKI notifications due to a connection error." # Check for error response (must be a dictionary) if isinstance(data, dict) and "error" in data: return f"API Error: {data.get('error')} - Details: {data.get('details', 'N/A')}" if isinstance(data, dict) and data.get("binary_content"): return f"Received unexpected binary content from Notifications API. URL: {data.get('url')}" try: # Ensure data is a list if not isinstance(data, list): logger.error(f"Unexpected non-list response from Notifications API: {data}") return "Received unexpected data format from Notifications API." # Format notifications results if not data: return "No notifications for the specified period and type." result = [f"Notifications found: {len(data)}"] display_limit = 10 count = 0 for notification in data: if count >= display_limit: result.append(f"n... and {len(data) - display_limit} more notifications.") break result.append(f"nID: {notification.get('messageID', 'Unknown')}") result.append(f"Type: {notification.get('messageType', 'Unknown')}") result.append(f"Issue Time: {notification.get('messageIssueTime', 'Unknown')}") result.append(f"Header: {notification.get('messageHeader', 'N/A')}") # Body can be long, maybe truncate body = notification.get('messageBody', 'N/A') result.append(f"Body: {body[:200]}{'...' if len(body) > 200 else ''}") result.append("-" * 40) count += 1 return "n".join(result) except Exception as e: logger.error(f"Error processing Notifications data: {str(e)}") return f"Error processing notifications: {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