pub struct Annotations {
pub audience: Vec<Role>,
pub priority: Option<f64>,
pub last_modified: Option<String>,
pub extensions: Extensions,
}Expand description
Annotations, added in 2025-03-26 (PR #185).
Modeled rather than dropped, because they are advisory metadata a client uses to decide how to present a result, and a tool that says it is read-only means something to the caller.
Not Eq, and neither is anything that holds one: priority is a
floating-point number and neither f32 nor f64 is a valid Eq type,
because of NaN. The cost is that a content block cannot be a HashMap
key, which nothing needs — blocks live in a Vec inside a result.
priority is f64 rather than the f32 that would be conventional for a
0.0–1.0 quantity, because every revision’s generated Annotations
spells it f64 and this crate’s whole job is to carry a peer’s value
through unchanged. Narrowing on the way in and widening on the way out is
not a round trip: 0.1_f32 is not 0.1_f64, and a bridge forwarding
annotations would quietly change a number the sender chose.
Fields§
§audience: Vec<Role>The audience this block is meant for.
priority: Option<f64>How important this block is, 0.0–1.0.
f64 to match the wire exactly; see the type’s docs.
last_modified: Option<String>The last time the resource was modified, ISO 8601.
extensions: ExtensionsUnmodelled fields.
Implementations§
Source§impl Annotations
impl Annotations
Sourcepub fn required_features(&self) -> FeatureSet
pub fn required_features(&self) -> FeatureSet
What these annotations need.
Annotations as a field need nothing: 2024-11-05 carries an
untyped annotations on every content block, so a block with an
audience and a priority lowers onto it and the value survives as JSON.
That is why this is not Feature::ToolAnnotations, which gates the
typed form added in 2025-03-26.
lastModified is different in kind, not degree. It exists only in the
typed object, so an older revision cannot hold it at all — not as a
field, not even untyped — and dropping it would lose information the
sender put there. So it, and only it, requires 2025-06-18.