Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(mcp): expose channel message attachments (#6783)
teo525c79b100cd
diff --git a/Cargo.lock b/Cargo.lockindex 0489a76335..1cbd858890 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -10704,6 +10704,7 @@ dependencies = ["foreign_entity","frecency","fusionauth",+ "futures","http 1.4.0","lexical_client","macro_auth",diff --git a/docs/AGENT_GUIDE/channels.md b/docs/AGENT_GUIDE/channels.mdindex 5ba4b914b2..45b926db8c 100644--- a/docs/AGENT_GUIDE/channels.md+++ b/docs/AGENT_GUIDE/channels.md@@ -36,6 +36,17 @@ button that copies the whole section; a call that failed is faded, shows theerror as its subtitle, and adds an `Error` section. Rows for a call still runningshow whatever has arrived so far.+## Reading channel attachments through MCP++When an agent reads a channel through Macro MCP, `ReadChannelMessages`,+`ReadChannelThread`, and `ReadChannelMessageContext` include download URLs for+image and video attachments, including attachments in replies and previews.+Up to eight distinct images per response are also returned as inline images.+Videos are linked for inspection with a video-capable tool. If an image cannot+be loaded or exceeds the inline limit, its URL remains available. To check this,+ask the agent to inspect an image on a channel message and a video on a reply;+verify that its tool response includes the matching attachment URLs.+## Message composerComposer and conversation body text use `text-base` (15px at the default rootdiff --git a/services/mcp_service/Cargo.toml b/services/mcp_service/Cargo.tomlindex c3070502be..f36e010454 100644--- a/services/mcp_service/Cargo.toml+++ b/services/mcp_service/Cargo.toml@@ -43,6 +43,7 @@ frecency = { path = "../../crates/frecency", features = ["postgres",] }fusionauth = { path = "../../crates/fusionauth" }+futures = { workspace = true }http = { workspace = true }lexical_client = { path = "../../crates/lexical_client" }macro_auth = { path = "../../crates/macro_auth" }diff --git a/services/mcp_service/src/main.rs b/services/mcp_service/src/main.rsindex 4a2f572940..683daadde9 100644--- a/services/mcp_service/src/main.rs+++ b/services/mcp_service/src/main.rs@@ -7,6 +7,7 @@mod config;mod context;mod markdown_images;+mod tool_response;mod tool_service;use anyhow::Context;use config::Config;@@ -35,6 +36,8 @@ async fn main() -> anyhow::Result<()> {// Base URL of the Macro web app, used to build links to Macro items in MCP// responses.let item_base_url = config.app_base_url.as_ref().to_string();+ let static_file_base_url =+ url::Url::parse(macro_service_urls::StaticFileServiceUrl::new()?.as_ref())?;let event_broker_tracker = TaskTracker::new();let context = build_context(&config, event_broker_tracker.clone()).await?;@@ -47,6 +50,7 @@ async fn main() -> anyhow::Result<()> {tools.toolset,context.tool_context.clone(),item_base_url.clone(),+ static_file_base_url.clone(),))},Arc::new(LocalSessionManager::default()),diff --git a/services/mcp_service/src/markdown_images.rs b/services/mcp_service/src/markdown_images.rsindex b12bfccfc7..f0015c3e0c 100644--- a/services/mcp_service/src/markdown_images.rs+++ b/services/mcp_service/src/markdown_images.rs@@ -30,6 +30,9 @@ pub(crate) struct ResolvedImage {pub(crate) trait MarkdownImageResolver: Send + Sync {async fn resolve_static(&self, url: &str) -> Option<ResolvedImage>;async fn resolve_dss(&self, user_id: &MacroUserIdStr<'_>, id: &str) -> Option<ResolvedImage>;+ /// Resolve an image URL built from the configured static file service and+ /// an attachment ID returned by an authorized channel read.+ async fn resolve_channel_image(&self, url: &str) -> Option<ResolvedImage>;}#[cfg(test)]@@ -42,6 +45,10 @@ impl MarkdownImageResolver for () {async fn resolve_dss(&self, _user_id: &MacroUserIdStr<'_>, _id: &str) -> Option<ResolvedImage> {None}++ async fn resolve_channel_image(&self, _url: &str) -> Option<ResolvedImage> {+ None+ }}#[async_trait]@@ -50,6 +57,12 @@ impl MarkdownImageResolver for ToolServiceContext {fetch_public_and_encode(url).await}+ async fn resolve_channel_image(&self, url: &str) -> Option<ResolvedImage> {+ // Unlike arbitrary markdown URLs, these URLs come from server config.+ // Allow the configured local static file service during development.+ fetch_and_encode(url).await+ }+async fn resolve_dss(&self, user_id: &MacroUserIdStr<'_>, id: &str) -> Option<ResolvedImage> {let ctx = &self.document_tool_context;let receipt = ctxdiff --git a/services/mcp_service/src/markdown_images/test.rs b/services/mcp_service/src/markdown_images/test.rsindex 77e252f061..ca47c302b6 100644--- a/services/mcp_service/src/markdown_images/test.rs+++ b/services/mcp_service/src/markdown_images/test.rs@@ -38,6 +38,10 @@ impl MarkdownImageResolver for FakeResolver {async fn resolve_dss(&self, _user_id: &MacroUserIdStr<'_>, id: &str) -> Option<ResolvedImage> {self.dss_images.get(id).cloned()}++ async fn resolve_channel_image(&self, url: &str) -> Option<ResolvedImage> {+ self.resolve_static(url).await+ }}struct CountingResolver {@@ -57,6 +61,10 @@ impl MarkdownImageResolver for CountingResolver {async fn resolve_dss(&self, _user_id: &MacroUserIdStr<'_>, _id: &str) -> Option<ResolvedImage> {None}++ async fn resolve_channel_image(&self, url: &str) -> Option<ResolvedImage> {+ self.resolve_static(url).await+ }}#[test]diff --git a/services/mcp_service/src/tool_response.rs b/services/mcp_service/src/tool_response.rsnew file mode 100644index 0000000000..015187f905--- /dev/null+++ b/services/mcp_service/src/tool_response.rs@@ -0,0 +1,163 @@+//! Convert authorized tool output into MCP text, images, and media links.++use crate::markdown_images::{MarkdownImageResolver, tool_result_with_images};+use futures::future::join_all;+use macro_user_id::user_id::MacroUserIdStr;+use rmcp::model::{CallToolResult, Content, RawResource};+use serde_json::Value;+use std::collections::HashSet;+use std::time::Duration;+use url::Url;++#[cfg(test)]+mod test;++const MAX_CHANNEL_IMAGES: usize = 8;+const CHANNEL_IMAGE_TIMEOUT: Duration = Duration::from_secs(5);++#[derive(Clone, Copy)]+enum MediaKind {+ Image,+ Video,+}++struct ChannelMedia {+ kind: MediaKind,+ entity_id: String,+ url: String,+}++/// Called only after the tool has authorized and successfully read its data.+pub(crate) async fn tool_result_with_media<R: MarkdownImageResolver>(+ resolver: &R,+ user_id: &MacroUserIdStr<'_>,+ tool_name: &str,+ static_file_base_url: &Url,+ mut value: Value,+) -> CallToolResult {+ if !matches!(+ tool_name,+ "ReadChannelMessages" | "ReadChannelThread" | "ReadChannelMessageContext"+ ) {+ return tool_result_with_images(resolver, user_id, value).await;+ }++ let mut media = Vec::new();+ add_media_urls(+ &mut value,+ static_file_base_url,+ &mut HashSet::new(),+ &mut media,+ );++ // Build both JSON representations after enrichment so text-only clients+ // also receive the URLs, including images beyond the inline image budget.+ let mut result = CallToolResult::structured(value);+ let mut image_resolutions = Vec::new();+ for attachment in media {+ match attachment.kind {+ MediaKind::Image if image_resolutions.len() < MAX_CHANNEL_IMAGES => {+ image_resolutions.push(async move {+ let image = tokio::time::timeout(+ CHANNEL_IMAGE_TIMEOUT,+ resolver.resolve_channel_image(&attachment.url),+ )+ .await+ .ok()+ .flatten()?;+ Some((attachment, image))+ });+ }+ MediaKind::Image => {}+ MediaKind::Video => {+ result.content.push(Content::resource_link(+ RawResource::new(+ attachment.url,+ format!("Channel video attachment {}", attachment.entity_id),+ )+ .with_description(+ "Download this channel video attachment to inspect it with a video-capable tool.",+ ),+ ));+ }+ }+ }++ // Video links are ready before any image fetch is awaited. Resolve the+ // bounded image batch concurrently, retaining attachment order in the output.+ for (attachment, image) in join_all(image_resolutions).await.into_iter().flatten() {+ result.content.push(Content::text(format!(+ "Channel image attachment {} ({})",+ attachment.entity_id, attachment.url,+ )));+ result+ .content+ .push(Content::image(image.data, image.mime_type));+ }+ result+}++// Channel results nest messages in timeline windows, thread parents, replies,+// and previews. Only attachment arrays in those successful tool results are+// enriched; message text is never interpreted as attachment references.+fn add_media_urls(+ value: &mut Value,+ base_url: &Url,+ seen: &mut HashSet<String>,+ media: &mut Vec<ChannelMedia>,+) {+ match value {+ Value::Array(values) => {+ for value in values {+ add_media_urls(value, base_url, seen, media);+ }+ }+ Value::Object(object) => {+ if let Some(Value::Array(attachments)) = object.get_mut("attachments") {+ for attachment in attachments {+ let Some(attachment) = attachment.as_object_mut() else {+ continue;+ };+ let kind = match attachment.get("entityType").and_then(Value::as_str) {+ Some("static/image") => MediaKind::Image,+ Some("static/video") => MediaKind::Video,+ _ => continue,+ };+ let Some(entity_id) = attachment.get("entityId").and_then(Value::as_str) else {+ continue;+ };+ // Static file IDs are path components, never URLs or paths.+ if entity_id.is_empty()+ || !entity_id+ .bytes()+ .all(|byte| byte.is_ascii_alphanumeric() || matches!(byte, b'-' | b'_'))+ {+ continue;+ }+ let mut url = base_url.clone();+ let Ok(mut path) = url.path_segments_mut() else {+ continue;+ };+ path.pop_if_empty().push("file").push(entity_id);+ drop(path);+ let url = url.to_string();+ let entity_id = entity_id.to_owned();+ attachment.insert("url".to_owned(), Value::String(url.clone()));+ if seen.insert(url.clone()) {+ media.push(ChannelMedia {+ kind,+ entity_id,+ url,+ });+ }+ }+ }+ for (key, child) in object {+ if key != "attachments" {+ add_media_urls(child, base_url, seen, media);+ }+ }+ }+ _ => {}+ }+}diff --git a/services/mcp_service/src/tool_response/test.rs b/services/mcp_service/src/tool_response/test.rsnew file mode 100644index 0000000000..c005d7bb18--- /dev/null+++ b/services/mcp_service/src/tool_response/test.rs@@ -0,0 +1,380 @@+use super::*;+use crate::markdown_images::ResolvedImage;+use async_trait::async_trait;+use serde_json::json;+use std::sync::Mutex;++#[derive(Default)]+struct RecordingResolver {+ urls: Mutex<Vec<String>>,+ missing: bool,+ gate: Option<tokio::sync::Notify>,+}++#[async_trait]+impl MarkdownImageResolver for RecordingResolver {+ async fn resolve_static(&self, url: &str) -> Option<ResolvedImage> {+ self.urls.lock().unwrap().push(url.to_owned());+ if let Some(gate) = &self.gate {+ gate.notified().await;+ }+ (!self.missing).then(|| ResolvedImage {+ data: "image-data".into(),+ mime_type: "image/webp".into(),+ })+ }++ async fn resolve_dss(&self, _user_id: &MacroUserIdStr<'_>, _id: &str) -> Option<ResolvedImage> {+ panic!("channel attachments must not be resolved as document images")+ }++ async fn resolve_channel_image(&self, url: &str) -> Option<ResolvedImage> {+ self.resolve_static(url).await+ }+}++fn attachment(entity_type: &str, entity_id: &str) -> Value {+ json!({+ "id": format!("attachment-{entity_id}"),+ "entityType": entity_type,+ "entityId": entity_id,+ "createdAt": "2026-09-01T00:00:00Z",+ })+}++fn message(entity_type: &str, entity_id: &str) -> Value {+ json!({+ "id": format!("message-{entity_id}"),+ "content": "See attached",+ "attachments": [attachment(entity_type, entity_id)],+ })+}++async fn render(resolver: &RecordingResolver, tool: &str, value: Value) -> CallToolResult {+ tool_result_with_media(+ resolver,+ &MacroUserIdStr::try_from_email("[email protected]").unwrap(),+ tool,+ &Url::parse("https://static.example/").unwrap(),+ value,+ )+ .await+}++fn assert_matching_json(result: &CallToolResult) -> &Value {+ let structured = result.structured_content.as_ref().unwrap();+ let text = result.content[0].as_text().unwrap();+ assert_eq!(+ serde_json::from_str::<Value>(&text.text).unwrap(),+ *structured+ );+ assert_eq!(result.is_error, Some(false));+ structured+}++#[tokio::test]+async fn timeline_returns_image_bytes_and_video_urls_including_previews() {+ let resolver = RecordingResolver::default();+ let mut parent = message("static/image", "image-1");+ parent["thread"] = json!({"preview": [message("static/video", "video-1")]});+ let value = json!({"messages": [parent], "navigation": {}, "omissions": []});++ let result = render(&resolver, "ReadChannelMessages", value.clone()).await;++ let enriched = assert_matching_json(&result);+ assert_eq!(enriched["messages"][0]["content"], "See attached");+ assert_eq!(+ enriched["messages"][0]["attachments"][0]["url"],+ "https://static.example/file/image-1"+ );+ assert_eq!(+ enriched["messages"][0]["thread"]["preview"][0]["attachments"][0]["url"],+ "https://static.example/file/video-1"+ );+ assert_eq!(+ enriched["messages"][0]["attachments"][0]["id"],+ value["messages"][0]["attachments"][0]["id"]+ );+ assert_eq!(+ *resolver.urls.lock().unwrap(),+ ["https://static.example/file/image-1"]+ );+ assert!(+ result.content[2]+ .as_text()+ .unwrap()+ .text+ .contains("image-1")+ );+ let image = result.content[3].as_image().unwrap();+ assert_eq!(image.data, "image-data");+ assert_eq!(image.mime_type, "image/webp");+ let video = result.content[1].as_resource_link().unwrap();+ assert_eq!(video.uri, "https://static.example/file/video-1");+ assert!(video.name.contains("video-1"));+ // static/video does not identify a container MIME type.+ assert_eq!(video.mime_type, None);+}++#[tokio::test]+async fn thread_includes_parent_replies_and_nearby_messages() {+ let resolver = RecordingResolver::default();+ let value = json!({+ "thread": {"parent": message("static/image", "parent")},+ "replies": [message("static/image", "reply")],+ "channelContext": [message("static/video", "nearby")],+ });++ let result = render(&resolver, "ReadChannelThread", value).await;++ let enriched = assert_matching_json(&result);+ for pointer in [+ "/thread/parent/attachments/0/url",+ "/replies/0/attachments/0/url",+ "/channelContext/0/attachments/0/url",+ ] {+ assert!(+ enriched+ .pointer(pointer)+ .unwrap()+ .as_str()+ .unwrap()+ .starts_with("https://static.example/file/")+ );+ }+ assert_eq!(resolver.urls.lock().unwrap().len(), 2);+ assert_eq!(+ result+ .content+ .iter()+ .filter(|c| c.as_image().is_some())+ .count(),+ 2+ );+ assert_eq!(+ result+ .content+ .iter()+ .filter(|c| c.as_resource_link().is_some())+ .count(),+ 1+ );+}++#[tokio::test]+async fn context_enriches_all_windows_and_deduplicates_repeated_media() {+ let resolver = RecordingResolver::default();+ let parent = message("static/image", "parent");+ let value = json!({+ "channelContext": {+ "before": [message("static/video", "before")],+ "anchorOrParent": parent,+ "after": [message("static/image", "after")],+ },+ "threadContext": {+ "parent": parent,+ "repliesBefore": [message("static/image", "reply-before")],+ "anchorReply": message("static/image", "anchor"),+ "repliesAfter": [message("static/video", "before")],+ },+ });++ let result = render(&resolver, "ReadChannelMessageContext", value).await;++ let enriched = assert_matching_json(&result);+ for (pointer, id) in [+ ("/channelContext/before/0", "before"),+ ("/channelContext/anchorOrParent", "parent"),+ ("/channelContext/after/0", "after"),+ ("/threadContext/parent", "parent"),+ ("/threadContext/repliesBefore/0", "reply-before"),+ ("/threadContext/anchorReply", "anchor"),+ ("/threadContext/repliesAfter/0", "before"),+ ] {+ assert_eq!(+ enriched+ .pointer(&format!("{pointer}/attachments/0/url"))+ .unwrap(),+ &json!(format!("https://static.example/file/{id}"))+ );+ }+ assert_eq!(resolver.urls.lock().unwrap().len(), 4);+ assert_eq!(+ result+ .content+ .iter()+ .filter(|c| c.as_image().is_some())+ .count(),+ 4+ );+ assert_eq!(+ result+ .content+ .iter()+ .filter(|c| c.as_resource_link().is_some())+ .count(),+ 1+ );+}++#[tokio::test]+async fn image_limit_retains_every_download_url_and_video_link() {+ let resolver = RecordingResolver::default();+ let mut messages = (0..MAX_CHANNEL_IMAGES + 2)+ .map(|i| message("static/image", &format!("image-{i}")))+ .collect::<Vec<_>>();+ messages.push(message("static/video", "video"));++ let result = render(+ &resolver,+ "ReadChannelMessages",+ json!({"messages": messages}),+ )+ .await;++ let enriched = assert_matching_json(&result);+ assert!(+ enriched["messages"]+ .as_array()+ .unwrap()+ .iter()+ .all(|message| { message["attachments"][0]["url"].is_string() })+ );+ assert_eq!(resolver.urls.lock().unwrap().len(), MAX_CHANNEL_IMAGES);+ assert_eq!(+ result+ .content+ .iter()+ .filter(|c| c.as_image().is_some())+ .count(),+ MAX_CHANNEL_IMAGES+ );+ assert!(result.content[1].as_resource_link().is_some());+}++#[tokio::test]+async fn image_fetches_start_concurrently_and_keep_the_cap_and_output_order() {+ let resolver = RecordingResolver {+ gate: Some(tokio::sync::Notify::new()),+ ..Default::default()+ };+ let mut messages = vec![message("static/image", "image-0")];+ messages.extend(+ (0..MAX_CHANNEL_IMAGES + 2).map(|i| message("static/image", &format!("image-{i}"))),+ );+ messages.push(message("static/video", "video"));+ let response = render(+ &resolver,+ "ReadChannelMessages",+ json!({"messages": messages}),+ );+ tokio::pin!(response);++ // Every selected fetch must start while the first one is still blocked.+ // A sequential implementation starts only one and fails without a timer.+ assert!(futures::poll!(&mut response).is_pending());+ let expected_urls = (0..MAX_CHANNEL_IMAGES)+ .map(|i| format!("https://static.example/file/image-{i}"))+ .collect::<Vec<_>>();+ assert_eq!(*resolver.urls.lock().unwrap(), expected_urls);++ resolver.gate.as_ref().unwrap().notify_waiters();+ let result = response.await;++ assert_matching_json(&result);+ assert_eq!(+ result.content[1].as_resource_link().unwrap().uri,+ "https://static.example/file/video"+ );+ assert_eq!(result.content.len(), 2 + MAX_CHANNEL_IMAGES * 2);+ for (i, pair) in result.content[2..].chunks_exact(2).enumerate() {+ assert!(+ pair[0]+ .as_text()+ .unwrap()+ .text+ .contains(&format!("image-{i}"))+ );+ assert!(pair[1].as_image().is_some());+ }+}++#[tokio::test]+async fn failed_images_preserve_messages_and_links_with_bounded_attempts() {+ let resolver = RecordingResolver {+ missing: true,+ ..Default::default()+ };+ let messages = (0..MAX_CHANNEL_IMAGES + 2)+ .map(|i| message("static/image", &format!("missing-{i}")))+ .collect::<Vec<_>>();++ let result = render(+ &resolver,+ "ReadChannelMessages",+ json!({"messages": messages}),+ )+ .await;++ let enriched = assert_matching_json(&result);+ assert_eq!(result.content.len(), 1);+ assert_eq!(+ enriched["messages"].as_array().unwrap().len(),+ MAX_CHANNEL_IMAGES + 2+ );+ assert_eq!(resolver.urls.lock().unwrap().len(), MAX_CHANNEL_IMAGES);+ assert!(enriched["messages"][0]["attachments"][0]["url"].is_string());+}++#[tokio::test]+async fn ignores_other_entities_malformed_ids_and_attachment_like_message_text() {+ let resolver = RecordingResolver::default();+ let value = json!({"messages": [{+ "content": message("static/image", "in-message-text").to_string(),+ "attachments": [+ attachment("document", "doc-1"),+ attachment("static/file", "file-1"),+ attachment("static/image", "../internal"),+ attachment("static/image", "https://private.example/image"),+ attachment("static/image", "id?size=99999"),+ attachment("static/video", ""),+ {"entityType": "static/image"},+ null,+ ],+ }]});++ let result = render(&resolver, "ReadChannelMessages", value.clone()).await;++ assert_eq!(assert_matching_json(&result), &value);+ assert_eq!(result.content.len(), 1);+ assert!(resolver.urls.lock().unwrap().is_empty());+}++#[tokio::test]+async fn unrelated_tool_results_are_not_treated_as_channel_attachments() {+ let resolver = RecordingResolver::default();+ let value = json!({"messages": [message("static/image", "image-1")]});++ let result = render(&resolver, "ReadContent", value.clone()).await;++ assert_eq!(assert_matching_json(&result), &value);+ assert!(resolver.urls.lock().unwrap().is_empty());+}++#[tokio::test]+async fn document_markdown_images_still_render() {+ let resolver = RecordingResolver::default();+ let value = json!({"content": {"markdown": [+ {"type": "staticImage", "url": "https://image.example/image.png"}+ ]}});++ let result = render(&resolver, "ReadContent", value.clone()).await;++ assert_eq!(assert_matching_json(&result), &value);+ assert_eq!(result.content.len(), 2);+ assert!(result.content[1].as_image().is_some());+ assert_eq!(+ *resolver.urls.lock().unwrap(),+ ["https://image.example/image.png"]+ );+}diff --git a/services/mcp_service/src/tool_service.rs b/services/mcp_service/src/tool_service.rsindex 740a2d99b3..7654c52895 100644--- a/services/mcp_service/src/tool_service.rs+++ b/services/mcp_service/src/tool_service.rs@@ -1,4 +1,5 @@-use crate::markdown_images::{MarkdownImageResolver, tool_result_with_images};+use crate::markdown_images::MarkdownImageResolver;+use crate::tool_response::tool_result_with_media;use ai_toolset::{AsyncToolCollection, RequestContext, ToolSet};use macro_user_id::user_id::MacroUserIdStr;use rmcp::{@@ -36,6 +37,8 @@ pub struct AuthenticatedToolService<Context> {/// responses (e.g. `https://macro.com`). Comes from the `APP_BASE_URL`/// environment variable.item_base_url: String,+ /// Static file CDN used for attachments returned by authorized channel reads.+ static_file_base_url: url::Url,}impl<Context> AuthenticatedToolService<Context> {@@ -44,11 +47,13 @@ impl<Context> AuthenticatedToolService<Context> {toolset: Arc<AsyncToolCollection<Context>>,context: Context,item_base_url: String,+ static_file_base_url: url::Url,) -> Self {Self {toolset,context,item_base_url,+ static_file_base_url,}}@@ -109,6 +114,10 @@ where"This server provides tools for interacting with a user's Macro workspace. \Use ContentSearch and NameSearch to find entities. \Use ReadContent, ReadMetadata, and ReadThread to read them. \+ Use ReadChannelMessages, ReadChannelThread, and ReadChannelMessageContext \+ to read channel messages and their attachments. Channel image attachments \+ include inline images when available; image and video attachments include \+ downloadable URLs. Use a video-capable tool to inspect video URLs. \Use CreateDocument to create new documents. \Use EditDocument to edit existing documents. \Use ListEntities to browse recent items.\n\n{}",@@ -163,7 +172,14 @@ where})?;match result {- Ok(value) => Ok(tool_result_with_images(&self.context, &user_id, value).await),+ Ok(value) => Ok(tool_result_with_media(+ &self.context,+ &user_id,+ &request.name,+ &self.static_file_base_url,+ value,+ )+ .await),Err(error) => Ok(rmcp::model::CallToolResult::error(vec![Content::text(error.description,)])),diff --git a/services/mcp_service/src/tool_service/test.rs b/services/mcp_service/src/tool_service/test.rsindex 260c46ae3b..1c1e939a46 100644--- a/services/mcp_service/src/tool_service/test.rs+++ b/services/mcp_service/src/tool_service/test.rs@@ -7,6 +7,7 @@ fn empty_service() -> AuthenticatedToolService<()> {Arc::new(AsyncToolCollection::new()),(),"https://macro.com".to_owned(),+ url::Url::parse("https://static-file-service.macro.com").unwrap(),)}@@ -58,6 +59,10 @@ async fn server_instructions_describe_available_workflows() {"ReadContent","ReadMetadata","ReadThread",+ "ReadChannelMessages",+ "ReadChannelThread",+ "ReadChannelMessageContext",+ "downloadable URLs","CreateDocument","ListEntities",] {