cortex-sdk 1.3.0

SDK for developing Cortex plugins — tools, skills, and extensions
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use cortex_sdk::{Attachment, ToolResult};

#[test]
fn tool_result_can_carry_text_and_media_without_runtime_types() {
    let image = Attachment {
        media_type: "image".to_string(),
        mime_type: "image/png".to_string(),
        url: "file:///tmp/image.png".to_string(),
        caption: Some("generated preview".to_string()),
        size: Some(1024),
    };
    let result = ToolResult::success("created").with_media(image);

    assert_eq!(result.output, "created");
    assert_eq!(result.media.len(), 1);
    assert!(!result.is_error);
}