Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions rust/crates/sift_cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).

### What's New

- New `list_file_attachments` and `download_file_attachment` tools let agents
find the files attached to runs, assets, annotations and their comments, test
reports, and test steps, and fetch each one through a short-lived download
URL. Agents used to send users to the run page to download these by hand.

## [v0.9.1] - November 17, 2026

### What's New
Expand Down
12 changes: 11 additions & 1 deletion rust/crates/sift_cli/assets/skills/sift/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,23 @@ tool.
connectivity check; when it fails, expect every other Sift tool to fail too.
- **Discovery:** `list_assets`, `list_runs`, `list_channels`, `list_reports`,
`list_report_templates`, `list_rules`, `list_rule_versions`, `list_annotations`,
`list_artifacts`, `list_artifact_versions`, `list_webhooks`.
`list_artifacts`, `list_artifact_versions`, `list_webhooks`,
`list_file_attachments`.
- **Artifacts:** `download_artifact` (latest version, or pin `artifact_version_id`),
`list_artifact_versions` for one artifact's history, newest first.
The artifact tools, including `list_artifacts` and the artifact writes below,
are enabled per account by the agents feature flag resolved when the MCP
server starts, so they may be absent from the tool list. Enabling them
requires an account setting and an MCP restart.
- **File attachments:** `list_file_attachments` lists the files attached to
runs, assets, annotations and their comments, test reports, and test steps;
scope it with `entity_ids`. `download_file_attachment` returns a short-lived signed URL
for one file that you can fetch without Sift credentials. Use these when a
user asks for a file attached to a run or asset, instead of sending them to
the run page to download it. Artifact files never appear there, so when the
user wants everything on a run or asset, also call `list_artifacts` with
`links.exists(l, l.entity_type == "RUN" && l.entity_id == "<run id>")`
(`"ASSET"` for an asset).
- **Derived channels:** `list_calculated_channels`,
`list_calculated_channel_versions`, `list_user_defined_functions`,
`list_user_defined_function_versions`.
Expand Down
10 changes: 7 additions & 3 deletions rust/crates/sift_mcp/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ use crate::service::{
annotations::AnnotationService, artifacts::ArtifactService, assets::AssetService,
calculated_channels::CalculatedChannelService, channels::ChannelService, data::DataService,
declarative::DeclarativeService, docs::DocsService, ingest::IngestService, ping::PingService,
report_templates::ReportTemplateService, reports::ReportService,
rule_evaluation::RuleEvaluationService, rules::RuleService, runs::RunService,
test_reports::TestReportService, url::UrlService,
remote_files::RemoteFileService, report_templates::ReportTemplateService,
reports::ReportService, rule_evaluation::RuleEvaluationService, rules::RuleService,
runs::RunService, test_reports::TestReportService, url::UrlService,
user_defined_functions::UserDefinedFunctionService, users::UserService,
webhooks::WebhookService,
};
Expand All @@ -71,6 +71,7 @@ pub struct SiftMcpServer {
pub url_service: UrlService,
pub ingest_service: IngestService,
pub ping_service: PingService,
pub remote_file_service: RemoteFileService,
pub run_service: RunService,
pub report_service: ReportService,
pub report_template_service: ReportTemplateService,
Expand Down Expand Up @@ -235,6 +236,7 @@ impl SiftMcpServer {
tool_router.merge(Self::rule_evaluation_router());
tool_router.merge(Self::annotations_router());
tool_router.merge(Self::artifacts_router());
tool_router.merge(Self::file_attachments_router());
tool_router.merge(Self::test_reports_router());
tool_router.merge(Self::docs_router());
tool_router.merge(Self::user_defined_functions_router());
Expand Down Expand Up @@ -296,6 +298,7 @@ impl SiftMcpServer {
let url_service = UrlService::new(app_uri);
let ingest_service = IngestService::new(channel.clone());
let ping_service = PingService::new(channel.clone(), retry_policy.clone());
let remote_file_service = RemoteFileService::new(channel.clone(), retry_policy.clone());
let run_service = RunService::new(channel.clone(), retry_policy.clone());
let report_service = ReportService::new(channel.clone(), retry_policy.clone());
let report_template_service =
Expand All @@ -321,6 +324,7 @@ impl SiftMcpServer {
url_service,
ingest_service,
ping_service,
remote_file_service,
run_service,
report_service,
report_template_service,
Expand Down
43 changes: 12 additions & 31 deletions rust/crates/sift_mcp/src/service/artifacts/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use anyhow::{Context, Result, anyhow, bail};
use anyhow::{Context, Result, anyhow};
use sift_rs::{
SiftChannel,
artifacts::v1::{
Expand All @@ -9,16 +9,13 @@ use sift_rs::{
artifact_service_client::ArtifactServiceClient,
},
metadata::v1::MetadataValue,
remote_files::v1::{
GetRemoteFileDownloadUrlRequest, remote_file_service_client::RemoteFileServiceClient,
},
};

use std::path::Path;

use crate::policy::{RetryPolicy, once, with_retry};
use crate::service::common;
use crate::service::remote_files::RemoteFileUploader;
use crate::service::remote_files::{RemoteFileService, RemoteFileUploader};

#[cfg(test)]
mod test;
Expand Down Expand Up @@ -92,6 +89,7 @@ impl UpdatePath {
pub struct ArtifactService {
channel: SiftChannel,
policy: RetryPolicy,
remote_files: RemoteFileService,
// Absent only when the server runs without a REST endpoint (some tests);
// creating an artifact with a file requires it.
uploader: Option<RemoteFileUploader>,
Expand All @@ -100,6 +98,7 @@ pub struct ArtifactService {
impl ArtifactService {
pub fn new(channel: SiftChannel, policy: RetryPolicy) -> Self {
Self {
remote_files: RemoteFileService::new(channel.clone(), policy.clone()),
channel,
policy,
uploader: None,
Expand Down Expand Up @@ -250,7 +249,12 @@ impl ArtifactService {
.as_ref()
.and_then(|version| version.remote_file_id.clone());
let download_url = match remote_file_id {
Some(remote_file_id) => Some(self.download_url(remote_file_id).await?),
Some(remote_file_id) => Some(
self.remote_files
.download_url(remote_file_id)
.await
.context("failed to get artifact download url")?,
),
None => None,
};
Ok(ArtifactView {
Expand Down Expand Up @@ -407,7 +411,7 @@ impl ArtifactService {
.as_ref()
.and_then(|version| version.remote_file_id.clone());
let download_url = match remote_file_id {
Some(remote_file_id) => self.download_url(remote_file_id).await.ok(),
Some(remote_file_id) => self.remote_files.download_url(remote_file_id).await.ok(),
None => None,
};
return Ok(ArtifactView {
Expand Down Expand Up @@ -451,7 +455,7 @@ impl ArtifactService {
.as_ref()
.and_then(|version| version.remote_file_id.clone());
let download_url = match remote_file_id {
Some(remote_file_id) => self.download_url(remote_file_id).await.ok(),
Some(remote_file_id) => self.remote_files.download_url(remote_file_id).await.ok(),
None => None,
};
Ok(ArtifactView {
Expand Down Expand Up @@ -486,27 +490,4 @@ impl ArtifactService {
.artifact
.ok_or_else(|| anyhow!("get artifact response missing artifact"))
}

async fn download_url(&self, remote_file_id: String) -> Result<String> {
let channel = self.channel.clone();
let resp = with_retry(&self.policy, move || {
let channel = channel.clone();
let remote_file_id = remote_file_id.clone();
async move {
let mut client = RemoteFileServiceClient::new(channel);
client
.get_remote_file_download_url(GetRemoteFileDownloadUrlRequest {
remote_file_id,
})
.await
.map(|resp| resp.into_inner())
}
})
.await
.context("failed to get artifact download url")?;
if resp.download_url.is_empty() {
bail!("download url response was empty");
}
Ok(resp.download_url)
}
}
10 changes: 9 additions & 1 deletion rust/crates/sift_mcp/src/service/artifacts/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,15 @@ async fn download_artifact_rejects_empty_download_url() {
.download_artifact("art-1".into(), None)
.await
.expect_err("empty url is an error");
assert!(err.to_string().contains("download url response was empty"));
let message = format!("{err:#}");
assert!(
message.contains("failed to get artifact download url"),
"{message}"
);
assert!(
message.contains("download url response was empty"),
"{message}"
);
}

#[tokio::test]
Expand Down
Loading
Loading