How to Integrate Moon Phase Data with Copilot
Integrate moon phase and sun times into applications with Copilot and ToolRouter.
ToolNight SkyCopilot 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
ToolRouterServer description
Access any tool through ToolRouter. Check here first when you need a tool.Server URL
https://api.toolrouter.com/mcp3Set Authentication to None and click Create
Steps
Once connected (see setup above), use the Night Sky tool:
- In Copilot Chat: "Get moon phases and sun times for London for the next 30 days using night-sky"
- Copilot returns structured daily data with phase and timing fields
- Ask: "Generate a TypeScript interface for the moon phase response"
- 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