Implement SEP-973 (#570)
mcp/protocol: Implement SEP-973 - Define Icon structure, which includes source, mimeType and sizes. - sizes is any array of strings. refer https://github.com/modelcontextprotocol/modelcontextprotocol/pull/1531 - Support setting websiteUrl, icons for mcp.Implementation - Support setting icons for mcp.Prompt - Support setting icons for mcp.Tool - Support setting icons for mcp.Resource Fixes #552
This commit is contained in:
parent
35dfcf21c9
commit
faddd764aa
1 changed files with 417 additions and 9 deletions
|
|
@ -130,6 +130,8 @@ type ResourceLink struct {
|
|||
Size *int64
|
||||
Meta Meta
|
||||
Annotations *Annotations
|
||||
// Icons for the resource link, if any.
|
||||
Icons []Icon `json:"icons,omitempty"`
|
||||
}
|
||||
|
||||
func (c *ResourceLink) MarshalJSON() ([]byte, error) {
|
||||
|
|
@ -143,6 +145,7 @@ func (c *ResourceLink) MarshalJSON() ([]byte, error) {
|
|||
Size: c.Size,
|
||||
Meta: c.Meta,
|
||||
Annotations: c.Annotations,
|
||||
Icons: c.Icons,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -155,6 +158,7 @@ func (c *ResourceLink) fromWire(wire *wireContent) {
|
|||
c.Size = wire.Size
|
||||
c.Meta = wire.Meta
|
||||
c.Annotations = wire.Annotations
|
||||
c.Icons = wire.Icons
|
||||
}
|
||||
|
||||
// EmbeddedResource contains embedded resources.
|
||||
|
|
@ -237,6 +241,7 @@ type wireContent struct {
|
|||
Size *int64 `json:"size,omitempty"`
|
||||
Meta Meta `json:"_meta,omitempty"`
|
||||
Annotations *Annotations `json:"annotations,omitempty"`
|
||||
Icons []Icon `json:"icons,omitempty"`
|
||||
}
|
||||
|
||||
func contentsFromWire(wires []*wireContent, allow map[string]bool) ([]Content, error) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue