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:
Suraj Bobade 2025-11-13 03:22:44 +05:30 • committed by GitHub
commit faddd764aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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) {