internal/mcp: adjust content types
- Change the names of some content-related types to better match the spec. Most notably, rename Resource to EmbeddedResource, because the former has a different meaning in the spec. - Use []byte intead of string where the spec says "base64-encoded data." - Unexport EmbeddedResource.ToWire. Change-Id: I9f65efaadadda1b3abc0e58c64a743af1a72852c Reviewed-on: https://go-review.googlesource.com/c/tools/+/671362 Reviewed-by: Robert Findley <rfindley@google.com> TryBot-Bypass: Jonathan Amsterdam <jba@google.com> Commit-Queue: Jonathan Amsterdam <jba@google.com>
This commit is contained in:
parent
51ea6a4a72
commit
71265ba130
1 changed files with 72 additions and 62 deletions
|
|
@ -19,24 +19,24 @@ func TestContent(t *testing.T) {
|
|||
}{
|
||||
{mcp.TextContent{Text: "hello"}, protocol.Content{Type: "text", Text: "hello"}},
|
||||
{
|
||||
mcp.ImageContent{Data: "a1b2c3", MimeType: "image/png"},
|
||||
protocol.Content{Type: "image", Data: "a1b2c3", MIMEType: "image/png"},
|
||||
mcp.ImageContent{Data: []byte("a1b2c3"), MIMEType: "image/png"},
|
||||
protocol.Content{Type: "image", Data: []byte("a1b2c3"), MIMEType: "image/png"},
|
||||
},
|
||||
{
|
||||
mcp.AudioContent{Data: "a1b2c3", MimeType: "audio/wav"},
|
||||
protocol.Content{Type: "audio", Data: "a1b2c3", MIMEType: "audio/wav"},
|
||||
mcp.AudioContent{Data: []byte("a1b2c3"), MIMEType: "audio/wav"},
|
||||
protocol.Content{Type: "audio", Data: []byte("a1b2c3"), MIMEType: "audio/wav"},
|
||||
},
|
||||
{
|
||||
mcp.ResourceContent{
|
||||
Resource: mcp.TextResource{
|
||||
Resource: mcp.TextResourceContents{
|
||||
URI: "file://foo",
|
||||
MimeType: "text",
|
||||
MIMEType: "text",
|
||||
Text: "abc",
|
||||
},
|
||||
},
|
||||
protocol.Content{
|
||||
Type: "resource",
|
||||
Resource: &protocol.Resource{
|
||||
Resource: &protocol.ResourceContents{
|
||||
URI: "file://foo",
|
||||
MIMEType: "text",
|
||||
Text: "abc",
|
||||
|
|
@ -45,18 +45,18 @@ func TestContent(t *testing.T) {
|
|||
},
|
||||
{
|
||||
mcp.ResourceContent{
|
||||
Resource: mcp.BlobResource{
|
||||
Resource: mcp.BlobResourceContents{
|
||||
URI: "file://foo",
|
||||
MimeType: "text",
|
||||
Blob: "a1b2c3",
|
||||
MIMEType: "text",
|
||||
Blob: []byte("a1b2c3"),
|
||||
},
|
||||
},
|
||||
protocol.Content{
|
||||
Type: "resource",
|
||||
Resource: &protocol.Resource{
|
||||
Resource: &protocol.ResourceContents{
|
||||
URI: "file://foo",
|
||||
MIMEType: "text",
|
||||
Blob: ptr("a1b2c3"),
|
||||
Blob: []byte("a1b2c3"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -69,7 +69,3 @@ func TestContent(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func ptr[T any](t T) *T {
|
||||
return &t
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue