# Sleep Window Duration AI Agent Connect

> Sleep Window Duration MCP handles the math for your sleep tracking. It calculates exact rest durations, even when your sleep session crosses midnight, and compares your actual rest against your personal sleep goals. Your AI client can use these tools to turn raw bedtime and wake times into clear, actionable sleep summaries.

## Overview
- **Category:** productivity
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_sjLCEGHMUx55YsHpQoBx3f58VTyrz0CJ02zUIlhT/ai-agent-connect
- **Tags:** sleep, time, health-tracking, duration, wellness

## Description

Tracking sleep is often a headache of manual math and messy time logs. This MCP fixes that by giving your AI client the ability to process sleep data accurately. Instead of you manually calculating how many hours you actually slept after a late night, you just tell your agent when you went to bed and when you woke up. It handles the midnight crossover logic automatically. 

You can use it to check if you actually hit your target rest duration or to get a plain English summary of your night. It also includes a way to verify that your time inputs follow the 24-hour standard, so you don't have to worry about formatting errors. Whether you are tracking sleep patterns for health reasons or just trying to hit a specific goal, this MCP turns raw timestamps into useful metrics.

## Tools

### calculate_sleep_efficiency_metric
This tool compares your actual sleep window against a specific target to see if you met your goal.

### get_sleep_duration
This tool calculates the total hours and minutes you slept based on your bedtime and wake time.

### get_sleep_window_summary
This tool generates a natural language description of your entire sleep session.

### validate_time_format
This tool checks if your time entries follow the required 24-hour format.

## Prompt Examples

**Prompt:** 
```
How long did I sleep if I went to bed at 23:00 and woke up at 07:30?
```

**Response:** 
```
You slept for 8 hours and 30 minutes.
```

**Prompt:** 
```
Is 22:00 a valid time format?
```

**Response:** 
```
Yes, 22:00 is a valid 24-hour time format.
```

**Prompt:** 
```
I slept from 22:00 to 06:00. Did I meet my 8-hour goal?
```

**Response:** 
```
No, you slept for 8 hours, which meets the minimum requirement but does not exceed the target.
```

## Capabilities

### Midnight Crossover Logic
The AI calculates duration correctly even when sleep starts one day and ends the next.

### Goal Comparison
Your agent checks your sleep duration against a target to determine if you hit your mark.

### Time Validation
The MCP ensures all time inputs use the 24-hour standard before processing.

### Natural Language Summaries
Your AI client converts raw sleep data into readable descriptions of your rest.

## Use Cases

### Daily Sleep Tracking
Tell your agent your bedtime and wake time to get your total sleep duration.

### Goal Monitoring
Check if your recent sleep patterns are meeting your specific hourly targets.

### Data Cleaning
Use the validation tool to ensure your sleep logs are in the correct 24-hour format.

### Sleep Reporting
Generate a text summary of a sleep session to include in a health log.

## Benefits

- Eliminates manual math for sleep sessions that cross midnight.
- Provides instant feedback on whether sleep goals were reached.
- Standardizes time input through built-in validation.
- Converts raw numbers into human-readable summaries.

## How It Works

Connecting this MCP to your AI client gives it immediate access to sleep calculation tools.

1. Connect the MCP to your preferred client like Claude or Cursor via Vinkius.
2. Provide your bedtime and wake time to your AI agent.
3. The agent uses the MCP to validate the time and calculate the duration.
4. The agent returns the exact hours, minutes, or a summary of your sleep.

## Frequently Asked Questions

**Can this MCP handle sleep that starts before midnight?**
Yes. The get_sleep_duration tool is designed to calculate durations even when the session crosses midnight.

**What time format should I use?**
The MCP uses the 24-hour standard. You can use the validate_time_format tool to check if your input is correct.

**How does it check if I met my sleep goal?**
The calculate_sleep_efficiency_metric tool compares your actual sleep duration against a target you provide.

**Which AI clients can use this MCP?**
Any MCP-compatible client, such as Claude, Cursor, Windsurf, or VS Code, can use these tools.

**Does it provide a written summary of my sleep?**
Yes. The get_sleep_window_summary tool provides a natural language description of your sleep session.

**How does it handle sleeping past midnight?**
The server automatically detects overnight rollover if the wake time is numerically earlier than the bedtime, ensuring accurate duration calculation.

**Can I check if I met my sleep goal?**
Yes, you can use the efficiency metric tool to compare your actual sleep duration against a specific target number of hours.
