Skip to main content
Glama
lalrow

AI Makerspace MCP Demo Server

by lalrow

space_fact

Retrieve NASA's Astronomy Picture of the Day with title, date, explanation, and image URL to explore daily space imagery and information.

Instructions

Get NASA's Astronomy Picture of the Day (APOD) with its title, date, description, and image URL.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • server.py:43-67 (handler)
    The handler function for the 'space_fact' tool, decorated with @mcp.tool() to register and implement fetching NASA's Astronomy Picture of the Day (APOD), including title, date, explanation, and image URL.
    @mcp.tool() def space_fact() -> str: """Get NASA's Astronomy Picture of the Day (APOD) with its title, date, description, and image URL.""" try: api_key = os.getenv("NASA_API_KEY", "DEMO_KEY") # fallback if not set url = f"https://api.nasa.gov/planetary/apod?api_key={api_key}" response = requests.get(url) if response.status_code == 200: data = response.json() title = data.get("title", "Unknown Title") explanation = data.get("explanation", "No description available.") date = data.get("date", "") image_url = data.get("hdurl") or data.get("url") # sometimes only 'url' exists message = ( f"🪐 **{title}** ({date})\n\n" f"{explanation}\n\n" f"📸 Image URL: {image_url}" ) return message else: return f"⚠️ NASA API error: {response.status_code}" except Exception as e: return f"❌ Something went wrong: {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/lalrow/AIE8-MCP-Session'

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