mcp: ensure meta is not skipped on blob ResourceContents (#96)
I noticed this while working on #95. Seems Meta was accidentally skipped in the custom wire format struct.
This commit is contained in:
parent
c6b229c855
commit
328a25d503
2 changed files with 6 additions and 0 deletions
|
|
@ -187,10 +187,12 @@ func (r ResourceContents) MarshalJSON() ([]byte, error) {
|
|||
URI string `json:"uri,omitempty"`
|
||||
MIMEType string `json:"mimeType,omitempty"`
|
||||
Blob []byte `json:"blob"`
|
||||
Meta Meta `json:"_meta,omitempty"`
|
||||
}{
|
||||
URI: r.URI,
|
||||
MIMEType: r.MIMEType,
|
||||
Blob: r.Blob,
|
||||
Meta: r.Meta,
|
||||
}
|
||||
return json.Marshal(br)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -154,6 +154,10 @@ func TestEmbeddedResource(t *testing.T) {
|
|||
&mcp.ResourceContents{URI: "u", Blob: []byte{1}},
|
||||
`{"uri":"u","blob":"AQ=="}`,
|
||||
},
|
||||
{
|
||||
&mcp.ResourceContents{URI: "u", MIMEType: "m", Blob: []byte{1}, Meta: mcp.Meta{"key": "value"}},
|
||||
`{"uri":"u","mimeType":"m","blob":"AQ==","_meta":{"key":"value"}}`,
|
||||
},
|
||||
} {
|
||||
data, err := json.Marshal(tt.rc)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue