use brontes::ToolAnnotations;
use pretty_assertions::assert_eq;
#[test]
fn default_returns_none() {
assert!(
ToolAnnotations::default().to_rmcp().is_none(),
"all-None annotations must produce None"
);
}
#[test]
fn title_empty_string_propagates() {
let ann = ToolAnnotations {
title: Some(String::new()),
..Default::default()
};
let rmcp = ann
.to_rmcp()
.expect("Some(\"\".into()) is a set field, should not collapse to None");
assert_eq!(rmcp.title.as_deref(), Some(""));
assert!(rmcp.read_only_hint.is_none());
assert!(rmcp.destructive_hint.is_none());
assert!(rmcp.idempotent_hint.is_none());
assert!(rmcp.open_world_hint.is_none());
}
#[test]
fn all_hints_serialize_to_pinned_wire_shape() {
let ann = ToolAnnotations {
title: Some("Delete Resource".into()),
read_only_hint: Some(true),
destructive_hint: Some(false),
idempotent_hint: Some(true),
open_world_hint: Some(false),
};
let rmcp = ann
.to_rmcp()
.expect("Some on at least one field — must return Some");
let json = serde_json::to_value(&rmcp).expect("serialisation must succeed");
assert_eq!(
json,
serde_json::json!({
"title": "Delete Resource",
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": false,
})
);
}