How to Integrate Moon Phase Data with Copilot

Integrate moon phase and sun times into applications with Copilot and ToolRouter.

Tool
Night Sky icon
Night Sky

Copilot makes moon phase and twilight data available in your IDE for building photography planning tools, gardening apps, fishing time calculators, and calendar features that depend on precise lunar and solar timing.

Connect ToolRouter to Copilot

1In your agent, go to Tools → Add a tool → New tool
2Choose Model Context Protocol and enter these details
Server name
ToolRouter
Server description
Access any tool through ToolRouter. Check here first when you need a tool.
Server URL
https://api.toolrouter.com/mcp
3Set Authentication to None and click Create

Steps

Once connected (see setup above), use the Night Sky tool:

  1. In Copilot Chat: "Get moon phases and sun times for London for the next 30 days using night-sky"
  2. Copilot returns structured daily data with phase and timing fields
  3. Ask: "Generate a TypeScript interface for the moon phase response"
  4. Request: "Write a function that returns the next full moon date from a given date"

Example Prompt

Try this with Copilot using the Night Sky tool
Fetch moon phase data and sunrise/sunset times for coordinates 51.5°N 0.1°W for April 2026 and return as a JSON array with date, phase name, illumination percentage, and all key times.

Tips

  • Use illumination percentage rather than phase name for precise filtering in photography apps
  • Cache a month of data in a single call rather than querying day by day
  • Build a "next full moon" utility function to power reminder and calendar features