Skip to content

Commit cc96080

Browse files
committed
mcp: ensure meta is not skipped on blob ResourceContents
1 parent ba7a064 commit cc96080

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

mcp/content.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,12 @@ func (r ResourceContents) MarshalJSON() ([]byte, error) {
177177
URI string `json:"uri,omitempty"`
178178
MIMEType string `json:"mimeType,omitempty"`
179179
Blob []byte `json:"blob"`
180+
Meta Meta `json:"_meta,omitempty"`
180181
}{
181182
URI: r.URI,
182183
MIMEType: r.MIMEType,
183184
Blob: r.Blob,
185+
Meta: r.Meta,
184186
}
185187
return json.Marshal(br)
186188
}

mcp/content_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ func TestEmbeddedResource(t *testing.T) {
146146
&mcp.ResourceContents{URI: "u", Blob: []byte{1}},
147147
`{"uri":"u","blob":"AQ=="}`,
148148
},
149+
{
150+
&mcp.ResourceContents{URI: "u", MIMEType: "m", Blob: []byte{1}, Meta: mcp.Meta{"key": "value"}},
151+
`{"uri":"u","mimeType":"m","blob":"AQ==","_meta":{"key":"value"}}`,
152+
},
149153
} {
150154
data, err := json.Marshal(tt.rc)
151155
if err != nil {

0 commit comments

Comments
 (0)