feat(server): add annotation to tool macro (#184)
skip serializing the tool annotations if none, fixes mcp inspector
This commit is contained in:
parent
5e4e77efa5
commit
68ddea3ad5
1 changed files with 124 additions and 3 deletions
|
|
@ -37,11 +37,13 @@ pub struct Tool {
|
|||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
||||
pub struct ToolAnnotations {
|
||||
/// A human-readable title for the tool.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub title: Option<String>,
|
||||
|
||||
/// If true, the tool does not modify its environment.
|
||||
///
|
||||
/// Default: false
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub read_only_hint: Option<bool>,
|
||||
|
||||
/// If true, the tool may perform destructive updates to its environment.
|
||||
|
|
@ -51,6 +53,7 @@ pub struct ToolAnnotations {
|
|||
///
|
||||
/// Default: true
|
||||
/// A human-readable description of the tool's purpose.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub destructive_hint: Option<bool>,
|
||||
|
||||
/// If true, calling the tool repeatedly with the same arguments
|
||||
|
|
@ -59,6 +62,7 @@ pub struct ToolAnnotations {
|
|||
/// (This property is meaningful only when `readOnlyHint == false`)
|
||||
///
|
||||
/// Default: false.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub idempotent_hint: Option<bool>,
|
||||
|
||||
/// If true, this tool may interact with an "open world" of external
|
||||
|
|
@ -67,6 +71,7 @@ pub struct ToolAnnotations {
|
|||
/// of a memory tool is not.
|
||||
///
|
||||
/// Default: true
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub open_world_hint: Option<bool>,
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue