@@ -198,7 +198,7 @@ func NewPromptMessage(role Role, content Content) PromptMessage {
198198// Helper function to create a new TextContent
199199func NewTextContent (text string ) TextContent {
200200 return TextContent {
201- Type : "text" ,
201+ Type : ContentTypeText ,
202202 Text : text ,
203203 }
204204}
@@ -207,7 +207,7 @@ func NewTextContent(text string) TextContent {
207207// Helper function to create a new ImageContent
208208func NewImageContent (data , mimeType string ) ImageContent {
209209 return ImageContent {
210- Type : "image" ,
210+ Type : ContentTypeImage ,
211211 Data : data ,
212212 MIMEType : mimeType ,
213213 }
@@ -216,7 +216,7 @@ func NewImageContent(data, mimeType string) ImageContent {
216216// Helper function to create a new AudioContent
217217func NewAudioContent (data , mimeType string ) AudioContent {
218218 return AudioContent {
219- Type : "audio" ,
219+ Type : ContentTypeAudio ,
220220 Data : data ,
221221 MIMEType : mimeType ,
222222 }
@@ -225,7 +225,7 @@ func NewAudioContent(data, mimeType string) AudioContent {
225225// Helper function to create a new ResourceLink
226226func NewResourceLink (uri , name , description , mimeType string ) ResourceLink {
227227 return ResourceLink {
228- Type : "resource_link" ,
228+ Type : ContentTypeLink ,
229229 URI : uri ,
230230 Name : name ,
231231 Description : description ,
@@ -236,7 +236,7 @@ func NewResourceLink(uri, name, description, mimeType string) ResourceLink {
236236// Helper function to create a new EmbeddedResource
237237func NewEmbeddedResource (resource ResourceContents ) EmbeddedResource {
238238 return EmbeddedResource {
239- Type : "resource" ,
239+ Type : ContentTypeResource ,
240240 Resource : resource ,
241241 }
242242}
@@ -246,7 +246,7 @@ func NewToolResultText(text string) *CallToolResult {
246246 return & CallToolResult {
247247 Content : []Content {
248248 TextContent {
249- Type : "text" ,
249+ Type : ContentTypeText ,
250250 Text : text ,
251251 },
252252 },
@@ -296,11 +296,11 @@ func NewToolResultImage(text, imageData, mimeType string) *CallToolResult {
296296 return & CallToolResult {
297297 Content : []Content {
298298 TextContent {
299- Type : "text" ,
299+ Type : ContentTypeText ,
300300 Text : text ,
301301 },
302302 ImageContent {
303- Type : "image" ,
303+ Type : ContentTypeImage ,
304304 Data : imageData ,
305305 MIMEType : mimeType ,
306306 },
@@ -313,11 +313,11 @@ func NewToolResultAudio(text, imageData, mimeType string) *CallToolResult {
313313 return & CallToolResult {
314314 Content : []Content {
315315 TextContent {
316- Type : "text" ,
316+ Type : ContentTypeText ,
317317 Text : text ,
318318 },
319319 AudioContent {
320- Type : "audio" ,
320+ Type : ContentTypeAudio ,
321321 Data : imageData ,
322322 MIMEType : mimeType ,
323323 },
@@ -333,11 +333,11 @@ func NewToolResultResource(
333333 return & CallToolResult {
334334 Content : []Content {
335335 TextContent {
336- Type : "text" ,
336+ Type : ContentTypeText ,
337337 Text : text ,
338338 },
339339 EmbeddedResource {
340- Type : "resource" ,
340+ Type : ContentTypeResource ,
341341 Resource : resource ,
342342 },
343343 },
@@ -350,7 +350,7 @@ func NewToolResultError(text string) *CallToolResult {
350350 return & CallToolResult {
351351 Content : []Content {
352352 TextContent {
353- Type : "text" ,
353+ Type : ContentTypeText ,
354354 Text : text ,
355355 },
356356 },
@@ -368,7 +368,7 @@ func NewToolResultErrorFromErr(text string, err error) *CallToolResult {
368368 return & CallToolResult {
369369 Content : []Content {
370370 TextContent {
371- Type : "text" ,
371+ Type : ContentTypeText ,
372372 Text : text ,
373373 },
374374 },
@@ -383,7 +383,7 @@ func NewToolResultErrorf(format string, a ...any) *CallToolResult {
383383 return & CallToolResult {
384384 Content : []Content {
385385 TextContent {
386- Type : "text" ,
386+ Type : ContentTypeText ,
387387 Text : fmt .Sprintf (format , a ... ),
388388 },
389389 },
@@ -505,27 +505,27 @@ func ParseContent(contentMap map[string]any) (Content, error) {
505505 contentType := ExtractString (contentMap , "type" )
506506
507507 switch contentType {
508- case "text" :
508+ case ContentTypeText :
509509 text := ExtractString (contentMap , "text" )
510510 return NewTextContent (text ), nil
511511
512- case "image" :
512+ case ContentTypeImage :
513513 data := ExtractString (contentMap , "data" )
514514 mimeType := ExtractString (contentMap , "mimeType" )
515515 if data == "" || mimeType == "" {
516516 return nil , fmt .Errorf ("image data or mimeType is missing" )
517517 }
518518 return NewImageContent (data , mimeType ), nil
519519
520- case "audio" :
520+ case ContentTypeAudio :
521521 data := ExtractString (contentMap , "data" )
522522 mimeType := ExtractString (contentMap , "mimeType" )
523523 if data == "" || mimeType == "" {
524524 return nil , fmt .Errorf ("audio data or mimeType is missing" )
525525 }
526526 return NewAudioContent (data , mimeType ), nil
527527
528- case "resource_link" :
528+ case ContentTypeLink :
529529 uri := ExtractString (contentMap , "uri" )
530530 name := ExtractString (contentMap , "name" )
531531 description := ExtractString (contentMap , "description" )
@@ -535,7 +535,7 @@ func ParseContent(contentMap map[string]any) (Content, error) {
535535 }
536536 return NewResourceLink (uri , name , description , mimeType ), nil
537537
538- case "resource" :
538+ case ContentTypeResource :
539539 resourceMap := ExtractMap (contentMap , "resource" )
540540 if resourceMap == nil {
541541 return nil , fmt .Errorf ("resource is missing" )
0 commit comments