@@ -139,13 +139,13 @@ type ToolAnnotation struct {
139139 // Human-readable title for the tool
140140 Title string `json:"title,omitempty"`
141141 // If true, the tool does not modify its environment
142- ReadOnlyHint bool `json:"readOnlyHint,omitempty"`
142+ ReadOnlyHint * bool `json:"readOnlyHint,omitempty"`
143143 // If true, the tool may perform destructive updates
144- DestructiveHint bool `json:"destructiveHint,omitempty"`
144+ DestructiveHint * bool `json:"destructiveHint,omitempty"`
145145 // If true, repeated calls with same args have no additional effect
146- IdempotentHint bool `json:"idempotentHint,omitempty"`
146+ IdempotentHint * bool `json:"idempotentHint,omitempty"`
147147 // If true, tool interacts with external entities
148- OpenWorldHint bool `json:"openWorldHint,omitempty"`
148+ OpenWorldHint * bool `json:"openWorldHint,omitempty"`
149149}
150150
151151// ToolOption is a function that configures a Tool.
@@ -173,10 +173,10 @@ func NewTool(name string, opts ...ToolOption) Tool {
173173 },
174174 Annotations : ToolAnnotation {
175175 Title : "" ,
176- ReadOnlyHint : false ,
177- DestructiveHint : true ,
178- IdempotentHint : false ,
179- OpenWorldHint : true ,
176+ ReadOnlyHint : ToBoolPtr ( false ) ,
177+ DestructiveHint : ToBoolPtr ( true ) ,
178+ IdempotentHint : ToBoolPtr ( false ) ,
179+ OpenWorldHint : ToBoolPtr ( true ) ,
180180 },
181181 }
182182
@@ -212,12 +212,53 @@ func WithDescription(description string) ToolOption {
212212 }
213213}
214214
215+ // WithToolAnnotation adds optional hints about the Tool.
215216func WithToolAnnotation (annotation ToolAnnotation ) ToolOption {
216217 return func (t * Tool ) {
217218 t .Annotations = annotation
218219 }
219220}
220221
222+ // WithTitleAnnotation sets the Title field of the Tool's Annotations.
223+ // It provides a human-readable title for the tool.
224+ func WithTitleAnnotation (title string ) ToolOption {
225+ return func (t * Tool ) {
226+ t .Annotations .Title = title
227+ }
228+ }
229+
230+ // WithReadOnlyHintAnnotation sets the ReadOnlyHint field of the Tool's Annotations.
231+ // If true, it indicates the tool does not modify its environment.
232+ func WithReadOnlyHintAnnotation (value bool ) ToolOption {
233+ return func (t * Tool ) {
234+ t .Annotations .ReadOnlyHint = & value
235+ }
236+ }
237+
238+ // WithDestructiveHintAnnotation sets the DestructiveHint field of the Tool's Annotations.
239+ // If true, it indicates the tool may perform destructive updates.
240+ func WithDestructiveHintAnnotation (value bool ) ToolOption {
241+ return func (t * Tool ) {
242+ t .Annotations .DestructiveHint = & value
243+ }
244+ }
245+
246+ // WithIdempotentHintAnnotation sets the IdempotentHint field of the Tool's Annotations.
247+ // If true, it indicates repeated calls with the same arguments have no additional effect.
248+ func WithIdempotentHintAnnotation (value bool ) ToolOption {
249+ return func (t * Tool ) {
250+ t .Annotations .IdempotentHint = & value
251+ }
252+ }
253+
254+ // WithOpenWorldHintAnnotation sets the OpenWorldHint field of the Tool's Annotations.
255+ // If true, it indicates the tool interacts with external entities.
256+ func WithOpenWorldHintAnnotation (value bool ) ToolOption {
257+ return func (t * Tool ) {
258+ t .Annotations .OpenWorldHint = & value
259+ }
260+ }
261+
221262//
222263// Common Property Options
223264//
0 commit comments