use crate::mcp::protocol::ToolAnnotations;
pub const READ_ONLY: ToolAnnotations = ToolAnnotations {
read_only: true,
destructive: false,
idempotent: true,
open_world: false,
};
pub const CONNECT: ToolAnnotations = ToolAnnotations {
read_only: false,
destructive: false,
idempotent: true,
open_world: false,
};
pub const ACTION: ToolAnnotations = ToolAnnotations {
read_only: false,
destructive: false,
idempotent: false,
open_world: false,
};
pub const DESTRUCTIVE: ToolAnnotations = ToolAnnotations {
read_only: false,
destructive: true,
idempotent: false,
open_world: false,
};
pub const OPEN_WORLD: ToolAnnotations = ToolAnnotations {
read_only: true,
destructive: false,
idempotent: true,
open_world: true,
};
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn read_only_annotations_are_safe() {
assert!(READ_ONLY.read_only);
assert!(!READ_ONLY.destructive);
assert!(READ_ONLY.idempotent);
assert!(!READ_ONLY.open_world);
}
#[test]
fn connect_annotations_are_not_read_only() {
assert!(!CONNECT.read_only);
assert!(CONNECT.idempotent);
assert!(!CONNECT.destructive);
assert!(!CONNECT.open_world);
}
#[test]
fn action_is_not_idempotent() {
assert!(!ACTION.idempotent);
assert!(!ACTION.read_only);
assert!(!ACTION.open_world);
}
#[test]
fn destructive_annotations_flag_correctly() {
assert!(DESTRUCTIVE.destructive);
assert!(!DESTRUCTIVE.idempotent);
assert!(!DESTRUCTIVE.open_world);
}
#[test]
fn open_world_sets_open_world_flag() {
assert!(OPEN_WORLD.open_world);
assert!(OPEN_WORLD.read_only);
assert!(!OPEN_WORLD.destructive);
}
}