Skip to content

Commit cf8d285

Browse files
Refactor: relax validation for ResourceLink and update comments
- Remove the requirement for description and mimeType when creating a ResourceLink, now only uri and name are mandatory. - Update the comment for the mimeType field from "resource link" to "resource" for terminology consistency.
1 parent dcd5c10 commit cf8d285

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

mcp/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ type ResourceLink struct {
875875
Name string `json:"name"`
876876
// The description of the resource.
877877
Description string `json:"description"`
878-
// The MIME type of the resource link.
878+
// The MIME type of the resource.
879879
MIMEType string `json:"mimeType"`
880880
}
881881

mcp/utils.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,8 @@ func NewResourceLink(uri, name, description, mimeType string) ResourceLink {
228228
Type: "resource_link",
229229
URI: uri,
230230
Name: name,
231-
MIMEType: mimeType,
232231
Description: description,
232+
MIMEType: mimeType,
233233
}
234234
}
235235

@@ -492,8 +492,8 @@ func ParseContent(contentMap map[string]any) (Content, error) {
492492
name := ExtractString(contentMap, "name")
493493
description := ExtractString(contentMap, "description")
494494
mimeType := ExtractString(contentMap, "mimeType")
495-
if uri == "" || name == "" || description == "" || mimeType == "" {
496-
return nil, fmt.Errorf("resource_link uri, name, description or mimeType is missing")
495+
if uri == "" || name == "" {
496+
return nil, fmt.Errorf("resource_link uri or name is missing")
497497
}
498498
return NewResourceLink(uri, name, description, mimeType), nil
499499

0 commit comments

Comments
 (0)