1pub(crate) mod calendar;
7mod calendar_list;
8mod google_calendar_availability_tool;
9mod google_calendar_list_tool;
10mod google_calendar_write_tools;
11pub mod oauth;
12mod runtime;
13mod token_manager;
14
15pub use calendar_list::{GoogleCalendarSummary, list_calendars, list_calendars_with_access_token};
16pub use oauth::{
17 CalendarScope, GoogleOAuthConfig, GoogleOAuthError, GoogleTokenSet, GoogleUserInfo,
18 PendingAuthorization, authorization_request, exchange_code, fetch_user_info,
19 refresh_access_token, revoke_token,
20};
21pub use runtime::GoogleCalendarRuntimeConfig;
22pub use token_manager::GoogleOAuthTokenManager;
23
24use std::path::PathBuf;
25
26use agent_config::ConfigError;
27use agent_runtime::ToolRegistry;
28
29pub fn register_tools(
31 registry: &mut ToolRegistry,
32 runtime: Option<GoogleCalendarRuntimeConfig>,
33) -> Result<(), ConfigError> {
34 let data_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("data");
35 registry.register_from_file(
36 data_dir.join("calendar_list.toml"),
37 google_calendar_list_tool::GoogleCalendarList::new(runtime.clone()),
38 )?;
39 registry.register_from_file(
40 data_dir.join("calendar_events.toml"),
41 calendar::GoogleCalendarEvents::new(runtime.clone()),
42 )?;
43 registry.register_from_file(
44 data_dir.join("calendar_check_availability.toml"),
45 google_calendar_availability_tool::GoogleCalendarCheckAvailability::new(runtime.clone()),
46 )?;
47 registry.register_from_file(
48 data_dir.join("calendar_create_event.toml"),
49 google_calendar_write_tools::GoogleCalendarCreateEvent::new(runtime.clone()),
50 )?;
51 registry.register_from_file(
52 data_dir.join("calendar_update_event.toml"),
53 google_calendar_write_tools::GoogleCalendarUpdateEvent::new(runtime),
54 )?;
55
56 Ok(())
57}