@@ -75,6 +75,8 @@ type Tool struct {
7575 InputSchema ToolInputSchema `json:"inputSchema"`
7676 // Alternative to InputSchema - allows arbitrary JSON Schema to be provided
7777 RawInputSchema json.RawMessage `json:"-"` // Hide this from JSON marshaling
78+ // Optional properties describing tool behavior
79+ Annotations ToolAnnotation `json:"annotations"`
7880}
7981
8082// MarshalJSON implements the json.Marshaler interface for Tool.
@@ -109,6 +111,19 @@ type ToolInputSchema struct {
109111 Required []string `json:"required,omitempty"`
110112}
111113
114+ type ToolAnnotation struct {
115+ // Human-readable title for the tool
116+ Title string `json:"title,omitempty"`
117+ // If true, the tool does not modify its environment
118+ ReadOnlyHint bool `json:"readOnlyHint,omitempty"`
119+ // If true, the tool may perform destructive updates
120+ DestructiveHint bool `json:"destructiveHint,omitempty"`
121+ // If true, repeated calls with same args have no additional effect
122+ IdempotentHint bool `json:"idempotentHint,omitempty"`
123+ // If true, tool interacts with external entities
124+ OpenWorldHint bool `json:"openWorldHint,omitempty"`
125+ }
126+
112127// ToolOption is a function that configures a Tool.
113128// It provides a flexible way to set various properties of a Tool using the functional options pattern.
114129type ToolOption func (* Tool )
@@ -132,6 +147,13 @@ func NewTool(name string, opts ...ToolOption) Tool {
132147 Properties : make (map [string ]interface {}),
133148 Required : nil , // Will be omitted from JSON if empty
134149 },
150+ Annotations : ToolAnnotation {
151+ Title : "" ,
152+ ReadOnlyHint : false ,
153+ DestructiveHint : true ,
154+ IdempotentHint : false ,
155+ OpenWorldHint : true ,
156+ },
135157 }
136158
137159 for _ , opt := range opts {
@@ -166,6 +188,12 @@ func WithDescription(description string) ToolOption {
166188 }
167189}
168190
191+ func WithToolAnnotation (annotation ToolAnnotation ) ToolOption {
192+ return func (t * Tool ) {
193+ t .Annotations = annotation
194+ }
195+ }
196+
169197//
170198// Common Property Options
171199//
0 commit comments