get_wsa_enlil_simulation
Retrieve WSA+Enlil simulation data for specified date ranges. Access space weather forecasts and solar wind predictions using NASA-MCP server.
Instructions
Get WSA+Enlil simulation data.
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.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end_date | No | ||
| start_date | No |
Implementation Reference
- src/nasa_mcp/server.py:636-689 (handler)The handler function implementing the get_wsa_enlil_simulation tool. It fetches WSA+Enlil simulation data from NASA's DONKI API, handles errors, and formats the response with key details like simulation ID, completion time, and impacts.async def get_wsa_enlil_simulation(start_date: str = None, end_date: str = None) -> str: """Get WSA+Enlil simulation data. 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. """ params = {} if start_date: params["startDate"] = start_date if end_date: params["endDate"] = end_date url = f"{NASA_API_BASE}/DONKI/WSAEnlilSimulations" data = await make_nasa_request(url, params) if not data: return "Could not retrieve WSA+Enlil simulation data 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 WSA+Enlil API. URL: {data.get('url')}" try: # Ensure data is a list if not isinstance(data, list): logger.error(f"Unexpected non-list response from WSA+Enlil API: {data}") return "Received unexpected data format from WSA+Enlil API." # Format WSA+Enlil results (structure is more complex) if not data: return "No WSA+Enlil simulation data for the specified period." result = [f"WSA+Enlil Simulations found: {len(data)}"] display_limit = 5 count = 0 for sim in data: if count >= display_limit: result.append(f"n... and {len(data) - display_limit} more simulations.") break result.append(f"nSimulation ID: {sim.get('simulationID', 'Unknown')}") result.append(f"Model Completion Time: {sim.get('modelCompletionTime', 'Unknown')}") # Add more fields as needed, e.g., impactList impacts = sim.get('impactList', []) if impacts: result.append(" Impacts (first 2):") for impact in impacts[:2]: result.append(f" - Location: {impact.get('location', 'N/A')}, Arrival: {impact.get('arrivalTime', 'N/A')}") result.append("-" * 40) count += 1 return "n".join(result) except Exception as e: logger.error(f"Error processing WSA+Enlil simulation data: {str(e)}") return f"Error processing WSA+Enlil simulation data: {str(e)}"