1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//! Tool annotation hints forwarded to MCP clients.
//!
//! [`ToolAnnotations`] is the brontes-side representation of an optional
//! title and four optional behavior hints defined by the Model Context
//! Protocol. When all fields are `None` it serialises to nothing; when
//! at least one field is set it converts to an `rmcp::model::ToolAnnotations`
//! that carries exactly the fields that were provided.
//!
//! ## Wire-shape divergence from ophis
//!
//! ophis (the Go reference) treats boolean hints as a three-state value via
//! `*bool`: unset (omitted), `true`, or `false`. When a boolean hint is
//! explicitly set to `false`, ophis omits it from the JSON output in some
//! code paths because the zero-value of `bool` in Go is `false` and the MCP
//! field defaults are often `false`.
//!
//! brontes uses `Option<bool>` end-to-end. `Some(false)` is a deliberate
//! override and is forwarded to rmcp, which serialises it as
//! `"readOnlyHint": false` (or whichever field) via
//! `#[serde(skip_serializing_if = "Option::is_none")]`. The result is that
//! brontes always emits explicit `false` values when they are set, giving
//! MCP clients an unambiguous signal. Consumers that want the field omitted
//! should leave it as `None`.
/// Annotation hints attached to an MCP tool.
///
/// All fields are optional. A [`ToolAnnotations`] where every field is
/// `None` (i.e. [`Default::default()`]) carries no information and
/// [`to_rmcp`](ToolAnnotations::to_rmcp) returns `None` for it.
///
/// Setting a boolean hint to `Some(false)` is an explicit override and
/// is forwarded to the wire as-is; see the crate-level divergence note
/// on wire-shape behaviour for details.