internal/mcp: pointerize all the things
Use pointers for the protocol's struct types, to future-proof against them getting large. Change-Id: I55b204080a41c8140539697ba264e502e912e613 Reviewed-on: https://go-review.googlesource.com/c/tools/+/672575 Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
7b100d7b30
commit
02fa1b3ea6
1 changed files with 137 additions and 98 deletions
|
|
@ -45,23 +45,23 @@ func (c *Content) UnmarshalJSON(data []byte) error {
|
|||
}
|
||||
|
||||
// NewTextContent creates a [Content] with text.
|
||||
func NewTextContent(text string) Content {
|
||||
return Content{Type: "text", Text: text}
|
||||
func NewTextContent(text string) *Content {
|
||||
return &Content{Type: "text", Text: text}
|
||||
}
|
||||
|
||||
// NewImageContent creates a [Content] with image data.
|
||||
func NewImageContent(data []byte, mimeType string) Content {
|
||||
return Content{Type: "image", Data: data, MIMEType: mimeType}
|
||||
func NewImageContent(data []byte, mimeType string) *Content {
|
||||
return &Content{Type: "image", Data: data, MIMEType: mimeType}
|
||||
}
|
||||
|
||||
// NewAudioContent creates a [Content] with audio data.
|
||||
func NewAudioContent(data []byte, mimeType string) Content {
|
||||
return Content{Type: "audio", Data: data, MIMEType: mimeType}
|
||||
func NewAudioContent(data []byte, mimeType string) *Content {
|
||||
return &Content{Type: "audio", Data: data, MIMEType: mimeType}
|
||||
}
|
||||
|
||||
// NewResourceContent creates a [Content] with an embedded resource.
|
||||
func NewResourceContent(resource *ResourceContents) Content {
|
||||
return Content{Type: "resource", Resource: resource}
|
||||
func NewResourceContent(resource *ResourceContents) *Content {
|
||||
return &Content{Type: "resource", Resource: resource}
|
||||
}
|
||||
|
||||
// ResourceContents represents the union of the spec's {Text,Blob}ResourceContents types.
|
||||
|
|
|
|||
Loading…
Reference in a new issue