@@ -152,6 +152,18 @@ func (m *Meta) UnmarshalJSON(data []byte) error {
152152 return nil
153153}
154154
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+
155167type Request struct {
156168 Method string `json:"method"`
157169 Params RequestParams `json:"params,omitempty"`
@@ -233,7 +245,7 @@ func (p *NotificationParams) UnmarshalJSON(data []byte) error {
233245type Result struct {
234246 // This result property is reserved by the protocol to allow clients and
235247 // servers to attach additional metadata to their responses.
236- Meta map [ string ] any `json:"_meta,omitempty"`
248+ Meta * Meta `json:"_meta,omitempty"`
237249}
238250
239251// RequestId is a uniquely identifying ID for a request in JSON-RPC.
@@ -644,6 +656,8 @@ type ResourceUpdatedNotificationParams struct {
644656// Resource represents a known resource that the server is capable of reading.
645657type Resource struct {
646658 Annotated
659+ // Meta is a metadata object that is reserved by MCP for storing additional information.
660+ Meta * Meta `json:"_meta,omitempty"`
647661 // The URI of this resource.
648662 URI string `json:"uri"`
649663 // A human-readable name for this resource.
@@ -668,6 +682,8 @@ func (r Resource) GetName() string {
668682// on the server.
669683type ResourceTemplate struct {
670684 Annotated
685+ // Meta is a metadata object that is reserved by MCP for storing additional information.
686+ Meta * Meta `json:"_meta,omitempty"`
671687 // A URI template (according to RFC 6570) that can be used to construct
672688 // resource URIs.
673689 URITemplate * URITemplate `json:"uriTemplate"`
@@ -697,6 +713,8 @@ type ResourceContents interface {
697713}
698714
699715type TextResourceContents struct {
716+ // Meta is a metadata object that is reserved by MCP for storing additional information.
717+ Meta * Meta `json:"_meta,omitempty"`
700718 // The URI of this resource.
701719 URI string `json:"uri"`
702720 // The MIME type of this resource, if known.
@@ -709,6 +727,8 @@ type TextResourceContents struct {
709727func (TextResourceContents ) isResourceContents () {}
710728
711729type BlobResourceContents struct {
730+ // Meta is a metadata object that is reserved by MCP for storing additional information.
731+ Meta * Meta `json:"_meta,omitempty"`
712732 // The URI of this resource.
713733 URI string `json:"uri"`
714734 // The MIME type of this resource, if known.
@@ -867,6 +887,8 @@ type Content interface {
867887// It must have Type set to "text".
868888type TextContent struct {
869889 Annotated
890+ // Meta is a metadata object that is reserved by MCP for storing additional information.
891+ Meta * Meta `json:"_meta,omitempty"`
870892 Type string `json:"type"` // Must be "text"
871893 // The text content of the message.
872894 Text string `json:"text"`
@@ -878,6 +900,8 @@ func (TextContent) isContent() {}
878900// It must have Type set to "image".
879901type ImageContent struct {
880902 Annotated
903+ // Meta is a metadata object that is reserved by MCP for storing additional information.
904+ Meta * Meta `json:"_meta,omitempty"`
881905 Type string `json:"type"` // Must be "image"
882906 // The base64-encoded image data.
883907 Data string `json:"data"`
@@ -891,6 +915,8 @@ func (ImageContent) isContent() {}
891915// It must have Type set to "audio".
892916type AudioContent struct {
893917 Annotated
918+ // Meta is a metadata object that is reserved by MCP for storing additional information.
919+ Meta * Meta `json:"_meta,omitempty"`
894920 Type string `json:"type"` // Must be "audio"
895921 // The base64-encoded audio data.
896922 Data string `json:"data"`
@@ -922,6 +948,8 @@ func (ResourceLink) isContent() {}
922948// benefit of the LLM and/or the user.
923949type EmbeddedResource struct {
924950 Annotated
951+ // Meta is a metadata object that is reserved by MCP for storing additional information.
952+ Meta * Meta `json:"_meta,omitempty"`
925953 Type string `json:"type"`
926954 Resource ResourceContents `json:"resource"`
927955}
@@ -1056,6 +1084,8 @@ type ListRootsResult struct {
10561084
10571085// Root represents a root directory or file that the server can operate on.
10581086type Root struct {
1087+ // Meta is a metadata object that is reserved by MCP for storing additional information.
1088+ Meta * Meta `json:"_meta,omitempty"`
10591089 // The URI identifying the root. This *must* start with file:// for now.
10601090 // This restriction may be relaxed in future versions of the protocol to allow
10611091 // other URI schemes.
0 commit comments