@@ -152,6 +152,18 @@ func (m *Meta) UnmarshalJSON(data []byte) error {
152
152
return nil
153
153
}
154
154
155
+ func NewMetaFromMap (m map [string ]any ) * Meta {
156
+ progressToken := m ["progressToken" ]
157
+ if progressToken != nil {
158
+ delete (m , "progressToken" )
159
+ }
160
+
161
+ return & Meta {
162
+ ProgressToken : progressToken ,
163
+ AdditionalFields : m ,
164
+ }
165
+ }
166
+
155
167
type Request struct {
156
168
Method string `json:"method"`
157
169
Params RequestParams `json:"params,omitempty"`
@@ -233,7 +245,7 @@ func (p *NotificationParams) UnmarshalJSON(data []byte) error {
233
245
type Result struct {
234
246
// This result property is reserved by the protocol to allow clients and
235
247
// servers to attach additional metadata to their responses.
236
- Meta map [ string ] any `json:"_meta,omitempty"`
248
+ Meta * Meta `json:"_meta,omitempty"`
237
249
}
238
250
239
251
// RequestId is a uniquely identifying ID for a request in JSON-RPC.
@@ -644,6 +656,8 @@ type ResourceUpdatedNotificationParams struct {
644
656
// Resource represents a known resource that the server is capable of reading.
645
657
type Resource struct {
646
658
Annotated
659
+ // Meta is a metadata object that is reserved by MCP for storing additional information.
660
+ Meta * Meta `json:"_meta,omitempty"`
647
661
// The URI of this resource.
648
662
URI string `json:"uri"`
649
663
// A human-readable name for this resource.
@@ -668,6 +682,8 @@ func (r Resource) GetName() string {
668
682
// on the server.
669
683
type ResourceTemplate struct {
670
684
Annotated
685
+ // Meta is a metadata object that is reserved by MCP for storing additional information.
686
+ Meta * Meta `json:"_meta,omitempty"`
671
687
// A URI template (according to RFC 6570) that can be used to construct
672
688
// resource URIs.
673
689
URITemplate * URITemplate `json:"uriTemplate"`
@@ -697,6 +713,8 @@ type ResourceContents interface {
697
713
}
698
714
699
715
type TextResourceContents struct {
716
+ // Meta is a metadata object that is reserved by MCP for storing additional information.
717
+ Meta * Meta `json:"_meta,omitempty"`
700
718
// The URI of this resource.
701
719
URI string `json:"uri"`
702
720
// The MIME type of this resource, if known.
@@ -709,6 +727,8 @@ type TextResourceContents struct {
709
727
func (TextResourceContents ) isResourceContents () {}
710
728
711
729
type BlobResourceContents struct {
730
+ // Meta is a metadata object that is reserved by MCP for storing additional information.
731
+ Meta * Meta `json:"_meta,omitempty"`
712
732
// The URI of this resource.
713
733
URI string `json:"uri"`
714
734
// The MIME type of this resource, if known.
@@ -867,6 +887,8 @@ type Content interface {
867
887
// It must have Type set to "text".
868
888
type TextContent struct {
869
889
Annotated
890
+ // Meta is a metadata object that is reserved by MCP for storing additional information.
891
+ Meta * Meta `json:"_meta,omitempty"`
870
892
Type string `json:"type"` // Must be "text"
871
893
// The text content of the message.
872
894
Text string `json:"text"`
@@ -878,6 +900,8 @@ func (TextContent) isContent() {}
878
900
// It must have Type set to "image".
879
901
type ImageContent struct {
880
902
Annotated
903
+ // Meta is a metadata object that is reserved by MCP for storing additional information.
904
+ Meta * Meta `json:"_meta,omitempty"`
881
905
Type string `json:"type"` // Must be "image"
882
906
// The base64-encoded image data.
883
907
Data string `json:"data"`
@@ -891,6 +915,8 @@ func (ImageContent) isContent() {}
891
915
// It must have Type set to "audio".
892
916
type AudioContent struct {
893
917
Annotated
918
+ // Meta is a metadata object that is reserved by MCP for storing additional information.
919
+ Meta * Meta `json:"_meta,omitempty"`
894
920
Type string `json:"type"` // Must be "audio"
895
921
// The base64-encoded audio data.
896
922
Data string `json:"data"`
@@ -922,6 +948,8 @@ func (ResourceLink) isContent() {}
922
948
// benefit of the LLM and/or the user.
923
949
type EmbeddedResource struct {
924
950
Annotated
951
+ // Meta is a metadata object that is reserved by MCP for storing additional information.
952
+ Meta * Meta `json:"_meta,omitempty"`
925
953
Type string `json:"type"`
926
954
Resource ResourceContents `json:"resource"`
927
955
}
@@ -1056,6 +1084,8 @@ type ListRootsResult struct {
1056
1084
1057
1085
// Root represents a root directory or file that the server can operate on.
1058
1086
type Root struct {
1087
+ // Meta is a metadata object that is reserved by MCP for storing additional information.
1088
+ Meta * Meta `json:"_meta,omitempty"`
1059
1089
// The URI identifying the root. This *must* start with file:// for now.
1060
1090
// This restriction may be relaxed in future versions of the protocol to allow
1061
1091
// other URI schemes.
0 commit comments