You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
966 B
Python

from __future__ import annotations
import logging
from typing import Any
from app.config import get_settings
from app.core.service import CoreAgentService
settings = get_settings()
core_service = CoreAgentService(settings=settings, logger=logging.getLogger("personal-agent.mcp"))
def check_availability(
start: str, end: str, calendar_ids: list[str] | None = None
) -> dict[str, Any]:
"""Return free/busy availability for a time range on one or more calendars."""
result = core_service.check_availability(start=start, end=end, calendar_ids=calendar_ids)
return {
"start": result.start,
"end": result.end,
"available": result.available,
"busy_slots": [
{
"calendar_id": slot.calendar_id,
"start": slot.start,
"end": slot.end,
}
for slot in result.busy_slots
],
"checked_calendars": result.checked_calendars,
}