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): remove send email from mcp server (#3089)

Eric Hayes0cf4c82348cc
diff --git a/rust/cloud-storage/ai_tools/src/lib.rs b/rust/cloud-storage/ai_tools/src/lib.rs
index 5ac97043f3..c495ce6585 100644
--- a/rust/cloud-storage/ai_tools/src/lib.rs
+++ b/rust/cloud-storage/ai_tools/src/lib.rs
@@ -14,7 +14,7 @@ use call::inbound::toolset::call_toolset;
use channels::inbound::toolset::channel_toolset;
use chat::inbound::toolset::chat_toolset;
use documents::inbound::toolset::document_toolset;
-use email::inbound::toolset::email_toolset;
+use email::inbound::toolset::{email_toolset, mcp_toolset as email_mcp_toolset};
use notification::inbound::ai_tool::notification_toolset;
use properties::inbound::toolset::properties_toolset;
use schemas::{anthropic_tools, read};
@@ -82,6 +82,17 @@ pub fn all_tool_combined_schema() -> CombinedToolSchemas {
.build()
}
+/// Toolset for the MCP server — excludes SendEmail.
+pub fn mcp_tools() -> ToolSetWithPrompt {
+ let toolset = subagent_toolset()
+ .add_subtoolset::<ToolNotificationToolContext>(notification_toolset())
+ .add_subtoolset::<ToolEmailToolContext>(email_mcp_toolset())
+ .add_tool::<Subagent, ToolServiceContext>();
+ let prompt = prompts::TOOLS_PROMPT;
+ let toolset = Arc::new(toolset);
+ ToolSetWithPrompt { toolset, prompt }
+}
+
pub fn no_tools() -> ToolSetWithPrompt {
ToolSetWithPrompt {
prompt: prompts::BASE_PROMPT,
diff --git a/rust/cloud-storage/email/src/inbound/toolset/mod.rs b/rust/cloud-storage/email/src/inbound/toolset/mod.rs
index 643197642e..724b44fa6d 100644
--- a/rust/cloud-storage/email/src/inbound/toolset/mod.rs
+++ b/rust/cloud-storage/email/src/inbound/toolset/mod.rs
@@ -89,8 +89,18 @@ impl<T: EmailService, G: GmailTokenProvider, E: EntityAccessService> EmailToolCo
}
}
-/// Create an email toolset.
+/// Create the full email toolset including SendEmail.
pub fn email_toolset<T, G, E>() -> AsyncToolSet<EmailToolContext<T, G, E>>
+where
+ T: EmailService,
+ G: GmailTokenProvider,
+ E: EntityAccessService,
+{
+ mcp_toolset().add_user_tool::<SendEmail, EmailToolContext<T, G, E>>()
+}
+
+/// Email toolset for the MCP server — excludes SendEmail.
+pub fn mcp_toolset<T, G, E>() -> AsyncToolSet<EmailToolContext<T, G, E>>
where
T: EmailService,
G: GmailTokenProvider,
@@ -99,5 +109,4 @@ where
AsyncToolSet::new()
.add_tool::<UpdateThreadLabels, EmailToolContext<T, G, E>>()
.add_tool::<GetThread, EmailToolContext<T, G, E>>()
- .add_user_tool::<SendEmail, EmailToolContext<T, G, E>>()
}
diff --git a/rust/cloud-storage/mcp_service/src/main.rs b/rust/cloud-storage/mcp_service/src/main.rs
index 4b5f437f1b..7773315d89 100644
--- a/rust/cloud-storage/mcp_service/src/main.rs
+++ b/rust/cloud-storage/mcp_service/src/main.rs
@@ -30,7 +30,7 @@ async fn main() -> anyhow::Result<()> {
// Create the MCP service with authenticated tool handler
let mcp_service = StreamableHttpService::new(
move || {
- let tools = ai_tools::all_tools();
+ let tools = ai_tools::mcp_tools();
Ok(AuthenticatedToolService::new(
tools.toolset,
context.tool_context.clone(),