Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(ai_tools): point calendar tools at calendar-service in MCP and DCS (#6878)

gbirmanaa8e74fca240
diff --git a/crates/ai_tools/src/build_context.rs b/crates/ai_tools/src/build_context.rs
index c8447a0b03..59a8e42759 100644
--- a/crates/ai_tools/src/build_context.rs
+++ b/crates/ai_tools/src/build_context.rs
@@ -113,7 +113,7 @@ pub async fn build_tool_service_context_from_env(
let document_storage_service_url = DocumentStorageServiceUrl::new()?.to_string();
let sync_service_url = SyncServiceUrl::new()?.to_string();
let email_service_url = EmailServiceUrl::new()?.to_string();
- let calendar_service_url = CalendarServiceUrl::new()?.to_string();
+ let calendar_service_url = CalendarServiceUrl::new()?;
let lexical_service_url = LexicalServiceUrl::new()?.to_string();
let ai_editing_worker_url = AiEditingWorkerUrl::new()?.to_string();
let connection_gateway_url = ConnectionGatewayUrl::new()?.to_string();
diff --git a/crates/ai_tools/src/tool_context.rs b/crates/ai_tools/src/tool_context.rs
index a9fd7b0b1c..103d09855c 100644
--- a/crates/ai_tools/src/tool_context.rs
+++ b/crates/ai_tools/src/tool_context.rs
@@ -363,13 +363,13 @@ pub type ToolCalendarToolContext =
/// `calendar_service_url` with the shared internal API key.
pub fn build_calendar_tool_context(
pool: sqlx::PgPool,
- calendar_service_url: String,
+ calendar_service_url: macro_service_urls::CalendarServiceUrl,
internal_api_key: String,
) -> ToolCalendarToolContext {
CalendarToolContext::new(
Arc::new(
calendar_events::outbound::calendar_service_mutations::CalendarServiceMutations::new(
- calendar_service_url,
+ calendar_service_url.to_string(),
internal_api_key,
),
),
diff --git a/services/document_cognition_service/src/api/context/test.rs b/services/document_cognition_service/src/api/context/test.rs
index 721b9e70b1..cede6c0218 100644
--- a/services/document_cognition_service/src/api/context/test.rs
+++ b/services/document_cognition_service/src/api/context/test.rs
@@ -371,7 +371,7 @@ pub async fn test_api_context(pool: sqlx::Pool<sqlx::Postgres>) -> std::sync::Ar
call_tool_context: call_tool_context.clone(),
calendar_tool_context: ai_tools::build_calendar_tool_context(
pool.clone(),
- "http://localhost:0".to_string(),
+ macro_service_urls::ServiceUrl::owned("http://localhost:0").into(),
"test-internal-api-key".to_string(),
),
notification_tool_context: notification_tool_context.clone(),
diff --git a/services/document_cognition_service/src/main.rs b/services/document_cognition_service/src/main.rs
index c6a6009b80..63fe77e4ef 100644
--- a/services/document_cognition_service/src/main.rs
+++ b/services/document_cognition_service/src/main.rs
@@ -34,8 +34,8 @@ use macro_authorization::{
};
use macro_entrypoint::MacroEntrypoint;
use macro_service_urls::{
- ConnectionGatewayUrl, DocumentStorageServiceUrl, EmailServiceUrl, LexicalServiceUrl,
- StaticFileServiceUrl, SyncServiceUrl,
+ CalendarServiceUrl, ConnectionGatewayUrl, DocumentStorageServiceUrl, EmailServiceUrl,
+ LexicalServiceUrl, StaticFileServiceUrl, SyncServiceUrl,
};
use notification::domain::service::{
NotificationReaderService, PlatformArnConfig, SqsNotificationIngress,
@@ -601,7 +601,7 @@ async fn main() -> anyhow::Result<()> {
call_tool_context: call_tool_context.clone(),
calendar_tool_context: ai_tools::build_calendar_tool_context(
db.clone(),
- EmailServiceUrl::new()?.to_string(),
+ CalendarServiceUrl::new()?,
internal_api_key.clone(),
),
notification_tool_context: notification_tool_context.clone(),
diff --git a/services/mcp_service/src/context.rs b/services/mcp_service/src/context.rs
index e38e970553..1faba05ecc 100644
--- a/services/mcp_service/src/context.rs
+++ b/services/mcp_service/src/context.rs
@@ -29,8 +29,8 @@ use frecency::domain::services::FrecencyQueryServiceImpl;
use frecency::outbound::postgres::FrecencyPgStorage;
use macro_auth::middleware::decode_jwt::JwtValidationArgs;
use macro_service_urls::{
- AiEditingWorkerUrl, ConnectionGatewayUrl, DocumentStorageServiceUrl, EmailServiceUrl,
- LexicalServiceUrl, SyncServiceUrl,
+ AiEditingWorkerUrl, CalendarServiceUrl, ConnectionGatewayUrl, DocumentStorageServiceUrl,
+ EmailServiceUrl, LexicalServiceUrl, SyncServiceUrl,
};
use mcp_auth_proxy::{
domain::service::McpAuthProxyServiceImpl,
@@ -387,7 +387,7 @@ async fn build_tool_context(args: ToolContextBuildArgs<'_>) -> anyhow::Result<To
call_tool_context,
calendar_tool_context: ai_tools::build_calendar_tool_context(
db.clone(),
- email_service_client.url().to_owned(),
+ CalendarServiceUrl::new()?,
config.internal_api_key.to_string(),
),
notification_tool_context,