Skip to main content

objectiveai_sdk/mcp/tool/
tool_annotations.rs

1//! Tool annotation metadata.
2
3use schemars::JsonSchema;
4use serde::{Deserialize, Serialize};
5
6/// Additional metadata about a tool to help clients decide how to display
7/// or control its use.
8#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
9#[schemars(rename = "mcp.tool.ToolAnnotations")]
10pub struct ToolAnnotations {
11    /// A human-readable title for the tool.
12    #[serde(skip_serializing_if = "Option::is_none")]
13    #[schemars(extend("omitempty" = true))]
14    pub title: Option<String>,
15    /// If true, the tool does not modify its environment.
16    #[serde(skip_serializing_if = "Option::is_none")]
17    #[schemars(extend("omitempty" = true))]
18    #[serde(rename = "readOnlyHint")]
19    pub read_only_hint: Option<bool>,
20    /// If true, the tool may perform destructive updates.
21    #[serde(skip_serializing_if = "Option::is_none")]
22    #[schemars(extend("omitempty" = true))]
23    #[serde(rename = "destructiveHint")]
24    pub destructive_hint: Option<bool>,
25    /// If true, calling the tool repeatedly with the same arguments
26    /// has no additional effect.
27    #[serde(skip_serializing_if = "Option::is_none")]
28    #[schemars(extend("omitempty" = true))]
29    #[serde(rename = "idempotentHint")]
30    pub idempotent_hint: Option<bool>,
31    /// If true, the tool interacts with the external world.
32    #[serde(skip_serializing_if = "Option::is_none")]
33    #[schemars(extend("omitempty" = true))]
34    #[serde(rename = "openWorldHint")]
35    pub open_world_hint: Option<bool>,
36}