This PR adds support for the optional `icons` parameter in prompt, resource, resource template, and server info. The specifications for `icons` are as follows. https://modelcontextprotocol.io/specification/2025-11-25/schema#icon Resolves https://github.com/modelcontextprotocol/ruby-sdk/issues/127.
27 lines
580 B
Ruby
27 lines
580 B
Ruby
# frozen_string_literal: true
|
|
|
|
module MCP
|
|
class Resource
|
|
attr_reader :uri, :name, :title, :description, :icons, :mime_type
|
|
|
|
def initialize(uri:, name:, title: nil, description: nil, icons: [], mime_type: nil)
|
|
@uri = uri
|
|
@name = name
|
|
@title = title
|
|
@description = description
|
|
@icons = icons
|
|
@mime_type = mime_type
|
|
end
|
|
|
|
def to_h
|
|
{
|
|
uri: uri,
|
|
name: name,
|
|
title: title,
|
|
description: description,
|
|
icons: icons.map(&:to_h),
|
|
mimeType: mime_type,
|
|
}.compact
|
|
end
|
|
end
|
|
end
|